Skip to Content
DocsReferenceResolversFindAnnotatedDefinitions

FindAnnotatedDefinitionsResolver

Finds components that have a leading annotation comment.

By default the annotation is @component. The annotation can be in a line comment or a block comment.

Options

new FindAnnotatedDefinitionsResolver({ annotation?: string });

annotation

Default: @component

The text to search for in leading comments.

Examples

component.tsx
// @component function Button() { return <button />; }
component.tsx
/* @component */ const Button = () => <button />;

The resolver can also find annotated components wrapped in calls.

component.tsx
// @component const Button = React.memo(() => <button />);

Source

Last updated on