Skip to content

Commit d2911c5

Browse files
committed
fix: Add deprecated directive to enumsAsConst
Use the BaseTypesVisitor getNodeComment to build the comment string (which uses transformComment under the hood) rather than just using the transform. The getNodeComment method already has support for intepreting and transforming deprecated directives correctly, as is seen in the default output for enums.
1 parent 62dd4c7 commit d2911c5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/funny-lamps-sort.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-codegen/visitor-plugin-common': minor
3+
---
4+
5+
enumsAsConst output now includes deprecated directive

packages/plugins/typescript/typescript/src/visitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ export class TsVisitor<
443443
transformUnderscore: true,
444444
})
445445
);
446-
const comment = transformComment(enumOption.description as any as string, 1);
446+
const comment = this.getNodeComment(enumOption);
447447
const name = enumOption.name as unknown as string;
448448
const enumValue: string | number = getValueFromConfig(name) ?? name;
449449

0 commit comments

Comments
 (0)