---
source: https://iinventedlight.com/library/notes/typescript-classes.md
title: "TypeScript classes: fields, readonly, visibility, implements"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC BY 4.0 (microsoft/TypeScript-Website); restated in our own words"
attribution: "Summary by iinventedlight (AI-assisted). Sources: TypeScript (Microsoft), TypeScript Handbook: Classes, CC BY 4.0 (microsoft/TypeScript-Website); TypeScript (Microsoft), Declaration Merging, CC BY 4.0 (microsoft/TypeScript-Website)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-05
as_of: 2026-11-05
confidence: medium
untested: "Steps and code were not run; only the fetched documentation page was read."
category: coding-references
topic_area: "code-web: TypeScript classes"
tags: typescript, classes, oop
sources:
  - id: S1
    title: "TypeScript Handbook: Classes"
    publisher: TypeScript (Microsoft)
    url: https://www.typescriptlang.org/docs/handbook/2/classes.html
    accessed: 2026-11-05
    license: "CC BY 4.0 (microsoft/TypeScript-Website)"
  - id: S2
    title: "Declaration Merging"
    publisher: TypeScript (Microsoft)
    url: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
    accessed: 2026-11-05
    license: "CC BY 4.0 (microsoft/TypeScript-Website)"
    license: "CC BY 4.0 (microsoft/TypeScript-Website docs)"
---
# TypeScript classes: fields, visibility, implements

## Short answer
TypeScript classes add types and visibility (`public`/`protected`/`private`) on top of JavaScript classes. `implements` only checks the shape; it does not change runtime code. [S1]

## Points
- `readonly` fields can be set in the constructor, not reassigned later. [S1]
- `protected` members are visible in subclasses only. [S1]
- TypeScript does not analyze methods you call from the constructor for definite assignment the way some expect. [S1]
- Declaration merging can join multiple interface declarations with the same name into one. [S2]

## Claims
- id: C1
  claim: readonly fields cannot be assigned outside the constructor.
  source: S1
  evidence: "This prevents assignments to the field outside of the constructor"
- id: C2
  claim: protected members are only visible to subclasses.
  source: S1
  evidence: "protected members are only visible to subclasses"
- id: C3
  claim: implements is only a static check.
  source: S1
  evidence: "implements clause is only a check"
- id: C4
  claim: Basic declaration merging joins members into one interface.
  source: S2
  evidence: "the merge mechanically joins the members of both declarations into a single interface"

## Sources
- [S1] TypeScript Handbook: Classes. TypeScript (Microsoft). https://www.typescriptlang.org/docs/handbook/2/classes.html . License: CC BY 4.0 (microsoft/TypeScript-Website). Accessed 2026-11-05.
- [S2] Declaration Merging. TypeScript (Microsoft). https://www.typescriptlang.org/docs/handbook/declaration-merging.html . License: CC BY 4.0 (microsoft/TypeScript-Website). Accessed 2026-11-05.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

Source notice: TypeScript Handbook / Website docs © Microsoft. Licensed under Creative Commons Attribution 4.0 International (https://github.com/microsoft/TypeScript-Website/blob/v2/LICENSE).
