-
Couldn't load subscription status.
- Fork 471
Open
Description
I observed some weird behavior while working on my app, so I tried to reduce the problem to a minimal example.
type a = { title: string, ingredients: array<string>, } type b = { ...a, parsedIngredients: array<string>, } // This works let a: a = { title: "Pizza", ingredients: ["1 EL Oil", "1 EL flour"], } // EXPECTED: This should compile let b: b = { // ERROR: This has type `a`, but it's expected to have type `b` ...a, parsedIngredients: ["Oil", "Flour"], } I don't know if I misunderstood the record type spread feature, but IMO from an intuition perspective I'd expect value b to initialize just fine, since we are essentially spreading in all the values that a has, plus the parsedIngredients value that's required from b.
Does this work as expected?
Freddy03h
Metadata
Metadata
Assignees
Labels
No labels