← All notes

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

Sources

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

Permanent ID: iil:note:g74y1hjd

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.},
}

Markdown

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.