Closed
Description
TypeScript Version:
1.8.7
Code
type OnlyNumberKeys = {[key: number]: any};
let a: OnlyNumberKeys = {};
a["abcd"] = 1; // No error?
let x = a["abcd"]; // No error?
type OnlyStringKeys = {[key: string]: any};
let b: OnlyStringKeys = {};
b[1234] = 1; // No error?
let y = b[1234]; // No error?
Expected behavior:
Should error
Actual behavior:
Doesn't error
(Sorry if this is a duplicate but a search did not yield anything on this)