Created
October 22, 2019 04:54
-
-
Save chenyong/473b1f34302492adc2d73d81d180667f to your computer and use it in GitHub Desktop.
Generation of router types(Drafted by hand)
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
/* | |
a | |
b | |
c/:cid | |
d/:did | |
e?f | |
g/:gid?h | |
*/ | |
type RootOfGenRouterType = GenRouterTypes['a']['$types'] | |
interface GenRouterTypes { | |
a: { | |
$types: { | |
name: 'a', | |
params: any, | |
queries: any, | |
next: GenRouterTypes['a']['b']['$type'] | GenRouterTypes['a']['c']['$type'] | |
} | |
b: { | |
$type: { | |
name: 'b', | |
params: any, | |
queries: any, | |
next: any | |
} | |
} | |
c: { | |
$type: { | |
name: 'c', | |
params: { | |
cid: string | |
}, | |
next: GenRouterTypes['a']['c']['d']['$type'] | GenRouterTypes['a']['c']['d']['$type'] | GenRouterTypes['a']['c']['g']['$type'] | |
} | |
d: { | |
$type: { | |
name: 'd', | |
params: { | |
cid: string, | |
did: string | |
} | |
} | |
}, | |
e: { | |
$type: { | |
name: 'e', | |
params: any, | |
queries: { | |
f: string | |
} | |
} | |
}, | |
g: { | |
$type: { | |
name: 'g', | |
params: { | |
cid: string, | |
gid: string, | |
}, | |
queries: { | |
h: string | |
}, | |
next: any | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment