I can not get the exact types in the stream to work with the distribution of objects.
type Point = {| x: number, y: number |}; const p1: Point = { x: 10, y: 10 }; const p2: Point = { ...p1, y: 5 };
Generates an object literal . Inaccurate type incompatible with exact type
This does not cause an error, but modifies p1:
const p3: Point = Object.assign(p1, {y: 5});
Using Object.assign with an empty object also results in the same object literal error:
const p4: Point = Object.assign({}, p1, {y: 5});
If I use type Point = {x: number, y: number}; then the object is distributed, but ideally I would like to use the exact type.
source share