TypeScript/tests/baselines/reference/objectLitIndexerContextualType.errors.txt
2014-07-12 17:30:19 -07:00

35 lines
1.2 KiB
Plaintext

==== tests/cases/compiler/objectLitIndexerContextualType.ts (6 errors) ====
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
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
~
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
};
x = {
0: t => t * t, // Should error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
~
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
};
y = {
s: t => t * t, // Should not error
};
y = {
0: t => t * t, // Should error
~
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
~
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
};