diff --git a/.flowconfig b/.flowconfig index e78ac9baa7..0d59c286e1 100644 --- a/.flowconfig +++ b/.flowconfig @@ -40,4 +40,4 @@ experimental.const_params=true include_warnings=true [version] -^0.131.0 +^0.132.0 diff --git a/package-lock.json b/package-lock.json index 56a5413dd5..feb3dd902a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4197,9 +4197,9 @@ "dev": true }, "flow-bin": { - "version": "0.131.0", - "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.131.0.tgz", - "integrity": "sha512-fZmoIBcDrtLhy/NNMxwJysSYzMr1ksRcAOMi3AHSoYXfcuQqTvhGJx+wqjlIOqIwz8RRYm8J4V4JrSJbIKP+Xg==", + "version": "0.132.0", + "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.132.0.tgz", + "integrity": "sha512-S1g/vnAyNaLUdajmuUHCMl30qqye12gS6mr4LVyswf1k+JDF4efs6SfKmptuvnpitF3LGCVf0TIffChP8ljwnw==", "dev": true }, "foreground-child": { diff --git a/package.json b/package.json index 4fe99cb6b5..7ac143b793 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "eslint-plugin-internal-rules": "file:./resources/eslint-internal-rules", "eslint-plugin-istanbul": "0.1.2", "eslint-plugin-node": "11.1.0", - "flow-bin": "0.131.0", + "flow-bin": "0.132.0", "mocha": "8.1.1", "nyc": "15.1.0", "prettier": "2.0.5", diff --git a/src/error/GraphQLError.js b/src/error/GraphQLError.js index 67533533fd..8e214ee2d4 100644 --- a/src/error/GraphQLError.js +++ b/src/error/GraphQLError.js @@ -212,7 +212,7 @@ export class GraphQLError extends Error { } // FIXME: workaround to not break chai comparisons, should be remove in v16 - // $FlowFixMe Flow doesn't support computed properties yet + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet get [SYMBOL_TO_STRING_TAG](): string { return 'Object'; } diff --git a/src/error/__tests__/formatError-test.js b/src/error/__tests__/formatError-test.js index a509826a6b..d6c8e17e8d 100644 --- a/src/error/__tests__/formatError-test.js +++ b/src/error/__tests__/formatError-test.js @@ -6,7 +6,7 @@ import { GraphQLError } from '../GraphQLError'; describe('formatError: default error formatter', () => { it('uses default message', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const e = new GraphQLError(); expect(formatError(e)).to.deep.equal({ @@ -45,12 +45,12 @@ describe('formatError: default error formatter', () => { }); it('rejects null and undefined errors', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => formatError(undefined)).to.throw( 'Received null or undefined error.', ); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => formatError(null)).to.throw( 'Received null or undefined error.', ); diff --git a/src/execution/__tests__/abstract-test.js b/src/execution/__tests__/abstract-test.js index 27dec94f26..938a44fba0 100644 --- a/src/execution/__tests__/abstract-test.js +++ b/src/execution/__tests__/abstract-test.js @@ -401,8 +401,8 @@ describe('Execute: Handles execution of abstract types', () => { const fooInterface = new GraphQLInterfaceType({ name: 'FooInterface', fields: { bar: { type: GraphQLString } }, - // $FlowExpectedError resolveType() { + // $FlowExpectedError[incompatible-call] return []; }, }); diff --git a/src/execution/__tests__/executor-test.js b/src/execution/__tests__/executor-test.js index 8cd55f015a..64048f591d 100644 --- a/src/execution/__tests__/executor-test.js +++ b/src/execution/__tests__/executor-test.js @@ -31,14 +31,14 @@ describe('Execute: Handles basic execution tasks', () => { }), }); - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => executeSync({ schema })).to.throw('Must provide document.'); }); it('throws if no schema is provided', () => { const document = parse('{ field }'); - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => executeSync({ document })).to.throw( 'Expected undefined to be a GraphQL schema.', ); @@ -63,7 +63,7 @@ describe('Execute: Handles basic execution tasks', () => { `); const variableValues = '{ "a": 1 }'; - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => executeSync({ schema, document, variableValues })).to.throw( 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.', ); diff --git a/src/jsutils/inspect.js b/src/jsutils/inspect.js index 6c3d1af2e0..9ffba8138e 100644 --- a/src/jsutils/inspect.js +++ b/src/jsutils/inspect.js @@ -35,7 +35,7 @@ function formatObjectValue(value, previouslySeenValues) { const customInspectFn = getCustomFn(value); if (customInspectFn !== undefined) { - // $FlowFixMe(>=0.90.0) + // $FlowFixMe[incompatible-use] const customValue = customInspectFn.call(value); // check for infinite recursion diff --git a/src/language/__tests__/parser-test.js b/src/language/__tests__/parser-test.js index 2213fd6c27..c8bb3e62db 100644 --- a/src/language/__tests__/parser-test.js +++ b/src/language/__tests__/parser-test.js @@ -22,12 +22,12 @@ function expectSyntaxError(text) { describe('Parser', () => { it('asserts that a source to parse was provided', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => parse()).to.throw('Must provide Source. Received: undefined.'); }); it('asserts that an invalid source to parse was provided', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => parse({})).to.throw('Must provide Source. Received: {}.'); }); diff --git a/src/language/__tests__/printer-test.js b/src/language/__tests__/printer-test.js index aa074819e3..0c852757e0 100644 --- a/src/language/__tests__/printer-test.js +++ b/src/language/__tests__/printer-test.js @@ -24,7 +24,7 @@ describe('Printer: Query document', () => { it('produces helpful error messages', () => { const badAST = { random: 'Data' }; - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => print(badAST)).to.throw( 'Invalid AST Node: { random: "Data" }.', ); @@ -113,7 +113,7 @@ describe('Printer: Query document', () => { const printed = print(parse(kitchenSinkQuery)); expect(printed).to.equal( - // $FlowFixMe + // $FlowFixMe[incompatible-call] dedent(String.raw` query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery { whoever123is: node(id: [123, 456]) { diff --git a/src/language/__tests__/schema-printer-test.js b/src/language/__tests__/schema-printer-test.js index 18fba5517d..115ca12730 100644 --- a/src/language/__tests__/schema-printer-test.js +++ b/src/language/__tests__/schema-printer-test.js @@ -20,7 +20,7 @@ describe('Printer: SDL document', () => { it('produces helpful error messages', () => { const badAST = { random: 'Data' }; - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => print(badAST)).to.throw( 'Invalid AST Node: { random: "Data" }.', ); diff --git a/src/language/__tests__/toJSONDeep.js b/src/language/__tests__/toJSONDeep.js index 2361a1ba26..3c3fae57f3 100644 --- a/src/language/__tests__/toJSONDeep.js +++ b/src/language/__tests__/toJSONDeep.js @@ -10,7 +10,7 @@ export default function toJSONDeep(value: mixed): mixed { } if (typeof value.toJSON === 'function') { - // $FlowFixMe(>=0.90.0) + // $FlowFixMe[incompatible-use] return value.toJSON(); } diff --git a/src/language/source.js b/src/language/source.js index 565f78ef47..74a823d6fa 100644 --- a/src/language/source.js +++ b/src/language/source.js @@ -37,7 +37,7 @@ export class Source { ); } - // $FlowFixMe Flow doesn't support computed properties yet + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet get [SYMBOL_TO_STRING_TAG]() { return 'Source'; } diff --git a/src/polyfills/arrayFrom.js b/src/polyfills/arrayFrom.js index c97b20ed54..2d153c56da 100644 --- a/src/polyfills/arrayFrom.js +++ b/src/polyfills/arrayFrom.js @@ -9,7 +9,7 @@ declare function arrayFrom( ): Array; /* eslint-disable no-redeclare */ -// $FlowFixMe +// $FlowFixMe[name-already-bound] const arrayFrom = Array.from || function (obj, mapFn, thisArg) { diff --git a/src/polyfills/find.js b/src/polyfills/find.js index c3a3b8b4dd..403ba0f2b7 100644 --- a/src/polyfills/find.js +++ b/src/polyfills/find.js @@ -4,7 +4,7 @@ declare function find( ): T | void; /* eslint-disable no-redeclare */ -// $FlowFixMe +// $FlowFixMe[name-already-bound] const find = Array.prototype.find ? function (list, predicate) { return Array.prototype.find.call(list, predicate); diff --git a/src/polyfills/flatMap.js b/src/polyfills/flatMap.js index e77a6e152a..f793d8c994 100644 --- a/src/polyfills/flatMap.js +++ b/src/polyfills/flatMap.js @@ -6,7 +6,7 @@ declare function flatMap( const flatMapMethod = Array.prototype.flatMap; /* eslint-disable no-redeclare */ -// $FlowFixMe +// $FlowFixMe[name-already-bound] const flatMap = flatMapMethod ? function (list, fn) { return flatMapMethod.call(list, fn); diff --git a/src/polyfills/isFinite.js b/src/polyfills/isFinite.js index dcaeba501a..58f8614b9f 100644 --- a/src/polyfills/isFinite.js +++ b/src/polyfills/isFinite.js @@ -3,7 +3,7 @@ declare function isFinitePolyfill( ): boolean %checks(typeof value === 'number'); /* eslint-disable no-redeclare */ -// $FlowFixMe workaround for: https://github.com/facebook/flow/issues/4441 +// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 const isFinitePolyfill = Number.isFinite || function (value) { diff --git a/src/polyfills/isInteger.js b/src/polyfills/isInteger.js index 5ff717a88d..fdd50ff247 100644 --- a/src/polyfills/isInteger.js +++ b/src/polyfills/isInteger.js @@ -2,7 +2,7 @@ declare function isInteger(value: mixed): boolean %checks(typeof value === 'number'); /* eslint-disable no-redeclare */ -// $FlowFixMe workaround for: https://github.com/facebook/flow/issues/4441 +// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 const isInteger = Number.isInteger || function (value) { diff --git a/src/polyfills/objectEntries.js b/src/polyfills/objectEntries.js index 20148f6947..30e5585272 100644 --- a/src/polyfills/objectEntries.js +++ b/src/polyfills/objectEntries.js @@ -3,7 +3,7 @@ import type { ObjMap } from '../jsutils/ObjMap'; declare function objectEntries(obj: ObjMap): Array<[string, T]>; /* eslint-disable no-redeclare */ -// $FlowFixMe workaround for: https://github.com/facebook/flow/issues/5838 +// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 const objectEntries = Object.entries || ((obj) => Object.keys(obj).map((key) => [key, obj[key]])); diff --git a/src/polyfills/objectValues.js b/src/polyfills/objectValues.js index dfa0088d4c..943362a640 100644 --- a/src/polyfills/objectValues.js +++ b/src/polyfills/objectValues.js @@ -3,7 +3,7 @@ import type { ObjMap } from '../jsutils/ObjMap'; declare function objectValues(obj: ObjMap): Array; /* eslint-disable no-redeclare */ -// $FlowFixMe workaround for: https://github.com/facebook/flow/issues/2221 +// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441 const objectValues = Object.values || ((obj) => Object.keys(obj).map((key) => obj[key])); export default objectValues; diff --git a/src/polyfills/symbols.js b/src/polyfills/symbols.js index b476b2adbb..2e911976be 100644 --- a/src/polyfills/symbols.js +++ b/src/polyfills/symbols.js @@ -6,10 +6,10 @@ export const SYMBOL_ITERATOR: string = // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') export const SYMBOL_ASYNC_ITERATOR: string = - // $FlowFixMe Flow doesn't define `Symbol.asyncIterator` yet + // $FlowFixMe[prop-missing] Flow doesn't define `Symbol.asyncIterator` yet typeof Symbol === 'function' ? Symbol.asyncIterator : '@@asyncIterator'; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') export const SYMBOL_TO_STRING_TAG: string = - // $FlowFixMe Flow doesn't define `Symbol.toStringTag` yet + // $FlowFixMe[incompatible-type] Flow doesn't define `Symbol.toStringTag` yet typeof Symbol === 'function' ? Symbol.toStringTag : '@@toStringTag'; diff --git a/src/subscription/__tests__/eventEmitterAsyncIterator-test.js b/src/subscription/__tests__/eventEmitterAsyncIterator-test.js index 61e2770089..3632c89b42 100644 --- a/src/subscription/__tests__/eventEmitterAsyncIterator-test.js +++ b/src/subscription/__tests__/eventEmitterAsyncIterator-test.js @@ -41,7 +41,7 @@ describe('eventEmitterAsyncIterator', () => { const i5 = iterator.next().then((x) => x); // Terminate emitter - // $FlowFixMe + // $FlowFixMe[prop-missing] await iterator.return(); // Publish is not caught after terminate diff --git a/src/subscription/__tests__/eventEmitterAsyncIterator.js b/src/subscription/__tests__/eventEmitterAsyncIterator.js index 77fc81c548..4f1e30000d 100644 --- a/src/subscription/__tests__/eventEmitterAsyncIterator.js +++ b/src/subscription/__tests__/eventEmitterAsyncIterator.js @@ -57,7 +57,7 @@ export default function eventEmitterAsyncIterator( emptyQueue(); return Promise.reject(error); }, - // $FlowFixMe Blocked by https://github.com/facebook/flow/issues/3258 + // $FlowFixMe[prop-missing] Blocked by https://github.com/facebook/flow/issues/3258 [Symbol.asyncIterator]() { return this; }, diff --git a/src/subscription/__tests__/mapAsyncIterator-test.js b/src/subscription/__tests__/mapAsyncIterator-test.js index 7ae9a14920..3402575804 100644 --- a/src/subscription/__tests__/mapAsyncIterator-test.js +++ b/src/subscription/__tests__/mapAsyncIterator-test.js @@ -26,7 +26,7 @@ describe('mapAsyncIterator', () => { const items = [1, 2, 3]; const iterator: any = { - // $FlowFixMe Blocked by https://github.com/facebook/flow/issues/3258 + // $FlowFixMe[prop-missing] Blocked by https://github.com/facebook/flow/issues/3258 [Symbol.asyncIterator]() { return this; }, @@ -122,7 +122,7 @@ describe('mapAsyncIterator', () => { const items = [1, 2, 3]; const iterator: any = { - // $FlowFixMe Blocked by https://github.com/facebook/flow/issues/3258 + // $FlowFixMe[prop-missing] Blocked by https://github.com/facebook/flow/issues/3258 [Symbol.asyncIterator]() { return this; }, @@ -186,7 +186,7 @@ describe('mapAsyncIterator', () => { const items = [1, 2, 3]; const iterator: any = { - // $FlowFixMe Blocked by https://github.com/facebook/flow/issues/3258 + // $FlowFixMe[prop-missing] Blocked by https://github.com/facebook/flow/issues/3258 [Symbol.asyncIterator]() { return this; }, diff --git a/src/subscription/__tests__/subscribe-test.js b/src/subscription/__tests__/subscribe-test.js index de0ddffe56..9063028421 100644 --- a/src/subscription/__tests__/subscribe-test.js +++ b/src/subscription/__tests__/subscribe-test.js @@ -126,7 +126,7 @@ async function createSubscription( // `subscribe` returns Promise return { sendImportantEmail, - // $FlowFixMe + // $FlowFixMe[incompatible-call] subscription: await subscribe({ schema, document, rootValue: data }), }; } @@ -155,7 +155,7 @@ describe('Subscription Initialization Phase', () => { // Empty } - // $FlowFixMe + // $FlowFixMe[incompatible-call] const ai = await subscribe(emailSchema, document, { importantEmail: emptyAsyncIterator, }); @@ -210,7 +210,7 @@ describe('Subscription Initialization Phase', () => { }), }); - // $FlowFixMe + // $FlowFixMe[incompatible-call] const subscription = await subscribe({ schema, document: parse(` @@ -245,7 +245,7 @@ describe('Subscription Initialization Phase', () => { }), }); - // $FlowFixMe + // $FlowFixMe[incompatible-call] const subscription = await subscribe({ schema, document: parse(` @@ -292,7 +292,7 @@ describe('Subscription Initialization Phase', () => { subscription: SubscriptionTypeMultiple, }); - // $FlowFixMe + // $FlowFixMe[incompatible-call] const subscription = await subscribe({ schema, document: parse(` @@ -320,13 +320,13 @@ describe('Subscription Initialization Phase', () => { `); await expectPromiseToThrow( - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] () => subscribe({ schema: null, document }), 'Expected null to be a GraphQL schema.', ); await expectPromiseToThrow( - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] () => subscribe({ document }), 'Expected undefined to be a GraphQL schema.', ); @@ -334,13 +334,13 @@ describe('Subscription Initialization Phase', () => { it('throws an error if document is missing', async () => { await expectPromiseToThrow( - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] () => subscribe({ schema: emailSchema, document: null }), 'Must provide document.', ); await expectPromiseToThrow( - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] () => subscribe({ schema: emailSchema }), 'Must provide document.', ); @@ -370,7 +370,7 @@ describe('Subscription Initialization Phase', () => { it('should pass through unexpected errors thrown in subscribe', async () => { let expectedError; try { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] await subscribe({ schema: emailSchema, document: {} }); } catch (error) { expectedError = error; @@ -930,7 +930,7 @@ describe('Subscription Publish Phase', () => { }, ); - // $FlowFixMe + // $FlowFixMe[incompatible-call] const subscription = await subscribe({ schema: erroringEmailSchema, document: parse(` @@ -1002,7 +1002,7 @@ describe('Subscription Publish Phase', () => { (email) => email, ); - // $FlowFixMe + // $FlowFixMe[incompatible-call] const subscription = await subscribe({ schema: erroringEmailSchema, document: parse(` @@ -1056,7 +1056,7 @@ describe('Subscription Publish Phase', () => { (email) => email, ); - // $FlowFixMe + // $FlowFixMe[incompatible-call] const subscription = await subscribe({ schema: erroringEmailSchema, document: parse(` diff --git a/src/subscription/mapAsyncIterator.js b/src/subscription/mapAsyncIterator.js index 264211202f..2874ebd92e 100644 --- a/src/subscription/mapAsyncIterator.js +++ b/src/subscription/mapAsyncIterator.js @@ -11,7 +11,7 @@ export default function mapAsyncIterator( callback: (T) => PromiseOrValue, rejectCallback?: (any) => PromiseOrValue, ): AsyncGenerator { - // $FlowFixMe + // $FlowFixMe[prop-missing] const iteratorMethod = iterable[SYMBOL_ASYNC_ITERATOR]; const iterator: any = iteratorMethod.call(iterable); let $return: any; diff --git a/src/type/__tests__/definition-test.js b/src/type/__tests__/definition-test.js index 94a4900057..f912052557 100644 --- a/src/type/__tests__/definition-test.js +++ b/src/type/__tests__/definition-test.js @@ -95,7 +95,7 @@ describe('Type System: Scalars', () => { }); it('rejects a Scalar type without name', () => { - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => new GraphQLScalarType({})).to.throw('Must provide name.'); }); @@ -104,7 +104,7 @@ describe('Type System: Scalars', () => { () => new GraphQLScalarType({ name: 'SomeScalar', - // $FlowExpectedError + // $FlowExpectedError[prop-missing] serialize: {}, }), ).to.throw( @@ -129,9 +129,9 @@ describe('Type System: Scalars', () => { () => new GraphQLScalarType({ name: 'SomeScalar', - // $FlowExpectedError + // $FlowExpectedError[prop-missing] parseValue: {}, - // $FlowExpectedError + // $FlowExpectedError[prop-missing] parseLiteral: {}, }), ).to.throw( @@ -144,7 +144,7 @@ describe('Type System: Scalars', () => { () => new GraphQLScalarType({ name: 'SomeScalar', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] specifiedByUrl: {}, }), ).to.throw( @@ -328,7 +328,7 @@ describe('Type System: Objects', () => { }); it('rejects an Object type without name', () => { - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => new GraphQLObjectType({})).to.throw('Must provide name.'); }); @@ -336,7 +336,7 @@ describe('Type System: Objects', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', fields: { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] f: undefined, }, }); @@ -348,7 +348,7 @@ describe('Type System: Objects', () => { it('rejects an Object type with incorrectly typed fields', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] fields: [{ field: ScalarType }], }); expect(() => objType.getFields()).to.throw( @@ -359,8 +359,8 @@ describe('Type System: Objects', () => { it('rejects an Object type with a field function that returns incorrect type', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', - // $FlowExpectedError fields() { + // $FlowExpectedError[incompatible-call] return [{ field: ScalarType }]; }, }); @@ -375,7 +375,7 @@ describe('Type System: Objects', () => { fields: { badField: { type: ScalarType, - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] args: [{ badArg: ScalarType }], }, }, @@ -388,7 +388,7 @@ describe('Type System: Objects', () => { it('rejects an Object type with an isDeprecated instead of deprecationReason on field', () => { const OldObject = new GraphQLObjectType({ name: 'OldObject', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] fields: { field: { type: ScalarType, isDeprecated: true }, }, @@ -403,7 +403,7 @@ describe('Type System: Objects', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', fields: {}, - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] interfaces: {}, }); expect(() => objType.getInterfaces()).to.throw( @@ -415,8 +415,8 @@ describe('Type System: Objects', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', fields: {}, - // $FlowExpectedError interfaces() { + // $FlowExpectedError[incompatible-call] return {}; }, }); @@ -428,7 +428,7 @@ describe('Type System: Objects', () => { it('rejects an empty Object field resolver', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] fields: { field: { type: ScalarType, resolve: {} }, }, @@ -442,7 +442,7 @@ describe('Type System: Objects', () => { it('rejects a constant scalar value resolver', () => { const objType = new GraphQLObjectType({ name: 'SomeObject', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] fields: { field: { type: ScalarType, resolve: 0 }, }, @@ -459,7 +459,7 @@ describe('Type System: Objects', () => { new GraphQLObjectType({ name: 'AnotherObject', fields: {}, - // $FlowExpectedError + // $FlowExpectedError[prop-missing] isTypeOf: {}, }), ).to.throw( @@ -498,7 +498,7 @@ describe('Type System: Interfaces', () => { }); it('rejects an Interface type without name', () => { - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => new GraphQLInterfaceType({})).to.throw('Must provide name.'); }); @@ -506,7 +506,7 @@ describe('Type System: Interfaces', () => { const objType = new GraphQLInterfaceType({ name: 'AnotherInterface', fields: {}, - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] interfaces: {}, }); expect(() => objType.getInterfaces()).to.throw( @@ -518,8 +518,8 @@ describe('Type System: Interfaces', () => { const objType = new GraphQLInterfaceType({ name: 'AnotherInterface', fields: {}, - // $FlowExpectedError interfaces() { + // $FlowExpectedError[incompatible-call] return {}; }, }); @@ -534,7 +534,7 @@ describe('Type System: Interfaces', () => { new GraphQLInterfaceType({ name: 'AnotherInterface', fields: {}, - // $FlowExpectedError + // $FlowExpectedError[prop-missing] resolveType: {}, }), ).to.throw( @@ -579,7 +579,7 @@ describe('Type System: Unions', () => { }); it('rejects an Union type without name', () => { - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => new GraphQLUnionType({})).to.throw('Must provide name.'); }); @@ -589,7 +589,7 @@ describe('Type System: Unions', () => { new GraphQLUnionType({ name: 'SomeUnion', types: [], - // $FlowExpectedError + // $FlowExpectedError[prop-missing] resolveType: {}, }), ).to.throw( @@ -600,7 +600,7 @@ describe('Type System: Unions', () => { it('rejects a Union type with incorrectly typed types', () => { const unionType = new GraphQLUnionType({ name: 'SomeUnion', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] types: { ObjectType }, }); @@ -699,7 +699,7 @@ describe('Type System: Enums', () => { }); it('rejects an Enum type without name', () => { - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => new GraphQLEnumType({ values: {} })).to.throw( 'Must provide name.', ); @@ -710,7 +710,7 @@ describe('Type System: Enums', () => { () => new GraphQLEnumType({ name: 'SomeEnum', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] values: [{ FOO: 10 }], }), ).to.throw('SomeEnum values must be an object with value names as keys.'); @@ -721,7 +721,7 @@ describe('Type System: Enums', () => { () => new GraphQLEnumType({ name: 'SomeEnum', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] values: { FOO: null }, }), ).to.throw( @@ -734,7 +734,7 @@ describe('Type System: Enums', () => { () => new GraphQLEnumType({ name: 'SomeEnum', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] values: { FOO: 10 }, }), ).to.throw( @@ -747,7 +747,7 @@ describe('Type System: Enums', () => { () => new GraphQLEnumType({ name: 'SomeEnum', - // $FlowExpectedError + // $FlowExpectedError[prop-missing] values: { FOO: { isDeprecated: true }, }, @@ -799,7 +799,7 @@ describe('Type System: Input Objects', () => { }); it('rejects an Input Object type without name', () => { - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => new GraphQLInputObjectType({})).to.throw( 'Must provide name.', ); @@ -808,7 +808,7 @@ describe('Type System: Input Objects', () => { it('rejects an Input Object type with incorrect fields', () => { const inputObjType = new GraphQLInputObjectType({ name: 'SomeInputObject', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] fields: [], }); expect(() => inputObjType.getFields()).to.throw( @@ -819,7 +819,7 @@ describe('Type System: Input Objects', () => { it('rejects an Input Object type with fields function that returns incorrect type', () => { const inputObjType = new GraphQLInputObjectType({ name: 'SomeInputObject', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] fields: () => [], }); expect(() => inputObjType.getFields()).to.throw( @@ -832,7 +832,7 @@ describe('Type System: Input Objects', () => { it('rejects an Input Object type with resolvers', () => { const inputObjType = new GraphQLInputObjectType({ name: 'SomeInputObject', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] fields: { f: { type: ScalarType, resolve: dummyFunc }, }, @@ -845,7 +845,7 @@ describe('Type System: Input Objects', () => { it('rejects an Input Object type with resolver constant', () => { const inputObjType = new GraphQLInputObjectType({ name: 'SomeInputObject', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] fields: { f: { type: ScalarType, resolve: {} }, }, @@ -874,15 +874,15 @@ describe('Type System: List', () => { }); it('rejects a non-type as item type of list', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expectList({}).to.throw('Expected {} to be a GraphQL type.'); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expectList(String).to.throw( 'Expected [function String] to be a GraphQL type.', ); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expectList(null).to.throw('Expected null to be a GraphQL type.'); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expectList(undefined).to.throw('Expected undefined to be a GraphQL type.'); }); }); @@ -904,21 +904,21 @@ describe('Type System: Non-Null', () => { }); it('rejects a non-type as nullable type of non-null', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expectNonNull(NonNullScalarType).to.throw( 'Expected Scalar! to be a GraphQL nullable type.', ); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expectNonNull({}).to.throw('Expected {} to be a GraphQL nullable type.'); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expectNonNull(String).to.throw( 'Expected [function String] to be a GraphQL nullable type.', ); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expectNonNull(null).to.throw( 'Expected null to be a GraphQL nullable type.', ); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expectNonNull(undefined).to.throw( 'Expected undefined to be a GraphQL nullable type.', ); diff --git a/src/type/__tests__/directive-test.js b/src/type/__tests__/directive-test.js index 262f700fda..cb11dc739e 100644 --- a/src/type/__tests__/directive-test.js +++ b/src/type/__tests__/directive-test.js @@ -83,8 +83,8 @@ describe('Type System: Directive', () => { }); it('rejects an unnamed directive', () => { - // $FlowExpectedError - expect(() => new GraphQLDirective({ locations: ['Query'] })).to.throw( + // $FlowExpectedError[prop-missing] + expect(() => new GraphQLDirective({ locations: ['QUERY'] })).to.throw( 'Directive must be named.', ); }); @@ -95,21 +95,21 @@ describe('Type System: Directive', () => { new GraphQLDirective({ name: 'Foo', locations: ['QUERY'], - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] args: [], }), ).to.throw('@Foo args must be an object with argument names as keys.'); }); it('rejects a directive with undefined locations', () => { - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => new GraphQLDirective({ name: 'Foo' })).to.throw( '@Foo locations must be an Array.', ); }); it('rejects a directive with incorrectly typed locations', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => new GraphQLDirective({ name: 'Foo', locations: {} })).to.throw( '@Foo locations must be an Array.', ); diff --git a/src/type/__tests__/enumType-test.js b/src/type/__tests__/enumType-test.js index 1b217a7498..13ef2feb83 100644 --- a/src/type/__tests__/enumType-test.js +++ b/src/type/__tests__/enumType-test.js @@ -363,7 +363,7 @@ describe('Type System: Enum Values', () => { const oneValue = ComplexEnum.getValue('ONE'); expect(oneValue).to.include({ name: 'ONE', value: Complex1 }); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const badUsage = ComplexEnum.getValue(Complex1); expect(badUsage).to.equal(undefined); }); diff --git a/src/type/__tests__/schema-test.js b/src/type/__tests__/schema-test.js index a610a3691e..f37ba6644d 100644 --- a/src/type/__tests__/schema-test.js +++ b/src/type/__tests__/schema-test.js @@ -329,11 +329,11 @@ describe('Type System: Schema', () => { }); it('checks the configuration for mistakes', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-exact] expect(() => new GraphQLSchema(JSON.parse)).to.throw(); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => new GraphQLSchema({ types: {} })).to.throw(); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => new GraphQLSchema({ directives: {} })).to.throw(); }); }); @@ -362,7 +362,7 @@ describe('Type System: Schema', () => { }); const types = [{}, query, {}]; - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => new GraphQLSchema({ query, types })).to.throw( 'One of the provided types for building the Schema is missing a name.', ); diff --git a/src/type/__tests__/validation-test.js b/src/type/__tests__/validation-test.js index 47f08a15dd..74061f1f07 100644 --- a/src/type/__tests__/validation-test.js +++ b/src/type/__tests__/validation-test.js @@ -391,7 +391,7 @@ describe('Type System: A Schema must have Object root types', () => { it('rejects a Schema whose types are incorrectly typed', () => { const schema = new GraphQLSchema({ query: SomeObjectType, - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] types: [{ name: 'SomeType' }, SomeDirective], }); expect(validateSchema(schema)).to.deep.equal([ @@ -408,7 +408,7 @@ describe('Type System: A Schema must have Object root types', () => { it('rejects a Schema whose directives are incorrectly typed', () => { const schema = new GraphQLSchema({ query: SomeObjectType, - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] directives: [null, 'SomeDirective', SomeScalarType], }); expect(validateSchema(schema)).to.deep.equal([ @@ -688,7 +688,7 @@ describe('Type System: Union types must be valid', () => { for (const memberType of badUnionMemberTypes) { const badUnion = new GraphQLUnionType({ name: 'BadUnion', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] types: [memberType], }); const badSchema = schemaWithFieldType(badUnion); @@ -1012,7 +1012,7 @@ describe('Type System: Object fields must have output types', () => { } it('rejects an empty Object field type', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithObjectField({ type: undefined }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1025,7 +1025,7 @@ describe('Type System: Object fields must have output types', () => { for (const type of notOutputTypes) { const typeStr = inspect(type); it(`rejects a non-output type as an Object field type: ${typeStr}`, () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithObjectField({ type }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1036,7 +1036,7 @@ describe('Type System: Object fields must have output types', () => { } it('rejects a non-type value as an Object field type', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithObjectField({ type: Number }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1074,7 +1074,7 @@ describe('Type System: Objects can only implement unique interfaces', () => { const schema = new GraphQLSchema({ query: new GraphQLObjectType({ name: 'BadObject', - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] interfaces: [undefined], fields: { f: { type: GraphQLString } }, }), @@ -1333,7 +1333,7 @@ describe('Type System: Interface fields must have output types', () => { } it('rejects an empty Interface field type', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithInterfaceField({ type: undefined }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1350,7 +1350,7 @@ describe('Type System: Interface fields must have output types', () => { for (const type of notOutputTypes) { const typeStr = inspect(type); it(`rejects a non-output type as an Interface field type: ${typeStr}`, () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithInterfaceField({ type }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1364,7 +1364,7 @@ describe('Type System: Interface fields must have output types', () => { } it('rejects a non-type value as an Interface field type', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithInterfaceField({ type: Number }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1469,7 +1469,7 @@ describe('Type System: Arguments must have input types', () => { } it('rejects an empty field arg type', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithArg({ type: undefined }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1486,7 +1486,7 @@ describe('Type System: Arguments must have input types', () => { for (const type of notInputTypes) { const typeStr = inspect(type); it(`rejects a non-input type as a field arg type: ${typeStr}`, () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithArg({ type }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1500,7 +1500,7 @@ describe('Type System: Arguments must have input types', () => { } it('rejects a non-type value as a field arg type', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithArg({ type: Number }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1572,7 +1572,7 @@ describe('Type System: Input Object fields must have input types', () => { } it('rejects an empty input field type', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithInputField({ type: undefined }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1585,7 +1585,7 @@ describe('Type System: Input Object fields must have input types', () => { for (const type of notInputTypes) { const typeStr = inspect(type); it(`rejects a non-input type as an input field type: ${typeStr}`, () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithInputField({ type }); expect(validateSchema(schema)).to.deep.equal([ { @@ -1596,7 +1596,7 @@ describe('Type System: Input Object fields must have input types', () => { } it('rejects a non-type value as an input field type', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] const schema = schemaWithInputField({ type: Number }); expect(validateSchema(schema)).to.deep.equal([ { diff --git a/src/type/definition.js b/src/type/definition.js index e3b5743142..5feb88744b 100644 --- a/src/type/definition.js +++ b/src/type/definition.js @@ -538,7 +538,7 @@ export function getNamedType(type) { export type Thunk<+T> = (() => T) | T; function resolveThunk<+T>(thunk: Thunk): T { - // $FlowFixMe(>=0.90.0) + // $FlowFixMe[incompatible-use] return typeof thunk === 'function' ? thunk() : thunk; } @@ -647,7 +647,7 @@ export class GraphQLScalarType { return this.toString(); } - // $FlowFixMe Flow doesn't support computed properties yet + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet get [SYMBOL_TO_STRING_TAG]() { return 'GraphQLScalarType'; } @@ -791,7 +791,7 @@ export class GraphQLObjectType { return this.toString(); } - // $FlowFixMe Flow doesn't support computed properties yet + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet get [SYMBOL_TO_STRING_TAG]() { return 'GraphQLObjectType'; } @@ -1108,7 +1108,7 @@ export class GraphQLInterfaceType { return this.toString(); } - // $FlowFixMe Flow doesn't support computed properties yet + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet get [SYMBOL_TO_STRING_TAG]() { return 'GraphQLInterfaceType'; } @@ -1215,7 +1215,7 @@ export class GraphQLUnionType { return this.toString(); } - // $FlowFixMe Flow doesn't support computed properties yet + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet get [SYMBOL_TO_STRING_TAG]() { return 'GraphQLUnionType'; } @@ -1393,7 +1393,7 @@ export class GraphQLEnumType /* */ { return this.toString(); } - // $FlowFixMe Flow doesn't support computed properties yet + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet get [SYMBOL_TO_STRING_TAG]() { return 'GraphQLEnumType'; } @@ -1552,7 +1552,7 @@ export class GraphQLInputObjectType { return this.toString(); } - // $FlowFixMe Flow doesn't support computed properties yet + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet get [SYMBOL_TO_STRING_TAG]() { return 'GraphQLInputObjectType'; } diff --git a/src/type/directives.js b/src/type/directives.js index f620371c79..a6196fb9c9 100644 --- a/src/type/directives.js +++ b/src/type/directives.js @@ -108,7 +108,7 @@ export class GraphQLDirective { return this.toString(); } - // $FlowFixMe Flow doesn't support computed properties yet + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet get [SYMBOL_TO_STRING_TAG]() { return 'GraphQLDirective'; } diff --git a/src/type/scalars.js b/src/type/scalars.js index 38709c5927..ceca14b5c3 100644 --- a/src/type/scalars.js +++ b/src/type/scalars.js @@ -142,7 +142,7 @@ function serializeObject(outputValue: mixed): mixed { } } if (typeof outputValue.toJSON === 'function') { - // $FlowFixMe(>=0.90.0) + // $FlowFixMe[incompatible-use] return outputValue.toJSON(); } } diff --git a/src/type/schema.js b/src/type/schema.js index 0522b5e5cd..230b1dcc62 100644 --- a/src/type/schema.js +++ b/src/type/schema.js @@ -355,7 +355,7 @@ export class GraphQLSchema { }; } - // $FlowFixMe Flow doesn't support computed properties yet + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet get [SYMBOL_TO_STRING_TAG]() { return 'GraphQLSchema'; } diff --git a/src/utilities/__tests__/assertValidName-test.js b/src/utilities/__tests__/assertValidName-test.js index d1c6b98272..40f9d2e398 100644 --- a/src/utilities/__tests__/assertValidName-test.js +++ b/src/utilities/__tests__/assertValidName-test.js @@ -15,7 +15,7 @@ describe('assertValidName()', () => { }); it('throws for non-strings', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => assertValidName({})).to.throw('Expected name to be a string.'); }); diff --git a/src/utilities/__tests__/buildASTSchema-test.js b/src/utilities/__tests__/buildASTSchema-test.js index 3abbd6d9c7..5dc1680b52 100644 --- a/src/utilities/__tests__/buildASTSchema-test.js +++ b/src/utilities/__tests__/buildASTSchema-test.js @@ -1149,12 +1149,12 @@ describe('Schema Builder', () => { }); it('Rejects invalid AST', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => buildASTSchema(null)).to.throw( 'Must provide valid Document AST', ); - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => buildASTSchema({})).to.throw( 'Must provide valid Document AST', ); diff --git a/src/utilities/__tests__/buildClientSchema-test.js b/src/utilities/__tests__/buildClientSchema-test.js index 67b846cec5..9a0e83de26 100644 --- a/src/utilities/__tests__/buildClientSchema-test.js +++ b/src/utilities/__tests__/buildClientSchema-test.js @@ -77,8 +77,7 @@ describe('Type System: build schema from introspection', () => { const schema = buildSchema(sdl); const introspection = introspectionFromSchema(schema); - // $FlowExpectedError - delete introspection.__schema.queryType; + delete (introspection: any).__schema.queryType; const clientSchema = buildClientSchema(introspection); expect(clientSchema.getQueryType()).to.equal(null); @@ -481,8 +480,7 @@ describe('Type System: build schema from introspection', () => { const schema = buildSchema(sdl); const introspection = introspectionFromSchema(schema); - // $FlowExpectedError - delete introspection.__schema.directives; + delete (introspection: any).__schema.directives; const clientSchema = buildClientSchema(introspection); @@ -602,12 +600,12 @@ describe('Type System: build schema from introspection', () => { `); it('throws when introspection is missing __schema property', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => buildClientSchema(null)).to.throw( 'Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: null.', ); - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => buildClientSchema({})).to.throw( 'Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: {}.', ); @@ -616,8 +614,7 @@ describe('Type System: build schema from introspection', () => { it('throws when referenced unknown type', () => { const introspection = introspectionFromSchema(dummySchema); - // $FlowExpectedError - introspection.__schema.types = introspection.__schema.types.filter( + (introspection: any).__schema.types = introspection.__schema.types.filter( ({ name }) => name !== 'Query', ); @@ -634,8 +631,7 @@ describe('Type System: build schema from introspection', () => { `); const introspection = introspectionFromSchema(schema); - // $FlowExpectedError - introspection.__schema.types = introspection.__schema.types.filter( + (introspection: any).__schema.types = introspection.__schema.types.filter( ({ name }) => name !== 'Float', ); @@ -649,8 +645,7 @@ describe('Type System: build schema from introspection', () => { expect(introspection).to.have.nested.property('__schema.queryType.name'); - // $FlowExpectedError - delete introspection.__schema.queryType.name; + delete (introspection: any).__schema.queryType.name; expect(() => buildClientSchema(introspection)).to.throw( 'Unknown type reference: {}.', @@ -665,8 +660,7 @@ describe('Type System: build schema from introspection', () => { expect(queryTypeIntrospection).to.have.property('kind'); - // $FlowExpectedError - delete queryTypeIntrospection.kind; + delete (queryTypeIntrospection: any).kind; expect(() => buildClientSchema(introspection)).to.throw( /Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: { name: "Query", .* }\./, @@ -681,8 +675,7 @@ describe('Type System: build schema from introspection', () => { expect(queryTypeIntrospection).to.have.property('interfaces'); - // $FlowExpectedError - delete queryTypeIntrospection.interfaces; + delete (queryTypeIntrospection: any).interfaces; expect(() => buildClientSchema(introspection)).to.throw( /Introspection result missing interfaces: { kind: "OBJECT", name: "Query", .* }\./, @@ -696,8 +689,7 @@ describe('Type System: build schema from introspection', () => { ); expect(someInterfaceIntrospection).to.have.property('interfaces'); - // $FlowExpectedError - someInterfaceIntrospection.interfaces = null; + (someInterfaceIntrospection: any).interfaces = null; const clientSchema = buildClientSchema(introspection); expect(printSchema(clientSchema)).to.equal(printSchema(dummySchema)); @@ -710,9 +702,7 @@ describe('Type System: build schema from introspection', () => { ); expect(queryTypeIntrospection).to.have.property('fields'); - - // $FlowExpectedError - delete queryTypeIntrospection.fields; + delete (queryTypeIntrospection: any).fields; expect(() => buildClientSchema(introspection)).to.throw( /Introspection result missing fields: { kind: "OBJECT", name: "Query", .* }\./, @@ -726,9 +716,7 @@ describe('Type System: build schema from introspection', () => { ); expect(queryTypeIntrospection).to.have.nested.property('fields[0].args'); - - // $FlowExpectedError - delete queryTypeIntrospection.fields[0].args; + delete (queryTypeIntrospection: any).fields[0].args; expect(() => buildClientSchema(introspection)).to.throw( /Introspection result missing field args: { name: "foo", .* }\./, @@ -745,8 +733,7 @@ describe('Type System: build schema from introspection', () => { 'fields[0].args[0].type.name', 'String', ); - // $FlowExpectedError - queryTypeIntrospection.fields[0].args[0].type.name = 'SomeUnion'; + (queryTypeIntrospection: any).fields[0].args[0].type.name = 'SomeUnion'; expect(() => buildClientSchema(introspection)).to.throw( 'Introspection must provide input type for arguments, but received: SomeUnion.', @@ -763,8 +750,7 @@ describe('Type System: build schema from introspection', () => { 'fields[0].type.name', 'String', ); - // $FlowExpectedError - queryTypeIntrospection.fields[0].type.name = 'SomeInputObject'; + (queryTypeIntrospection: any).fields[0].type.name = 'SomeInputObject'; expect(() => buildClientSchema(introspection)).to.throw( 'Introspection must provide output type for fields, but received: SomeInputObject.', @@ -778,9 +764,7 @@ describe('Type System: build schema from introspection', () => { ); expect(someUnionIntrospection).to.have.property('possibleTypes'); - - // $FlowExpectedError - delete someUnionIntrospection.possibleTypes; + delete (someUnionIntrospection: any).possibleTypes; expect(() => buildClientSchema(introspection)).to.throw( /Introspection result missing possibleTypes: { kind: "UNION", name: "SomeUnion",.* }\./, @@ -794,9 +778,7 @@ describe('Type System: build schema from introspection', () => { ); expect(someEnumIntrospection).to.have.property('enumValues'); - - // $FlowExpectedError - delete someEnumIntrospection.enumValues; + delete (someEnumIntrospection: any).enumValues; expect(() => buildClientSchema(introspection)).to.throw( /Introspection result missing enumValues: { kind: "ENUM", name: "SomeEnum", .* }\./, @@ -810,9 +792,7 @@ describe('Type System: build schema from introspection', () => { ); expect(someInputObjectIntrospection).to.have.property('inputFields'); - - // $FlowExpectedError - delete someInputObjectIntrospection.inputFields; + delete (someInputObjectIntrospection: any).inputFields; expect(() => buildClientSchema(introspection)).to.throw( /Introspection result missing inputFields: { kind: "INPUT_OBJECT", name: "SomeInputObject", .* }\./, @@ -827,9 +807,7 @@ describe('Type System: build schema from introspection', () => { name: 'SomeDirective', locations: ['QUERY'], }); - - // $FlowExpectedError - delete someDirectiveIntrospection.locations; + delete (someDirectiveIntrospection: any).locations; expect(() => buildClientSchema(introspection)).to.throw( /Introspection result missing directive locations: { name: "SomeDirective", .* }\./, @@ -844,9 +822,7 @@ describe('Type System: build schema from introspection', () => { name: 'SomeDirective', args: [], }); - - // $FlowExpectedError - delete someDirectiveIntrospection.args; + delete (someDirectiveIntrospection: any).args; expect(() => buildClientSchema(introspection)).to.throw( /Introspection result missing directive args: { name: "SomeDirective", .* }\./, diff --git a/src/utilities/__tests__/extendSchema-test.js b/src/utilities/__tests__/extendSchema-test.js index 1c07359442..6cefd7cd61 100644 --- a/src/utilities/__tests__/extendSchema-test.js +++ b/src/utilities/__tests__/extendSchema-test.js @@ -1242,12 +1242,12 @@ describe('extendSchema', () => { it('Rejects invalid AST', () => { const schema = new GraphQLSchema({}); - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => extendSchema(schema, null)).to.throw( 'Must provide valid Document AST', ); - // $FlowExpectedError + // $FlowExpectedError[prop-missing] expect(() => extendSchema(schema, {})).to.throw( 'Must provide valid Document AST', ); diff --git a/src/utilities/__tests__/getOperationRootType-test.js b/src/utilities/__tests__/getOperationRootType-test.js index 0b5cfc08e5..cf11ac6e90 100644 --- a/src/utilities/__tests__/getOperationRootType-test.js +++ b/src/utilities/__tests__/getOperationRootType-test.js @@ -153,7 +153,7 @@ describe('getOperationRootType', () => { operation: 'non_existent_operation', }; - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => getOperationRootType(testSchema, operationNode)).to.throw( 'Can only have query, mutation and subscription operations.', ); diff --git a/src/utilities/__tests__/printSchema-test.js b/src/utilities/__tests__/printSchema-test.js index e90dc2b379..dfe7c870da 100644 --- a/src/utilities/__tests__/printSchema-test.js +++ b/src/utilities/__tests__/printSchema-test.js @@ -151,7 +151,7 @@ describe('Type System Printer', () => { }); expectPrintedSchema(schema).to.equal( - // $FlowFixMe + // $FlowFixMe[incompatible-call] dedent(String.raw` type Query { singleField(argOne: String = "tes\t de\fault"): String diff --git a/src/utilities/__tests__/stripIgnoredCharacters-test.js b/src/utilities/__tests__/stripIgnoredCharacters-test.js index cb8fd1a269..0d3e9257b1 100644 --- a/src/utilities/__tests__/stripIgnoredCharacters-test.js +++ b/src/utilities/__tests__/stripIgnoredCharacters-test.js @@ -99,14 +99,14 @@ function expectStripped(docString) { describe('stripIgnoredCharacters', () => { it('asserts that a source was provided', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => stripIgnoredCharacters()).to.throw( 'Must provide string or Source. Received: undefined.', ); }); it('asserts that a valid source was provided', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => stripIgnoredCharacters({})).to.throw( 'Must provide string or Source. Received: {}.', ); diff --git a/src/validation/__tests__/validation-test.js b/src/validation/__tests__/validation-test.js index bd32a219c7..4f37cf5d29 100644 --- a/src/validation/__tests__/validation-test.js +++ b/src/validation/__tests__/validation-test.js @@ -14,7 +14,7 @@ import { testSchema } from './harness'; describe('Validate: Supports full validation', () => { it('rejects invalid documents', () => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-call] expect(() => validate(testSchema, null)).to.throw('Must provide document.'); });