88 */
99
1010import instanceOf from '../jsutils/instanceOf' ;
11+ import inspect from '../jsutils/inspect' ;
1112import invariant from '../jsutils/invariant' ;
1213import isInvalid from '../jsutils/isInvalid' ;
1314import keyMap from '../jsutils/keyMap' ;
@@ -63,7 +64,7 @@ export function isType(type: mixed): boolean %checks {
6364}
6465
6566export function assertType ( type : mixed ) : GraphQLType {
66- invariant ( isType ( type ) , `Expected ${ String ( type ) } to be a GraphQL type.` ) ;
67+ invariant ( isType ( type ) , `Expected ${ inspect ( type ) } to be a GraphQL type.` ) ;
6768 return ( type : any ) ;
6869}
6970
@@ -81,7 +82,7 @@ export function isScalarType(type) {
8182export function assertScalarType ( type : mixed ) : GraphQLScalarType {
8283 invariant (
8384 isScalarType ( type ) ,
84- `Expected ${ String ( type ) } to be a GraphQL Scalar type.` ,
85+ `Expected ${ inspect ( type ) } to be a GraphQL Scalar type.` ,
8586 ) ;
8687 return type ;
8788}
@@ -96,7 +97,7 @@ export function isObjectType(type) {
9697export function assertObjectType ( type : mixed ) : GraphQLObjectType {
9798 invariant (
9899 isObjectType ( type ) ,
99- `Expected ${ String ( type ) } to be a GraphQL Object type.` ,
100+ `Expected ${ inspect ( type ) } to be a GraphQL Object type.` ,
100101 ) ;
101102 return type ;
102103}
@@ -111,7 +112,7 @@ export function isInterfaceType(type) {
111112export function assertInterfaceType ( type : mixed ) : GraphQLInterfaceType {
112113 invariant (
113114 isInterfaceType ( type ) ,
114- `Expected ${ String ( type ) } to be a GraphQL Interface type.` ,
115+ `Expected ${ inspect ( type ) } to be a GraphQL Interface type.` ,
115116 ) ;
116117 return type ;
117118}
@@ -126,7 +127,7 @@ export function isUnionType(type) {
126127export function assertUnionType ( type : mixed ) : GraphQLUnionType {
127128 invariant (
128129 isUnionType ( type ) ,
129- `Expected ${ String ( type ) } to be a GraphQL Union type.` ,
130+ `Expected ${ inspect ( type ) } to be a GraphQL Union type.` ,
130131 ) ;
131132 return type ;
132133}
@@ -141,7 +142,7 @@ export function isEnumType(type) {
141142export function assertEnumType ( type : mixed ) : GraphQLEnumType {
142143 invariant (
143144 isEnumType ( type ) ,
144- `Expected ${ String ( type ) } to be a GraphQL Enum type.` ,
145+ `Expected ${ inspect ( type ) } to be a GraphQL Enum type.` ,
145146 ) ;
146147 return type ;
147148}
@@ -156,7 +157,7 @@ export function isInputObjectType(type) {
156157export function assertInputObjectType ( type : mixed ) : GraphQLInputObjectType {
157158 invariant (
158159 isInputObjectType ( type ) ,
159- `Expected ${ String ( type ) } to be a GraphQL Input Object type.` ,
160+ `Expected ${ inspect ( type ) } to be a GraphQL Input Object type.` ,
160161 ) ;
161162 return type ;
162163}
@@ -171,7 +172,7 @@ export function isListType(type) {
171172export function assertListType ( type : mixed ) : GraphQLList < any > {
172173 invariant (
173174 isListType ( type ) ,
174- `Expected ${ String ( type ) } to be a GraphQL List type.` ,
175+ `Expected ${ inspect ( type ) } to be a GraphQL List type.` ,
175176 ) ;
176177 return type ;
177178}
@@ -186,7 +187,7 @@ export function isNonNullType(type) {
186187export function assertNonNullType(type: mixed): GraphQLNonNull< any > {
187188 invariant (
188189 isNonNullType ( type ) ,
189- `Expected ${ String ( type ) } to be a GraphQL Non-Null type.` ,
190+ `Expected ${ inspect ( type ) } to be a GraphQL Non-Null type.` ,
190191 ) ;
191192 return type ;
192193}
@@ -218,7 +219,7 @@ export function isInputType(type: mixed): boolean %checks {
218219export function assertInputType(type: mixed): GraphQLInputType {
219220 invariant (
220221 isInputType ( type ) ,
221- `Expected ${ String ( type ) } to be a GraphQL input type.` ,
222+ `Expected ${ inspect ( type ) } to be a GraphQL input type.` ,
222223 ) ;
223224 return type ;
224225}
@@ -256,7 +257,7 @@ export function isOutputType(type: mixed): boolean %checks {
256257export function assertOutputType(type: mixed): GraphQLOutputType {
257258 invariant (
258259 isOutputType ( type ) ,
259- `Expected ${ String ( type ) } to be a GraphQL output type.` ,
260+ `Expected ${ inspect ( type ) } to be a GraphQL output type.` ,
260261 ) ;
261262 return type ;
262263}
@@ -273,7 +274,7 @@ export function isLeafType(type: mixed): boolean %checks {
273274export function assertLeafType(type: mixed): GraphQLLeafType {
274275 invariant (
275276 isLeafType ( type ) ,
276- `Expected ${ String ( type ) } to be a GraphQL leaf type.` ,
277+ `Expected ${ inspect ( type ) } to be a GraphQL leaf type.` ,
277278 ) ;
278279 return type ;
279280}
@@ -293,7 +294,7 @@ export function isCompositeType(type: mixed): boolean %checks {
293294export function assertCompositeType(type: mixed): GraphQLCompositeType {
294295 invariant (
295296 isCompositeType ( type ) ,
296- `Expected ${ String ( type ) } to be a GraphQL composite type.` ,
297+ `Expected ${ inspect ( type ) } to be a GraphQL composite type.` ,
297298 ) ;
298299 return type ;
299300}
@@ -310,7 +311,7 @@ export function isAbstractType(type: mixed): boolean %checks {
310311export function assertAbstractType(type: mixed): GraphQLAbstractType {
311312 invariant (
312313 isAbstractType ( type ) ,
313- `Expected ${ String ( type ) } to be a GraphQL abstract type.` ,
314+ `Expected ${ inspect ( type ) } to be a GraphQL abstract type.` ,
314315 ) ;
315316 return type ;
316317}
@@ -408,7 +409,7 @@ export function isWrappingType(type: mixed): boolean %checks {
408409export function assertWrappingType ( type : mixed ) : GraphQLWrappingType {
409410 invariant (
410411 isWrappingType ( type ) ,
411- `Expected ${ String ( type ) } to be a GraphQL wrapping type.` ,
412+ `Expected ${ inspect ( type ) } to be a GraphQL wrapping type.` ,
412413 ) ;
413414 return type ;
414415}
@@ -432,7 +433,7 @@ export function isNullableType(type: mixed): boolean %checks {
432433export function assertNullableType ( type : mixed ) : GraphQLNullableType {
433434 invariant (
434435 isNullableType ( type ) ,
435- `Expected ${ String ( type ) } to be a GraphQL nullable type.` ,
436+ `Expected ${ inspect ( type ) } to be a GraphQL nullable type.` ,
436437 ) ;
437438 return type ;
438439}
@@ -473,7 +474,7 @@ export function isNamedType(type: mixed): boolean %checks {
473474export function assertNamedType ( type : mixed ) : GraphQLNamedType {
474475 invariant (
475476 isNamedType ( type ) ,
476- `Expected ${ String ( type ) } to be a GraphQL named type.` ,
477+ `Expected ${ inspect ( type ) } to be a GraphQL named type.` ,
477478 ) ;
478479 return type ;
479480}
@@ -736,7 +737,7 @@ function defineFieldMap<TSource, TContext>(
736737 invariant (
737738 isValidResolver ( field . resolve ) ,
738739 `${ type . name } .${ fieldName } field resolver must be a function if ` +
739- `provided, but got: ${ String ( field . resolve ) } .` ,
740+ `provided, but got: ${ inspect ( field . resolve ) } .` ,
740741 ) ;
741742 const argsConfig = fieldConfig . args ;
742743 if ( ! argsConfig ) {
@@ -1148,7 +1149,7 @@ function defineEnumValues(
11481149 invariant (
11491150 isPlainObj ( value ) ,
11501151 `${ type . name } .${ valueName } must refer to an object with a "value" key ` +
1151- `representing an internal value but got: ${ String ( value ) } .` ,
1152+ `representing an internal value but got: ${ inspect ( value ) } .` ,
11521153 ) ;
11531154 invariant (
11541155 ! value . hasOwnProperty ( 'isDeprecated' ) ,
0 commit comments