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

Support for flow types #1216

Closed
martin-badin opened this issue Nov 2, 2017 · 3 comments
Closed

Support for flow types #1216

martin-badin opened this issue Nov 2, 2017 · 3 comments

Comments

@martin-badin
Copy link

martin-badin commented Nov 2, 2017

Hello,

please add support for flow types. Webpage is here.

Examples

type CustomType = {
    n: string,
    n2: Array<string>,
    ...
};

(n: string | boolean | number | Function | Object | any)
(n: { [string]:string })
(n: Array<string>)
(n: CustomType)

image

image

Thank you

@Golmote
Copy link
Contributor

Golmote commented Nov 5, 2017

Hi. This looks quite tedious... Flow syntax allows many many things, and it appears to be quite hard to highlight those precisely without breaking some of the normal JS highlighting.

The best I managed to come up with is the following:

The component would only highlight these types:

  • number, Number
  • string, String
  • boolean, Boolean
  • Function
  • any, mixed, null and void

It would highlight these keywords:

  • type, opaque, declare, Class
  • $await, $Diff, $Exact, $Keys, $ObjMap, $PropertyType, $Shape, $Record, $Supertype, $Subtype, $Enum

It would highlight {| and |} as punctuation.

It would not highlight generic types, or custom types.

Here is what it would look like (those are examples from the documentation):

capture d ecran 2017-11-05 a 16 46 56

Would it be good enough?

@martin-badin
Copy link
Author

Hi, good, it should be enough.

@Golmote
Copy link
Contributor

Golmote commented Nov 11, 2017

Just added support for Flow ;)

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

2 participants