---
source: https://iinventedlight.com/library/notes/typescript-const-assertions.md
title: "as const keeps literal types from widening"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (TypeScript Handbook); CC-BY-4.0 (TypeScript-Website release notes); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Microsoft (TypeScript Handbook), Everyday Types (Literal Inference), CC-BY-4.0 (https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE); microsoft/TypeScript-Website (GitHub), TypeScript 3.4 release notes (const assertions), CC-BY-4.0 (https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-17
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-17
as_of: 2026-11-17
confidence: medium
untested: "Not reproduced (2026-11-17). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: TypeScript const assertions"
tags: [typescript, as-const, const-assertion, literal-types, readonly]
client: Librarian
sources:
  - id: S1
    title: "Everyday Types (Literal Inference)"
    publisher: Microsoft (TypeScript Handbook)
    url: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html
    accessed: 2026-11-17
    license: "CC-BY-4.0"
  - id: S2
    title: "TypeScript 3.4 release notes (const assertions)"
    publisher: microsoft/TypeScript-Website (GitHub)
    url: https://github.com/microsoft/TypeScript-Website/blob/v2/packages/documentation/copy/en/release-notes/TypeScript%203.4.md
    accessed: 2026-11-17
    license: "CC-BY-4.0"
---
# as const keeps literal types from widening
**Answer:** Use `as const` to convert an entire object to type literals. Properties are assigned the literal type, not a more general version like `string` or `number`.

## What as const changes

If you initialize a variable with an object, TypeScript assumes those properties might change later. An `as const` assertion on the object turns its values into type literals.

Const assertions also stop literal widening in general, give object literals `readonly` properties, and turn array literals into readonly tuples.

## Limits

A `const` assertion applies only to a string, number, boolean, array, or object literal. Const contexts don't immediately convert an expression to be fully immutable.

## See also

- [typescript-type-assertions-and-literals](https://iinventedlight.com/library/notes/typescript-type-assertions-and-literals/)
- [typescript-basic-everyday-types](https://iinventedlight.com/library/notes/typescript-basic-everyday-types/)

## Claims

- id: C1
  claim: as const converts the entire object to type literals.
  source: S1
  evidence: "as const to convert the entire object to be type literals"

- id: C2
  claim: The suffix keeps properties from widening to string or number.
  source: S1
  evidence: "literal type instead of a more general version"

- id: C3
  claim: Const assertions stop literal types from being widened.
  source: S2
  evidence: "no literal types in that expression should be widened"

- id: C4
  claim: Object literals in a const assertion get readonly properties.
  source: S2
  evidence: "object literals get `readonly` properties"

## Sources

- [S1] Everyday Types (Literal Inference). Microsoft (TypeScript Handbook). https://www.typescriptlang.org/docs/handbook/2/everyday-types.html . License: CC-BY-4.0. Accessed 2026-11-17.

- [S2] TypeScript 3.4 release notes (const assertions). microsoft/TypeScript-Website (GitHub). https://github.com/microsoft/TypeScript-Website/blob/v2/packages/documentation/copy/en/release-notes/TypeScript%203.4.md . License: CC-BY-4.0. Accessed 2026-11-17.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Microsoft (TypeScript Handbook), Everyday Types (Literal Inference), CC-BY-4.0 (https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE); microsoft/TypeScript-Website (GitHub), TypeScript 3.4 release notes (const assertions), CC-BY-4.0 (https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
