TypeScript/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js
2015-02-03 17:43:31 -08:00

18 lines
429 B
JavaScript

//// [computedPropertyNamesContextualType2_ES5.ts]
interface I {
[s: string]: (x: any) => number; // Doesn't get hit
[s: number]: (x: string) => number;
}
var o: I = {
[+"foo"](y) { return y.length; },
[+"bar"]: y => y.length
}
//// [computedPropertyNamesContextualType2_ES5.js]
var o = {
[+"foo"]: function (y) {
return y.length;
},
[+"bar"]: function (y) { return y.length; }
};