Flow errors from imported npm package in buildAstSchema
See original GitHub issueUsing 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…
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Don't typecheck or load files under node_modules/ unless ...
Go with the default settings so that imported npm modules get detected correctly, but see lots of flow errors from other packages that...
Read more >How to Remove Flow Issues in Node Modules? | by BlueEast
To remove these errors, follow the these steps. Here's What You Do Next:- Open the terminal and access the root folder of project....
Read more >Flow erroring "cant resolve module" when importing node ...
Now every module I import results in an error where flow says it can't resolve it, hence leading me to think this is...
Read more >flow-bin - npm
flow -bin. Binary wrapper for Flow - A static type checker for JavaScript. macOS (x64), Linux (x64, arm64) and Windows ( ...
Read more >flow-remove-types - npm
Start using flow-remove-types in your project by running `npm i ... import SomeClass from 'some-module' import type { SomeInterface } from ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@mjmahone @leebyron Can you please update NPM token so we can release RC?
Currently we block Flow users from updating Flow. More recent example: https://github.com/graphql/graphql-js/commit/4cdc8e2a283e5e551cc462fbd00b0ce01c9126af#commitcomment-31933578
And I see 14.1.1 fast-followed. Thanks!