class area {
var length;
let width;
length:number; // why do i need to do like this only;
width: number; // why do i need to do like this only;
...
...
}
答案 0 :(得分:0)
Typescript转换为Javascript。你不能在JS中这样做,而不是在es5或es6中。
这是ts类转化为(es5目标)
class Test {
field: string = 'test';
}
// becomes:
var Test = /** @class */ (function () {
function Test() {
this.field = 'test';
}
return Test;
}());