Closed
Description
openedon Jan 23, 2017
The following code gives an error on the assignment to x:
type Bar = "A" | "B"
type Foo = { key: "a", name: string } | { key: "b", name: Bar }
const x: Foo = { key: "b", name: "A" }
There are multiple weird things that get rid of the error, including:
- Changing
{ key: "a", name: string }
to{ key: "a" }
. - Changing
name: "A"
toname: "A" as Bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment