Yeah, it's definitely not ideal, but even with its many flaws I prefer TS over plain JS.
The problem in question can be "fixed" like this
const r1: { a: number; b: number } = { a: 10, b: 20 };
const r2 = r1 satisfies { a: number };
const r3: { a: number; b: string } = { b: "hello", ...r2 };
Now, TS would warn us that "'b' is specified more than once, so this usage will be overwritten". And if we remove b property -- "Type 'number' is not assignable to type 'string'"
Another "fix" would be to avoid using spread operator and specify every property manually .
Both of these solutions are far from ideal, I agree.
---
I don't advocate TS in this thread though; I genuinely want to understand what makes row polymorphism different, and after reading several articles and harassing Claude Sonnet about it, I still didn't grasp what row polymorphism allows over what TS has.