Closed
Description
TypeScript Version: 2.1.5
Code
let key: keyof string[]
key = 1 // Type '1' is not assignable to type '"length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shif...'.
interface Container<T> {
[index: number]: T
}
let key: keyof Container<string>
key = 1 // Type '1' is not assignable to type 'never'.
Expected behavior:
number
should be subtype of keyof string[]
and keyof Container<string>
Actual behavior:
number
is no subtype of keyof string[]
and keyof Container<string>