-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Do not register ambient classes to the TS scope #10352
Conversation
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.
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11344/ |
There was a problem hiding this 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.
Yeah, I think that even if we don't throw for all the invalid TS programs it's ok, since people will also use |
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.