Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScripttype-level string parsingSingle-choice MCQ

What does this recursive `Split` produce, and why does the base case keep the final segment?

type Split<S extends string, D extends string> = S extends `${infer Head}${D}${infer Tail}` ? [Head, ...Split<Tail, D>] : [S]; type R = Split<"a,b,c", ",">;