Skip to content

Commit bdb7913

Browse files
fix: correct reversed types in 03-split-on (#291)
* fix: correct reversed types in 03-split-on * fix: correct reversed types in 03-split-on
1 parent 3554199 commit bdb7913

File tree

1 file changed

+2
-2
lines changed
  • projects/type-operations/template-literal-type-shenanigans/03-split-on

1 file changed

+2
-2
lines changed

projects/type-operations/template-literal-type-shenanigans/03-split-on/solution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ export type SplitOn<
33
On extends string,
44
Results extends string[] = [],
55
> = Text extends `${infer Prefix}${On}${infer Suffix}`
6-
? SplitOn<Suffix, On, [Prefix, ...Results]>
7-
: [Text, ...Results];
6+
? SplitOn<Suffix, On, [...Results, Prefix]>
7+
: [...Results, Text];

0 commit comments

Comments
 (0)