Skip to content

fix(ecma_parser) Allow arrow func without parenthesisised param in conditional for TS #4138

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

Merged

Conversation

williamtetlow
Copy link
Contributor

@williamtetlow williamtetlow commented Mar 23, 2022

Description:
Fixes #2174, #4067

In #3685 (comment) we removed TS support for arrow function without parenthesis on single param to match the behaviour of TSC.

As of microsoft/TypeScript#47550 TSC supports this syntax.

This PR adds support for syntax.

BREAKING CHANGE:

Related issue (if exists):

@williamtetlow williamtetlow changed the title fix(ecma_parser) Allow arrow func without parenthesisised param in ts fix(ecma_parser) Allow arrow func without parenthesisised param in conditional for TS Mar 23, 2022
@williamtetlow williamtetlow marked this pull request as ready for review March 23, 2022 19:22
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!


swc-bump:

  • swc_ecma_parser

@kdy1 kdy1 added this to the v1.2.161 milestone Mar 23, 2022
@kdy1 kdy1 enabled auto-merge (squash) March 23, 2022 21:57
Copy link
Collaborator

@swc-bot swc-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review comment generated by auto-rebase script

@kdy1 kdy1 merged commit ab4ea9f into swc-project:main Mar 23, 2022
@williamtetlow williamtetlow deleted the ts-parenth-less-arrow-func-in-conditional branch March 24, 2022 10:00
@dsherret
Copy link
Contributor

Thanks for fixing this, @williamtetlow!

@jakebailey
Copy link

FYI, we just reverted microsoft/TypeScript#47550 for TS 4.7 (in microsoft/TypeScript#48940), as it caused some unexpected breaks (with plans to solve it for real in 4.8). So, you my want to back this one out.

@williamtetlow
Copy link
Contributor Author

Ah yep we had the same bug 😆 we've fixed that case and one other on our side and haven't seen any other issues come in

@kdy1 I'll let you decide whether we pull this or leave it in seeing as it will be released in 4.8?

@kdy1
Copy link
Member

kdy1 commented May 5, 2022

I think it's better to revert this and #4302 for now

@williamtetlow
Copy link
Contributor Author

Cool I can submit PR later today

@kdy1
Copy link
Member

kdy1 commented May 5, 2022

Thank you!

I was busy due to the new minifier rule :)

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
5 participants