From 3f859d4e5e6088deea97193d5106382a901a9c21 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Tue, 18 Feb 2020 18:31:21 +0530 Subject: [PATCH] getNullableType: fix TS signature (#2460) partial revert of https://github.com/graphql/graphql-js/commit/23b427cacc3a6d16eb985ea3e5ab9b47d7a295d0#diff-15f6b6c92ff954f80995d31726f89851L477 Reported by @yaacovCR here: https://github.com/yaacovCR/graphql-tools-fork/issues/40#issuecomment-586671219 --- src/type/definition.d.ts | 4 +++- src/type/definition.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/type/definition.d.ts b/src/type/definition.d.ts index 32cf43d054..df62c66743 100644 --- a/src/type/definition.d.ts +++ b/src/type/definition.d.ts @@ -241,8 +241,10 @@ export function isNullableType(type: any): type is GraphQLNullableType; export function assertNullableType(type: any): GraphQLNullableType; export function getNullableType(type: void): undefined; +export function getNullableType(type: T): T; export function getNullableType( - type: GraphQLNonNull | T, + // eslint-disable-next-line @typescript-eslint/unified-signatures + type: GraphQLNonNull, ): T; /** diff --git a/src/type/definition.js b/src/type/definition.js index 739732cd5f..2d5a15117d 100644 --- a/src/type/definition.js +++ b/src/type/definition.js @@ -474,7 +474,8 @@ export function assertNullableType(type: mixed): GraphQLNullableType { /* eslint-disable no-redeclare */ declare function getNullableType(type: void | null): void; -declare function getNullableType(type: GraphQLNonNull | T): T; +declare function getNullableType(type: T): T; +declare function getNullableType(type: GraphQLNonNull): T; export function getNullableType(type) { /* eslint-enable no-redeclare */ if (type) {