Bug Report
The TypeScript code
class Example {
constructor(private A: string) {
"ngInject";
}
}
when compiled with TS 4.6.2 yields:
"use strict";
class Example {
constructor(A) {
this.A = A;
"ngInject";
"ngInject";
}
}
when compiled with TS 4.5.5 yields:
"use strict";
class Example {
constructor(A) {
"ngInject";
this.A = A;
}
}
The differences are:
- the string
"ngInject;" is repeated
- the string appears after the constructor assignment, not before as in 4.5.
For our use case, the repetition is probably not a real problem, however the re-ordering is. If any of these two are by design now, we can work around - but I wanted to double check with the TypeScript developers because it seems to be a bit unexpected.
🕗 Version & Regression Information
We observed errors in a AngularJS-based project using ng-annotate-patched which relies on the string to annotate classes for AngularJS. It works wiht TS 4.5 and broke with TS 4.6.
TS 4.6.2 (broken)
TS 4.5.5 (good)
⏯ Playground Link
https://www.typescriptlang.org/play?removeComments=true&target=2&ts=4.5.5#code/MYGwhgzhAECiAeYC2AHEBTaBvAUASGAHsA7CAFwCcBXYMwigChQoEsA3MMzAQQC5pyrYgHMAlNnx4ARCICSxAFbpaUgNz4Avji1A
Bug Report
The TypeScript code
when compiled with TS 4.6.2 yields:
when compiled with TS 4.5.5 yields:
The differences are:
"ngInject;"is repeatedFor our use case, the repetition is probably not a real problem, however the re-ordering is. If any of these two are by design now, we can work around - but I wanted to double check with the TypeScript developers because it seems to be a bit unexpected.
🕗 Version & Regression Information
We observed errors in a AngularJS-based project using
ng-annotate-patchedwhich relies on the string to annotate classes for AngularJS. It works wiht TS 4.5 and broke with TS 4.6.TS 4.6.2 (broken)
TS 4.5.5 (good)
⏯ Playground Link
https://www.typescriptlang.org/play?removeComments=true&target=2&ts=4.5.5#code/MYGwhgzhAECiAeYC2AHEBTaBvAUASGAHsA7CAFwCcBXYMwigChQoEsA3MMzAQQC5pyrYgHMAlNnx4ARCICSxAFbpaUgNz4Avji1A