-2
。下面的代碼拋出錯誤:TypeScript推斷類型在TypeScript的學習過程中錯誤
Error:- Unexpected token. A constructor, method, accessor, or property was expected.
[ts] Declaration or statement expected.
class duckType{
public validType(){}
var myVar:any = {id:1, name:"ABC"};
myVar = {id:2};
}
}
var myType = new duckType();
myType.validType();
謝謝。它的工作現在。 – Ravikanth