This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// shamelessly taken from tanstack router ;-) | |
type ParsePathParams<T extends string, TAcc = never> = T & | |
`${string}:${string}` extends never | |
? TAcc | |
: T extends `${string}:${infer TPossiblyParam}` | |
? TPossiblyParam extends "" | |
? TAcc | |
: TPossiblyParam & `${string}/${string}` extends never | |
? TPossiblyParam | TAcc | |
: TPossiblyParam extends `${infer TParam}/${infer TRest}` |