Closed as not planned
Closed as not planned
Description
type x = {name: string}
type y = Person({...x})
Gives:
I'm not sure what to parse here when looking at ")".
Add a field before and it parses fine:
type x = {name: string}
type y = Person({age: int, ...x})
Add a field after and it tries to parse the spread as an object:
type x = {name: string}
type y = Person({...x, age: int})
A record type declaration doesn't support the ... spread. Only an object (with quoted field names) does.
So, this is ambiguous with regular object spreads. But previously we've changed things up to prefer records now that records are so much more powerful, and there are less reasons to use regular objects. So it'd be safe to parse this as a record spread instead of an object spread, in my opinion.