Rush StackShopBlogEvents
Skip to main content

@decorator

Standardization:Extended
Syntax kind:Block tag

Usage

ECMAScript decorators are sometimes an important part of an API contract. However, today the TypeScript compiler does not represent decorators in the .d.ts output files used by API consumers. The @decorator tag provides a workaround, enabling a decorator expression to be quoted in a doc comment.

Example

class Book {
/**
* The title of the book.
* @decorator `@jsonSerialized`
* @decorator `@jsonFormat(JsonFormats.Url)`
*/
@jsonSerialized
@jsonFormat(JsonFormats.Url)
public website: string;
}

See also

  • RFC #271: @decorator tag for documenting ECMAScript decorators