TypeScript/tests/cases/compiler/objectLitIndexerContextualType.ts
Nathan Shively-Sanders 5138e8be8e Correct tests and update baselines.
A lot of tests used non-numeric property names for object literals that
are contextually typed only by a numeric indexer.
2016-05-25 11:37:10 -07:00

23 lines
332 B
TypeScript

interface I {
[s: string]: (s: string) => number;
}
interface J {
[s: number]: (s: string) => number;
}
var x: I;
var y: J;
x = {
s: t => t * t, // Should error
};
x = {
0: t => t * t, // Should error
};
y = {
s: t => t * t, // Should error
};
y = {
0: t => t * t, // Should error
};