Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

Add type annotations to arrow-parens "as-needed" #44

Merged
merged 1 commit into from
Jan 22, 2016
Merged

Add type annotations to arrow-parens "as-needed" #44

merged 1 commit into from
Jan 22, 2016

Conversation

ssorallen
Copy link
Contributor

When using optional type annotations, parentheses are required even for
single-argument arrow functions. Check for a typeAnnotation on the
single param and allow parentheses if it exists.

// good with "as-needed"
a => 5;
(a: string) => 5; // Previously this reported an error

// bad with "as-needed"
(a) => 5;

When using optional type annotations, parentheses are required even for
single-argument arrow functions. Check for a `typeAnnotation` on the
single param and allow parentheses if it exists.

    // good with "as-needed"
    a => 5;
    (a: string) => 5; // Previously this reported an error

    // bad with "as-needed"
    (a) => 5;
@ssorallen
Copy link
Contributor Author

🐼 Anything I can do to help on this? We annotate all of our code, and we aren't able to enable this rule because it currently doesn't inspect the typeAnnotation.

@jquense
Copy link
Contributor

jquense commented Jan 22, 2016

thanks for the ping and PR :)

jquense added a commit that referenced this pull request Jan 22, 2016
Add type annotations to arrow-parens "as-needed"
@jquense jquense merged commit d29a9e8 into babel:master Jan 22, 2016
@ssorallen
Copy link
Contributor Author

@jquense Thanks!

@ssorallen ssorallen deleted the arrow-type-annotations branch January 22, 2016 02:03
@ssorallen
Copy link
Contributor Author

@jquense Any chance of a release? Looks like the last one was in November, and there have been several changes since then: v3.0.0...master

nicolo-ribaudo pushed a commit to babel/babel that referenced this pull request Nov 14, 2019
…type-annotations

Add type annotations to arrow-parens "as-needed"
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants