Is it possible to use getters/setters in TypeScript Interfaces? [duplicate]
Getter-only properties were introduced in Typescript 2.0:
interface foo {
readonly bar: boolean;
}
Yes, this is a limitation of interfaces. Whether or not the access to the property is implemented with a getter is an implementation detail and thus should not be part of the public interface. See also this question.
If you need a readonly attribute specified in an interface, you can add a getter method:
interface foo {
getAttribute() : string;
}