-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
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
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue