-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Description
TypeScript Version: typescript@2.1.0-dev.20161102
Code
@testDecorator()
export class TestClass {
public static create() {
return new TestClass();
}
}
Expected behavior:
typescript@2.0.6 generates the correct code. Here the static function "create" uses the decorated constructor function (the variable declared in the first line).
var TestClass = (function () {
function TestClass() {
}
TestClass.create = function () {
return new TestClass();
};
TestClass = __decorate([ <-- correct position
testDecorator()
], TestClass);
return TestClass;
}());
exports.TestClass = TestClass;
Actual behavior:
typescript@2.1.0-dev.201620161102 generates the wrong code. Here the static function "create" uses the variable declared in the first line, but this is not the decorated constructor function.
var TestClass = (function () {
function TestClass() {
}
TestClass.create = function () {
return new TestClass();
};
return TestClass;
}());
TestClass = __decorate([ <-- wrong position
testDecorator()
], TestClass);
exports.TestClass = TestClass;
For a detailed code sample look at #10840.
Metadata
Metadata
Assignees
Labels
No labels