You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compiler elides import of identifier that is referenced in emitted code. #6003
(Compiled with target=ES6, module=commonjs, noEmitHelpers=true).
The BluebirdPromise import has been elided in the generated code, resulting in "ReferenceError: BluebirdPromise is not defined" at runtime.
The elision occurs because BluebirdPromise only appears in a type position which up until v1.7 meant that the compiler could safely elide it. But the compiler now emits this type annotation into the JavaScript output so that elision assumption is no longer safe.
IMO the problem here is not the elision logic, its the fact that the compiler now emits code that depends on type annotaitons, so the type system no longer enjoys the quality of being fully erasable, which I understood to be a core design principle of the language. I thought the idea of using type annotations to change runtime behaviour would have been smacked down by Anders Hejlsberg (@ahejlsberg) and the team before it got into production.
Regardless of that contended side-topic, I believe this is a bug.
Activity
mhegazy commentedon Dec 9, 2015
this is duplicate of #5998, it has since been fixed in master. please try
typescript@nextand let us know if you are still running into other issues.