-
Notifications
You must be signed in to change notification settings - Fork 12.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
Re-exports of external modules with side effects are erased from ES5 targets #6835
Comments
The compiler omits the You can ensure that a side-effecting module with no exports is imported with a simple // all.ts
import './b';
import './c';
export {A} from './a'; |
@ahejlsberg Should importing the side effecting module export its declared ambient modules to consumers? In other words, should the augmentations to
Right now my workaround is to do this:
Is there a nicer way to do this? |
It works just with this: // all.ts
import './b';
import './c';
export {A} from './a'; The augmentations don't need to be exported, they behave as if they were written on |
@ahejlsberg Unfortunately this is not the behavior I'm seeing. When writing
As you can see, no trace of the augmentations or the modules they occur in has remained, so consumers of these typings will not be aware of |
that is true, we won't elide |
We should emit |
Re-exports of external modules with no public members are erased from the generated JS for ES5 targets. This causes problems in scenarios where the module is used to extend some class by patching the prototype (see #6213 and #6022).
The ultimate goal is to be able to do the following:
Once this is built and distributed as a set of JS and definition files, the user should be able to do:
Currently, this compiles without errors, but produces the following output for
all.js
:You can see that
./b
and./c
are not imported, which results in the prototype patches forA
being unavailable at runtime. The user will therefore get the following exception:Hopefully I'm not misusing the feature here.
The text was updated successfully, but these errors were encountered: