Last active
August 10, 2022 18:50
-
-
Save sebinsua/07cd2dfdcd97ca10492ea650d100d7c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type GetTail<Items extends string[]> = Items extends [any, ...infer Tail] | |
? Tail | |
: string[]; | |
type HasTail<Items extends string[]> = Items extends [any, any, ...any[]] | |
? true | |
: false; | |
type Join<Strs extends string[], Delimiter extends string = ""> = HasTail<Strs> extends false | |
? Strs[0] extends string ? Strs[0] : '' | |
: Strs extends string[] ? `${Strs[0]}${Delimiter}${Join<GetTail<Strs>, Delimiter>}` : '' ; | |
type Goal = Join<["Make", "anxiety", "work", "for", "you!"], ' '> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment