Skip to content

Improving Flow types #4410

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
jamiebuilds opened this issue Dec 8, 2016 · 4 comments · Fixed by #4567
Closed

Improving Flow types #4410

jamiebuilds opened this issue Dec 8, 2016 · 4 comments · Fixed by #4567

Comments

@jamiebuilds
Copy link

In files like https://github.com/vuejs/vue/blob/dev/flow/component.js there's a lot of uses of any, Object, and Function.

I'm currently improving the documentation around this in Flow, because we don't do a good enough job of explaining it right now. Sorry about that.

These types aren't actually type-safe. They are there for convenience purposes.

  • Instead of any you should use mixed (or a more specific type).
  • Instead of Function you should use (type, type) => type
  • Instead of Object you should use { prop: type } or { [key: type]: type } (for maps)

This will drastically improve user's experience with Vue using Flow.

@yyx990803
Copy link
Member

Yep, it could definitely use some improvements! The declarations were added mid-way when a pure ES codebase was already in place, so there are quite a few places I was just trying to get by. My Flow knowledge is also limited so I'd appreciate PRs.

@vinicius73
Copy link

@thejameskyle have you any link about using flow with vuejs?
i was try yesterday, but i was have much problems

@yyx990803 It would be great to have documentation like the one that was made for TS.

@MarkusToe
Copy link

Is currently someone working on this? If not I would like to try it.

@LinusBorg
Copy link
Member

@MarkusToe Thanks for offering to help! :) Currently we are not actively working on improving the typings - we only add/change stuff we find while working on other parts, fixing bugs etc.

So it would be great if you can improve the situation here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants