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

fix: preserve function params type if possible #14694

Merged
merged 2 commits into from Jun 27, 2022
Merged

fix: preserve function params type if possible #14694

merged 2 commits into from Jun 27, 2022

Conversation

magic-akari
Copy link
Contributor

@magic-akari magic-akari commented Jun 26, 2022

Q                       A
Fixed Issues? Fixes #14691
Patch: Bug Fix? 👍
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@liuxingbaoyu liuxingbaoyu added PR: Bug Fix 🐛 A type of pull request used for our changelog categories area: typescript labels Jun 26, 2022
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

I dislike hard-coding TS/Flow AST info in "plain JS" plugins, but until we have something like #9545 this is the best we can do.

@nicolo-ribaudo
Copy link
Member

Can you also add a test for function point({ x, y }: Point = {})?

@magic-akari
Copy link
Contributor Author

Can you also add a test for function point({ x, y }: Point = {})?

Sure. I dont' think there is anything to do if the function parameter doesn't exist.
Or should we add a param placeholder? not a good idea.

@magic-akari
Copy link
Contributor Author

Since the function param with default value does not count in function length, we should never add param placeholder for it.

@nicolo-ribaudo
Copy link
Member

Oh right, I don't know what I was thinking

@nicolo-ribaudo nicolo-ribaudo merged commit 767c7b4 into babel:main Jun 27, 2022
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Sep 27, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Destructurisation transformation loses typescript types
3 participants