From 2ebe06b45abfe62bb446365f78680ad01d86a541 Mon Sep 17 00:00:00 2001 From: Igor Kusakov Date: Mon, 17 Nov 2025 19:30:03 -0500 Subject: [PATCH 1/2] [typescript-operations] Remove generation of InputMaybe and Scalars for variables --- .../src/ts-operation-variables-to-object.ts | 26 +++++++++ .../__snapshots__/ts-documents.spec.ts.snap | 6 +-- .../operations/tests/ts-documents.spec.ts | 53 ++++++++++--------- .../tests/ts-documents.standalone.spec.ts | 6 +-- .../src/typescript-variables-to-object.ts | 2 +- 5 files changed, 60 insertions(+), 33 deletions(-) diff --git a/packages/plugins/typescript/operations/src/ts-operation-variables-to-object.ts b/packages/plugins/typescript/operations/src/ts-operation-variables-to-object.ts index b3b73c6c841..fc75862ba8f 100644 --- a/packages/plugins/typescript/operations/src/ts-operation-variables-to-object.ts +++ b/packages/plugins/typescript/operations/src/ts-operation-variables-to-object.ts @@ -1,7 +1,33 @@ import { TypeScriptOperationVariablesToObject as TSOperationVariablesToObject } from '@graphql-codegen/typescript'; +const SCALARS = { + ID: 'string', + String: 'string', + Int: 'number', + Float: 'number', + Boolean: 'boolean', +}; + +const MAYBE_SUFFIX = ' | null'; + export class TypeScriptOperationVariablesToObject extends TSOperationVariablesToObject { protected formatTypeString(fieldType: string, _isNonNullType: boolean, _hasDefaultValue: boolean): string { return fieldType; } + + protected clearOptional(str: string): string { + if (str?.endsWith(MAYBE_SUFFIX)) { + return (str = str.substring(0, str.length - MAYBE_SUFFIX.length)); + } + + return str; + } + + protected wrapMaybe(type: string): string { + return type?.endsWith(MAYBE_SUFFIX) ? type : `${type}${MAYBE_SUFFIX}`; + } + + protected getScalar(name: string): string { + return SCALARS[name] ?? 'any'; + } } diff --git a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap index 99164f06d68..f364438cc65 100644 --- a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap +++ b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap @@ -5,15 +5,15 @@ exports[`TypeScript Operations Plugin > Config > should include fragment variabl export type TextNotificationFragmentFragmentVariables = Exact<{ - skip: Scalars['Boolean']['input']; + skip: boolean; }>; " `; exports[`TypeScript Operations Plugin > Issues > #2699 - Issues with multiple interfaces and unions 1`] = ` "export type GetEntityBrandDataQueryVariables = Exact<{ - gid: Scalars['ID']['input']; - brand: Scalars['ID']['input']; + gid: string; + brand: string; }>; diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index 54c601320df..28dd11e4a41 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -1,3 +1,4 @@ +import dedent from 'dedent'; import { mergeOutputs, Types } from '@graphql-codegen/plugin-helpers'; import { validateTs } from '@graphql-codegen/testing'; import { buildClientSchema, buildSchema, parse } from 'graphql'; @@ -343,7 +344,7 @@ describe('TypeScript Operations Plugin', () => { expect(content).toBeSimilarStringTo(` export type UserQueryVariables = Exact<{ - showProperty: Scalars['Boolean']['input']; + showProperty: boolean; }> | undefined; `); }); @@ -2481,7 +2482,7 @@ export type Q2Query = { search: Array< expect(content).toBeSimilarStringTo( `export type MeQueryVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>;` ); expect(content).toBeSimilarStringTo(` @@ -2847,16 +2848,16 @@ export type Q2Query = { search: Array< }); expect(content).toBeSimilarStringTo( - `export type TestQueryQueryVariables = Exact<{ - username?: InputMaybe; - email?: InputMaybe; - password: Scalars['String']['input']; - input?: InputMaybe; + dedent(`export type TestQueryQueryVariables = Exact<{ + username?: string | null; + email?: string | null; + password: string; + input?: InputType | null; mandatoryInput: InputType; - testArray?: InputMaybe> | InputMaybe>; - requireString: Array> | InputMaybe; - innerRequired: Array | Scalars['String']['input']; - }>;` + testArray?: Array | string | null; + requireString: Array | string; + innerRequired: Array | string; + }>;`) ); await validate(content, config, schema); }); @@ -2874,7 +2875,7 @@ export type Q2Query = { search: Array< expect(content).toBeSimilarStringTo( `export type TestQueryQueryVariables = Exact<{ - test?: InputMaybe; + test?: any | null; }>;` ); await validate(content, config); @@ -3228,7 +3229,7 @@ export type Q2Query = { search: Array< expect(content).toBeSimilarStringTo(` export type UsersQueryVariables = Exact<{ - reverse?: InputMaybe; + reverse?: boolean | null; }>; `); }); @@ -5506,9 +5507,9 @@ function test(q: GetEntityBrandDataQuery): void { expect(content).toBeSimilarStringTo(` export type UserQueryVariables = Exact<{ - testArray?: InputMaybe> | InputMaybe>; - requireString: Array> | InputMaybe; - innerRequired: Array | Scalars['String']['input']; + testArray?: Array | string | null; + requireString: Array | string; + innerRequired: Array | string; }>;`); await validate(content, config); }); @@ -5538,9 +5539,9 @@ function test(q: GetEntityBrandDataQuery): void { expect(content).toBeSimilarStringTo(` export type UserQueryVariables = Exact<{ - testArray?: InputMaybe>>; - requireString: Array>; - innerRequired: Array; + testArray?: Array | null; + requireString: Array; + innerRequired: Array; }>;`); await validate(content, config); }); @@ -6086,8 +6087,8 @@ function test(q: GetEntityBrandDataQuery): void { expect(content).toBeSimilarStringTo(` export type UserQueryQueryVariables = Exact<{ - skipFirstName: Scalars['Boolean']['input']; - skipAddress: Scalars['Boolean']['input']; + skipFirstName: boolean; + skipAddress: boolean; }>; export type UserQueryQuery = { @@ -6145,7 +6146,7 @@ function test(q: GetEntityBrandDataQuery): void { expect(content).toBeSimilarStringTo(` export type UserQueryVariables = Exact<{ - showAddress: Scalars['Boolean']['input']; + showAddress: boolean; }>; export type UserQuery = { __typename?: 'Query', user: { __typename?: 'User', name: string, address?: string, nicknames?: Array | null, parents?: Array } };`); @@ -6198,8 +6199,8 @@ function test(q: GetEntityBrandDataQuery): void { expect(content).toBeSimilarStringTo(` export type UserQueryVariables = Exact<{ - showAddress: Scalars['Boolean']['input']; - showName: Scalars['Boolean']['input']; + showAddress: boolean; + showName: boolean; }>; export type UserQuery = { __typename?: 'Query', user: { __typename?: 'User', id: string, name?: string, address?: { __typename?: 'Address', city: string }, friends?: Array<{ __typename?: 'User', id: string }> } };`); }); @@ -6246,8 +6247,8 @@ function test(q: GetEntityBrandDataQuery): void { expect(content).toBeSimilarStringTo(` export type UserQueryVariables = Exact<{ - showAddress: Scalars['Boolean']['input']; - showName: Scalars['Boolean']['input']; + showAddress: boolean; + showName: boolean; }>; export type UserQuery = ( diff --git a/packages/plugins/typescript/operations/tests/ts-documents.standalone.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.standalone.spec.ts index e6385fc03ba..a557c507d3d 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.standalone.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.standalone.spec.ts @@ -88,7 +88,7 @@ describe('TypeScript Operations Plugin - Standalone', () => { expect(result).toMatchInlineSnapshot(` "type Exact = { [K in keyof T]: T[K] }; export type UserQueryVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; @@ -105,8 +105,8 @@ describe('TypeScript Operations Plugin - Standalone', () => { }; export type UsersWithScalarInputQueryVariables = Exact<{ - from: Scalars['DateTime']['input']; - to?: InputMaybe; + from: any; + to?: any | null; }>; diff --git a/packages/plugins/typescript/typescript/src/typescript-variables-to-object.ts b/packages/plugins/typescript/typescript/src/typescript-variables-to-object.ts index 8cb07a79bfc..06d45e1f934 100644 --- a/packages/plugins/typescript/typescript/src/typescript-variables-to-object.ts +++ b/packages/plugins/typescript/typescript/src/typescript-variables-to-object.ts @@ -36,7 +36,7 @@ export class TypeScriptOperationVariablesToObject extends OperationVariablesToOb ); } - private clearOptional(str: string): string { + protected clearOptional(str: string): string { const prefix = this._namespacedImportName ? `${this._namespacedImportName}.` : ''; const rgx = new RegExp(`^${this.wrapMaybe(`(.*?)`)}$`, 'i'); From bbaed46891bd26c57f34bd9740eb75ecaf642144 Mon Sep 17 00:00:00 2001 From: Igor Kusakov Date: Fri, 21 Nov 2025 15:57:34 -0500 Subject: [PATCH 2/2] Adding support for `config.scalars`, fixing intergation tests --- .changeset/khaki-turtles-juggle.md | 6 ++++ dev-test/githunt/typed-document-nodes.ts | 20 +++++------ dev-test/githunt/types.avoidOptionals.ts | 20 +++++------ dev-test/githunt/types.d.ts | 20 +++++------ dev-test/githunt/types.enumsAsTypes.ts | 20 +++++------ .../githunt/types.flatten.preResolveTypes.ts | 20 +++++------ dev-test/githunt/types.immutableTypes.ts | 20 +++++------ ...ypes.preResolveTypes.onlyOperationTypes.ts | 20 +++++------ dev-test/githunt/types.preResolveTypes.ts | 20 +++++------ dev-test/githunt/types.ts | 20 +++++------ dev-test/star-wars/types.avoidOptionals.ts | 24 ++++++------- dev-test/star-wars/types.excludeQueryAlpha.ts | 22 ++++++------ dev-test/star-wars/types.excludeQueryBeta.ts | 22 ++++++------ .../star-wars/types.globallyAvailable.d.ts | 24 ++++++------- dev-test/star-wars/types.immutableTypes.ts | 24 ++++++------- ...ypes.preResolveTypes.onlyOperationTypes.ts | 24 ++++++------- dev-test/star-wars/types.preResolveTypes.ts | 24 ++++++------- dev-test/star-wars/types.skipSchema.ts | 24 ++++++------- dev-test/star-wars/types.ts | 24 ++++++------- .../react/apollo-client/src/gql/graphql.ts | 2 +- .../react/http-executor/src/gql/graphql.ts | 2 +- .../tanstack-react-query/src/gql/graphql.ts | 2 +- examples/react/urql/src/gql/graphql.ts | 2 +- examples/typescript-esm/src/gql/graphql.ts | 2 +- .../src/gql/graphql.ts | 2 +- .../vite/vite-react-cts/src/gql/graphql.ts | 2 +- .../vite/vite-react-mts/src/gql/graphql.ts | 2 +- .../vite/vite-react-ts/src/gql/graphql.ts | 2 +- .../vue/apollo-composable/src/gql/graphql.ts | 2 +- examples/vue/urql/src/gql/graphql.ts | 2 +- examples/vue/villus/src/gql/graphql.ts | 2 +- examples/yoga-tests/src/gql/graphql.ts | 2 +- .../src/ts-operation-variables-to-object.ts | 4 +-- .../tests/ts-documents.standalone.spec.ts | 36 +++++++++++++++++++ 34 files changed, 253 insertions(+), 211 deletions(-) create mode 100644 .changeset/khaki-turtles-juggle.md diff --git a/.changeset/khaki-turtles-juggle.md b/.changeset/khaki-turtles-juggle.md new file mode 100644 index 00000000000..bb0e0614a6a --- /dev/null +++ b/.changeset/khaki-turtles-juggle.md @@ -0,0 +1,6 @@ +--- +'@graphql-codegen/typescript-operations': major +'@graphql-codegen/typescript': minor +--- + +The `typescript-operations` plugin no longer generates InputMaybe and Scalars types; it now uses native Typescript types instead. diff --git a/dev-test/githunt/typed-document-nodes.ts b/dev-test/githunt/typed-document-nodes.ts index f9153c95543..4eed5751e4f 100644 --- a/dev-test/githunt/typed-document-nodes.ts +++ b/dev-test/githunt/typed-document-nodes.ts @@ -170,7 +170,7 @@ export enum VoteType { } export type OnCommentAddedSubscriptionVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type OnCommentAddedSubscription = { @@ -185,9 +185,9 @@ export type OnCommentAddedSubscription = { }; export type CommentQueryVariables = Exact<{ - repoFullName: Scalars['String']['input']; - limit?: InputMaybe; - offset?: InputMaybe; + repoFullName: string; + limit?: number | null; + offset?: number | null; }>; export type CommentQuery = { @@ -253,8 +253,8 @@ export type FeedEntryFragment = { export type FeedQueryVariables = Exact<{ type: FeedType; - offset?: InputMaybe; - limit?: InputMaybe; + offset?: number | null; + limit?: number | null; }>; export type FeedQuery = { @@ -281,7 +281,7 @@ export type FeedQuery = { }; export type SubmitRepositoryMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type SubmitRepositoryMutation = { @@ -302,8 +302,8 @@ export type RepoInfoFragment = { }; export type SubmitCommentMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; - commentContent: Scalars['String']['input']; + repoFullName: string; + commentContent: string; }>; export type SubmitCommentMutation = { @@ -324,7 +324,7 @@ export type VoteButtonsFragment = { }; export type VoteMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; type: VoteType; }>; diff --git a/dev-test/githunt/types.avoidOptionals.ts b/dev-test/githunt/types.avoidOptionals.ts index 7d17ee7fa4d..66c403d7758 100644 --- a/dev-test/githunt/types.avoidOptionals.ts +++ b/dev-test/githunt/types.avoidOptionals.ts @@ -169,7 +169,7 @@ export enum VoteType { } export type OnCommentAddedSubscriptionVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type OnCommentAddedSubscription = { @@ -184,9 +184,9 @@ export type OnCommentAddedSubscription = { }; export type CommentQueryVariables = Exact<{ - repoFullName: Scalars['String']['input']; - limit: InputMaybe; - offset: InputMaybe; + repoFullName: string; + limit: number | null; + offset: number | null; }>; export type CommentQuery = { @@ -252,8 +252,8 @@ export type FeedEntryFragment = { export type FeedQueryVariables = Exact<{ type: FeedType; - offset: InputMaybe; - limit: InputMaybe; + offset: number | null; + limit: number | null; }>; export type FeedQuery = { @@ -280,7 +280,7 @@ export type FeedQuery = { }; export type SubmitRepositoryMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type SubmitRepositoryMutation = { @@ -301,8 +301,8 @@ export type RepoInfoFragment = { }; export type SubmitCommentMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; - commentContent: Scalars['String']['input']; + repoFullName: string; + commentContent: string; }>; export type SubmitCommentMutation = { @@ -323,7 +323,7 @@ export type VoteButtonsFragment = { }; export type VoteMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; type: VoteType; }>; diff --git a/dev-test/githunt/types.d.ts b/dev-test/githunt/types.d.ts index c56fb3823ff..b84825f3808 100644 --- a/dev-test/githunt/types.d.ts +++ b/dev-test/githunt/types.d.ts @@ -164,7 +164,7 @@ export type Vote = { export type VoteType = 'CANCEL' | 'DOWN' | 'UP'; export type OnCommentAddedSubscriptionVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type OnCommentAddedSubscription = { @@ -179,9 +179,9 @@ export type OnCommentAddedSubscription = { }; export type CommentQueryVariables = Exact<{ - repoFullName: Scalars['String']['input']; - limit?: InputMaybe; - offset?: InputMaybe; + repoFullName: string; + limit?: number | null; + offset?: number | null; }>; export type CommentQuery = { @@ -247,8 +247,8 @@ export type FeedEntryFragment = { export type FeedQueryVariables = Exact<{ type: FeedType; - offset?: InputMaybe; - limit?: InputMaybe; + offset?: number | null; + limit?: number | null; }>; export type FeedQuery = { @@ -275,7 +275,7 @@ export type FeedQuery = { }; export type SubmitRepositoryMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type SubmitRepositoryMutation = { @@ -296,8 +296,8 @@ export type RepoInfoFragment = { }; export type SubmitCommentMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; - commentContent: Scalars['String']['input']; + repoFullName: string; + commentContent: string; }>; export type SubmitCommentMutation = { @@ -318,7 +318,7 @@ export type VoteButtonsFragment = { }; export type VoteMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; type: VoteType; }>; diff --git a/dev-test/githunt/types.enumsAsTypes.ts b/dev-test/githunt/types.enumsAsTypes.ts index c56fb3823ff..b84825f3808 100644 --- a/dev-test/githunt/types.enumsAsTypes.ts +++ b/dev-test/githunt/types.enumsAsTypes.ts @@ -164,7 +164,7 @@ export type Vote = { export type VoteType = 'CANCEL' | 'DOWN' | 'UP'; export type OnCommentAddedSubscriptionVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type OnCommentAddedSubscription = { @@ -179,9 +179,9 @@ export type OnCommentAddedSubscription = { }; export type CommentQueryVariables = Exact<{ - repoFullName: Scalars['String']['input']; - limit?: InputMaybe; - offset?: InputMaybe; + repoFullName: string; + limit?: number | null; + offset?: number | null; }>; export type CommentQuery = { @@ -247,8 +247,8 @@ export type FeedEntryFragment = { export type FeedQueryVariables = Exact<{ type: FeedType; - offset?: InputMaybe; - limit?: InputMaybe; + offset?: number | null; + limit?: number | null; }>; export type FeedQuery = { @@ -275,7 +275,7 @@ export type FeedQuery = { }; export type SubmitRepositoryMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type SubmitRepositoryMutation = { @@ -296,8 +296,8 @@ export type RepoInfoFragment = { }; export type SubmitCommentMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; - commentContent: Scalars['String']['input']; + repoFullName: string; + commentContent: string; }>; export type SubmitCommentMutation = { @@ -318,7 +318,7 @@ export type VoteButtonsFragment = { }; export type VoteMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; type: VoteType; }>; diff --git a/dev-test/githunt/types.flatten.preResolveTypes.ts b/dev-test/githunt/types.flatten.preResolveTypes.ts index 750dd005dd0..90348f33215 100644 --- a/dev-test/githunt/types.flatten.preResolveTypes.ts +++ b/dev-test/githunt/types.flatten.preResolveTypes.ts @@ -169,7 +169,7 @@ export enum VoteType { } export type OnCommentAddedSubscriptionVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type OnCommentAddedSubscription = { @@ -184,9 +184,9 @@ export type OnCommentAddedSubscription = { }; export type CommentQueryVariables = Exact<{ - repoFullName: Scalars['String']['input']; - limit?: InputMaybe; - offset?: InputMaybe; + repoFullName: string; + limit?: number | null; + offset?: number | null; }>; export type CommentQuery = { @@ -225,8 +225,8 @@ export type CurrentUserForProfileQuery = { export type FeedQueryVariables = Exact<{ type: FeedType; - offset?: InputMaybe; - limit?: InputMaybe; + offset?: number | null; + limit?: number | null; }>; export type FeedQuery = { @@ -253,7 +253,7 @@ export type FeedQuery = { }; export type SubmitRepositoryMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type SubmitRepositoryMutation = { @@ -262,8 +262,8 @@ export type SubmitRepositoryMutation = { }; export type SubmitCommentMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; - commentContent: Scalars['String']['input']; + repoFullName: string; + commentContent: string; }>; export type SubmitCommentMutation = { @@ -278,7 +278,7 @@ export type SubmitCommentMutation = { }; export type VoteMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; type: VoteType; }>; diff --git a/dev-test/githunt/types.immutableTypes.ts b/dev-test/githunt/types.immutableTypes.ts index f72d3f835a0..f708b3c3dce 100644 --- a/dev-test/githunt/types.immutableTypes.ts +++ b/dev-test/githunt/types.immutableTypes.ts @@ -169,7 +169,7 @@ export enum VoteType { } export type OnCommentAddedSubscriptionVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type OnCommentAddedSubscription = { @@ -184,9 +184,9 @@ export type OnCommentAddedSubscription = { }; export type CommentQueryVariables = Exact<{ - repoFullName: Scalars['String']['input']; - limit?: InputMaybe; - offset?: InputMaybe; + repoFullName: string; + limit?: number | null; + offset?: number | null; }>; export type CommentQuery = { @@ -252,8 +252,8 @@ export type FeedEntryFragment = { export type FeedQueryVariables = Exact<{ type: FeedType; - offset?: InputMaybe; - limit?: InputMaybe; + offset?: number | null; + limit?: number | null; }>; export type FeedQuery = { @@ -280,7 +280,7 @@ export type FeedQuery = { }; export type SubmitRepositoryMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type SubmitRepositoryMutation = { @@ -301,8 +301,8 @@ export type RepoInfoFragment = { }; export type SubmitCommentMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; - commentContent: Scalars['String']['input']; + repoFullName: string; + commentContent: string; }>; export type SubmitCommentMutation = { @@ -323,7 +323,7 @@ export type VoteButtonsFragment = { }; export type VoteMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; type: VoteType; }>; diff --git a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts index cff8aed143f..29bff30b9dd 100644 --- a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts @@ -32,7 +32,7 @@ export enum VoteType { } export type OnCommentAddedSubscriptionVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type OnCommentAddedSubscription = { @@ -47,9 +47,9 @@ export type OnCommentAddedSubscription = { }; export type CommentQueryVariables = Exact<{ - repoFullName: Scalars['String']['input']; - limit?: InputMaybe; - offset?: InputMaybe; + repoFullName: string; + limit?: number | null; + offset?: number | null; }>; export type CommentQuery = { @@ -115,8 +115,8 @@ export type FeedEntryFragment = { export type FeedQueryVariables = Exact<{ type: FeedType; - offset?: InputMaybe; - limit?: InputMaybe; + offset?: number | null; + limit?: number | null; }>; export type FeedQuery = { @@ -143,7 +143,7 @@ export type FeedQuery = { }; export type SubmitRepositoryMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type SubmitRepositoryMutation = { @@ -164,8 +164,8 @@ export type RepoInfoFragment = { }; export type SubmitCommentMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; - commentContent: Scalars['String']['input']; + repoFullName: string; + commentContent: string; }>; export type SubmitCommentMutation = { @@ -186,7 +186,7 @@ export type VoteButtonsFragment = { }; export type VoteMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; type: VoteType; }>; diff --git a/dev-test/githunt/types.preResolveTypes.ts b/dev-test/githunt/types.preResolveTypes.ts index 1b90b9ef461..c63166be345 100644 --- a/dev-test/githunt/types.preResolveTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.ts @@ -169,7 +169,7 @@ export enum VoteType { } export type OnCommentAddedSubscriptionVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type OnCommentAddedSubscription = { @@ -184,9 +184,9 @@ export type OnCommentAddedSubscription = { }; export type CommentQueryVariables = Exact<{ - repoFullName: Scalars['String']['input']; - limit?: InputMaybe; - offset?: InputMaybe; + repoFullName: string; + limit?: number | null; + offset?: number | null; }>; export type CommentQuery = { @@ -252,8 +252,8 @@ export type FeedEntryFragment = { export type FeedQueryVariables = Exact<{ type: FeedType; - offset?: InputMaybe; - limit?: InputMaybe; + offset?: number | null; + limit?: number | null; }>; export type FeedQuery = { @@ -280,7 +280,7 @@ export type FeedQuery = { }; export type SubmitRepositoryMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type SubmitRepositoryMutation = { @@ -301,8 +301,8 @@ export type RepoInfoFragment = { }; export type SubmitCommentMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; - commentContent: Scalars['String']['input']; + repoFullName: string; + commentContent: string; }>; export type SubmitCommentMutation = { @@ -323,7 +323,7 @@ export type VoteButtonsFragment = { }; export type VoteMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; type: VoteType; }>; diff --git a/dev-test/githunt/types.ts b/dev-test/githunt/types.ts index 1b90b9ef461..c63166be345 100644 --- a/dev-test/githunt/types.ts +++ b/dev-test/githunt/types.ts @@ -169,7 +169,7 @@ export enum VoteType { } export type OnCommentAddedSubscriptionVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type OnCommentAddedSubscription = { @@ -184,9 +184,9 @@ export type OnCommentAddedSubscription = { }; export type CommentQueryVariables = Exact<{ - repoFullName: Scalars['String']['input']; - limit?: InputMaybe; - offset?: InputMaybe; + repoFullName: string; + limit?: number | null; + offset?: number | null; }>; export type CommentQuery = { @@ -252,8 +252,8 @@ export type FeedEntryFragment = { export type FeedQueryVariables = Exact<{ type: FeedType; - offset?: InputMaybe; - limit?: InputMaybe; + offset?: number | null; + limit?: number | null; }>; export type FeedQuery = { @@ -280,7 +280,7 @@ export type FeedQuery = { }; export type SubmitRepositoryMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; }>; export type SubmitRepositoryMutation = { @@ -301,8 +301,8 @@ export type RepoInfoFragment = { }; export type SubmitCommentMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; - commentContent: Scalars['String']['input']; + repoFullName: string; + commentContent: string; }>; export type SubmitCommentMutation = { @@ -323,7 +323,7 @@ export type VoteButtonsFragment = { }; export type VoteMutationVariables = Exact<{ - repoFullName: Scalars['String']['input']; + repoFullName: string; type: VoteType; }>; diff --git a/dev-test/star-wars/types.avoidOptionals.ts b/dev-test/star-wars/types.avoidOptionals.ts index 8310e5be51b..24b23e24f0c 100644 --- a/dev-test/star-wars/types.avoidOptionals.ts +++ b/dev-test/star-wars/types.avoidOptionals.ts @@ -251,7 +251,7 @@ export type CreateReviewForEpisodeMutation = { }; export type ExcludeQueryAlphaQueryVariables = Exact<{ - episode: InputMaybe; + episode: Episode | null; }>; export type ExcludeQueryAlphaQuery = { @@ -260,7 +260,7 @@ export type ExcludeQueryAlphaQuery = { }; export type ExcludeQueryBetaQueryVariables = Exact<{ - episode: InputMaybe; + episode: Episode | null; }>; export type ExcludeQueryBetaQuery = { @@ -269,7 +269,7 @@ export type ExcludeQueryBetaQuery = { }; export type HeroAndFriendsNamesQueryVariables = Exact<{ - episode: InputMaybe; + episode: Episode | null; }>; export type HeroAndFriendsNamesQuery = { @@ -299,7 +299,7 @@ export type HeroAppearsInQuery = { }; export type HeroDetailsQueryVariables = Exact<{ - episode: InputMaybe; + episode: Episode | null; }>; export type HeroDetailsQuery = { @@ -317,7 +317,7 @@ type HeroDetails_Human_Fragment = { __typename?: 'Human'; height: number | null; export type HeroDetailsFragment = HeroDetails_Droid_Fragment | HeroDetails_Human_Fragment; export type HeroDetailsWithFragmentQueryVariables = Exact<{ - episode: InputMaybe; + episode: Episode | null; }>; export type HeroDetailsWithFragmentQuery = { @@ -329,7 +329,7 @@ export type HeroDetailsWithFragmentQuery = { }; export type HeroNameQueryVariables = Exact<{ - episode: InputMaybe; + episode: Episode | null; }>; export type HeroNameQuery = { @@ -338,8 +338,8 @@ export type HeroNameQuery = { }; export type HeroNameConditionalInclusionQueryVariables = Exact<{ - episode: InputMaybe; - includeName: Scalars['Boolean']['input']; + episode: Episode | null; + includeName: boolean; }>; export type HeroNameConditionalInclusionQuery = { @@ -348,8 +348,8 @@ export type HeroNameConditionalInclusionQuery = { }; export type HeroNameConditionalExclusionQueryVariables = Exact<{ - episode: InputMaybe; - skipName: Scalars['Boolean']['input']; + episode: Episode | null; + skipName: boolean; }>; export type HeroNameConditionalExclusionQuery = { @@ -358,7 +358,7 @@ export type HeroNameConditionalExclusionQuery = { }; export type HeroParentTypeDependentFieldQueryVariables = Exact<{ - episode: InputMaybe; + episode: Episode | null; }>; export type HeroParentTypeDependentFieldQuery = { @@ -382,7 +382,7 @@ export type HeroParentTypeDependentFieldQuery = { }; export type HeroTypeDependentAliasedFieldQueryVariables = Exact<{ - episode: InputMaybe; + episode: Episode | null; }>; export type HeroTypeDependentAliasedFieldQuery = { diff --git a/dev-test/star-wars/types.excludeQueryAlpha.ts b/dev-test/star-wars/types.excludeQueryAlpha.ts index 5b00ab0b4a0..40703b13094 100644 --- a/dev-test/star-wars/types.excludeQueryAlpha.ts +++ b/dev-test/star-wars/types.excludeQueryAlpha.ts @@ -251,7 +251,7 @@ export type CreateReviewForEpisodeMutation = { }; export type ExcludeQueryBetaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryBetaQuery = { @@ -260,7 +260,7 @@ export type ExcludeQueryBetaQuery = { }; export type HeroAndFriendsNamesQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroAndFriendsNamesQuery = { @@ -290,7 +290,7 @@ export type HeroAppearsInQuery = { }; export type HeroDetailsQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsQuery = { @@ -308,7 +308,7 @@ type HeroDetails_Human_Fragment = { __typename?: 'Human'; height?: number | null export type HeroDetailsFragment = HeroDetails_Droid_Fragment | HeroDetails_Human_Fragment; export type HeroDetailsWithFragmentQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsWithFragmentQuery = { @@ -320,7 +320,7 @@ export type HeroDetailsWithFragmentQuery = { }; export type HeroNameQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroNameQuery = { @@ -329,8 +329,8 @@ export type HeroNameQuery = { }; export type HeroNameConditionalInclusionQueryVariables = Exact<{ - episode?: InputMaybe; - includeName: Scalars['Boolean']['input']; + episode?: Episode | null; + includeName: boolean; }>; export type HeroNameConditionalInclusionQuery = { @@ -339,8 +339,8 @@ export type HeroNameConditionalInclusionQuery = { }; export type HeroNameConditionalExclusionQueryVariables = Exact<{ - episode?: InputMaybe; - skipName: Scalars['Boolean']['input']; + episode?: Episode | null; + skipName: boolean; }>; export type HeroNameConditionalExclusionQuery = { @@ -349,7 +349,7 @@ export type HeroNameConditionalExclusionQuery = { }; export type HeroParentTypeDependentFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroParentTypeDependentFieldQuery = { @@ -373,7 +373,7 @@ export type HeroParentTypeDependentFieldQuery = { }; export type HeroTypeDependentAliasedFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroTypeDependentAliasedFieldQuery = { diff --git a/dev-test/star-wars/types.excludeQueryBeta.ts b/dev-test/star-wars/types.excludeQueryBeta.ts index d7b3f040985..5b38889e9ac 100644 --- a/dev-test/star-wars/types.excludeQueryBeta.ts +++ b/dev-test/star-wars/types.excludeQueryBeta.ts @@ -251,7 +251,7 @@ export type CreateReviewForEpisodeMutation = { }; export type ExcludeQueryAlphaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryAlphaQuery = { @@ -260,7 +260,7 @@ export type ExcludeQueryAlphaQuery = { }; export type HeroAndFriendsNamesQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroAndFriendsNamesQuery = { @@ -290,7 +290,7 @@ export type HeroAppearsInQuery = { }; export type HeroDetailsQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsQuery = { @@ -308,7 +308,7 @@ type HeroDetails_Human_Fragment = { __typename?: 'Human'; height?: number | null export type HeroDetailsFragment = HeroDetails_Droid_Fragment | HeroDetails_Human_Fragment; export type HeroDetailsWithFragmentQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsWithFragmentQuery = { @@ -320,7 +320,7 @@ export type HeroDetailsWithFragmentQuery = { }; export type HeroNameQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroNameQuery = { @@ -329,8 +329,8 @@ export type HeroNameQuery = { }; export type HeroNameConditionalInclusionQueryVariables = Exact<{ - episode?: InputMaybe; - includeName: Scalars['Boolean']['input']; + episode?: Episode | null; + includeName: boolean; }>; export type HeroNameConditionalInclusionQuery = { @@ -339,8 +339,8 @@ export type HeroNameConditionalInclusionQuery = { }; export type HeroNameConditionalExclusionQueryVariables = Exact<{ - episode?: InputMaybe; - skipName: Scalars['Boolean']['input']; + episode?: Episode | null; + skipName: boolean; }>; export type HeroNameConditionalExclusionQuery = { @@ -349,7 +349,7 @@ export type HeroNameConditionalExclusionQuery = { }; export type HeroParentTypeDependentFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroParentTypeDependentFieldQuery = { @@ -373,7 +373,7 @@ export type HeroParentTypeDependentFieldQuery = { }; export type HeroTypeDependentAliasedFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroTypeDependentAliasedFieldQuery = { diff --git a/dev-test/star-wars/types.globallyAvailable.d.ts b/dev-test/star-wars/types.globallyAvailable.d.ts index 9647e05c044..2efbb00482e 100644 --- a/dev-test/star-wars/types.globallyAvailable.d.ts +++ b/dev-test/star-wars/types.globallyAvailable.d.ts @@ -249,7 +249,7 @@ type CreateReviewForEpisodeMutation = { }; type ExcludeQueryAlphaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; type ExcludeQueryAlphaQuery = { @@ -258,7 +258,7 @@ type ExcludeQueryAlphaQuery = { }; type ExcludeQueryBetaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; type ExcludeQueryBetaQuery = { @@ -267,7 +267,7 @@ type ExcludeQueryBetaQuery = { }; type HeroAndFriendsNamesQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; type HeroAndFriendsNamesQuery = { @@ -297,7 +297,7 @@ type HeroAppearsInQuery = { }; type HeroDetailsQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; type HeroDetailsQuery = { @@ -315,7 +315,7 @@ type HeroDetails_Human_Fragment = { __typename?: 'Human'; height?: number | null type HeroDetailsFragment = HeroDetails_Droid_Fragment | HeroDetails_Human_Fragment; type HeroDetailsWithFragmentQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; type HeroDetailsWithFragmentQuery = { @@ -327,7 +327,7 @@ type HeroDetailsWithFragmentQuery = { }; type HeroNameQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; type HeroNameQuery = { @@ -336,8 +336,8 @@ type HeroNameQuery = { }; type HeroNameConditionalInclusionQueryVariables = Exact<{ - episode?: InputMaybe; - includeName: Scalars['Boolean']['input']; + episode?: Episode | null; + includeName: boolean; }>; type HeroNameConditionalInclusionQuery = { @@ -346,8 +346,8 @@ type HeroNameConditionalInclusionQuery = { }; type HeroNameConditionalExclusionQueryVariables = Exact<{ - episode?: InputMaybe; - skipName: Scalars['Boolean']['input']; + episode?: Episode | null; + skipName: boolean; }>; type HeroNameConditionalExclusionQuery = { @@ -356,7 +356,7 @@ type HeroNameConditionalExclusionQuery = { }; type HeroParentTypeDependentFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; type HeroParentTypeDependentFieldQuery = { @@ -380,7 +380,7 @@ type HeroParentTypeDependentFieldQuery = { }; type HeroTypeDependentAliasedFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; type HeroTypeDependentAliasedFieldQuery = { diff --git a/dev-test/star-wars/types.immutableTypes.ts b/dev-test/star-wars/types.immutableTypes.ts index 8b412710155..5849e8f6d04 100644 --- a/dev-test/star-wars/types.immutableTypes.ts +++ b/dev-test/star-wars/types.immutableTypes.ts @@ -255,7 +255,7 @@ export type CreateReviewForEpisodeMutation = { }; export type ExcludeQueryAlphaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryAlphaQuery = { @@ -267,7 +267,7 @@ export type ExcludeQueryAlphaQuery = { }; export type ExcludeQueryBetaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryBetaQuery = { @@ -279,7 +279,7 @@ export type ExcludeQueryBetaQuery = { }; export type HeroAndFriendsNamesQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroAndFriendsNamesQuery = { @@ -317,7 +317,7 @@ export type HeroAppearsInQuery = { }; export type HeroDetailsQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsQuery = { @@ -343,7 +343,7 @@ type HeroDetails_Human_Fragment = { export type HeroDetailsFragment = HeroDetails_Droid_Fragment | HeroDetails_Human_Fragment; export type HeroDetailsWithFragmentQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsWithFragmentQuery = { @@ -355,7 +355,7 @@ export type HeroDetailsWithFragmentQuery = { }; export type HeroNameQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroNameQuery = { @@ -367,8 +367,8 @@ export type HeroNameQuery = { }; export type HeroNameConditionalInclusionQueryVariables = Exact<{ - episode?: InputMaybe; - includeName: Scalars['Boolean']['input']; + episode?: Episode | null; + includeName: boolean; }>; export type HeroNameConditionalInclusionQuery = { @@ -380,8 +380,8 @@ export type HeroNameConditionalInclusionQuery = { }; export type HeroNameConditionalExclusionQueryVariables = Exact<{ - episode?: InputMaybe; - skipName: Scalars['Boolean']['input']; + episode?: Episode | null; + skipName: boolean; }>; export type HeroNameConditionalExclusionQuery = { @@ -393,7 +393,7 @@ export type HeroNameConditionalExclusionQuery = { }; export type HeroParentTypeDependentFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroParentTypeDependentFieldQuery = { @@ -421,7 +421,7 @@ export type HeroParentTypeDependentFieldQuery = { }; export type HeroTypeDependentAliasedFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroTypeDependentAliasedFieldQuery = { diff --git a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts index 4900fa39aae..d5430785c67 100644 --- a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts @@ -60,7 +60,7 @@ export type CreateReviewForEpisodeMutation = { }; export type ExcludeQueryAlphaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryAlphaQuery = { @@ -69,7 +69,7 @@ export type ExcludeQueryAlphaQuery = { }; export type ExcludeQueryBetaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryBetaQuery = { @@ -78,7 +78,7 @@ export type ExcludeQueryBetaQuery = { }; export type HeroAndFriendsNamesQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroAndFriendsNamesQuery = { @@ -108,7 +108,7 @@ export type HeroAppearsInQuery = { }; export type HeroDetailsQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsQuery = { @@ -126,7 +126,7 @@ type HeroDetails_Human_Fragment = { __typename?: 'Human'; height?: number | null export type HeroDetailsFragment = HeroDetails_Droid_Fragment | HeroDetails_Human_Fragment; export type HeroDetailsWithFragmentQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsWithFragmentQuery = { @@ -138,7 +138,7 @@ export type HeroDetailsWithFragmentQuery = { }; export type HeroNameQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroNameQuery = { @@ -147,8 +147,8 @@ export type HeroNameQuery = { }; export type HeroNameConditionalInclusionQueryVariables = Exact<{ - episode?: InputMaybe; - includeName: Scalars['Boolean']['input']; + episode?: Episode | null; + includeName: boolean; }>; export type HeroNameConditionalInclusionQuery = { @@ -157,8 +157,8 @@ export type HeroNameConditionalInclusionQuery = { }; export type HeroNameConditionalExclusionQueryVariables = Exact<{ - episode?: InputMaybe; - skipName: Scalars['Boolean']['input']; + episode?: Episode | null; + skipName: boolean; }>; export type HeroNameConditionalExclusionQuery = { @@ -167,7 +167,7 @@ export type HeroNameConditionalExclusionQuery = { }; export type HeroParentTypeDependentFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroParentTypeDependentFieldQuery = { @@ -191,7 +191,7 @@ export type HeroParentTypeDependentFieldQuery = { }; export type HeroTypeDependentAliasedFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroTypeDependentAliasedFieldQuery = { diff --git a/dev-test/star-wars/types.preResolveTypes.ts b/dev-test/star-wars/types.preResolveTypes.ts index c1ae59f954d..5e82a72b7e0 100644 --- a/dev-test/star-wars/types.preResolveTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.ts @@ -251,7 +251,7 @@ export type CreateReviewForEpisodeMutation = { }; export type ExcludeQueryAlphaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryAlphaQuery = { @@ -260,7 +260,7 @@ export type ExcludeQueryAlphaQuery = { }; export type ExcludeQueryBetaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryBetaQuery = { @@ -269,7 +269,7 @@ export type ExcludeQueryBetaQuery = { }; export type HeroAndFriendsNamesQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroAndFriendsNamesQuery = { @@ -299,7 +299,7 @@ export type HeroAppearsInQuery = { }; export type HeroDetailsQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsQuery = { @@ -317,7 +317,7 @@ type HeroDetails_Human_Fragment = { __typename?: 'Human'; height?: number | null export type HeroDetailsFragment = HeroDetails_Droid_Fragment | HeroDetails_Human_Fragment; export type HeroDetailsWithFragmentQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsWithFragmentQuery = { @@ -329,7 +329,7 @@ export type HeroDetailsWithFragmentQuery = { }; export type HeroNameQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroNameQuery = { @@ -338,8 +338,8 @@ export type HeroNameQuery = { }; export type HeroNameConditionalInclusionQueryVariables = Exact<{ - episode?: InputMaybe; - includeName: Scalars['Boolean']['input']; + episode?: Episode | null; + includeName: boolean; }>; export type HeroNameConditionalInclusionQuery = { @@ -348,8 +348,8 @@ export type HeroNameConditionalInclusionQuery = { }; export type HeroNameConditionalExclusionQueryVariables = Exact<{ - episode?: InputMaybe; - skipName: Scalars['Boolean']['input']; + episode?: Episode | null; + skipName: boolean; }>; export type HeroNameConditionalExclusionQuery = { @@ -358,7 +358,7 @@ export type HeroNameConditionalExclusionQuery = { }; export type HeroParentTypeDependentFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroParentTypeDependentFieldQuery = { @@ -382,7 +382,7 @@ export type HeroParentTypeDependentFieldQuery = { }; export type HeroTypeDependentAliasedFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroTypeDependentAliasedFieldQuery = { diff --git a/dev-test/star-wars/types.skipSchema.ts b/dev-test/star-wars/types.skipSchema.ts index c1ae59f954d..5e82a72b7e0 100644 --- a/dev-test/star-wars/types.skipSchema.ts +++ b/dev-test/star-wars/types.skipSchema.ts @@ -251,7 +251,7 @@ export type CreateReviewForEpisodeMutation = { }; export type ExcludeQueryAlphaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryAlphaQuery = { @@ -260,7 +260,7 @@ export type ExcludeQueryAlphaQuery = { }; export type ExcludeQueryBetaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryBetaQuery = { @@ -269,7 +269,7 @@ export type ExcludeQueryBetaQuery = { }; export type HeroAndFriendsNamesQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroAndFriendsNamesQuery = { @@ -299,7 +299,7 @@ export type HeroAppearsInQuery = { }; export type HeroDetailsQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsQuery = { @@ -317,7 +317,7 @@ type HeroDetails_Human_Fragment = { __typename?: 'Human'; height?: number | null export type HeroDetailsFragment = HeroDetails_Droid_Fragment | HeroDetails_Human_Fragment; export type HeroDetailsWithFragmentQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsWithFragmentQuery = { @@ -329,7 +329,7 @@ export type HeroDetailsWithFragmentQuery = { }; export type HeroNameQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroNameQuery = { @@ -338,8 +338,8 @@ export type HeroNameQuery = { }; export type HeroNameConditionalInclusionQueryVariables = Exact<{ - episode?: InputMaybe; - includeName: Scalars['Boolean']['input']; + episode?: Episode | null; + includeName: boolean; }>; export type HeroNameConditionalInclusionQuery = { @@ -348,8 +348,8 @@ export type HeroNameConditionalInclusionQuery = { }; export type HeroNameConditionalExclusionQueryVariables = Exact<{ - episode?: InputMaybe; - skipName: Scalars['Boolean']['input']; + episode?: Episode | null; + skipName: boolean; }>; export type HeroNameConditionalExclusionQuery = { @@ -358,7 +358,7 @@ export type HeroNameConditionalExclusionQuery = { }; export type HeroParentTypeDependentFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroParentTypeDependentFieldQuery = { @@ -382,7 +382,7 @@ export type HeroParentTypeDependentFieldQuery = { }; export type HeroTypeDependentAliasedFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroTypeDependentAliasedFieldQuery = { diff --git a/dev-test/star-wars/types.ts b/dev-test/star-wars/types.ts index c1ae59f954d..5e82a72b7e0 100644 --- a/dev-test/star-wars/types.ts +++ b/dev-test/star-wars/types.ts @@ -251,7 +251,7 @@ export type CreateReviewForEpisodeMutation = { }; export type ExcludeQueryAlphaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryAlphaQuery = { @@ -260,7 +260,7 @@ export type ExcludeQueryAlphaQuery = { }; export type ExcludeQueryBetaQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type ExcludeQueryBetaQuery = { @@ -269,7 +269,7 @@ export type ExcludeQueryBetaQuery = { }; export type HeroAndFriendsNamesQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroAndFriendsNamesQuery = { @@ -299,7 +299,7 @@ export type HeroAppearsInQuery = { }; export type HeroDetailsQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsQuery = { @@ -317,7 +317,7 @@ type HeroDetails_Human_Fragment = { __typename?: 'Human'; height?: number | null export type HeroDetailsFragment = HeroDetails_Droid_Fragment | HeroDetails_Human_Fragment; export type HeroDetailsWithFragmentQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroDetailsWithFragmentQuery = { @@ -329,7 +329,7 @@ export type HeroDetailsWithFragmentQuery = { }; export type HeroNameQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroNameQuery = { @@ -338,8 +338,8 @@ export type HeroNameQuery = { }; export type HeroNameConditionalInclusionQueryVariables = Exact<{ - episode?: InputMaybe; - includeName: Scalars['Boolean']['input']; + episode?: Episode | null; + includeName: boolean; }>; export type HeroNameConditionalInclusionQuery = { @@ -348,8 +348,8 @@ export type HeroNameConditionalInclusionQuery = { }; export type HeroNameConditionalExclusionQueryVariables = Exact<{ - episode?: InputMaybe; - skipName: Scalars['Boolean']['input']; + episode?: Episode | null; + skipName: boolean; }>; export type HeroNameConditionalExclusionQuery = { @@ -358,7 +358,7 @@ export type HeroNameConditionalExclusionQuery = { }; export type HeroParentTypeDependentFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroParentTypeDependentFieldQuery = { @@ -382,7 +382,7 @@ export type HeroParentTypeDependentFieldQuery = { }; export type HeroTypeDependentAliasedFieldQueryVariables = Exact<{ - episode?: InputMaybe; + episode?: Episode | null; }>; export type HeroTypeDependentAliasedFieldQuery = { diff --git a/examples/react/apollo-client/src/gql/graphql.ts b/examples/react/apollo-client/src/gql/graphql.ts index 37b302c812e..2a6550b7fc5 100644 --- a/examples/react/apollo-client/src/gql/graphql.ts +++ b/examples/react/apollo-client/src/gql/graphql.ts @@ -1276,7 +1276,7 @@ export type VehiclesEdge = { }; export type AllFilmsWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllFilmsWithVariablesQueryQuery = { diff --git a/examples/react/http-executor/src/gql/graphql.ts b/examples/react/http-executor/src/gql/graphql.ts index 37b302c812e..2a6550b7fc5 100644 --- a/examples/react/http-executor/src/gql/graphql.ts +++ b/examples/react/http-executor/src/gql/graphql.ts @@ -1276,7 +1276,7 @@ export type VehiclesEdge = { }; export type AllFilmsWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllFilmsWithVariablesQueryQuery = { diff --git a/examples/react/tanstack-react-query/src/gql/graphql.ts b/examples/react/tanstack-react-query/src/gql/graphql.ts index 677ad8f5163..71fa037f2f0 100644 --- a/examples/react/tanstack-react-query/src/gql/graphql.ts +++ b/examples/react/tanstack-react-query/src/gql/graphql.ts @@ -1276,7 +1276,7 @@ export type VehiclesEdge = { }; export type AllFilmsWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllFilmsWithVariablesQueryQuery = { diff --git a/examples/react/urql/src/gql/graphql.ts b/examples/react/urql/src/gql/graphql.ts index 1949a54a39c..400e9d8c6b5 100644 --- a/examples/react/urql/src/gql/graphql.ts +++ b/examples/react/urql/src/gql/graphql.ts @@ -1276,7 +1276,7 @@ export type VehiclesEdge = { }; export type AllFilmsWithVariablesQuery199QueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllFilmsWithVariablesQuery199Query = { diff --git a/examples/typescript-esm/src/gql/graphql.ts b/examples/typescript-esm/src/gql/graphql.ts index 6c0c78903c1..909cb6ea52c 100644 --- a/examples/typescript-esm/src/gql/graphql.ts +++ b/examples/typescript-esm/src/gql/graphql.ts @@ -1293,7 +1293,7 @@ export type AllPeopleQueryQuery = { }; export type AllPeopleWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllPeopleWithVariablesQueryQuery = { diff --git a/examples/typescript-graphql-request/src/gql/graphql.ts b/examples/typescript-graphql-request/src/gql/graphql.ts index fa4fa668109..2c77fcf5102 100644 --- a/examples/typescript-graphql-request/src/gql/graphql.ts +++ b/examples/typescript-graphql-request/src/gql/graphql.ts @@ -1293,7 +1293,7 @@ export type AllPeopleQueryQuery = { }; export type AllPeopleWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllPeopleWithVariablesQueryQuery = { diff --git a/examples/vite/vite-react-cts/src/gql/graphql.ts b/examples/vite/vite-react-cts/src/gql/graphql.ts index 2293d4c15d4..4f2cce74c7c 100644 --- a/examples/vite/vite-react-cts/src/gql/graphql.ts +++ b/examples/vite/vite-react-cts/src/gql/graphql.ts @@ -1284,7 +1284,7 @@ export type FilmItemFragment = { } & { ' $fragmentName'?: 'FilmItemFragment' }; export type AllFilmsWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllFilmsWithVariablesQueryQuery = { diff --git a/examples/vite/vite-react-mts/src/gql/graphql.ts b/examples/vite/vite-react-mts/src/gql/graphql.ts index 2293d4c15d4..4f2cce74c7c 100644 --- a/examples/vite/vite-react-mts/src/gql/graphql.ts +++ b/examples/vite/vite-react-mts/src/gql/graphql.ts @@ -1284,7 +1284,7 @@ export type FilmItemFragment = { } & { ' $fragmentName'?: 'FilmItemFragment' }; export type AllFilmsWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllFilmsWithVariablesQueryQuery = { diff --git a/examples/vite/vite-react-ts/src/gql/graphql.ts b/examples/vite/vite-react-ts/src/gql/graphql.ts index 2293d4c15d4..4f2cce74c7c 100644 --- a/examples/vite/vite-react-ts/src/gql/graphql.ts +++ b/examples/vite/vite-react-ts/src/gql/graphql.ts @@ -1284,7 +1284,7 @@ export type FilmItemFragment = { } & { ' $fragmentName'?: 'FilmItemFragment' }; export type AllFilmsWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllFilmsWithVariablesQueryQuery = { diff --git a/examples/vue/apollo-composable/src/gql/graphql.ts b/examples/vue/apollo-composable/src/gql/graphql.ts index c4141533b85..9c6cddf063c 100644 --- a/examples/vue/apollo-composable/src/gql/graphql.ts +++ b/examples/vue/apollo-composable/src/gql/graphql.ts @@ -1276,7 +1276,7 @@ export type VehiclesEdge = { }; export type AllFilmsWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllFilmsWithVariablesQueryQuery = { diff --git a/examples/vue/urql/src/gql/graphql.ts b/examples/vue/urql/src/gql/graphql.ts index c4141533b85..9c6cddf063c 100644 --- a/examples/vue/urql/src/gql/graphql.ts +++ b/examples/vue/urql/src/gql/graphql.ts @@ -1276,7 +1276,7 @@ export type VehiclesEdge = { }; export type AllFilmsWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllFilmsWithVariablesQueryQuery = { diff --git a/examples/vue/villus/src/gql/graphql.ts b/examples/vue/villus/src/gql/graphql.ts index c4141533b85..9c6cddf063c 100644 --- a/examples/vue/villus/src/gql/graphql.ts +++ b/examples/vue/villus/src/gql/graphql.ts @@ -1276,7 +1276,7 @@ export type VehiclesEdge = { }; export type AllFilmsWithVariablesQueryQueryVariables = Exact<{ - first: Scalars['Int']['input']; + first: number; }>; export type AllFilmsWithVariablesQueryQuery = { diff --git a/examples/yoga-tests/src/gql/graphql.ts b/examples/yoga-tests/src/gql/graphql.ts index 6b459b0a0c9..556903779f4 100644 --- a/examples/yoga-tests/src/gql/graphql.ts +++ b/examples/yoga-tests/src/gql/graphql.ts @@ -35,7 +35,7 @@ export type HelloQueryQueryVariables = Exact<{ [key: string]: never }>; export type HelloQueryQuery = { __typename?: 'Query'; hello: string }; export type EchoMutationMutationVariables = Exact<{ - message: Scalars['String']['input']; + message: string; }>; export type EchoMutationMutation = { __typename?: 'Mutation'; echo: string }; diff --git a/packages/plugins/typescript/operations/src/ts-operation-variables-to-object.ts b/packages/plugins/typescript/operations/src/ts-operation-variables-to-object.ts index fc75862ba8f..e49bdf673df 100644 --- a/packages/plugins/typescript/operations/src/ts-operation-variables-to-object.ts +++ b/packages/plugins/typescript/operations/src/ts-operation-variables-to-object.ts @@ -1,7 +1,7 @@ import { TypeScriptOperationVariablesToObject as TSOperationVariablesToObject } from '@graphql-codegen/typescript'; const SCALARS = { - ID: 'string', + ID: 'string | number', String: 'string', Int: 'number', Float: 'number', @@ -28,6 +28,6 @@ export class TypeScriptOperationVariablesToObject extends TSOperationVariablesTo } protected getScalar(name: string): string { - return SCALARS[name] ?? 'any'; + return this._scalars?.[name]?.input ?? SCALARS[name] ?? 'any'; } } diff --git a/packages/plugins/typescript/operations/tests/ts-documents.standalone.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.standalone.spec.ts index a557c507d3d..50057f007c6 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.standalone.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.standalone.spec.ts @@ -120,4 +120,40 @@ describe('TypeScript Operations Plugin - Standalone', () => { // FIXME: enable this to ensure type correctness // validateTs(content, undefined, undefined, undefined, undefined, true); }); + + it('test overrdiding config.scalars', async () => { + const schema = buildSchema(/* GraphQL */ ` + type Query { + user(id: ID!): User + } + + type User { + id: ID! + name: String! + } + `); + const document = parse(/* GraphQL */ ` + query User($id: ID!) { + user(id: $id) { + id + name + } + } + `); + + const result = mergeOutputs([ + await plugin(schema, [{ document }], { scalars: { ID: 'string | number | boolean' } }), + ]); + + expect(result).toMatchInlineSnapshot(` + "type Exact = { [K in keyof T]: T[K] }; + export type UserQueryVariables = Exact<{ + id: string | number | boolean; + }>; + + + export type UserQuery = { __typename?: 'Query', user?: { __typename?: 'User', id: string | number | boolean, name: string } | null }; + " + `); + }); });