Skip to content

Commit c7af639

Browse files
jyasskinenisdenjo
andauthored
Add |undefined in the TypedDocumentString constructor to make it work with --isolatedDeclarations (#10160)
Co-authored-by: Denis Badurina <[email protected]>
1 parent 55a1e9e commit c7af639

File tree

7 files changed

+14
-9
lines changed

7 files changed

+14
-9
lines changed

.changeset/twenty-spiders-sell.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-codegen/typed-document-node': patch
3+
---
4+
5+
Allow explicit `undefined` in additional to optional arguments

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class TypedDocumentString<TResult, TVariables>
2626
{
2727
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
2828

29-
constructor(private value: string, public __meta__?: Record<string, any>) {
29+
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
3030
super(value);
3131
}
3232

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class TypedDocumentString<TResult, TVariables>
4545
{
4646
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
4747

48-
constructor(private value: string, public __meta__?: Record<string, any>) {
48+
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
4949
super(value);
5050
}
5151

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class TypedDocumentString<TResult, TVariables>
4545
{
4646
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
4747

48-
constructor(private value: string, public __meta__?: Record<string, any>) {
48+
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
4949
super(value);
5050
}
5151

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class TypedDocumentString<TResult, TVariables>
5858
{
5959
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
6060

61-
constructor(private value: string, public __meta__?: Record<string, any>) {
61+
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
6262
super(value);
6363
}
6464

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class TypedDocumentString<TResult, TVariables>
4343
{
4444
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
4545
46-
constructor(private value: string, public __meta__?: Record<string, any>) {
46+
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
4747
super(value);
4848
}
4949

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -2209,7 +2209,7 @@ export * from "./gql.js";`);
22092209
{
22102210
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
22112211
2212-
constructor(private value: string, public __meta__?: Record<string, any>) {
2212+
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
22132213
super(value);
22142214
}
22152215
@@ -2338,7 +2338,7 @@ export * from "./gql.js";`);
23382338
{
23392339
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
23402340
2341-
constructor(private value: string, public __meta__?: Record<string, any>) {
2341+
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
23422342
super(value);
23432343
}
23442344
@@ -2463,7 +2463,7 @@ export * from "./gql.js";`);
24632463
{
24642464
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
24652465
2466-
constructor(private value: string, public __meta__?: Record<string, any>) {
2466+
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
24672467
super(value);
24682468
}
24692469
@@ -2727,7 +2727,7 @@ export * from "./gql.js";`);
27272727
{
27282728
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
27292729
2730-
constructor(private value: string, public __meta__?: Record<string, any>) {
2730+
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
27312731
super(value);
27322732
}
27332733

0 commit comments

Comments
 (0)