Hands-on real world projects that will help you exercise your knowledge of TypeScript.
244
stars
166
forks
source link
🐛 Bug: [type-operations/template-literal-type-shenanigans/03-split-on] Incorrect logic in solution #283
Open
ryo-utsunomiya opened 3 months ago
Bug Report Checklist
main
branch of the repository.Expected
SplitOn<"baby", "a">
->["b", "by"]
SplitOn<"hello my baby", " ">
->["hello", "my", "baby"]
Actual
The resulting array is in reverse order.
SplitOn<"baby", "a">
->["by", "b"]
SplitOn<"hello my baby", " ">
->["baby", "my", "hello"]
Impacted Project
projects/type-operations/template-literal-type-shenanigans/03-split-on/solution.ts
Additional Info
The correct implementation of the
SplitOn
type would be something like the following:Alternatively, it could be written more simply like this: