Skip to content

Commit a69908f

Browse files
committed
feat: add infer types for Route
1 parent 20b1c8a commit a69908f

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/core/route/route.types.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { IsPartial, AnyObject, Maybe, MaybePromise } from 'yummies/utils/types';
33

44
import { RouteGlobalConfig } from '../config/config.types.js';
55
import { AnyAbstractRouteEntity } from '../route-group/route-group.types.js';
6+
import { VirtualRoute } from '../virtual-route/virtual-route.js';
67

78
import { Route } from './route.js';
89

@@ -186,7 +187,15 @@ export type InferPath<T extends AnyRoute> =
186187
T extends IRoute<infer TPath, any, any> ? TPath : never;
187188

188189
export type InferInputParams<T extends AnyRoute> =
189-
T extends IRoute<any, infer TInputParams, any> ? TInputParams : never;
190+
T extends VirtualRoute<infer TParams>
191+
? TParams
192+
: T extends IRoute<any, infer TInputParams, any>
193+
? TInputParams
194+
: never;
190195

191196
export type InferParams<T extends AnyRoute> =
192-
T extends IRoute<any, any, infer TParams> ? TParams : never;
197+
T extends VirtualRoute<infer TParams>
198+
? TParams
199+
: T extends IRoute<any, any, infer TParams>
200+
? TParams
201+
: never;

0 commit comments

Comments
 (0)