graphql-code-generator icon indicating copy to clipboard operation
graphql-code-generator copied to clipboard

Client preset, generated code with `documentMode: "string"` results in ts(4114) noImplicitOverride error

Open Brookke opened this issue 5 months ago • 1 comments

Which packages are impacted by your issue?

@graphql-codegen/cli

Describe the bug

Generated code fails typescript checks when noImplicitOverride is set to true in tsconfig

$ /project/workspace/node_modules/.bin/tsc
src/graphql/graphql.ts:55:3 - error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'String'.

55   toString(): string & DocumentTypeDecoration<TResult, TVariables> {
     ~~~~~~~~


Found 1 error in src/graphql/graphql.ts:55

Your Example Website or App

https://codesandbox.io/p/devbox/clever-cloud-nzr6nq

Steps to Reproduce the Bug or Issue

  1. Enable noImplicitOverride in tsconfig.json
  2. Run yarn codegen
  3. Run yarn tsc

Expected behavior

No errors

Screenshots or Videos

Platform

  • @graphql-codegen/* version(s): 5.0.6

Codegen Config File

import { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = { schema: "schema.graphql", documents: "./src/document.ts", ignoreNoDocuments: true, generates: { "./src/graphql/": { preset: "client", config: { // Error not present when this is commented out documentMode: "string", }, }, }, };

export default config;

Additional context

No response

Brookke avatar May 28 '25 14:05 Brookke