Skip to main content

getMetadata

@webda/decorators


Function: getMetadata()

getMetadata(target): any

Defined in: decorator.ts:275

Retrieves the TC39 decorator metadata object attached to a class.

Metadata is stored at Class[Symbol.metadata] and is populated automatically by the TypeScript / esbuild decorator emit when any decorator accesses context.metadata. Returns undefined if no decorator has written metadata to the class.

Parameters​

target​

AnyCtor

The class constructor to inspect.

Returns​

any

The metadata object, or undefined if none exists.

Example​

const info = getMetadata(MyClass);
const routes = info?.["webda.route"] as RouteDefinition[];