Skip to content

Commit

Permalink
getNullableType: fix TS signature (#2460)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Feb 18, 2020
1 parent 268888b commit 3f859d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/type/definition.d.ts
Expand Up @@ -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<T extends GraphQLNullableType>(type: T): T;
export function getNullableType<T extends GraphQLNullableType>(
type: GraphQLNonNull<T> | T,
// eslint-disable-next-line @typescript-eslint/unified-signatures
type: GraphQLNonNull<T>,
): T;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/type/definition.js
Expand Up @@ -474,7 +474,8 @@ export function assertNullableType(type: mixed): GraphQLNullableType {

/* eslint-disable no-redeclare */
declare function getNullableType(type: void | null): void;
declare function getNullableType<T>(type: GraphQLNonNull<T> | T): T;
declare function getNullableType<T: GraphQLNullableType>(type: T): T;
declare function getNullableType<T>(type: GraphQLNonNull<T>): T;
export function getNullableType(type) {
/* eslint-enable no-redeclare */
if (type) {
Expand Down

0 comments on commit 3f859d4

Please sign in to comment.