Skip to content

Commit d73a8a8

Browse files
committed
Remove unused utility types and functions (#10564)
* Remove MakeOptional MakeMaybe MakeEmpty and Incremental utitlity types from typescript plugin because they were used for typescript-operations * Fix unit tests * Remove deprecated functions * Add changeset
1 parent d5d8808 commit d73a8a8

18 files changed

Lines changed: 14 additions & 160 deletions

File tree

.changeset/twelve-trams-pump.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@graphql-codegen/visitor-plugin-common': major
3+
'@graphql-codegen/typescript': major
4+
---
5+
6+
BREAKING CHANGE: Remove unused utility types from `typescript` plugin as they were previously used for `typescript-operations` plugin:
7+
8+
- `MakeOptional`
9+
- `MakeMaybe`
10+
- `MakeEmpty`
11+
- `Incremental`
12+
13+
BREAKING CHANGE: Remove `getRootTypeNames` function because it's available in `@graphql-utils/tools` and not used anywhere

dev-test/modules/types.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import { GraphQLResolveInfo } from 'graphql';
22

33
export type Maybe<T> = T | null;
44
export type InputMaybe<T> = Maybe<T>;
5-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
6-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
7-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = {
8-
[_ in K]?: never;
9-
};
10-
export type Incremental<T> =
11-
| T
12-
| { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
135
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
146
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
157
/** All built-in and custom scalars, mapped to their actual values */

dev-test/subpath-import/result.d.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ import { GraphQLResolveInfo } from 'graphql';
55

66
export type Maybe<T> = T | null;
77
export type InputMaybe<T> = Maybe<T>;
8-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
9-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
10-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = {
11-
[_ in K]?: never;
12-
};
13-
export type Incremental<T> =
14-
| T
15-
| { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
168
export type EnumResolverSignature<T, AllowedValues = any> = { [key in keyof T]?: AllowedValues };
179
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
1810
/** All built-in and custom scalars, mapped to their actual values */

dev-test/test-federation/generated/types.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from '
22

33
export type Maybe<T> = T | null | undefined;
44
export type InputMaybe<T> = T | null | undefined;
5-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
6-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
7-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = {
8-
[_ in K]?: never;
9-
};
10-
export type Incremental<T> =
11-
| T
12-
| { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
135
/** All built-in and custom scalars, mapped to their actual values */
146
export type Scalars = {
157
ID: { input: string; output: string };

dev-test/test-schema/env.types.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
export type Maybe<T> = T | null;
22
export type InputMaybe<T> = Maybe<T>;
3-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
4-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
5-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = {
6-
[_ in K]?: never;
7-
};
8-
export type Incremental<T> =
9-
| T
10-
| { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
113
/** All built-in and custom scalars, mapped to their actual values */
124
export type Scalars = {
135
ID: { input: string; output: string };

dev-test/test-schema/resolvers-federation.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import { GraphQLResolveInfo } from 'graphql';
22

33
export type Maybe<T> = T | null;
44
export type InputMaybe<T> = Maybe<T>;
5-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
6-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
7-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = {
8-
[_ in K]?: never;
9-
};
10-
export type Incremental<T> =
11-
| T
12-
| { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
135
/** All built-in and custom scalars, mapped to their actual values */
146
export type Scalars = {
157
ID: { input: string; output: string };

dev-test/test-schema/resolvers-root.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import { GraphQLResolveInfo } from 'graphql';
22

33
export type Maybe<T> = T | null;
44
export type InputMaybe<T> = Maybe<T>;
5-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
6-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
7-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = {
8-
[_ in K]?: never;
9-
};
10-
export type Incremental<T> =
11-
| T
12-
| { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
135
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
146
/** All built-in and custom scalars, mapped to their actual values */
157
export type Scalars = {

dev-test/test-schema/resolvers-stitching.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import { FieldNode, GraphQLResolveInfo, SelectionSetNode } from 'graphql';
22

33
export type Maybe<T> = T | null;
44
export type InputMaybe<T> = Maybe<T>;
5-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
6-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
7-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = {
8-
[_ in K]?: never;
9-
};
10-
export type Incremental<T> =
11-
| T
12-
| { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
135
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
146
/** All built-in and custom scalars, mapped to their actual values */
157
export type Scalars = {

dev-test/test-schema/resolvers-types.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import { GraphQLResolveInfo } from 'graphql';
22

33
export type Maybe<T> = T | null;
44
export type InputMaybe<T> = Maybe<T>;
5-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
6-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
7-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = {
8-
[_ in K]?: never;
9-
};
10-
export type Incremental<T> =
11-
| T
12-
| { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
135
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
146
/** All built-in and custom scalars, mapped to their actual values */
157
export type Scalars = {

dev-test/test-schema/typings.avoidOptionals.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
export type Maybe<T> = T | null;
22
export type InputMaybe<T> = Maybe<T>;
3-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
4-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
5-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = {
6-
[_ in K]?: never;
7-
};
8-
export type Incremental<T> =
9-
| T
10-
| { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
113
/** All built-in and custom scalars, mapped to their actual values */
124
export type Scalars = {
135
ID: { input: string; output: string };

0 commit comments

Comments
 (0)