---
title: Type assertions do not replace runtime checks
slug: typescript-type-assertions-and-literals
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source: https://iinventedlight.com/library/notes/typescript-type-assertions-and-literals.md
source_license: CC-BY-4.0
attribution: Original synthesis by iinventedlight, drafted by Librarian with AI assistance; based on the attributed sources
  below.
author: Librarian
client: Librarian
date: '2026-11-05'
checked_on: '2026-11-05'
as_of: '2026-11-05'
status: published
confidence: medium
category: coding-references
tags:
- typescript
- type
- assertions
untested: Reference note. No code or commands were run to validate behavior.
sources:
- id: S1
  title: Everyday types
  publisher: Microsoft and TypeScript documentation contributors
  url: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html
  accessed: '2026-11-05'
  license: CC-BY-4.0
  license_url: https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE
  license_verified: '2026-11-05'
  green: true
  attribution: Microsoft and TypeScript documentation contributors; Everyday types; CC-BY-4.0
  snapshot: _fetched/ts-types.txt
- id: S2
  title: Narrowing
  publisher: Microsoft and TypeScript documentation contributors
  url: https://www.typescriptlang.org/docs/handbook/2/narrowing.html
  accessed: '2026-11-05'
  license: CC-BY-4.0
  license_url: https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE
  license_verified: '2026-11-05'
  green: true
  attribution: Microsoft and TypeScript documentation contributors; Narrowing; CC-BY-4.0
  snapshot: _fetched/ts-narrow.txt
---
# Type assertions do not replace runtime checks

## Summary
A TypeScript type assertion changes what the compiler assumes about a value. The compiler removes it, so an incorrect assertion does not add a runtime check or conversion. [S1]

## Details
Literal types describe particular values instead of all strings or numbers. `as const` preserves literal information in an object expression. Narrowing works differently from an assertion: the compiler follows control flow and checks such as `typeof` to refine a value's possible type. A claim about the type and a runtime test of the value are therefore different operations. [S1, S2]

## Claims
- id: C1
  claim: "Type assertions do not provide runtime checking."
  source: S1
  evidence: "there is no runtime checking associated with a type assertion"
- id: C2
  claim: "as const keeps literal types for object properties."
  source: S1
  evidence: "all properties are assigned the literal type"
- id: C3
  claim: "Type guards and assignments refine types through narrowing."
  source: S2
  evidence: "the process of refining types to more specific types"

## Sources
- [S1] Everyday types. Microsoft and TypeScript documentation contributors. https://www.typescriptlang.org/docs/handbook/2/everyday-types.html. CC-BY-4.0; license: https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE. Accessed 2026-11-05.
- [S2] Narrowing. Microsoft and TypeScript documentation contributors. https://www.typescriptlang.org/docs/handbook/2/narrowing.html. CC-BY-4.0; license: https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE. Accessed 2026-11-05.

## Attribution and notices
This note is CC BY 4.0. Source material has been condensed and restated; short evidence excerpts retain their source license.

TypeScript Website documentation is CC BY 4.0. This is an original condensed explanation, not the original documentation.
