Dwip
This commit is contained in:
1 parent
c367d3f3ca
commit
2bc148342d
3 files changed
+39
-18
No files matched your search
@@ -0,0 +1,13 @@
|
||||
type ParseUrlParams<Url> = Url extends `${infer Start}/${infer Rest}`
|
||||
? ParseUrlParams<Start> & ParseUrlParams<Rest>
|
||||
: Url extends `{${infer Param}}`
|
||||
? { [P in Param]: string }
|
||||
: {};
|
||||
|
||||
function navigate<P extends string>(path: P, params: ParseUrlParams<P>) {
|
||||
// ...
|
||||
}
|
||||
|
||||
function main() {
|
||||
navigate("/foo/bar", { foo: "asd" });
|
||||
}
|
||||
Reference in new issue
Block a user