Skip to content

Commit cda43e2

Browse files
authored
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 d731066 commit cda43e2

File tree

18 files changed

+14
-102
lines changed

18 files changed

+14
-102
lines changed

.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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { GraphQLResolveInfo } from 'graphql';
22
export type Maybe<T> = T | null;
33
export type InputMaybe<T> = Maybe<T>;
4-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
5-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
6-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
7-
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
84
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
95
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
106
/** All built-in and custom scalars, mapped to their actual values */

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ import { TestContext } from '#test-null-value/context';
44
import { FiedContextType } from '#test/root';
55
export type Maybe<T> = T | null;
66
export type InputMaybe<T> = Maybe<T>;
7-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
8-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
9-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
10-
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
117
export type EnumResolverSignature<T, AllowedValues = any> = { [key in keyof T]?: AllowedValues };
128
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
139
/** All built-in and custom scalars, mapped to their actual values */

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

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

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +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> = { [_ in K]?: never };
6-
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
73
/** All built-in and custom scalars, mapped to their actual values */
84
export type Scalars = {
95
ID: { input: string; output: string };

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

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

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { GraphQLResolveInfo } from 'graphql';
22
export type Maybe<T> = T | null;
33
export type InputMaybe<T> = Maybe<T>;
4-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
5-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
6-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
7-
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
84
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
95
/** All built-in and custom scalars, mapped to their actual values */
106
export type Scalars = {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { GraphQLResolveInfo, SelectionSetNode, FieldNode } from 'graphql';
22
export type Maybe<T> = T | null;
33
export type InputMaybe<T> = Maybe<T>;
4-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
5-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
6-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
7-
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
84
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
95
/** All built-in and custom scalars, mapped to their actual values */
106
export type Scalars = {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { GraphQLResolveInfo } from 'graphql';
22
export type Maybe<T> = T | null;
33
export type InputMaybe<T> = Maybe<T>;
4-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
5-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
6-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
7-
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
84
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
95
/** All built-in and custom scalars, mapped to their actual values */
106
export type Scalars = {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +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> = { [_ in K]?: never };
6-
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
73
/** All built-in and custom scalars, mapped to their actual values */
84
export type Scalars = {
95
ID: { input: string; output: string };

0 commit comments

Comments
 (0)