Spread for tuple types and record types is parallel to spread for tuples and records (#64). Tuple types may be spread into other tuple types, and record types may be spread into other record types. Spreading a collection type is shorthand for injecting each of that type’s members.
type CDE = [str, str, str];
type ABCDEFG = [str, str, #CDE, str, str];
let abcdefg: ABCDEFG = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
Note that spreading record types is not the same as intersecting them. The former overrides properties in source order, whereas the latter takes the union of the properties but intersects the property types.
Spread syntax for tuple types and record types.
Discussion
Spread for tuple types and record types is parallel to spread for tuples and records (#64). Tuple types may be spread into other tuple types, and record types may be spread into other record types. Spreading a collection type is shorthand for injecting each of that type’s members.
Note that spreading record types is not the same as intersecting them. The former overrides properties in source order, whereas the latter takes the union of the properties but intersects the property types.
Specification
Syntax
Semantics
Decorate