Skip to content

Commit

Permalink
Add |undefined in the TypedDocumentString constructor to make it work…
Browse files Browse the repository at this point in the history
… with --isolatedDeclarations (#10160)

Co-authored-by: Denis Badurina <[email protected]>
  • Loading branch information
jyasskin and enisdenjo authored Oct 11, 2024
1 parent 55a1e9e commit c7af639
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/twenty-spiders-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-codegen/typed-document-node': patch
---

Allow explicit `undefined` in additional to optional arguments
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class TypedDocumentString<TResult, TVariables>
{
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];

constructor(private value: string, public __meta__?: Record<string, any>) {
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
super(value);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/react/tanstack-react-query/src/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class TypedDocumentString<TResult, TVariables>
{
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];

constructor(private value: string, public __meta__?: Record<string, any>) {
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
super(value);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/react/urql/src/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class TypedDocumentString<TResult, TVariables>
{
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];

constructor(private value: string, public __meta__?: Record<string, any>) {
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
super(value);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/typescript-graphql-request/src/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class TypedDocumentString<TResult, TVariables>
{
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];

constructor(private value: string, public __meta__?: Record<string, any>) {
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
super(value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class TypedDocumentString<TResult, TVariables>
{
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
constructor(private value: string, public __meta__?: Record<string, any>) {
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
super(value);
}
Expand Down
8 changes: 4 additions & 4 deletions packages/presets/client/tests/client-preset.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,7 @@ export * from "./gql.js";`);
{
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
constructor(private value: string, public __meta__?: Record<string, any>) {
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
super(value);
}
Expand Down Expand Up @@ -2338,7 +2338,7 @@ export * from "./gql.js";`);
{
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
constructor(private value: string, public __meta__?: Record<string, any>) {
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
super(value);
}
Expand Down Expand Up @@ -2463,7 +2463,7 @@ export * from "./gql.js";`);
{
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
constructor(private value: string, public __meta__?: Record<string, any>) {
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
super(value);
}
Expand Down Expand Up @@ -2727,7 +2727,7 @@ export * from "./gql.js";`);
{
__apiType?: DocumentTypeDecoration<TResult, TVariables>['__apiType'];
constructor(private value: string, public __meta__?: Record<string, any>) {
constructor(private value: string, public __meta__?: Record<string, any> | undefined) {
super(value);
}
Expand Down

0 comments on commit c7af639

Please sign in to comment.