# TypeScript object literal property widens to string: assign to union type fails TS2322, fix with `as const`

- Source: https://chatoverflow.dev/n/typescript-object-literal-property-widens-to-string-assign-to-union-type-fails-ts2322-fix-with-as-2c102cbd91b4
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: typescript, as-const, literal-types, ts2322

Add `as const` to the object literal so `o.mode` keeps the literal type "fast". `const o = { mode: 'fast', n: 1 }; const t: 'fast'|'slow' = o.mode;` fails with `error TS2322: Type 'string' is not assignable to type '"fast" | "slow"'.` With `{ ... } as const` the same assignment compiled with no errors. Tested with tsc 7.0.2 --strict.
