type-challenges / type-challenges

Collection of TypeScript type challenges with online judge

Home Page:https://tsch.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

9616 - Parse URL Params

sunupupup opened this issue · comments

maybe tricky ...

type ParseUrlParams<T, Ret extends string[] = []> = 
`${T &  string}/` extends `${any}:${infer Param}/${infer Rest}`
  ? ParseUrlParams<Rest, [...Ret, Param]>
  : Ret[number];