Skip to content

Commit c5ace4f

Browse files
committed
strip %checks annotations (flow)
1 parent 68b6588 commit c5ace4f

14 files changed

+42
-56
lines changed

src/jsutils/instanceOf.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
declare function instanceOf(
66
value: unknown,
77
constructor: unknown,
8-
): boolean %checks(value instanceof constructor);
9-
8+
): boolean;
109
// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production
1110
// See: https://webpack.js.org/guides/production/
1211
export default process.env.NODE_ENV === 'production'
1312
? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
1413
// eslint-disable-next-line no-shadow
15-
function instanceOf(value: unknown, constructor: unknown): boolean {
14+
function instanceOf(value: unknown, constructor: unknown): boolean { // FIXME: TS_CONVERTION %check
1615
return value instanceof constructor;
1716
}
1817
: // eslint-disable-next-line no-shadow

src/jsutils/isAsyncIterable.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
* Returns true if the provided object implements the AsyncIterator protocol via
33
* either implementing a `Symbol.asyncIterator` or `"@@asyncIterator"` method.
44
*/
5-
declare function isAsyncIterable(value: unknown): boolean %checks(value instanceof
6-
AsyncIterable);
5+
declare function isAsyncIterable(value: unknown): boolean; // FIXME: TS_CONVERTION %check
76

87
// eslint-disable-next-line no-redeclare
98
export default function isAsyncIterable(maybeAsyncIterable) {

src/jsutils/isCollection.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
* An Object value which might implement the Iterable or Array-like protocols.
2020
* @return {boolean} true if Iterable or Array-like Object.
2121
*/
22-
declare function isCollection(value: unknown): boolean %checks(value instanceof
23-
Iterable);
22+
declare function isCollection(value: unknown): boolean; // FIXME: TS_CONVERTION %check
2423

2524
// eslint-disable-next-line no-redeclare
2625
export default function isCollection(obj) {

src/jsutils/isObjectLike.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
* Return true if `value` is object-like. A value is object-like if it's not
33
* `null` and has a `typeof` result of "object".
44
*/
5-
export default function isObjectLike(value: unknown): boolean %checks {
5+
export default function isObjectLike(value: unknown): boolean { // FIXME: TS_CONVERTION %check
66
return typeof value == 'object' && value !== null;
77
}

src/jsutils/isPromise.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
* Returns true if the value acts like a Promise, i.e. has a "then" function,
33
* otherwise returns false.
44
*/
5-
declare function isPromise(value: unknown): boolean %checks(value instanceof
6-
Promise);
5+
declare function isPromise(value: unknown): boolean; // FIXME: TS_CONVERTION %check
76

87
// eslint-disable-next-line no-redeclare
98
export default function isPromise(value) {

src/language/ast.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class Token {
136136
/**
137137
* @internal
138138
*/
139-
export function isNode(maybeNode: unknown): boolean %checks {
139+
export function isNode(maybeNode: unknown): boolean { // FIXME: TS_CONVERTION %check
140140
return maybeNode != null && typeof maybeNode.kind === 'string';
141141
}
142142

src/language/lexer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class Lexer {
7575
/**
7676
* @internal
7777
*/
78-
export function isPunctuatorTokenKind(kind: TokenKindEnum): boolean %checks {
78+
export function isPunctuatorTokenKind(kind: TokenKindEnum): boolean {
7979
return (
8080
kind === TokenKind.BANG ||
8181
kind === TokenKind.DOLLAR ||

src/language/predicates.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
import type { ASTNode } from './ast';
22
import { Kind } from './kinds';
33

4-
export function isDefinitionNode(node: ASTNode): boolean %checks {
4+
export function isDefinitionNode(node: ASTNode): boolean {
55
return (
66
isExecutableDefinitionNode(node) ||
77
isTypeSystemDefinitionNode(node) ||
88
isTypeSystemExtensionNode(node)
99
);
1010
}
1111

12-
export function isExecutableDefinitionNode(node: ASTNode): boolean %checks {
12+
export function isExecutableDefinitionNode(node: ASTNode): boolean {
1313
return (
1414
node.kind === Kind.OPERATION_DEFINITION ||
1515
node.kind === Kind.FRAGMENT_DEFINITION
1616
);
1717
}
1818

19-
export function isSelectionNode(node: ASTNode): boolean %checks {
19+
export function isSelectionNode(node: ASTNode): boolean {
2020
return (
2121
node.kind === Kind.FIELD ||
2222
node.kind === Kind.FRAGMENT_SPREAD ||
2323
node.kind === Kind.INLINE_FRAGMENT
2424
);
2525
}
2626

27-
export function isValueNode(node: ASTNode): boolean %checks {
27+
export function isValueNode(node: ASTNode): boolean {
2828
return (
2929
node.kind === Kind.VARIABLE ||
3030
node.kind === Kind.INT ||
@@ -38,23 +38,23 @@ export function isValueNode(node: ASTNode): boolean %checks {
3838
);
3939
}
4040

41-
export function isTypeNode(node: ASTNode): boolean %checks {
41+
export function isTypeNode(node: ASTNode): boolean {
4242
return (
4343
node.kind === Kind.NAMED_TYPE ||
4444
node.kind === Kind.LIST_TYPE ||
4545
node.kind === Kind.NON_NULL_TYPE
4646
);
4747
}
4848

49-
export function isTypeSystemDefinitionNode(node: ASTNode): boolean %checks {
49+
export function isTypeSystemDefinitionNode(node: ASTNode): boolean {
5050
return (
5151
node.kind === Kind.SCHEMA_DEFINITION ||
5252
isTypeDefinitionNode(node) ||
5353
node.kind === Kind.DIRECTIVE_DEFINITION
5454
);
5555
}
5656

57-
export function isTypeDefinitionNode(node: ASTNode): boolean %checks {
57+
export function isTypeDefinitionNode(node: ASTNode): boolean {
5858
return (
5959
node.kind === Kind.SCALAR_TYPE_DEFINITION ||
6060
node.kind === Kind.OBJECT_TYPE_DEFINITION ||
@@ -65,11 +65,11 @@ export function isTypeDefinitionNode(node: ASTNode): boolean %checks {
6565
);
6666
}
6767

68-
export function isTypeSystemExtensionNode(node: ASTNode): boolean %checks {
68+
export function isTypeSystemExtensionNode(node: ASTNode): boolean {
6969
return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node);
7070
}
7171

72-
export function isTypeExtensionNode(node: ASTNode): boolean %checks {
72+
export function isTypeExtensionNode(node: ASTNode): boolean {
7373
return (
7474
node.kind === Kind.SCALAR_TYPE_EXTENSION ||
7575
node.kind === Kind.OBJECT_TYPE_EXTENSION ||

src/language/source.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ export class Source {
5353
*
5454
* @internal
5555
*/
56-
declare function isSource(source: unknown): boolean %checks(source instanceof
57-
Source);
56+
declare function isSource(source: unknown): boolean;
5857
// eslint-disable-next-line no-redeclare
5958
export function isSource(source) {
6059
return instanceOf(source, Source);

src/type/definition.ts

+19-27
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export type GraphQLType =
6565
| GraphQLList<any>
6666
| GraphQLNonNull<any>;
6767

68-
export function isType(type: unknown): boolean %checks {
68+
export function isType(type: unknown): boolean {
6969
return (
7070
isScalarType(type) ||
7171
isObjectType(type) ||
@@ -89,8 +89,7 @@ export function assertType(type: unknown): GraphQLType {
8989
* There are predicates for each kind of GraphQL type.
9090
*/
9191

92-
declare function isScalarType(type: unknown): boolean %checks(type instanceof
93-
GraphQLScalarType);
92+
declare function isScalarType(type: unknown): boolean;
9493
// eslint-disable-next-line no-redeclare
9594
export function isScalarType(type) {
9695
return instanceOf(type, GraphQLScalarType);
@@ -103,8 +102,7 @@ export function assertScalarType(type: unknown): GraphQLScalarType {
103102
return type;
104103
}
105104

106-
declare function isObjectType(type: unknown): boolean %checks(type instanceof
107-
GraphQLObjectType);
105+
declare function isObjectType(type: unknown): boolean;
108106
// eslint-disable-next-line no-redeclare
109107
export function isObjectType(type) {
110108
return instanceOf(type, GraphQLObjectType);
@@ -117,8 +115,7 @@ export function assertObjectType(type: unknown): GraphQLObjectType {
117115
return type;
118116
}
119117

120-
declare function isInterfaceType(type: unknown): boolean %checks(type instanceof
121-
GraphQLInterfaceType);
118+
declare function isInterfaceType(type: unknown): boolean;
122119
// eslint-disable-next-line no-redeclare
123120
export function isInterfaceType(type) {
124121
return instanceOf(type, GraphQLInterfaceType);
@@ -133,8 +130,7 @@ export function assertInterfaceType(type: unknown): GraphQLInterfaceType {
133130
return type;
134131
}
135132

136-
declare function isUnionType(type: unknown): boolean %checks(type instanceof
137-
GraphQLUnionType);
133+
declare function isUnionType(type: unknown): boolean;
138134
// eslint-disable-next-line no-redeclare
139135
export function isUnionType(type) {
140136
return instanceOf(type, GraphQLUnionType);
@@ -147,8 +143,7 @@ export function assertUnionType(type: unknown): GraphQLUnionType {
147143
return type;
148144
}
149145

150-
declare function isEnumType(type: unknown): boolean %checks(type instanceof
151-
GraphQLEnumType);
146+
declare function isEnumType(type: unknown): boolean;
152147
// eslint-disable-next-line no-redeclare
153148
export function isEnumType(type) {
154149
return instanceOf(type, GraphQLEnumType);
@@ -161,8 +156,7 @@ export function assertEnumType(type: unknown): GraphQLEnumType {
161156
return type;
162157
}
163158

164-
declare function isInputObjectType(type: unknown): boolean %checks(type instanceof
165-
GraphQLInputObjectType);
159+
declare function isInputObjectType(type: unknown): boolean;
166160
// eslint-disable-next-line no-redeclare
167161
export function isInputObjectType(type) {
168162
return instanceOf(type, GraphQLInputObjectType);
@@ -177,8 +171,7 @@ export function assertInputObjectType(type: unknown): GraphQLInputObjectType {
177171
return type;
178172
}
179173

180-
declare function isListType(type: unknown): boolean %checks(type instanceof
181-
GraphQLList);
174+
declare function isListType(type: unknown): boolean;
182175
// eslint-disable-next-line no-redeclare
183176
export function isListType(type) {
184177
return instanceOf(type, GraphQLList);
@@ -191,8 +184,7 @@ export function assertListType(type: unknown): GraphQLList<any> {
191184
return type;
192185
}
193186

194-
declare function isNonNullType(type: unknown): boolean %checks(type instanceof
195-
GraphQLNonNull);
187+
declare function isNonNullType(type: unknown): boolean;
196188
// eslint-disable-next-line no-redeclare
197189
export function isNonNullType(type) {
198190
return instanceOf(type, GraphQLNonNull);
@@ -220,7 +212,7 @@ export type GraphQLInputType =
220212
| GraphQLList<GraphQLInputType>,
221213
>;
222214

223-
export function isInputType(type: unknown): boolean %checks {
215+
export function isInputType(type: unknown): boolean {
224216
return (
225217
isScalarType(type) ||
226218
isEnumType(type) ||
@@ -255,7 +247,7 @@ export type GraphQLOutputType =
255247
| GraphQLList<GraphQLOutputType>,
256248
>;
257249

258-
export function isOutputType(type: unknown): boolean %checks {
250+
export function isOutputType(type: unknown): boolean {
259251
return (
260252
isScalarType(type) ||
261253
isObjectType(type) ||
@@ -278,7 +270,7 @@ export function assertOutputType(type: unknown): GraphQLOutputType {
278270
*/
279271
export type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType;
280272

281-
export function isLeafType(type: unknown): boolean %checks {
273+
export function isLeafType(type: unknown): boolean {
282274
return isScalarType(type) || isEnumType(type);
283275
}
284276

@@ -297,7 +289,7 @@ export type GraphQLCompositeType =
297289
| GraphQLInterfaceType
298290
| GraphQLUnionType;
299291

300-
export function isCompositeType(type: unknown): boolean %checks {
292+
export function isCompositeType(type: unknown): boolean {
301293
return isObjectType(type) || isInterfaceType(type) || isUnionType(type);
302294
}
303295

@@ -315,7 +307,7 @@ export function assertCompositeType(type: unknown): GraphQLCompositeType {
315307
*/
316308
export type GraphQLAbstractType = GraphQLInterfaceType | GraphQLUnionType;
317309

318-
export function isAbstractType(type: unknown): boolean %checks {
310+
export function isAbstractType(type: unknown): boolean {
319311
return isInterfaceType(type) || isUnionType(type);
320312
}
321313

@@ -422,7 +414,7 @@ export class GraphQLNonNull<T extends GraphQLNullableType> {
422414

423415
export type GraphQLWrappingType = GraphQLList<any> | GraphQLNonNull<any>;
424416

425-
export function isWrappingType(type: unknown): boolean %checks {
417+
export function isWrappingType(type: unknown): boolean {
426418
return isListType(type) || isNonNullType(type);
427419
}
428420

@@ -445,7 +437,7 @@ export type GraphQLNullableType =
445437
| GraphQLInputObjectType
446438
| GraphQLList<any>;
447439

448-
export function isNullableType(type: unknown): boolean %checks {
440+
export function isNullableType(type: unknown): boolean {
449441
return isType(type) && !isNonNullType(type);
450442
}
451443

@@ -478,7 +470,7 @@ export type GraphQLNamedType =
478470
| GraphQLEnumType
479471
| GraphQLInputObjectType;
480472

481-
export function isNamedType(type: unknown): boolean %checks {
473+
export function isNamedType(type: unknown): boolean {
482474
return (
483475
isScalarType(type) ||
484476
isObjectType(type) ||
@@ -986,7 +978,7 @@ export type GraphQLArgument = {
986978
astNode: Maybe<InputValueDefinitionNode>,
987979
};
988980

989-
export function isRequiredArgument(arg: GraphQLArgument): boolean %checks {
981+
export function isRequiredArgument(arg: GraphQLArgument): boolean {
990982
return isNonNullType(arg.type) && arg.defaultValue === undefined;
991983
}
992984

@@ -1573,7 +1565,7 @@ export type GraphQLInputField = {
15731565

15741566
export function isRequiredInputField(
15751567
field: GraphQLInputField,
1576-
): boolean %checks {
1568+
): boolean {
15771569
return isNonNullType(field.type) && field.defaultValue === undefined;
15781570
}
15791571

src/type/directives.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Maybe } from '../jsutils/Maybe';
2424
*/
2525
declare function isDirective(
2626
directive: unknown,
27-
): boolean %checks(directive instanceof GraphQLDirective);
27+
): boolean;
2828
// eslint-disable-next-line no-redeclare
2929
export function isDirective(directive) {
3030
return instanceOf(directive, GraphQLDirective);
@@ -218,6 +218,6 @@ export const specifiedDirectives = Object.freeze([
218218

219219
export function isSpecifiedDirective(
220220
directive: GraphQLDirective,
221-
): boolean %checks {
221+
): boolean {
222222
return specifiedDirectives.some(({ name }) => name === directive.name);
223223
}

src/type/introspection.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,6 @@ export const introspectionTypes = Object.freeze([
541541
__TypeKind,
542542
]);
543543

544-
export function isIntrospectionType(type: GraphQLNamedType): boolean %checks {
544+
export function isIntrospectionType(type: GraphQLNamedType): boolean { // FIXME: TS_CONVERTION %check
545545
return introspectionTypes.some(({ name }) => type.name === name);
546546
}

src/type/scalars.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,6 @@ export const specifiedScalarTypes = Object.freeze([
278278
GraphQLID,
279279
]);
280280

281-
export function isSpecifiedScalarType(type: GraphQLNamedType): boolean %checks {
281+
export function isSpecifiedScalarType(type: GraphQLNamedType): boolean {
282282
return specifiedScalarTypes.some(({ name }) => type.name === name);
283283
}

src/type/schema.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ import { Maybe } from '../jsutils/Maybe';
4343
/**
4444
* Test if the given value is a GraphQL schema.
4545
*/
46-
declare function isSchema(schema: unknown): boolean %checks(schema instanceof
47-
GraphQLSchema);
46+
declare function isSchema(schema: unknown): boolean;
4847
// eslint-disable-next-line no-redeclare
4948
export function isSchema(schema) {
5049
return instanceOf(schema, GraphQLSchema);

0 commit comments

Comments
 (0)