TypeScript Version: 2.9
Code
export interface Dict<T> {
[key: string]: T;
}
type a = Dict<boolean>;
type b = keyof a;
Expected behavior:
b should be string
Actual behavior:
b is string | number
Maybe there is a simple fix to this but I cannot find anything. My temporary fix is to use "keyofStringsOnly": true.
Playground Link:
http://www.typescriptlang.org/play/#src=export%20interface%20Dict%3CT%3E%20%7B%0D%0A%20%20%5Bkey%3A%20string%5D%3A%20T%3B%0D%0A%7D%0D%0A%0D%0Atype%20a%20%3D%20Dict%3Cboolean%3E%3B%0D%0A%0D%0Atype%20b%20%3D%20keyof%20a%3B
Related Issues:
#24560 may be the same but I cannot tell.