-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[typescript-operations] Fix external custom scalars not getting imported #10584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[typescript-operations] Fix external custom scalars not getting imported #10584
Conversation
…nto shared type file
🦋 Changeset detectedLatest commit: 3a44df6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| public getEnumsImports(): string[] { | ||
| const usedEnumMap: ParsedEnumValuesMap = {}; | ||
| for (const [enumName, enumDetails] of Object.entries(this.config.enumValues)) { | ||
| if (this._usedNamedInputTypes[enumName]) { | ||
| usedEnumMap[enumName] = enumDetails; | ||
| } | ||
| } | ||
|
|
||
| return getEnumsImports({ | ||
| enumValues: usedEnumMap, | ||
| useTypeImports: this.config.useTypeImports, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this up here as a drive-by to keep similar imports methods closer together.
🚀 Snapshot Release (
|
| Package | Version | Info |
|---|---|---|
@graphql-codegen/cli |
6.1.2-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/introspection |
5.0.1-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/visitor-plugin-common |
7.0.0-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-document-nodes |
5.0.8-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/gql-tag-operations |
5.1.3-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-operations |
6.0.0-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-resolvers |
6.0.0-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typed-document-node |
6.1.6-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript |
6.0.0-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/client-preset |
6.0.0-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/graphql-modules-preset |
5.1.3-alpha-20260125135505-3a44df6ccbf1d89c6f8128d64583d534868311e1 |
npm ↗︎ unpkg ↗︎ |
| if (usedInputTypes[node.name]) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GraphQLInputObjectType and GraphQLEnumType don't have special cases like GraphQLScalarType where it may need special handling depending on where it's used (tracked by useCases). Therefore, we can return early for the former two if we've seen them previously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is renamed to ts-douments.standalone.scalars.spec.ts
Description
This PR fix an issue where external custom scalars are not imported correctly into files:
Related #10496
Type of change
How Has This Been Tested?