From ab93bf496ac46c704305e71fb1b83a337457eed0 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Wed, 22 May 2019 18:17:01 +0300 Subject: [PATCH] findBreakingChanges: Correctly document not reachable statement (#1896) --- src/utilities/findBreakingChanges.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utilities/findBreakingChanges.js b/src/utilities/findBreakingChanges.js index c55dfad874..54b9ec2949 100644 --- a/src/utilities/findBreakingChanges.js +++ b/src/utilities/findBreakingChanges.js @@ -8,6 +8,7 @@ */ import find from '../polyfills/find'; +import inspect from '../jsutils/inspect'; import { type GraphQLNamedType, type GraphQLFieldMap, @@ -292,7 +293,10 @@ function typeKindName(type: GraphQLNamedType): string { if (isInputObjectType(type)) { return 'an Input type'; } - throw new TypeError('Unknown type ' + type.constructor.name); + + // Not reachable. All possible named types have been considered. + /* istanbul ignore next */ + throw new TypeError(`Unexpected type: ${inspect((type: empty))}.`); } function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(