koSakano/type-challenges

2822 - Split

Opened this issue · 0 comments

type Split<S extends string, SEP extends string> = S extends `${infer First}${SEP}${infer Second}` ? [First, ...Split<Second, SEP>] : S extends '' ? (SEP extends '' ? [] : ['']) : S extends `${infer Rest}` ? [Rest] : string[];