Understanding The @Component Decorator In TypeDoc
Exploring the @Component decorator in TypeDoc, a decorator factory that returns an arrow function executed at runtime, used to register components and their child classes.
In this article, we analyse the Component decorator in TypeDoc.
Let’s take a step back and first understand what’s a decorator in TypeScript.
Decorator in TypeScript
A Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorators use the form @expression, where expression must evaluate to a function that will be called at runtime with information about the decorated declaration. — Source.
For example, given the decorator @sealed we might write the sealed function as follows:
function sealed(target) {
/...