Skip to content

Improving Flow types #4410

Closed
Closed
@jamiebuilds

Description

@jamiebuilds

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions