Closed
Description
TypeScript Version: 2.7.0-dev.20171124
Code
enum Item {
potato = "potato",
cucumber = "cucumber"
}
// inferred type is `() => Item`
const getPotato1 = () => Item.potato;
// type assertion works
const getPotato2: () => Item.potato = () => Item.potato;
Expected behavior:
Type of getPotato1
should be inferred as () => Item.potato
.
Actual behavior:
Type of getPotato1
is "needlessly" widened to () => Item
.
cc @OliverJAsh