Skip to content

Flow 0.50.0 throws errors in kefir #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
EvHaus opened this issue Jul 14, 2017 · 4 comments
Closed

Flow 0.50.0 throws errors in kefir #245

EvHaus opened this issue Jul 14, 2017 · 4 comments

Comments

@EvHaus
Copy link

EvHaus commented Jul 14, 2017

After upgrading to Flow 0.50.0 I am now getting the following Flow errors coming from kefir:

node_modules/kefir/dist/kefir.js.flow:40
 40:     next?: (value: V) => any,
                        ^ V. invariant position (expected `V` to occur only covariantly)

node_modules/kefir/dist/kefir.js.flow:41
 41:     error?: (error: E) => any,
                         ^ E. invariant position (expected `E` to occur only covariantly)

node_modules/kefir/kefir.js.flow:40
 40:     next?: (value: V) => any,
                        ^ V. invariant position (expected `V` to occur only covariantly)

node_modules/kefir/kefir.js.flow:41
 41:     error?: (error: E) => any,
                         ^ E. invariant position (expected `E` to occur only covariantly)
@mAAdhaTTah
Copy link
Collaborator

There are two articles about this on Flowtype that should help here:

https://flow.org/en/docs/lang/variance/
https://flow.org/en/docs/lang/depth-subtyping/

I think the functions may just need to add + to the generics passed into them.

@rpominov
Copy link
Member

rpominov commented Jul 14, 2017

I have a fix in #246 , but not sure if it's correct. As far as I understand Flow thinks that this code is unsafe because subscribe() may mutate passed object, and I've tricked Flow to think that It's alright using interface.

See also facebook/flow#2354

/cc @hallettj @agentme

@Macil
Copy link
Collaborator

Macil commented Jul 15, 2017

Yeahh variance errors are fun. I think that pull request looks right.

@rpominov
Copy link
Member

Ok, probably should merge it.

rpominov added a commit that referenced this issue Jul 17, 2017
* master:
  cleanup repository after release
  3.7.3
  update changelog
  Fix #245 (#246)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants