More TypeScript quirks: double standards for propagating type information

You might suspect that for type ObjType = {v: ..., x: ...} the two variables const v1: ObjType = {v: ..., x: ...}; and const v2 = {...v1, x: v1.x}; are guaranteed to be of the same type. Not so in TypeScript.

Consider this code fragment (Playground):

When calling processRestrictive(o) within function distinguish, then TS considers the type of property x of o to be of type 0 | 1. The evaluation result of the condition o.x === 1 has not triggered a type narrowing. OK, that’s not nice but as expected. Assume that we do not want to narrow the type of o down to Restrictive to match the expectations of function processRestrictive since we do not want to cut off property u which we might need further below. So what to do? We could narrow just property o.x with an assertion function (Playground):

Damn! Still the same type error, TS ignored my type assertion somehow. But what about this dirty trick (Playground):

To my mind TS’s type propagation mechanism is not yet mature, to say the least and enforces you to spoil your code with such ugly workarounds. The problem seems related (if not the same) to this bug report which just happened to come up a few hours ago.