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