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

Flow: typed variable with generic arrow function value breaks syntax #480

Closed
CadenP opened this issue Feb 13, 2018 · 0 comments
Closed

Flow: typed variable with generic arrow function value breaks syntax #480

CadenP opened this issue Feb 13, 2018 · 0 comments

Comments

@CadenP
Copy link

CadenP commented Feb 13, 2018

Syntax seems to break when a variable is given a type and assigned to an arrow function which has a generic type and the generic type is not immediately followed by a colon (and a space or special/numeric character before the generic's type if there is one).

Not Working:

A type on the variable, and the generics of the function not having a type
Generic without a type

A type on the variable, and the generics of the function has a type, but no space around the colon.
Generic with a type without a separating space

A type on the variable, and the generics of the function having a type with a space before the colon (my personal preference).
Generic with a space before the colon and type

Unexpectedly Working [Bugs?]:

A type on the variable, and there's a colon in the function generics, but no type after the colon.
Generic with a colon but no type following

A type on the variable, and garbage following the colon in the function generics. I'm not really sure if this is a bad thing, but I am amused by it.
Generic with a bunch of special and numerical characters after the colon with no space before the colon

Working Expectedly:

A type on the variable, but there's a space after the colon in the generics and not before.
Generic with a space between the colon and type

No type on the variable, but keeping the function generics.
Generic but without the type on the variable itself

Summary:

Overall, it seems that it is requiring that a colon come immediately after the generic type, and any following character must be non-alpha. Otherwise it seems to think that it's a JSX tag that needs to close.

It does not appear to matter what order the colon and space/no-space appear with regard to the variable's type.

@gandm gandm closed this as completed in ec2084c Feb 13, 2018
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

1 participant