Skip to content

Commit 342147a

Browse files
committed
feat(common): handled 'ParamData' expected types unknow overlap
1 parent 28c35c1 commit 342147a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

packages/common/decorators/http/create-route-param-metadata.decorator.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ const assignCustomMetadata = (
2727
});
2828

2929
export type ParamDecoratorEnhancer = ParameterDecorator;
30+
3031
type Unpacked<T> = T extends (infer U)[]
3132
? U
32-
: T extends (...args: any[]) => infer U
33-
? U
34-
: T extends Promise<infer U>
35-
? U
33+
: T extends (...args: any[]) => infer A
34+
? A
35+
: T extends Promise<infer B>
36+
? B
3637
: T;
3738
/**
3839
* Defines HTTP route param decorator
@@ -61,7 +62,7 @@ export function createParamDecorator<T>(
6162
isFunction(pipe.transform));
6263

6364
const hasParamData = isNil(data) || !isPipe(data);
64-
const paramData = hasParamData ? data : undefined;
65+
const paramData = hasParamData ? (data as any) : undefined;
6566
const paramPipes = hasParamData ? pipes : [data, ...pipes];
6667

6768
Reflect.defineMetadata(

0 commit comments

Comments
 (0)