mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
`checksum += parsed[i].score` (a number local plus an `any` value) failed with SC1043 "comparing non-number, non-string values" in TypeScript, while the expanded `checksum = checksum + parsed[i].score` compiled: the compound lowering only routed checked-dynamic operands through the runtime operators in JavaScript files. Locals, record fields and array elements now lower `op=` with an untyped right operand (or an untyped local target) exactly like `x = x op rhs`: dyn.add / dyn.arithmetic / dyn.bitwise, then the checked conversion into the target's declared type. Numeric operators keep Node's ToNumber semantics; a `+=` that produces a string for a `number` target throws the same catchable TypeError as the expanded assignment and leaves the target unchanged (pinned in tests/harness/dyncheck.test.ts). Remaining SC1043 refusals for arithmetic, unary, update and compound operators now name the operator and operand types instead of the comparison wording. The retired-engine-763 diagnostics fixture compiles now and matches Node, so it moves to the corpus as 5343.