At the moment, TypeScript
does not allow use get/set methods(accessors) in interfaces.
For example:
interface I {
get name():string;
}
class C implements I {
get name():string {
return null;
}
}
furthermore, TypeScript does not allow use Array Function Expression in class methods: for ex.:
class C {
private _name:string;
get name():string => this._name;
}
Is there any other way I can use a getter and setter on an interface definition?