Typescript@2.1.6
Here's an example:
interface Test {
fun(opts: {foo: 'enum1' | 'enum2'}): void
}
const bar: Test = {
fun: (opts) => { }
}
const defaults = {
foo: 'enum1'
};
bar.fun(defaults) // Error: Type 'string' is not assignable to type '"enum1" | "enum2"'
Shouldn't defaults.foo be inferred to be a subset of the string enum?
Typescript@2.1.6
Here's an example:
Shouldn't
defaults.foobe inferred to be a subset of the string enum?