Skip to content

fix: preserve function params type if possible#14694

Merged
nicolo-ribaudo merged 2 commits intobabel:mainfrom
magic-akari:fix/issue-14691
Jun 27, 2022
Merged

fix: preserve function params type if possible#14694
nicolo-ribaudo merged 2 commits intobabel:mainfrom
magic-akari:fix/issue-14691

Conversation

@magic-akari
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@magic-akari
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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