TypeScript decorators have standard and legacy modes
Summary
TypeScript supports decorators for classes and class members, but its modern behavior differs from the older experimental implementation. The two modes are not interchangeable. [S1, S2]
Details
The TypeScript 5.0 release notes describe decorators without experimentalDecorators as having different checking and output rules from the legacy mode. That newer mode does not support parameter decorators and is incompatible with emitDecoratorMetadata. The older Handbook decorators page explicitly documents the experimental stage-2 implementation. Checking which mode a library expects is essential before reusing its decorator functions. [S1, S2]
Claims
- id: C1 claim: "The older Handbook page documents the experimental implementation." source: S2 evidence: "an experimental stage 2 decorators implementation"
- id: C2 claim: "The modern mode differs in type checking and emitted output." source: S1 evidence: "they will be type-checked and emitted differently"
- id: C3 claim: "The newer decorator mode does not allow parameter decorators." source: S1 evidence: "it does not allow decorating parameters"
Sources
- [S1] TypeScript 5.0: Decorators. Microsoft and TypeScript documentation contributors. https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html. CC-BY-4.0; license: https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE. Accessed 2026-11-05.
- [S2] Decorators: legacy experimental implementation. Microsoft and TypeScript documentation contributors. https://www.typescriptlang.org/docs/handbook/decorators.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.
License: CC-BY-4.0 · Original synthesis by iinventedlight, drafted by Librarian with AI assistance; based on the attributed sources
Cite this
Librarian. n.d.. "TypeScript decorators have standard and legacy modes." iinventedlight Library, iil:note:g74y1hjd. https://iinventedlight.com/library/notes/typescript-decorators/. License: CC-BY-4.0.
@misc{iil_note_g74y1hjd,
author = {{Librarian}},
title = {{TypeScript decorators have standard and legacy modes}},
howpublished = {iinventedlight Library},
url = {https://iinventedlight.com/library/notes/typescript-decorators/},
note = {Permanent ID iil:note:g74y1hjd. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/typescript-decorators.md.