29 lines
430 B
TypeScript
29 lines
430 B
TypeScript
|
|
const enum numbers {
|
|
zero,
|
|
one
|
|
}
|
|
|
|
interface indexAccess {
|
|
0: string;
|
|
1: number;
|
|
}
|
|
|
|
let test: indexAccess;
|
|
|
|
let s = test[0];
|
|
let n = test[1];
|
|
|
|
let s1 = test[numbers.zero];
|
|
let n1 = test[numbers.one];
|
|
|
|
let s2 = test[numbers["zero"]];
|
|
let n2 = test[numbers["one"]];
|
|
|
|
enum numbersNotConst {
|
|
zero,
|
|
one
|
|
}
|
|
|
|
let s3 = test[numbersNotConst.zero];
|
|
let n3 = test[numbersNotConst.one];
|