Skip to content

Commit ab93bf4

Browse files
findBreakingChanges: Correctly document not reachable statement (#1896)
1 parent 93a3bda commit ab93bf4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utilities/findBreakingChanges.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
import find from '../polyfills/find';
11+
import inspect from '../jsutils/inspect';
1112
import {
1213
type GraphQLNamedType,
1314
type GraphQLFieldMap,
@@ -292,7 +293,10 @@ function typeKindName(type: GraphQLNamedType): string {
292293
if (isInputObjectType(type)) {
293294
return 'an Input type';
294295
}
295-
throw new TypeError('Unknown type ' + type.constructor.name);
296+
297+
// Not reachable. All possible named types have been considered.
298+
/* istanbul ignore next */
299+
throw new TypeError(`Unexpected type: ${inspect((type: empty))}.`);
296300
}
297301

298302
function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(

0 commit comments

Comments
 (0)