7e33cb9626
When a class with a custom decorator is transpiled to ES5, it looks something like this: ``` var SomeClass = (function() { function SomeClass() {...}; var SomeClass_1 = __decorate([Decorator()], SomeClass); SomeClass = SomeClass_1; return SomeClass; })(); ``` The problem is that if the class also has an Angular decorator that refers to the class itself (e.g. `{provide: someToken, useClass: SomeClass}`), the generated `setClassMetadata` code will be emitted after the IIFE, but will still refer to the intermediate `SomeClass_1` variable from inside the IIFE. This happens, because we generate the `setClassMetadata` call directly from the source AST which contains identifiers that TS will rename when it emits the ES5 code. These changes resolve the issue by looking through the metadata AST and cloning any `Identifier` that is referring to the class. Since TS doesn't have references to the clone, it won't rename it when transpiling to ES5. Fixes #39509. PR Close #39527 |
||
---|---|---|
.. | ||
animations | ||
bazel | ||
benchpress | ||
common | ||
compiler | ||
compiler-cli | ||
core | ||
docs | ||
elements | ||
examples | ||
forms | ||
language-service | ||
localize | ||
misc/angular-in-memory-web-api | ||
platform-browser | ||
platform-browser-dynamic | ||
platform-server | ||
private/testing | ||
router | ||
service-worker | ||
upgrade | ||
zone.js | ||
BUILD.bazel | ||
README.md | ||
circular-deps-test.conf.js | ||
empty.ts | ||
goog.d.ts | ||
license-banner.txt | ||
system.d.ts | ||
tsconfig-build-no-strict.json | ||
tsconfig-build.json | ||
tsconfig-test.json | ||
tsconfig.json | ||
types.d.ts |
README.md
Angular
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT