Skip to content

Commit 72e57ec

Browse files
authored
[typescript-operations] Generate Exact into target file (#10504)
* Create standalone test * Add Exact and set up test * Remove Exact from typescript plugin * Update tests that switch out Exact * Update dev tests * Add changeset * Update test * Add InputMaybe Scalars tests * Fix schema in test * Fix up examples tests * Add result enum example
1 parent 331e56a commit 72e57ec

File tree

64 files changed

+201
-97
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+201
-97
lines changed

.changeset/lovely-sloths-kiss.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@graphql-codegen/typescript-operations': major
3+
'@graphql-codegen/typescript': major
4+
'@graphql-codegen/client-preset': major
5+
---
6+
7+
BREAKING CHANGE: `typescript` plugin no longer generates `Exact` utility type. Instead, `typescript-operations` generates said utility type for every file it creates. This is because it is used _only_ for `Variables`, so we only need to generate it once for every generated operation file.

dev-test/githunt/typed-document-nodes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
22
export type Maybe<T> = T | null;
33
export type InputMaybe<T> = Maybe<T>;
4-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
54
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
65
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
76
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
87
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
8+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
99
/** All built-in and custom scalars, mapped to their actual values */
1010
export type Scalars = {
1111
ID: { input: string; output: string };

dev-test/githunt/types.avoidOptionals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export type Maybe<T> = T | null;
22
export type InputMaybe<T> = Maybe<T>;
3-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
43
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
54
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
65
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
76
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
7+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
88
/** All built-in and custom scalars, mapped to their actual values */
99
export type Scalars = {
1010
ID: { input: string; output: string };

dev-test/githunt/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export type Maybe<T> = T | null;
22
export type InputMaybe<T> = Maybe<T>;
3-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
43
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
54
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
65
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
76
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
7+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
88
/** All built-in and custom scalars, mapped to their actual values */
99
export type Scalars = {
1010
ID: { input: string; output: string };

dev-test/githunt/types.enumsAsTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export type Maybe<T> = T | null;
22
export type InputMaybe<T> = Maybe<T>;
3-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
43
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
54
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
65
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
76
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
7+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
88
/** All built-in and custom scalars, mapped to their actual values */
99
export type Scalars = {
1010
ID: { input: string; output: string };

dev-test/githunt/types.flatten.preResolveTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export type Maybe<T> = T | null;
22
export type InputMaybe<T> = Maybe<T>;
3-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
43
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
54
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
65
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
76
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
7+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
88
/** All built-in and custom scalars, mapped to their actual values */
99
export type Scalars = {
1010
ID: { input: string; output: string };

dev-test/githunt/types.immutableTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export type Maybe<T> = T | null;
22
export type InputMaybe<T> = Maybe<T>;
3-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
43
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
54
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
65
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
76
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
7+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
88
/** All built-in and custom scalars, mapped to their actual values */
99
export type Scalars = {
1010
ID: { input: string; output: string };

dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export type Maybe<T> = T | null;
22
export type InputMaybe<T> = Maybe<T>;
3-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
43
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
54
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
65
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
76
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
7+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
88
/** All built-in and custom scalars, mapped to their actual values */
99
export type Scalars = {
1010
ID: { input: string; output: string };

dev-test/githunt/types.preResolveTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export type Maybe<T> = T | null;
22
export type InputMaybe<T> = Maybe<T>;
3-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
43
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
54
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
65
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
76
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
7+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
88
/** All built-in and custom scalars, mapped to their actual values */
99
export type Scalars = {
1010
ID: { input: string; output: string };

dev-test/githunt/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export type Maybe<T> = T | null;
22
export type InputMaybe<T> = Maybe<T>;
3-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
43
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
54
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
65
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
76
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
7+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
88
/** All built-in and custom scalars, mapped to their actual values */
99
export type Scalars = {
1010
ID: { input: string; output: string };

0 commit comments

Comments
 (0)