Graphql-js: Flow errors from imported npm package in buildAstSchema

Created on 28 Nov 2018  ยท  9Comments  ยท  Source: graphql/graphql-js

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...

Most helpful comment

@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

Could you please release this change so we are not blocked on it? ๐Ÿ™‚

All 9 comments

The same for me, thanks for the workaround. I think it's already fixed, but not yet released - https://github.com/graphql/graphql-js/commit/0ea7b5192cd3e3f55352d276ece87a83add7c68b

The same for me, thanks for the workaround. I think it's already fixed, but not yet released - 0ea7b51

@alizhdanov Correct, you can test using this package:
https://github.com/graphql/graphql-js#want-to-ride-the-bleeding-edge

@mjmahone Can we release 14.1.0 as is to publish fix for this issue and #1518 ?
I think we can push all other planned items to 14.2.0.
What do you think?

I'd be happy pushing 14.2.0 this week. I'll try to ping @leebyron to make sure he's aware.

@mjmahone @leebyron It would be great to update tokens inside:
https://github.com/graphql/graphql-js/blob/97568af33516f189e50da7e8234f5799d4b4121b/.travis.yml#L44-L51
That way we will be able to do automatic releases and release bugfixes faster.

That way we will be able to do automatic releases and release bugfixes faster.

That would be nice. :-)

Seems like .89 was released but this is still broken?

@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

Could you please release this change so we are not blocked on it? ๐Ÿ™‚

@mjmahone just published 14.1.0 so this issue should be fully resolved.

And I see 14.1.1 fast-followed. Thanks!

Was this page helpful?
0 / 5 - 0 ratings