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

chore: Remove meaningless typeof undefined #15395

Merged
merged 1 commit into from Feb 2, 2023

Conversation

liuxingbaoyu
Copy link
Member

@liuxingbaoyu liuxingbaoyu commented Feb 2, 2023

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

#15379
I found in #15379 that typeof undefined is equivalent to any, which doesn't seem to make sense, let's remove them.

@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/53835/

@ehoogeveen-medweb
Copy link
Contributor

ehoogeveen-medweb commented Feb 2, 2023

Yeah, I guess because undefined is a property of the global object, typeof undefined (in a position where a type is expected) is getting the type of that property, which is any or unknown. But undefined is also a primitive value and one of TypeScript's built-in types, so using undefined by itself does the right thing.

@nicolo-ribaudo nicolo-ribaudo merged commit 91b24d5 into babel:main Feb 2, 2023
@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 May 5, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants