Skip to content

Commit c5f19b8

Browse files
committed
Merge branch 'refs/heads/dev'
2 parents 2dc34fe + cc8c125 commit c5f19b8

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

packages/express-typed/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "express-typed",
3-
"version": "0.0.3",
3+
"version": "0.1.0",
44
"description": "",
55
"type": "module",
66
"main": "dist/express-typed.js",

packages/express-typed/src/express-typed.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export type IHandlerResponse<Res extends any[] = []> = {
1313
jsonp<const T>(arg: T): IHandlerResponse<[...Res, { jsonp: T }]>;
1414
send<const T>(arg: T): IHandlerResponse<[...Res, { send: T }]>;
1515
} & Response;
16-
1716
export type SendMethod = "send" | "json" | "jsonp";
1817

1918
export type IHandlerRequest<Req extends any[] = []> = {} & Request;
@@ -32,7 +31,7 @@ export class TypedRouter<
3231
[key in HandlerMethods]?: (req: IHandlerRequest, res: IHandlerResponse, next: NextFunction) => void;
3332
}
3433
| TypedRouter<any>;
35-
}
34+
},
3635
> {
3736
router: express.Router;
3837
routes: R;
@@ -59,7 +58,7 @@ export type FlatNestedRouters<T> = {
5958
? (
6059
x: T[K] extends TypedRouter<infer N>
6160
? FlatNestedRouters<{ [K2 in keyof N extends string ? `${keyof N}` : "" as `${K}${K2}`]: N[K2] }>
62-
: Pick<T, K>
61+
: Pick<T, K>,
6362
) => void
6463
: never;
6564
} extends { [k: string]: (x: infer I) => void }
@@ -71,7 +70,7 @@ export type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) ex
7170
export type GetRouteResponseInfoHelper<
7271
Router extends TypedRouter<any>["routes"],
7372
Path extends keyof FlatNestedRouters<Router>,
74-
Method extends keyof FlatNestedRouters<Router>[Path]
73+
Method extends keyof FlatNestedRouters<Router>[Path],
7574
> = UnionToIntersection<
7675
(
7776
ReturnType<
@@ -88,13 +87,13 @@ export type GetRouteResponseInfo<
8887
Router extends TypedRouter<any>["routes"],
8988
Path extends keyof FlatNestedRouters<Router>,
9089
Method extends keyof FlatNestedRouters<Router>[Path],
91-
Info extends keyof GetRouteResponseInfoHelper<Router, Path, Method> | "body" = "body"
90+
Info extends keyof GetRouteResponseInfoHelper<Router, Path, Method> | "body" = "body",
9291
// Info extends "body" | undefined = undefined
9392
> = Info extends "body"
9493
? GetRouteResponseInfoHelper<Router, Path, Method>[Extract<keyof GetRouteResponseInfoHelper<Router, Path, Method>, SendMethod>]
9594
: Info extends keyof GetRouteResponseInfoHelper<Router, Path, Method>
96-
? GetRouteResponseInfoHelper<Router, Path, Method>[Info]
97-
: GetRouteResponseInfoHelper<Router, Path, Method>;
95+
? GetRouteResponseInfoHelper<Router, Path, Method>[Info]
96+
: GetRouteResponseInfoHelper<Router, Path, Method>;
9897

9998
export type ParseRoutes<T extends TypedRouter<any>> = FlatNestedRouters<T["routes"]>;
10099

0 commit comments

Comments
 (0)