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

Destructured params in TS arrow function types cause a crash #277

Closed
alangpierce opened this issue Jun 26, 2018 · 0 comments
Closed

Destructured params in TS arrow function types cause a crash #277

alangpierce opened this issue Jun 26, 2018 · 0 comments
Assignees

Comments

@alangpierce
Copy link
Owner

This TypeScript code crashes both Babel and Sucrase, but works in tsc:

const f: ({a}: {a: number}) => void = () => {};

Playground link

A workaround is to simply avoid the destructure, like defining the type as (args: {a: number}) => void, since the destructure doesn't do anything.

@alangpierce alangpierce self-assigned this Jun 26, 2018
alangpierce added a commit that referenced this issue Jun 27, 2018
Fixes #277

There's a decision point on whether the upcoming type is a function type or not,
and it wasn't considering destructured params.
alangpierce added a commit that referenced this issue Jun 27, 2018
Fixes #277

There's a decision point on whether the upcoming type is a function type or not,
and it wasn't considering destructured params.
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