metarize
Version:
A lightweight, ESM-compatible TypeScript metadata library for creating and inspecting decorators with zero dependencies
25 lines • 654 B
JavaScript
/**
* A strongly-typed metadata accessor via reflection
* @typeParam T - Type of the metadata value
* @typeParam D - Type of the decorator
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export class MetadataAccessor {
key;
constructor(key) {
this.key = key;
}
toString() {
return this.key;
}
/**
* Create a strongly-typed metadata accessor
* @param key - The metadata key
* @typeParam V - Type of the metadata value
* @typeParam DT - Type of the decorator
*/
static create(key) {
return new MetadataAccessor(key);
}
}
//# sourceMappingURL=types.js.map