Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
331 bytes
|
Line | |
---|
1 | /**
|
---|
2 | Recursively split a string literal into two parts on the first occurence of the given string, returning an array literal of all the separate parts.
|
---|
3 | */
|
---|
4 | export type Split<S extends string, D extends string> =
|
---|
5 | string extends S ? string[] :
|
---|
6 | S extends '' ? [] :
|
---|
7 | S extends `${infer T}${D}${infer U}` ? [T, ...Split<U, D>] :
|
---|
8 | [S];
|
---|
Note:
See
TracBrowser
for help on using the repository browser.