-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Decouple typescript-operations plugin from typescript plugin
#10572
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
Conversation
🦋 Changeset detectedLatest commit: fccc3b2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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 |
| "dependencies": { | ||
| "@graphql-codegen/plugin-helpers": "^6.1.0", | ||
| "@graphql-codegen/schema-ast": "^5.0.0", | ||
| "@graphql-codegen/typescript": "^5.0.7", |
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.
Bye! 🫡
@graphql-codegen/typescript served us well for the last 10+ years. But with goal of creating the independence of typescript for typescript-operations plugin for this work, we can now remove this dep.
🚀 Snapshot Release (
|
| Package | Version | Info |
|---|---|---|
@graphql-codegen/cli |
6.1.1-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/introspection |
5.0.1-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/visitor-plugin-common |
7.0.0-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-document-nodes |
5.0.8-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/gql-tag-operations |
5.1.3-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-operations |
6.0.0-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-resolvers |
6.0.0-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typed-document-node |
6.1.6-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript |
6.0.0-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/client-preset |
6.0.0-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/graphql-modules-preset |
5.1.3-alpha-20260115120206-c999e1213ed0c6f98d53a7a1821fe3de16f64c65 |
npm ↗︎ unpkg ↗︎ |
| undefined, | ||
| undefined |
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.
Since we are always passing undefined through, we can just use the default.
| _scalars: NormalizedScalarsMap, | ||
| _convertName: ConvertNameFn, | ||
| private _avoidOptionals: NormalizedAvoidOptionalsConfig, | ||
| private _immutableTypes: boolean, | ||
| _namespacedImportName: string | null, | ||
| _enumNames: string[], | ||
| _enumPrefix: boolean, | ||
| _enumSuffix: boolean, | ||
| _enumValues: ParsedEnumValuesMap, | ||
| _applyCoercion: boolean |
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.
There are lots of default values here from the typescript version of this class.
Since we are really dedicating this implementation for typescript-operations, it's a lot easier to force them to be non-optional since we only have one use case to cater for.
We event removed the last param _maybeType since we don't use it in typescript-operations any more!
| _enumSuffix, | ||
| _enumValues, | ||
| _applyCoercion, | ||
| {} |
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 _directiveArgumentAndInputFieldMappings.
We were receiving undefined all the time from the only callsite, so it's ok to just pass through the default value.
Description
Previously,
TypeScriptOperationVariablesToObjectfromtypescript-operationswas extending fromtypescriptplugin. This made it (1) very hard to read, as we need to jump from base class <-> typescript class <-> typescript-operations class to understand the flow and (2) very hard to evolve the two independently (which is the point of this work).Since there's not much shared logic anyways, it's simpler to extend the
typescript-operationsclass from the base class directly.Related #10496
Type of change