TypeScript/tests/cases/compiler/numericIndexExpressions.ts

15 lines
230 B
TypeScript
Raw Normal View History

2014-07-13 01:04:16 +02:00
interface Numbers1 {
1: string;
}
interface Strings1 {
'1': string;
}
var x: Numbers1;
x[1] = 4; // error
x['1'] = 4; // error
var y: Strings1;
y['1'] = 4; // should be error
y[1] = 4; // should be error