20 lines
652 B
Text
20 lines
652 B
Text
|
==== tests/cases/compiler/objectLitPropertyScoping.ts (2 errors) ====
|
||
|
// Should compile, x and y should not be picked up from the properties
|
||
|
|
||
|
function makePoint(x: number, y: number) {
|
||
|
return {
|
||
|
get x() {
|
||
|
~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
return x;
|
||
|
},
|
||
|
get y() {
|
||
|
~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
return y;
|
||
|
},
|
||
|
dist: function () {
|
||
|
return Math.sqrt(x * x + y * y);
|
||
|
}
|
||
|
}
|
||
|
};
|