Skip to content

Commit ea7c7d3

Browse files
Merge pull request #16631 from Microsoft/fix13721
Emit class annotation comment on downlevel classes
2 parents d03d107 + 660a63d commit ea7c7d3

File tree

3,603 files changed

+7534
-7524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,603 files changed

+7534
-7524
lines changed

src/compiler/transformers/es2015.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ namespace ts {
840840
outer.end = skipTrivia(currentText, node.pos);
841841
setEmitFlags(outer, EmitFlags.NoComments);
842842

843-
return createParen(
843+
const result = createParen(
844844
createCall(
845845
outer,
846846
/*typeArguments*/ undefined,
@@ -849,6 +849,8 @@ namespace ts {
849849
: []
850850
)
851851
);
852+
addSyntheticLeadingComment(result, SyntaxKind.MultiLineCommentTrivia, "* @class ");
853+
return result;
852854
}
853855

854856
/**

tests/baselines/reference/2dArrays.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ class Board {
1616
}
1717

1818
//// [2dArrays.js]
19-
var Cell = (function () {
19+
var Cell = /** @class */ (function () {
2020
function Cell() {
2121
}
2222
return Cell;
2323
}());
24-
var Ship = (function () {
24+
var Ship = /** @class */ (function () {
2525
function Ship() {
2626
}
2727
return Ship;
2828
}());
29-
var Board = (function () {
29+
var Board = /** @class */ (function () {
3030
function Board() {
3131
}
3232
Board.prototype.allShipsSunk = function () {

tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000
2525
//// [classPoint.js]
2626
var A;
2727
(function (A) {
28-
var Point = (function () {
28+
var Point = /** @class */ (function () {
2929
function Point(x, y) {
3030
this.x = x;
3131
this.y = y;

tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,42 +51,42 @@ module clodule4 {
5151

5252
//// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js]
5353
// all expected to be errors
54-
var clodule1 = (function () {
54+
var clodule1 = /** @class */ (function () {
5555
function clodule1() {
5656
}
5757
return clodule1;
5858
}());
5959
(function (clodule1) {
6060
function f(x) { }
6161
})(clodule1 || (clodule1 = {}));
62-
var clodule2 = (function () {
62+
var clodule2 = /** @class */ (function () {
6363
function clodule2() {
6464
}
6565
return clodule2;
6666
}());
6767
(function (clodule2) {
6868
var x;
69-
var D = (function () {
69+
var D = /** @class */ (function () {
7070
function D() {
7171
}
7272
return D;
7373
}());
7474
})(clodule2 || (clodule2 = {}));
75-
var clodule3 = (function () {
75+
var clodule3 = /** @class */ (function () {
7676
function clodule3() {
7777
}
7878
return clodule3;
7979
}());
8080
(function (clodule3) {
8181
clodule3.y = { id: T };
8282
})(clodule3 || (clodule3 = {}));
83-
var clodule4 = (function () {
83+
var clodule4 = /** @class */ (function () {
8484
function clodule4() {
8585
}
8686
return clodule4;
8787
}());
8888
(function (clodule4) {
89-
var D = (function () {
89+
var D = /** @class */ (function () {
9090
function D() {
9191
}
9292
return D;

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module clodule {
1616

1717

1818
//// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js]
19-
var clodule = (function () {
19+
var clodule = /** @class */ (function () {
2020
function clodule() {
2121
}
2222
clodule.fn = function (id) { };

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module clodule {
1616

1717

1818
//// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js]
19-
var clodule = (function () {
19+
var clodule = /** @class */ (function () {
2020
function clodule() {
2121
}
2222
clodule.fn = function (id) { };

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module clodule {
1616

1717

1818
//// [ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js]
19-
var clodule = (function () {
19+
var clodule = /** @class */ (function () {
2020
function clodule() {
2121
}
2222
clodule.sfn = function (id) { return 42; };

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module A {
2323
}
2424

2525
//// [ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js]
26-
var Point = (function () {
26+
var Point = /** @class */ (function () {
2727
function Point(x, y) {
2828
this.x = x;
2929
this.y = y;
@@ -37,7 +37,7 @@ var Point = (function () {
3737
})(Point || (Point = {}));
3838
var A;
3939
(function (A) {
40-
var Point = (function () {
40+
var Point = /** @class */ (function () {
4141
function Point(x, y) {
4242
this.x = x;
4343
this.y = y;

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module A {
2323
}
2424

2525
//// [ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js]
26-
var Point = (function () {
26+
var Point = /** @class */ (function () {
2727
function Point(x, y) {
2828
this.x = x;
2929
this.y = y;
@@ -36,7 +36,7 @@ var Point = (function () {
3636
})(Point || (Point = {}));
3737
var A;
3838
(function (A) {
39-
var Point = (function () {
39+
var Point = /** @class */ (function () {
4040
function Point(x, y) {
4141
this.x = x;
4242
this.y = y;

tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module A {
2323
}
2424

2525
//// [ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js]
26-
var Point = (function () {
26+
var Point = /** @class */ (function () {
2727
function Point(x, y) {
2828
this.x = x;
2929
this.y = y;
@@ -36,7 +36,7 @@ var Point = (function () {
3636
})(Point || (Point = {}));
3737
var A;
3838
(function (A) {
39-
var Point = (function () {
39+
var Point = /** @class */ (function () {
4040
function Point(x, y) {
4141
this.x = x;
4242
this.y = y;

0 commit comments

Comments
 (0)