Skip to content

Commit

Permalink
Adding string union type
Browse files Browse the repository at this point in the history
  • Loading branch information
kamaal111 committed Sep 2, 2024
1 parent def1b2e commit eb0b6af
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/types/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export type Character<TargetString extends string> =
TargetString extends TargetString & OnlyFirstCharacter<TargetString>
? TargetString & OnlyFirstCharacter<TargetString>
: string & { length: 1 };

export type StringUnion<TargetKey extends string> = `${TargetKey}`;

0 comments on commit eb0b6af

Please sign in to comment.