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 more arrow function annotations #161

Open
iccir opened this issue Nov 19, 2018 · 1 comment
Open

Support more arrow function annotations #161

iccir opened this issue Nov 19, 2018 · 1 comment

Comments

@iccir
Copy link
Member

iccir commented Nov 19, 2018

As of #160, we support annotations on arrow function parameters when parentheses are used:

_.each(arr, (foo: Foo) => {  });

let foo = (a: Foo, b: Foo) => { … };

We don't support the following annotations:

_.each(arr, item: TheItem => {  }); // Parameter with no parentheses

let foo = (a, b): Foo => { … }; // Return value

Ideally, we'd match TypeScript's support and allow all of the above.

@iccir
Copy link
Member Author

iccir commented Nov 19, 2018

I investigated this when trying to fix #159 and #160, but failed to come up with a safe solution for all cases. JavaScript's use of cover grammars (see section 5.1.4) make this a complex task - it's likely not worth the effort, but I wanted to document the issue.

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