Merge pull request #10009 from Microsoft/null-undefined-allowed-as-index-expressions

`Null` and `undefined` are allowed as index expressions
This commit is contained in:
Nathan Shively-Sanders
2016-08-16 15:46:42 -07:00
committed by GitHub
8 changed files with 199 additions and 2 deletions

View File

@@ -0,0 +1,13 @@
// @strictNullChecks: false
interface N {
[n: number]: string;
}
interface S {
[s: string]: number;
}
let n: N;
let s: S;
let str: string = n[undefined];
str = n[null];
let num: number = s[undefined];
num = s[null];

View File

@@ -0,0 +1,13 @@
// @strictNullChecks: true
interface N {
[n: number]: string;
}
interface S {
[s: string]: number;
}
let n: N;
let s: S;
let str: string = n[undefined];
str = n[null];
let num: number = s[undefined];
num = s[null];