File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -18,13 +18,16 @@ type KnownRouteName = keyof RouteList;
1818/**
1919 * A route name, or any string.
2020 */
21- type RouteName = TypeConfig extends { strictRouteNames : true }
22- ? KnownRouteName
23- : KnownRouteName | ( string & { } ) ;
21+ type RouteName = KnownRouteName | ( string & { } ) ;
2422// `(string & {})` prevents TypeScript from reducing this type to just `string`,
2523// which would prevent intellisense from autocompleting known route names.
2624// See https://stackoverflow.com/a/61048124/6484459.
2725
26+ /**
27+ * A valid route name to pass to `route()` to generate a URL.
28+ */
29+ type ValidRouteName = TypeConfig extends { strictRouteNames : true } ? KnownRouteName : RouteName ;
30+
2831/**
2932 * Information about a single route parameter.
3033 */
@@ -190,14 +193,14 @@ export function route(
190193) : Router ;
191194
192195// Called with a route name and optional additional arguments - returns a URL string
193- export function route < T extends RouteName > (
196+ export function route < T extends ValidRouteName > (
194197 name : T ,
195198 params ?: RouteParams < T > | undefined ,
196199 absolute ?: boolean ,
197200 config ?: Config ,
198201) : string ;
199202
200- export function route < T extends RouteName > (
203+ export function route < T extends ValidRouteName > (
201204 name : T ,
202205 params ?: ParameterValue | undefined ,
203206 absolute ?: boolean ,
You can’t perform that action at this time.
0 commit comments