File tree Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -149,15 +149,26 @@ export function getDecoratorName(decorator: Decorator) {
149
149
const isDecoratorFactory =
150
150
decorator . expression . kind === SyntaxKind . CallExpression ;
151
151
if ( isDecoratorFactory ) {
152
- const callExpression = decorator . expression ;
153
- const identifier = ( callExpression as CallExpression )
154
- . expression as Identifier ;
155
- if ( isDynamicallyAdded ( identifier ) ) {
156
- return undefined ;
152
+ const callExpression = decorator . expression as ts . CallExpression ;
153
+
154
+ if (
155
+ callExpression . expression ?. kind === ts . SyntaxKind . PropertyAccessExpression
156
+ ) {
157
+ // When "import * as _" is used
158
+ const propertyAccessExpression =
159
+ callExpression . expression as PropertyAccessExpression ;
160
+ return getIdentifierFromName ( propertyAccessExpression . name ) . getText ( ) ;
161
+ }
162
+
163
+ if ( callExpression . kind === ts . SyntaxKind . CallExpression ) {
164
+ const identifier = ( callExpression as CallExpression )
165
+ . expression as Identifier ;
166
+
167
+ if ( isDynamicallyAdded ( identifier ) ) {
168
+ return undefined ;
169
+ }
170
+ return getIdentifierFromName ( identifier ) . getText ( ) ;
157
171
}
158
- return getIdentifierFromName (
159
- ( callExpression as CallExpression ) . expression ,
160
- ) . getText ( ) ;
161
172
}
162
173
return getIdentifierFromName ( decorator . expression ) . getText ( ) ;
163
174
}
Original file line number Diff line number Diff line change 1
1
export const createCatDtoText = `
2
+ import * as gql from "@nestjs/graphql";
3
+
2
4
enum Status {
3
5
ENABLED,
4
6
DISABLED
@@ -12,6 +14,7 @@ interface Node {
12
14
id: number;
13
15
}
14
16
17
+ @gql.InputType()
15
18
@ObjectType()
16
19
export class CreateCatDto {
17
20
name: string;
@@ -69,7 +72,8 @@ export class CreateCatArgs {
69
72
}
70
73
` ;
71
74
72
- export const createCatDtoTextTranspiled = `var Status;
75
+ export const createCatDtoTextTranspiled = `import * as gql from "@nestjs/graphql";
76
+ var Status;
73
77
(function (Status) {
74
78
Status[Status["ENABLED"] = 0] = "ENABLED";
75
79
Status[Status["DISABLED"] = 1] = "DISABLED";
@@ -91,6 +95,7 @@ __decorate([
91
95
HideField()
92
96
], CreateCatDto.prototype, "hidden", void 0);
93
97
CreateCatDto = __decorate([
98
+ gql.InputType(),
94
99
ObjectType()
95
100
], CreateCatDto);
96
101
export { CreateCatDto };
You can’t perform that action at this time.
0 commit comments