Changed graphql->typescript codegen to treeshake types#6357
Changed graphql->typescript codegen to treeshake types#6357lkostrowski wants to merge 1 commit intomainfrom
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR updates the GraphQL code generation configuration to enable treeshaking of TypeScript types by replacing the standard typescript plugin with a more optimized approach using typescript-operations with preResolveTypes and omitObjectTypes options, along with the new graphql-codegen-typescript-operation-types plugin.
Changes:
- Added
graphql-codegen-typescript-operation-typesdependency - Replaced
typescriptplugin with optimizedtypescript-operationsconfiguration - Updated import statements to use
typemodifier for better treeshaking
Reviewed changes
Copilot reviewed 3 out of 6 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| package.json | Added graphql-codegen-typescript-operation-types v2.0.2 as a dev dependency |
| codegen-staging.ts | Updated plugin configuration to use treeshaking-optimized plugins and added type import modifier |
| codegen-main.ts | Updated plugin configuration to use treeshaking-optimized plugins and added type import modifier |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| plugins: [ | ||
| { | ||
| "typescript-operations": { | ||
| preResolveTypes: true, | ||
| omitObjectTypes: true, | ||
| }, | ||
| }, | ||
| { | ||
| "graphql-codegen-typescript-operation-types": { | ||
| enumsAsTypes: true, | ||
| }, | ||
| }, | ||
| ], |
There was a problem hiding this comment.
The typescript base plugin has been removed but typescript-operations requires it as a prerequisite. The typescript plugin generates the base GraphQL schema types that typescript-operations depends on. Without it, the code generation will fail.
| plugins: [ | ||
| { | ||
| "typescript-operations": { | ||
| preResolveTypes: true, | ||
| omitObjectTypes: true, | ||
| }, | ||
| }, | ||
| { | ||
| "graphql-codegen-typescript-operation-types": { | ||
| enumsAsTypes: true, | ||
| }, | ||
| }, | ||
| ], |
There was a problem hiding this comment.
The typescript base plugin has been removed but typescript-operations requires it as a prerequisite. The typescript plugin generates the base GraphQL schema types that typescript-operations depends on. Without it, the code generation will fail.
Differences FoundExpandLicense Package MIT graphql-codegen-typescript-operation-types SummaryExpand
|
|
I think for Dashboard maybe we could use knip to remove unused types from generated? 🤔 |
No description provided.