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

Do not register ambient classes to the TS scope #10352

Merged
merged 2 commits into from Aug 20, 2019

Conversation

nicolo-ribaudo
Copy link
Member

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

This is what we already did for ambient functions, since they
follow complex rules regarding declaration merging.
This changes effectively disables duplicate declaration errors
about ambitent classes. While it's not exactly the TypeScript
compiler's behavior, is a close enough approximation which
makes it easy for us to allow ambient classes to merge with
function declarations.

This is what we already did for ambient functions, since they
follow complex rules regarding declaration merging.
This changes effectively disables duplicate declaration errors
about ambitent classes. While it's not exactly the TypeScript
compiler's behavior, is a close enough approximation which
makes it easy for us to allow ambient classes to merge with
function declarations.
@nicolo-ribaudo nicolo-ribaudo added PR: New Feature 🚀 A type of pull request used for our changelog categories pkg: parser area: typescript spec-update labels Aug 17, 2019
@babel-bot
Copy link
Collaborator

babel-bot commented Aug 17, 2019

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

Copy link
Member

@Jessidhia Jessidhia left a comment

Choose a reason for hiding this comment

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

Sounds good to me.

This will unintentionally accept declare class C {}; declare class C {} as well but that shouldn't be a big deal.

@nicolo-ribaudo
Copy link
Member Author

This will unintentionally accept declare class C {}; declare class C {} as well but that shouldn't be a big deal.

Yeah, I think that even if we don't throw for all the invalid TS programs it's ok, since people will also use tsc to type check anyway.

@existentialism existentialism merged commit 15aa511 into babel:master Aug 20, 2019
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 pkg: parser PR: New Feature 🚀 A type of pull request used for our changelog categories spec-update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ambient classes and functions (concrete or ambient) can merge in TypeScript 3.6
5 participants