Skip to content

Commit 09cee73

Browse files
Update Flow (#2500)
1 parent a8f73db commit 09cee73

File tree

8 files changed

+25
-27
lines changed

8 files changed

+25
-27
lines changed

.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)?)\\)
4040
suppress_comment=\\(.\\|\n\\)*\\$DisableFlowOnNegativeTest
4141

4242
[version]
43-
^0.120.0
43+
^0.121.0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"eslint-plugin-flowtype": "4.6.0",
5959
"eslint-plugin-graphql-internal": "link:./resources/eslint-rules",
6060
"eslint-plugin-import": "2.20.1",
61-
"flow-bin": "0.120.1",
61+
"flow-bin": "0.121.0",
6262
"mocha": "7.1.0",
6363
"nyc": "15.0.0",
6464
"prettier": "2.0.2",

src/execution/__tests__/abstract-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ describe('Execute: Handles execution of abstract types', () => {
403403
const fooInterface = new GraphQLInterfaceType({
404404
name: 'FooInterface',
405405
fields: { bar: { type: GraphQLString } },
406+
// $DisableFlowOnNegativeTest
406407
resolveType() {
407-
// $DisableFlowOnNegativeTest
408408
return [];
409409
},
410410
});

src/subscription/__tests__/subscribe-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ describe('Subscription Initialization Phase', () => {
160160
// Empty
161161
}
162162

163+
// $FlowFixMe
163164
const ai = await subscribe(emailSchema, document, {
164165
importantEmail: emptyAsyncIterator,
165166
});
166167

167-
// $FlowFixMe
168168
ai.next();
169169
ai.return();
170170
});
@@ -215,6 +215,7 @@ describe('Subscription Initialization Phase', () => {
215215
}),
216216
});
217217

