@@ -65,7 +65,7 @@ export type GraphQLType =
6565 | GraphQLList < any >
6666 | GraphQLNonNull < any > ;
6767
68- export function isType ( type : unknown ) : boolean {
68+ export function isType ( type : unknown ) : type is GraphQLType {
6969 return (
7070 isScalarType ( type ) ||
7171 isObjectType ( type ) ||
@@ -88,10 +88,7 @@ export function assertType(type: unknown): GraphQLType {
8888/**
8989 * There are predicates for each kind of GraphQL type.
9090 */
91-
92- declare function isScalarType ( type : unknown ) : boolean ;
93- // eslint-disable-next-line no-redeclare
94- export function isScalarType ( type ) {
91+ export function isScalarType ( type : unknown ) : type is GraphQLScalarType {
9592 return instanceOf ( type , GraphQLScalarType ) ;
9693}
9794
@@ -102,9 +99,7 @@ export function assertScalarType(type: unknown): GraphQLScalarType {
10299 return type ;
103100}
104101
105- declare function isObjectType ( type : unknown ) : boolean ;
106- // eslint-disable-next-line no-redeclare
107- export function isObjectType ( type ) {
102+ export function isObjectType ( type : unknown ) : type is GraphQLObjectType {
108103 return instanceOf ( type , GraphQLObjectType ) ;
109104}
110105
@@ -115,9 +110,7 @@ export function assertObjectType(type: unknown): GraphQLObjectType {
115110 return type ;
116111}
117112
118- declare function isInterfaceType ( type : unknown ) : boolean ;
119- // eslint-disable-next-line no-redeclare
120- export function isInterfaceType ( type ) {
113+ export function isInterfaceType ( type : unknown ) : type is GraphQLInterfaceType {
121114 return instanceOf ( type , GraphQLInterfaceType ) ;
122115}
123116
@@ -130,9 +123,7 @@ export function assertInterfaceType(type: unknown): GraphQLInterfaceType {
130123 return type ;
131124}
132125
133- declare function isUnionType ( type : unknown ) : boolean ;
134- // eslint-disable-next-line no-redeclare
135- export function isUnionType ( type ) {
126+ export function isUnionType ( type : unknown ) : type is GraphQLUnionType {
136127 return instanceOf ( type , GraphQLUnionType ) ;
137128}
138129
@@ -143,9 +134,7 @@ export function assertUnionType(type: unknown): GraphQLUnionType {
143134 return type ;
144135}
145136
146- declare function isEnumType ( type : unknown ) : boolean ;
147- // eslint-disable-next-line no-redeclare
148- export function isEnumType ( type ) {
137+ export function isEnumType ( type : unknown ) : type is GraphQLEnumType {
149138 return instanceOf ( type , GraphQLEnumType ) ;
150139}
151140
@@ -156,9 +145,7 @@ export function assertEnumType(type: unknown): GraphQLEnumType {
156145 return type ;
157146}
158147
159- declare function isInputObjectType ( type : unknown ) : boolean ;
160- // eslint-disable-next-line no-redeclare
161- export function isInputObjectType ( type ) {
148+ export function isInputObjectType ( type : unknown ) : type is GraphQLInputObjectType {
162149 return instanceOf ( type , GraphQLInputObjectType ) ;
163150}
164151
@@ -171,9 +158,7 @@ export function assertInputObjectType(type: unknown): GraphQLInputObjectType {
171158 return type ;
172159}
173160
174- declare function isListType ( type : unknown ) : boolean ;
175- // eslint-disable-next-line no-redeclare
176- export function isListType ( type ) {
161+ export function isListType ( type : unknown ) : type is GraphQLList < any > {
177162 return instanceOf ( type , GraphQLList ) ;
178163}
179164
@@ -184,9 +169,7 @@ export function assertListType(type: unknown): GraphQLList<any> {
184169 return type ;
185170}
186171
187- declare function isNonNullType ( type : unknown ) : boolean ;
188- // eslint-disable-next-line no-redeclare
189- export function isNonNullType ( type ) {
172+ export function isNonNullType ( type : unknown ) : type is GraphQLNonNull < any > {
190173 return instanceOf ( type , GraphQLNonNull ) ;
191174}
192175
@@ -212,7 +195,7 @@ export type GraphQLInputType =
212195 | GraphQLList < GraphQLInputType > ,
213196 > ;
214197
215- export function isInputType ( type : unknown ) : boolean {
198+ export function isInputType ( type : unknown ) : type is GraphQLInputType {
216199 return (
217200 isScalarType ( type ) ||
218201 isEnumType ( type ) ||
@@ -247,7 +230,7 @@ export type GraphQLOutputType =
247230 | GraphQLList < GraphQLOutputType > ,
248231 > ;
249232
250- export function isOutputType ( type : unknown ) : boolean {
233+ export function isOutputType ( type : unknown ) : type is GraphQLOutputType {
251234 return (
252235 isScalarType ( type ) ||
253236 isObjectType ( type ) ||
@@ -270,7 +253,7 @@ export function assertOutputType(type: unknown): GraphQLOutputType {
270253 */
271254export type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType ;
272255
273- export function isLeafType ( type : unknown ) : boolean {
256+ export function isLeafType ( type : unknown ) : type is GraphQLLeafType {
274257 return isScalarType ( type ) || isEnumType ( type ) ;
275258}
276259
@@ -289,7 +272,7 @@ export type GraphQLCompositeType =
289272 | GraphQLInterfaceType
290273 | GraphQLUnionType ;
291274
292- export function isCompositeType ( type : unknown ) : boolean {
275+ export function isCompositeType ( type : unknown ) : type is GraphQLCompositeType {
293276 return isObjectType ( type ) || isInterfaceType ( type ) || isUnionType ( type ) ;
294277}
295278
@@ -307,7 +290,7 @@ export function assertCompositeType(type: unknown): GraphQLCompositeType {
307290 */
308291export type GraphQLAbstractType = GraphQLInterfaceType | GraphQLUnionType ;
309292
310- export function isAbstractType ( type : unknown ) : boolean {
293+ export function isAbstractType ( type : unknown ) : type is GraphQLAbstractType {
311294 return isInterfaceType ( type ) || isUnionType ( type ) ;
312295}
313296
@@ -414,7 +397,7 @@ export class GraphQLNonNull<T extends GraphQLNullableType> {
414397
415398export type GraphQLWrappingType = GraphQLList < any > | GraphQLNonNull < any > ;
416399
417- export function isWrappingType ( type : unknown ) : boolean {
400+ export function isWrappingType ( type : unknown ) : type is GraphQLWrappingType {
418401 return isListType ( type ) || isNonNullType ( type ) ;
419402}
420403
@@ -437,7 +420,7 @@ export type GraphQLNullableType =
437420 | GraphQLInputObjectType
438421 | GraphQLList < any > ;
439422
440- export function isNullableType ( type : unknown ) : boolean {
423+ export function isNullableType ( type : unknown ) : type is GraphQLNullableType {
441424 return isType ( type ) && ! isNonNullType ( type ) ;
442425}
443426
@@ -448,12 +431,11 @@ export function assertNullableType(type: unknown): GraphQLNullableType {
448431 return type ;
449432}
450433
451- /* eslint-disable no-redeclare */
452- declare function getNullableType ( type : void | null ) : void ;
453- declare function getNullableType < T extends GraphQLNullableType > ( type : T ) : T ;
454- declare function getNullableType < T > ( type : GraphQLNonNull < T > ) : T ;
434+
435+ export function getNullableType ( type : void | null ) : void ;
436+ export function getNullableType < T extends GraphQLNullableType > ( type : T ) : T ;
437+ export function getNullableType < T extends GraphQLNullableType > ( type : GraphQLNonNull < T > ) : T ;
455438export function getNullableType ( type ) {
456- /* eslint-enable no-redeclare */
457439 if ( type ) {
458440 return isNonNullType ( type ) ? type . ofType : type ;
459441 }
@@ -470,7 +452,7 @@ export type GraphQLNamedType =
470452 | GraphQLEnumType
471453 | GraphQLInputObjectType ;
472454
473- export function isNamedType ( type : unknown ) : boolean {
455+ export function isNamedType ( type : unknown ) : type is GraphQLNamedType {
474456 return (
475457 isScalarType ( type ) ||
476458 isObjectType ( type ) ||
@@ -488,11 +470,9 @@ export function assertNamedType(type: unknown): GraphQLNamedType {
488470 return type ;
489471}
490472
491- /* eslint-disable no-redeclare */
492- declare function getNamedType ( type : void | null ) : void ;
493- declare function getNamedType ( type : GraphQLType ) : GraphQLNamedType ;
473+ export function getNamedType ( type : void | null ) : void ;
474+ export function getNamedType ( type : GraphQLType ) : GraphQLNamedType ;
494475export function getNamedType ( type ) {
495- /* eslint-enable no-redeclare */
496476 if ( type ) {
497477 let unwrappedType = type ;
498478 while ( isWrappingType ( unwrappedType ) ) {
0 commit comments