Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add |undefined in the TypedDocumentString constructor to make it work with --isolatedDeclarations #10160

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading