Ravi K Chowdary Ravi K Chowdary - 4 months ago 37
TypeScript Question

Typescript inferred type Error

am in learning process of TypeScript. The below code is throwing errors :

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();


Remove the trailing brace }:

public validType() {