Skip to content
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

correctly expose flow typings #1254

Merged

Conversation

halbgut
Copy link
Contributor

@halbgut halbgut commented Nov 25, 2017

With this PR consumers can use the Flow type definitions without needing any configuration.

@halbgut halbgut changed the title correctly expose flow typings #1232 correctly expose flow typings Nov 25, 2017
@halbgut
Copy link
Contributor Author

halbgut commented Nov 25, 2017

Apparently references don't work in titles... #1232

@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.686% when pulling 7b31f96 on Kriegslustig:feature/correctly-expose-flow-typings into c6bd40c on mobxjs:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.686% when pulling 12c5b2c on Kriegslustig:feature/correctly-expose-flow-typings into c6bd40c on mobxjs:master.

@mweststrate
Copy link
Member

@Kriegslustig just double check: you verified this will work when installing the package and import stuff using import { x } from "mobx"?

@halbgut
Copy link
Contributor Author

halbgut commented Dec 4, 2017

Yes, this works. With one caveat though, consumers will need to remove MobX from flow config [libs] section. I will update the README accordingly.

--- a/.flowconfig
+++ b/.flowconfig
@@ -5,7 +5,6 @@
 [include]
 
 [libs]
-./node_modules/mobx/lib/mobx.js.flow
 /flow-typed
 
 [options]

@halbgut
Copy link
Contributor Author

halbgut commented Dec 4, 2017

I documented it in the README. Should I also write something into the changelog?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.686% when pulling 548ce0c on Kriegslustig:feature/correctly-expose-flow-typings into c6bd40c on mobxjs:master.

@mweststrate
Copy link
Member

@Kriegslustig yep, please put it in the changelog.md as well :)

@halbgut
Copy link
Contributor Author

halbgut commented Dec 4, 2017

done 👍

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 94.649% when pulling b14f7e9 on Kriegslustig:feature/correctly-expose-flow-typings into c6bd40c on mobxjs:master.

@mweststrate
Copy link
Member

Thanks! Merged and will release soon as 3.4.0

@mweststrate mweststrate merged commit a15a8d0 into mobxjs:master Dec 4, 2017
@zhaocnus
Copy link

zhaocnus commented Dec 29, 2017

@Kriegslustig, @mweststrate:

I think a lot of people might accidentally update MobX from v3.3.3 to v3.4.0 (by just removing and reinstalling all the node_modules). If they do that but they still use MobX's flow type definition based on the old README, they will get a ton of flow errors.

I have a blog post to explain this: https://medium.com/@xiaoyangzhao/mobx-and-flow-typed-1d411a7b47fb

Maybe we need to provide more info in the readme?

@halbgut
Copy link
Contributor Author

halbgut commented Dec 29, 2017

@zhaocnus have you read the changelog? Maybe we can extend this information, if it's not sufficient.

@zhaocnus
Copy link

@Kriegslustig Yes I think extending the information will be helpful (especially for people who are not an expert in flow). But it not necessary.

I did check the changelog but I wish I have seen it earlier :)

This is how I encountered the issue:

  1. I did a refresh install of all my node modules (removed node_modules folder and package-lock.json, and run npm i). I have "mobx": "^3.2.2", in my package.json. npm i installed mobx 3.4.1.
  2. I still have node_modules/mobx/lib/mobx.js.flow in .flowconfig

So this exposes all the mobx type definitions to the global scope, and flow throws a lot of errors. It took me a while to figure the issue. I hope I could have checked the README and changelog earlier.

So I figure adding some more info might save other people's time later.

@mweststrate
Copy link
Member

mweststrate commented Dec 29, 2017 via email

@zhaocnus
Copy link

@mweststrate Thanks for the tip! I've learned my lesson. I will create a PR.

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

Successfully merging this pull request may close these issues.

4 participants