Which packages are impacted by your issue?
@graphql-codegen/typescript-rtk-query
Describe the bug
Since @graphql-codegen/typescript-rtk-query 4.0.0, the generated typescript file contains references to TypedDocumentString, but this class is not defined in the same file. This causes TypeScript to print out this error when building:
Cannot find name 'TypedDocumentString'.
Your Example Website or App
https://codesandbox.io/p/devbox/solitary-sea-pg72wt
Steps to Reproduce the Bug or Issue
- Follow instructions in https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-rtk-query to add rtk-query plugin to codegen.ts
- Run codegen
- The generated
types.ts contains references to TypedDocumentString, which is not defined.
Expected behavior
I expect the generated types.ts to have no TypeScript errors when building (i.e. without using TypedDocumentString or having its definition included in the file).
Screenshots or Videos
Platform
- OS: Linux
- NodeJS: 20.12.1
graphql version: 16.6.0
@graphql-codegen/typescript version: 4.0.1
@graphql-codegen/typescript-rtk-query version: 4.0.0
Codegen Config File
import { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
schema: "schema.graphql",
documents: "document.graphql",
generates: {
"types.ts": {
plugins: [
"typescript",
"typescript-operations",
{
"typescript-rtk-query": {
importBaseApiFrom: "./baseApi",
exportHooks: true,
},
},
],
},
},
};
export default config;
Additional context
- The same codegen configuration was working prior to @graphql-codegen/typescript-rtk-query 4.0.0
- I understand that client should use Client preset, but rtk-query is not listed as one of the supported clients on the webpage.
- The reason for upgrade is because
typescript-rtk-query implicitly depends on immutable which has a vulnerability prior to version 3.8.3.
Which packages are impacted by your issue?
@graphql-codegen/typescript-rtk-query
Describe the bug
Since @graphql-codegen/typescript-rtk-query 4.0.0, the generated typescript file contains references to
TypedDocumentString, but this class is not defined in the same file. This causes TypeScript to print out this error when building:Your Example Website or App
https://codesandbox.io/p/devbox/solitary-sea-pg72wt
Steps to Reproduce the Bug or Issue
types.tscontains references toTypedDocumentString, which is not defined.Expected behavior
I expect the generated
types.tsto have no TypeScript errors when building (i.e. without using TypedDocumentString or having its definition included in the file).Screenshots or Videos
Platform
graphqlversion: 16.6.0@graphql-codegen/typescriptversion: 4.0.1@graphql-codegen/typescript-rtk-queryversion: 4.0.0Codegen Config File
Additional context
typescript-rtk-queryimplicitly depends on immutable which has a vulnerability prior to version 3.8.3.