Record with optional fields introduce multiple spread oppty

Currently we can only use one spread in creating a new record with the reasoning that a second spread would replace all the fields of the first. With optional fields this is no longer true. Will the single splat constraint be relaxed?

Records can only have one `...` spread, at the beginning.
Explanation: since records have a known, fixed shape, a spread like `{a, ...b}` wouldn't make sense, as `b` would override every field of `a` anyway.

Thanks
Alex

3 Likes

This could be relevant in the context of type extension https://github.com/rescript-lang/rescript-compiler/issues/5659

1 Like

Can also be considered before extensible types as well?

Feel free to explore actual use cases and possible drawbacks and report here.

1 Like

“javascript does it” =)