diff --git a/.flowconfig b/.flowconfig index 9be0cd2..497f3b5 100644 --- a/.flowconfig +++ b/.flowconfig @@ -29,8 +29,8 @@ unsafe-getters-setters=error unnecessary-optional-chain=error unnecessary-invariant=error signature-verification-failure=error -implicit-inexact-object=error -ambiguous-object-type=error +implicit-inexact-object=off +ambiguous-object-type=off uninitialized-instance-property=error unsafe-addition=error @@ -39,6 +39,7 @@ include_warnings=true module.use_strict=true babel_loose_array_spread=true esproposal.optional_chaining=enable +exact_by_default=true [version] ^0.127.0 diff --git a/src/connection/arrayconnection.js b/src/connection/arrayconnection.js index 8af688a..5aba906 100644 --- a/src/connection/arrayconnection.js +++ b/src/connection/arrayconnection.js @@ -8,10 +8,10 @@ import type { ConnectionCursor, } from './connectiontypes'; -type ArraySliceMetaInfo = {| +type ArraySliceMetaInfo = { sliceStart: number, arrayLength: number, -|}; +}; /** * A simple function that accepts an array and connection arguments, and returns diff --git a/src/connection/connection.js b/src/connection/connection.js index d22ea9c..32b516c 100644 --- a/src/connection/connection.js +++ b/src/connection/connection.js @@ -51,19 +51,19 @@ export const connectionArgs: GraphQLFieldConfigArgumentMap = { ...backwardConnectionArgs, }; -type ConnectionConfig = {| +type ConnectionConfig = { name?: ?string, nodeType: GraphQLObjectType, resolveNode?: ?GraphQLFieldResolver, resolveCursor?: ?GraphQLFieldResolver, edgeFields?: ?Thunk>, connectionFields?: ?Thunk>, -|}; +}; -type GraphQLConnectionDefinitions = {| +type GraphQLConnectionDefinitions = { edgeType: GraphQLObjectType, connectionType: GraphQLObjectType, -|}; +}; function resolveMaybeThunk(thingOrThunk: Thunk): T { return typeof thingOrThunk === 'function' diff --git a/src/connection/connectiontypes.js b/src/connection/connectiontypes.js index 5c10a70..6f2d09d 100644 --- a/src/connection/connectiontypes.js +++ b/src/connection/connectiontypes.js @@ -8,28 +8,28 @@ export type ConnectionCursor = string; /** * A flow type designed to be exposed as `PageInfo` over GraphQL. */ -export type PageInfo = {| +export type PageInfo = { startCursor: ?ConnectionCursor, endCursor: ?ConnectionCursor, hasPreviousPage: ?boolean, hasNextPage: ?boolean, -|}; +}; /** * A flow type designed to be exposed as a `Connection` over GraphQL. */ -export type Connection = {| +export type Connection = { edges: Array>, pageInfo: PageInfo, -|}; +}; /** * A flow type designed to be exposed as a `Edge` over GraphQL. */ -export type Edge = {| +export type Edge = { node: T, cursor: ConnectionCursor, -|}; +}; /** * A flow type describing the arguments a connection field receives in GraphQL. diff --git a/src/mutation/mutation.js b/src/mutation/mutation.js index 6fd59b1..0f39148 100644 --- a/src/mutation/mutation.js +++ b/src/mutation/mutation.js @@ -42,14 +42,14 @@ function resolveMaybeThunk(thingOrThunk: Thunk): T { * input field, and it should return an Object with a key for each * output field. It may return synchronously, or return a Promise. */ -type MutationConfig = {| +type MutationConfig = { name: string, description?: string, deprecationReason?: string, inputFields: Thunk, outputFields: Thunk>, mutateAndGetPayload: MutationFn, -|}; +}; /** * Returns a GraphQLFieldConfig for the mutation described by the diff --git a/src/node/node.js b/src/node/node.js index ba54940..8dff2fd 100644 --- a/src/node/node.js +++ b/src/node/node.js @@ -15,11 +15,11 @@ import type { import { base64, unbase64 } from '../utils/base64'; -type GraphQLNodeDefinitions = {| +type GraphQLNodeDefinitions = { nodeInterface: GraphQLInterfaceType, nodeField: GraphQLFieldConfig, nodesField: GraphQLFieldConfig, -|}; +}; /** * Given a function to map from an ID to an underlying object, and a function @@ -77,10 +77,10 @@ export function nodeDefinitions( return { nodeInterface, nodeField, nodesField }; } -type ResolvedGlobalId = {| +type ResolvedGlobalId = { type: string, id: string, -|}; +}; /** * Takes a type name and an ID specific to that type name, and returns a diff --git a/src/node/plural.js b/src/node/plural.js index d992f50..b0623d7 100644 --- a/src/node/plural.js +++ b/src/node/plural.js @@ -9,7 +9,7 @@ import type { GraphQLResolveInfo, } from 'graphql'; -type PluralIdentifyingRootFieldConfig = {| +type PluralIdentifyingRootFieldConfig = { argName: string, inputType: GraphQLInputType, outputType: GraphQLOutputType, @@ -19,7 +19,7 @@ type PluralIdentifyingRootFieldConfig = {| info: GraphQLResolveInfo, ) => ?any, description?: ?string, -|}; +}; export function pluralIdentifyingRootField( config: PluralIdentifyingRootFieldConfig,