2015-10-08 13:57:35 +02:00
|
|
|
|
|
|
|
|
|
const enum numbers {
|
2015-10-08 23:30:46 +02:00
|
|
|
|
zero,
|
|
|
|
|
one
|
2015-10-08 13:57:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface indexAccess {
|
2015-10-08 23:30:46 +02:00
|
|
|
|
0: string;
|
|
|
|
|
1: number;
|
2015-10-08 13:57:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let test: indexAccess;
|
|
|
|
|
|
|
|
|
|
let s = test[0];
|
|
|
|
|
let n = test[1];
|
|
|
|
|
|
|
|
|
|
let s1 = test[numbers.zero];
|
|
|
|
|
let n1 = test[numbers.one];
|
|
|
|
|
|
2015-10-08 23:30:46 +02:00
|
|
|
|
let s2 = test[numbers["zero"]];
|
|
|
|
|
let n2 = test[numbers["one"]];
|
2015-10-08 13:57:35 +02:00
|
|
|
|
|
2015-10-08 23:30:46 +02:00
|
|
|
|
enum numbersNotConst {
|
|
|
|
|
zero,
|
|
|
|
|
one
|
|
|
|
|
}
|
2015-10-08 13:57:35 +02:00
|
|
|
|
|
2015-10-08 23:30:46 +02:00
|
|
|
|
let s3 = test[numbersNotConst.zero];
|
|
|
|
|
let n3 = test[numbersNotConst.one];
|