Skip to content

Commit 3188b8c

Browse files
Brooke Hattoneddeee888
andauthored
fix: noImplicitOverride error in generated code when using documentMode: "string" (#10362)
* fix: noImplictOverride error Fixes the noImplicitOverride error * Update tests * Add changeset * Update examples test --------- Co-authored-by: Eddy Nguyen <[email protected]>
1 parent c3295f9 commit 3188b8c

File tree

7 files changed

+15
-9
lines changed

7 files changed

+15
-9
lines changed

.changeset/green-trainers-perform.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@graphql-codegen/typed-document-node': patch
3+
'@graphql-codegen/client-preset': patch
4+
---
5+
6+
Make generated type compatible with noImplicitOverride=true

examples/persisted-documents-string-mode/src/gql/graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class TypedDocumentString<TResult, TVariables>
4848
this.__meta__ = __meta__;
4949
}
5050

51-
toString(): string & DocumentTypeDecoration<TResult, TVariables> {
51+
override toString(): string & DocumentTypeDecoration<TResult, TVariables> {
5252
return this.value;
5353
}
5454
}

examples/react/tanstack-react-query/src/gql/graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ export class TypedDocumentString<TResult, TVariables>
13121312
this.__meta__ = __meta__;
13131313
}
13141314

1315-
toString(): string & DocumentTypeDecoration<TResult, TVariables> {
1315+
override toString(): string & DocumentTypeDecoration<TResult, TVariables> {
13161316
return this.value;
13171317
}
13181318
}

examples/react/urql/src/gql/graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ export class TypedDocumentString<TResult, TVariables>
13121312
this.__meta__ = __meta__;
13131313
}
13141314

1315-
toString(): string & DocumentTypeDecoration<TResult, TVariables> {
1315+
override toString(): string & DocumentTypeDecoration<TResult, TVariables> {
13161316
return this.value;
13171317
}
13181318
}

examples/typescript-graphql-request/src/gql/graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ export class TypedDocumentString<TResult, TVariables>
13251325
this.__meta__ = __meta__;
13261326
}
13271327

1328-
toString(): string & DocumentTypeDecoration<TResult, TVariables> {
1328+
override toString(): string & DocumentTypeDecoration<TResult, TVariables> {
13291329
return this.value;
13301330
}
13311331
}

packages/plugins/typescript/typed-document-node/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class TypedDocumentString<TResult, TVariables>
5151
this.__meta__ = __meta__;
5252
}
5353
54-
toString(): string & DocumentTypeDecoration<TResult, TVariables> {
54+
override toString(): string & DocumentTypeDecoration<TResult, TVariables> {
5555
return this.value;
5656
}
5757
}`,

packages/presets/client/tests/client-preset.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,7 +2473,7 @@ export * from "./gql.js";`);
24732473
this.__meta__ = __meta__;
24742474
}
24752475
2476-
toString(): string & DocumentTypeDecoration<TResult, TVariables> {
2476+
override toString(): string & DocumentTypeDecoration<TResult, TVariables> {
24772477
return this.value;
24782478
}
24792479
}
@@ -2618,7 +2618,7 @@ export * from "./gql.js";`);
26182618
this.__meta__ = __meta__;
26192619
}
26202620
2621-
toString(): string & DocumentTypeDecoration<TResult, TVariables> {
2621+
override toString(): string & DocumentTypeDecoration<TResult, TVariables> {
26222622
return this.value;
26232623
}
26242624
}
@@ -2758,7 +2758,7 @@ export * from "./gql.js";`);
27582758
this.__meta__ = __meta__;
27592759
}
27602760
2761-
toString(): string & DocumentTypeDecoration<TResult, TVariables> {
2761+
override toString(): string & DocumentTypeDecoration<TResult, TVariables> {
27622762
return this.value;
27632763
}
27642764
}
@@ -3057,7 +3057,7 @@ export * from "./gql.js";`);
30573057
this.__meta__ = __meta__;
30583058
}
30593059
3060-
toString(): string & DocumentTypeDecoration<TResult, TVariables> {
3060+
override toString(): string & DocumentTypeDecoration<TResult, TVariables> {
30613061
return this.value;
30623062
}
30633063
}

0 commit comments

Comments
 (0)