A lot of tests used non-numeric property names for object literals that are contextually typed only by a numeric indexer.
23 lines
332 B
TypeScript
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
|
|
};
|