decorator metadata
An object shared by all decorators on a class, reached through context.metadata and later readable at Symbol.metadata on the class.
In more detail
It replaces the old habit of attaching metadata by modifying global objects or prototypes. TypeScript 5.2 added support for it.
Related terms
- ClassMethodDecoratorContext — The typed object passed as the second argument to a standard method decorator, describing the method being decorated.
- symbol — A primitive value created by Symbol() that is guaranteed unique, used as a property key that can never clash with another.
- metadata — Data that describes other data, such as a file name, a creation time or a package version.
Taught in
- The satisfies Operator: Safe Validation Without Widening — Production TypeScript
- Modern Decorators: Stage 3 Standards And Class Metadata — Production TypeScript