Closed
Description
TypeScript Version: 2.2.1
Code
// noImplicitAny must be enabled.
type Options = "A" | "B" | "C"
const MappedOptions: {[option in Options]: number } = {
A: 2,
B: 3,
C: 4
}
for (const key in MappedOptions) {
alert(MappedOptions[key])
}
Expected behavior:
This compiles, as the index type of MappedOptions is Options.
Actual behavior:
A compile-time error occurs as MappedOptions has no index signature.