[typescript][typescript-resolvers] Fix enumValues not considering namingConvention in certain scenarios (2)#10657
Conversation
🦋 Changeset detectedLatest commit: e6d2a4c The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
🚀 Snapshot Release (
|
| Package | Version | Info |
|---|---|---|
@graphql-codegen/cli |
7.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/core |
6.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/add |
7.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/fragment-matcher |
7.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/introspection |
6.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/schema-ast |
6.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/time |
7.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/visitor-plugin-common |
7.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-document-nodes |
6.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/gql-tag-operations |
6.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-operations |
6.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-resolvers |
6.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typed-document-node |
7.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript |
6.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/client-preset |
6.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/graphql-modules-preset |
6.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/testing |
5.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/plugin-helpers |
7.0.0-alpha-20260331125845-e6d2a4ce6d2c1f46380441d80f8a3b827fbac6d8 |
npm ↗︎ unpkg ↗︎ |
| ? this.convertName(this.config.enumValues[typeName].typeIdentifier, { | ||
| useTypesPrefix: false, | ||
| useTypesSuffix: false, | ||
| }) |
There was a problem hiding this comment.
typeIdentifierConverted is the converted enum type name, so we can safely use it across callsites
| namingConvention: { enumValues: 'change-case-all#constantCase' }, | ||
| enumValues: { | ||
| UserRole: './files#default as IUserRole', | ||
| UserRole: './files#default as UserRole', // NOTE: `as UserRole` doesn't do anything here, this is here to demonstrate that it's the same as './files#default' |
There was a problem hiding this comment.
This as UserRole doesn't work at all for default imports, even on master 🤔
The fixed behaviour for default import: the name of the enum (UserRole) will have namingConvention applied (becomes IUserRole) so the subsequent references will work.
| expect(mergedOutputs).toContain(`C: GQL_C;`); | ||
| expect(mergedOutputs).toContain(`import { MyC as GQL_C } from '../enums.js';`); |
There was a problem hiding this comment.
All imports and references must have naming convention applied, so subsequent refer to the enum type correctly.
…ingConvention in certain scenarios (2) (#10657) * Ensure enumValues is consistent in typescript and typescript-resolvers * Add a note to default alias import not doing anything * Add changeset
Description
This is the continuation of #10656. After merging said PR, I realised that the
enumValuesbehaviour needs to be applied totypescriptandtypescript-resolversas well.Related #10496
Type of change