Login
From:
Tan Li Hau's Blog
(Uncensored)
subscribe
Extract parameter types from string literal types with TypeScript
https://lihautan.com/extract-parameters-type-from-string-literal-types-with-typescript/
links
backlinks
Tagged with:
typescript
conditional type
template literal type
Parse and derive types from string literal types in TypeScript using the Template Literal Types, turning `'/purchase/[shopid]/[itemid]/args/[...args]'` into `{ shopid: number, itemid: number, args: string[] }`
Roast topics
Find topics
Find it!