218+
// $FlowFixMe
218219
const subscription = await subscribe({
219220
schema,
220221
document: parse(`
@@ -228,7 +229,6 @@ describe('Subscription Initialization Phase', () => {
228229
importantEmail: {},
229230
});
230231

231-
// $FlowFixMe
232232
await subscription.next();
233233
});
234234

@@ -250,6 +250,7 @@ describe('Subscription Initialization Phase', () => {
250250
}),
251251
});
252252

253+
// $FlowFixMe
253254
const subscription = await subscribe({
254255
schema,
255256
document: parse(`
@@ -263,7 +264,6 @@ describe('Subscription Initialization Phase', () => {
263264
importantEmail: {},
264265
});
265266

266-
// $FlowFixMe
267267
await subscription.next();
268268
});
269269

@@ -297,6 +297,7 @@ describe('Subscription Initialization Phase', () => {
297297
subscription: SubscriptionTypeMultiple,
298298
});
299299

300+
// $FlowFixMe
300301
const subscription = await subscribe({
301302
schema,
302303
document: parse(`
@@ -307,7 +308,6 @@ describe('Subscription Initialization Phase', () => {
307308
`),
308309
});
309310

310-
// $FlowFixMe
311311
subscription.next(); // Ask for a result, but ignore it.
312312

313313
expect(didResolveImportantEmail).to.equal(true);
@@ -935,6 +935,7 @@ describe('Subscription Publish Phase', () => {
935935
},
936936
);
937937

938+
// $FlowFixMe
938939
const subscription = await subscribe({
939940
schema: erroringEmailSchema,
940941
document: parse(`
@@ -948,7 +949,6 @@ describe('Subscription Publish Phase', () => {
948949
`),
949950
});
950951

951-
// $FlowFixMe
952952
const payload1 = await subscription.next();
953953
expect(payload1).to.deep.equal({
954954
done: false,
@@ -1007,6 +1007,7 @@ describe('Subscription Publish Phase', () => {
10071007
(email) => email,
10081008
);
10091009

1010+
// $FlowFixMe
10101011
const subscription = await subscribe({
10111012
schema: erroringEmailSchema,
10121013
document: parse(`
@@ -1020,7 +1021,6 @@ describe('Subscription Publish Phase', () => {
10201021
`),
10211022
});
10221023

1023-
// $FlowFixMe
10241024
const payload1 = await subscription.next();
10251025
expect(payload1).to.deep.equal({
10261026
done: false,
@@ -1061,6 +1061,7 @@ describe('Subscription Publish Phase', () => {
10611061
(email) => email,
10621062
);
10631063

1064+
// $FlowFixMe
10641065
const subscription = await subscribe({
10651066
schema: erroringEmailSchema,
10661067
document: parse(`
@@ -1074,7 +1075,6 @@ describe('Subscription Publish Phase', () => {
10741075
`),
10751076
});
10761077

1077-
// $FlowFixMe
10781078
const payload1 = await subscription.next();
10791079
expect(payload1).to.deep.equal({
10801080
done: false,

src/subscription/mapAsyncIterator.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ export default function mapAsyncIterator<T, U>(
1515
): AsyncGenerator<U, void, void> {
1616
// $FlowFixMe
1717
const iteratorMethod = iterable[SYMBOL_ASYNC_ITERATOR];
18-
const iterator: AsyncIterator<T> = iteratorMethod.call(iterable);
19-
let $return;
18+
const iterator: any = iteratorMethod.call(iterable);
19+
let $return: any;
2020
let abruptClose;
21-
// $FlowFixMe(>=0.68.0)
2221
if (typeof iterator.return === 'function') {
2322
$return = iterator.return;
2423
abruptClose = (error) => {
@@ -53,7 +52,6 @@ export default function mapAsyncIterator<T, U>(
5352
: Promise.resolve({ value: undefined, done: true });
5453
},
5554
throw(error) {
56-
// $FlowFixMe(>=0.68.0)
5755
if (typeof iterator.throw === 'function') {
5856
return iterator.throw(error).then(mapResult, mapReject);
5957
}

src/type/__tests__/definition-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ describe('Type System: Objects', () => {
336336
it('rejects an Object type with a field function that returns incorrect type', () => {
337337
const objType = new GraphQLObjectType({
338338
name: 'SomeObject',
339+
// $DisableFlowOnNegativeTest
339340
fields() {
340-
// $DisableFlowOnNegativeTest
341341
return [{ field: ScalarType }];
342342
},
343343
});
@@ -365,8 +365,8 @@ describe('Type System: Objects', () => {
365365
it('rejects an Object type with an isDeprecated instead of deprecationReason on field', () => {
366366
const OldObject = new GraphQLObjectType({
367367
name: 'OldObject',
368+
// $DisableFlowOnNegativeTest
368369
fields: {
369-
// $DisableFlowOnNegativeTest
370370
field: { type: ScalarType, isDeprecated: true },
371371
},
372372
});
@@ -405,8 +405,8 @@ describe('Type System: Objects', () => {
405405
it('rejects an empty Object field resolver', () => {
406406
const objType = new GraphQLObjectType({
407407
name: 'SomeObject',
408+
// $DisableFlowOnNegativeTest
408409
fields: {
409-
// $DisableFlowOnNegativeTest
410410
field: { type: ScalarType, resolve: {} },
411411
},
412412
});
@@ -419,8 +419,8 @@ describe('Type System: Objects', () => {
419419
it('rejects a constant scalar value resolver', () => {
420420
const objType = new GraphQLObjectType({
421421
name: 'SomeObject',
422+
// $DisableFlowOnNegativeTest
422423
fields: {
423-
// $DisableFlowOnNegativeTest
424424
field: { type: ScalarType, resolve: 0 },
425425
},
426426
});
@@ -724,8 +724,8 @@ describe('Type System: Enums', () => {
724724
() =>
725725
new GraphQLEnumType({
726726
name: 'SomeEnum',
727+
// $DisableFlowOnNegativeTest
727728
values: {
728-
// $DisableFlowOnNegativeTest
729729
FOO: { isDeprecated: true },
730730
},
731731
}),
@@ -809,8 +809,8 @@ describe('Type System: Input Objects', () => {
809809
it('rejects an Input Object type with resolvers', () => {
810810
const inputObjType = new GraphQLInputObjectType({
811811
name: 'SomeInputObject',
812+
// $DisableFlowOnNegativeTest
812813
fields: {
813-
// $DisableFlowOnNegativeTest
814814
f: { type: ScalarType, resolve: dummyFunc },
815815
},
816816
});
@@ -822,8 +822,8 @@ describe('Type System: Input Objects', () => {
822822
it('rejects an Input Object type with resolver constant', () => {
823823
const inputObjType = new GraphQLInputObjectType({
824824
name: 'SomeInputObject',
825+
// $DisableFlowOnNegativeTest
825826
fields: {
826-
// $DisableFlowOnNegativeTest
827827
f: { type: ScalarType, resolve: {} },
828828
},
829829
});

src/utilities/__tests__/getOperationRootType-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ describe('getOperationRootType', () => {
149149

150150
it('Throws when operation not a valid operation kind', () => {
151151
const testSchema = new GraphQLSchema({});
152-
153152
const doc = parse('{ field }');
154153
const operationNode = {
155154
...getOperationNode(doc),
156-
// $DisableFlowOnNegativeTest
157155
operation: 'non_existent_operation',
158156
};
157+
158+
// $DisableFlowOnNegativeTest
159159
expect(() => getOperationRootType(testSchema, operationNode)).to.throw(
160160
'Can only have query, mutation and subscription operations.',
161161
);

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,10 +1975,10 @@ flatted@^2.0.0:
19751975
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
19761976
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==
19771977

1978-
flow-bin@0.120.1:
1979-
version "0.120.1"
1980-
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.120.1.tgz#ab051d6df71829b70a26a2c90bb81f9d43797cae"
1981-
integrity sha512-KgE+d+rKzdXzhweYVJty1QIOOZTTbtnXZf+4SLnmArLvmdfeLreQOZpeLbtq5h79m7HhDzX/HkUkoyu/fmSC2A==
1978+
flow-bin@0.121.0:
1979+
version "0.121.0"
1980+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.121.0.tgz#e206bdc3d510277f9a847920540f72c49e87c130"
1981+
integrity sha512-QYRMs+AoMLj/OTaSo9+8c3kzM/u8YgvfrInp0qzhtzC02Sc2jb3BV/QZWZGjPo+XK3twyyqXrcI3s8MuL1UQRg==
19821982

19831983
foreground-child@^2.0.0:
19841984
version "2.0.0"

0 commit comments

Comments
 (0)