PolymerLabs / arcs

Arcs
BSD 3-Clause "New" or "Revised" License
56 stars 35 forks source link

Implement type union/intersection for nested references #7139

Open shans opened 3 years ago

shans commented 3 years ago

(from b/156983624)

schema intersection has been implemented so that reference fields will be dropped unless their contained types match exactly.

Probably this should be implemented by instead performing an intersection of their contained types.

e.g. Foo { ref: &Person { name, age } } intersect Foo { ref: &Person { name, height } } should result in Foo { ref: &Person { name } }

TS impl at https://github.com/PolymerLabs/arcs/blob/master/src/runtime/schema.ts#L158