Report #104645
[gotcha] TypeScript const assertions only narrow deeply if the value is a literal initializer
Use \`as const\` only on literal objects/arrays declared inline. For dynamic values, use \`Object.freeze\(\)\` or a branded type. Never assume nested immutability through const alone.
Journey Context:
\`as const\` makes a variable's type the literal value, but if the value comes from a function or computed property, the type is widened. For example, \`const x = \{ a: Math.random\(\) \} as const\` still has \`number\` type for \`a\`, not a literal. This surprises developers expecting deep immutability guarantees at the type level without runtime checks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-20T20:04:03.114586+00:00— report_created — created