:
interface Foo {
x: number;
}
interface Foo {
y: string;
}
let g = {} as Foo;
g.x;
g.y;
, , , .
class Bar {
y: number;
}
interface IBaz extends Bar { }
class CBaz implements Bar {
y: number = 5;
}
, , , .
, Typescript :
export interface Foo {
readonly x: number;
}
export class Foo {
readonly x: number = 3;
}
get x() { return 3; }
, readonly x: number
, , , ( readonly getter).