Skip to content

Flow errors from imported npm package in buildAstSchema #1586

Closed
@TxHawks

Description

@TxHawks

Using graphql-js version 14.0.2 and Flow version 0.87.0, Flow throws the following errors:

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/graphql/utilities/buildASTSchema.js.flow:363:9

Missing type annotation for V. V is a type parameter declared in function [1] and was implicitly
instantiated at call of keyValMap [2].

     node_modules/graphql/utilities/buildASTSchema.js.flow
     360│     def: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode,
     361│   ) {
     362│     return def.fields
 [2] 363│       ? keyValMap(
     364│           def.fields,
     365│           field => field.name.value,
     366│           field => this.buildField(field),
     367│         )
     368│       : {};
     369│   }
     370│

     node_modules/graphql/jsutils/keyValMap.js.flow
 [1]  29│ export default function keyValMap<T, V>(
      30│   list: $ReadOnlyArray<T>,
      31│   keyFn: (item: T) => string,
      32│   valFn: (item: T) => V,
      33│ ): ObjMap<V> {


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/graphql/utilities/buildASTSchema.js.flow:372:12

Missing type annotation for V. V is a type parameter declared in function [1] and was implicitly
instantiated at call of keyValMap [2].

     node_modules/graphql/utilities/buildASTSchema.js.flow
     369│   }
     370│
     371│   _makeInputValues(values: $ReadOnlyArray<InputValueDefinitionNode>) {
 [2] 372│     return keyValMap(
     373│       values,
     374│       value => value.name.value,
     375│       value => this.buildInputField(value),
     376│     );
     377│   }
     378│
     379│   _makeInterfaceDef(def: InterfaceTypeDefinitionNode) {

     node_modules/graphql/jsutils/keyValMap.js.flow
 [1]  29│ export default function keyValMap<T, V>(
      30│   list: $ReadOnlyArray<T>,
      31│   keyFn: (item: T) => string,
      32│   valFn: (item: T) => V,
      33│ ): ObjMap<V> {


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/graphql/utilities/buildASTSchema.js.flow:399:9

Missing type annotation for V. V is a type parameter declared in function [1] and was implicitly
instantiated at call of keyValMap [2].

     node_modules/graphql/utilities/buildASTSchema.js.flow
     396│
     397│   _makeValueDefMap(def: EnumTypeDefinitionNode) {
     398│     return def.values
 [2] 399│       ? keyValMap(
     400│           def.values,
     401│           enumValue => enumValue.name.value,
     402│           enumValue => this.buildEnumValue(enumValue),
     403│         )
     404│       : {};
     405│   }
     406│

     node_modules/graphql/jsutils/keyValMap.js.flow
 [1]  29│ export default function keyValMap<T, V>(
      30│   list: $ReadOnlyArray<T>,
      31│   keyFn: (item: T) => string,
      32│   valFn: (item: T) => V,
      33│ ): ObjMap<V> {

As a quick fix, I've added .*/node_modules/graphql/jsutils/keyValMap.js.flow to my .flowconfig, but this is far from ideal...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions