From 0d1cdc152e3750e19f919cb396422c115a7ac0c6 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Sun, 30 Jun 2019 22:36:07 +0300 Subject: [PATCH] Flow: Switch to explicit inexact objects --- .flowconfig | 2 +- src/__tests__/http-test.js | 2 +- src/index.js | 10 +++++----- src/parseBody.js | 2 +- src/renderGraphiQL.js | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.flowconfig b/.flowconfig index 21db7ece..3688a306 100644 --- a/.flowconfig +++ b/.flowconfig @@ -37,7 +37,7 @@ deprecated-utility=error dynamic-export=off unsafe-getters-setters=error inexact-spread=error -implicit-inexact-object=off +implicit-inexact-object=error unnecessary-optional-chain=error unnecessary-invariant=error diff --git a/src/__tests__/http-test.js b/src/__tests__/http-test.js index d7260f6c..2bf94a78 100644 --- a/src/__tests__/http-test.js +++ b/src/__tests__/http-test.js @@ -59,7 +59,7 @@ const TestSchema = new GraphQLSchema({ }), }); -function urlString(urlParams?: ?{ [param: string]: mixed }) { +function urlString(urlParams?: ?{ [param: string]: mixed, ... }) { let string = '/graphql'; if (urlParams) { string += '?' + stringify(urlParams); diff --git a/src/index.js b/src/index.js index ffd6dd35..14ddda95 100644 --- a/src/index.js +++ b/src/index.js @@ -115,7 +115,7 @@ export type OptionsData = {| * * This function may be async. */ - extensions?: ?(info: RequestInfo) => { [key: string]: mixed }, + extensions?: ?(info: RequestInfo) => { [key: string]: mixed, ... }, /** * A boolean to optionally enable GraphiQL mode. @@ -150,7 +150,7 @@ export type RequestInfo = {| /** * The variable values used at runtime. */ - variables: ?{ +[name: string]: mixed }, + variables: ?{ +[name: string]: mixed, ... }, /** * The (optional) operation name requested. @@ -435,7 +435,7 @@ function graphqlHTTP(options: Options): Middleware { export type GraphQLParams = {| query: ?string, - variables: ?{ +[name: string]: mixed }, + variables: ?{ +[name: string]: mixed, ... }, operationName: ?string, raw: ?boolean, |}; @@ -456,8 +456,8 @@ async function getGraphQLParams(request: $Request): Promise { * Helper function to get the GraphQL params from the request. */ function parseGraphQLParams( - urlData: { [param: string]: mixed }, - bodyData: { [param: string]: mixed }, + urlData: { [param: string]: mixed, ... }, + bodyData: { [param: string]: mixed, ... }, ): GraphQLParams { // GraphQL Query string. let query = urlData.query || bodyData.query; diff --git a/src/parseBody.js b/src/parseBody.js index 4a58b961..d84923ce 100644 --- a/src/parseBody.js +++ b/src/parseBody.js @@ -14,7 +14,7 @@ import { type $Request } from 'express'; */ export async function parseBody( req: $Request, -): Promise<{ [param: string]: mixed }> { +): Promise<{ [param: string]: mixed, ... }> { const body = req.body; // If express has already parsed a body as a keyed object, use it. diff --git a/src/renderGraphiQL.js b/src/renderGraphiQL.js index 1d74bf95..62345446 100644 --- a/src/renderGraphiQL.js +++ b/src/renderGraphiQL.js @@ -2,7 +2,7 @@ type GraphiQLData = {| query: ?string, - variables: ?{ +[name: string]: mixed }, + variables: ?{ +[name: string]: mixed, ... }, operationName: ?string, result?: mixed, options: GraphiQLOptions,