immutable-js: Error in the new version of flow 0.55

Library in version : immutable@4.0.0-rc.2

To get this error just run flow:

Error: node_modules/immutable/dist/immutable.js.flow:519
519:   static of<T>(...values: T[]): SetSeq<T>;
                                     ^^^^^^^^^ SetSeq. This type is incompatible with
383:   static of<T>(...values: T[]): IndexedSeq<T>;
                                     ^^^^^^^^^^^^^ IndexedSeq

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 29
  • Comments: 18 (4 by maintainers)

Commits related to this issue

Most upvoted comments

OK I could work around this issue without having to update to 4.0.0, which I can’t do ATM. Here are the instructions: https://gist.github.com/fabiomcosta/617ef69320a5539ab5cdc510b0b648af

It seems we have a local copy of the type definitions, so the change I made isn’t going to sync out (we should keep these in sync, but alas).

Any chance you can publish this as a third party definition in https://github.com/flowtype/flow-typed? I think this would make it a lot easier to work on flow types collaboratively (i.e for https://github.com/facebook/immutable-js/issues/1223).

Agreeing with @philipp-spiess here. Simply commenting out a line in node_modules seems like a pretty nasty work around, since every dev on the team will need to do this every time they download the project. Porting these flow types over to flow-typed will allow me to persist this to the repo more easily.

I think removing Seq.of is the right call, even though it’s breaking. It’s really just an alias for IndexedSeq.of and also a less commonly used API. Will include in the next release.

I’ve forked and pushed a branch to remove this line. Feel free to use my fork to get rid of the flow errors.

If you’re using yarn:

$ yarn add FormAPI/immutable-js#v3.8.1-flow-fix

Or add this line to your package.json:

"immutable": "FormAPI/immutable-js#v3.8.1-flow-fix"

I agree with @philipp-spiess and @duro, it would be good to either port these types to flow-typed so that it’s easier to fix them manually. But releasing a new version with the fix would be really nice.

@tanem Right. It seems we have a local copy of the type definitions, so the change I made isn’t going to sync out (we should keep these in sync, but alas).

I’m lazy, so I probably won’t submit a PR, but feel free to use my explanation above. You’re right on about removing that one line. It’s a breaking change, but I’m not sure how this project deals with that.

@fabiomcosta Thanks, that solved my problem!