2015-02-03 00:15:54 +01:00
|
|
|
//// [declFileObjectLiteralWithAccessors.ts]
|
|
|
|
|
|
|
|
function /*1*/makePoint(x: number) {
|
|
|
|
return {
|
|
|
|
b: 10,
|
|
|
|
get x() { return x; },
|
|
|
|
set x(a: number) { this.b = a; }
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var /*4*/point = makePoint(2);
|
|
|
|
var /*2*/x = point.x;
|
|
|
|
point./*3*/x = 30;
|
|
|
|
|
|
|
|
//// [declFileObjectLiteralWithAccessors.js]
|
|
|
|
function makePoint(x) {
|
|
|
|
return {
|
|
|
|
b: 10,
|
2015-03-09 02:23:23 +01:00
|
|
|
get x() {
|
|
|
|
return x;
|
|
|
|
},
|
|
|
|
set x(a) {
|
|
|
|
this.b = a;
|
|
|
|
}
|
2015-02-03 00:15:54 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
;
|
|
|
|
var point = makePoint(2);
|
|
|
|
var x = point.x;
|
|
|
|
point.x = 30;
|
2015-02-05 23:41:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
//// [declFileObjectLiteralWithAccessors.d.ts]
|
|
|
|
declare function makePoint(x: number): {
|
|
|
|
b: number;
|
|
|
|
x: number;
|
|
|
|
};
|
|
|
|
declare var point: {
|
|
|
|
b: number;
|
|
|
|
x: number;
|
|
|
|
};
|
|
|
|
declare var x: number;
|