Reflect metadata
Less than 1 minute
Reflect
metadata
Modules
esnext.reflect.define-metadata
esnext.reflect.delete-metadata
esnext.reflect.get-metadata
esnext.reflect.get-metadata-keys
esnext.reflect.get-own-metadata
esnext.reflect.get-own-metadata-keys
esnext.reflect.has-metadata
esnext.reflect.has-own-metadata
esnext.reflect.metadata
Types
namespace Reflect {
function defineMetadata(
metadataKey: any,
metadataValue: any,
target: Object,
propertyKey?: PropertyKey
): void;
function getMetadata(
metadataKey: any,
target: Object,
propertyKey?: PropertyKey
): any;
function getOwnMetadata(
metadataKey: any,
target: Object,
propertyKey?: PropertyKey
): any;
function hasMetadata(
metadataKey: any,
target: Object,
propertyKey?: PropertyKey
): boolean;
function hasOwnMetadata(
metadataKey: any,
target: Object,
propertyKey?: PropertyKey
): boolean;
function deleteMetadata(
metadataKey: any,
target: Object,
propertyKey?: PropertyKey
): boolean;
function getMetadataKeys(
target: Object,
propertyKey?: PropertyKey
): Array<any>;
function getOwnMetadataKeys(
target: Object,
propertyKey?: PropertyKey
): Array<any>;
function metadata(
metadataKey: any,
metadataValue: any
): (target: Object, targetKey: string | symbol) => void;
}
Entry points
core-js/proposals/reflect-metadata
core-js(-pure)/full/reflect/define-metadata
core-js(-pure)/full/reflect/delete-metadata
core-js(-pure)/full/reflect/get-metadata
core-js(-pure)/full/reflect/get-metadata-keys
core-js(-pure)/full/reflect/get-own-metadata
core-js(-pure)/full/reflect/get-own-metadata-keys
core-js(-pure)/full/reflect/has-metadata
core-js(-pure)/full/reflect/has-own-metadata
core-js(-pure)/full/reflect/metadata
Example
let object = {};
Reflect.defineMetadata("foo", "bar", object);
Reflect.ownKeys(object); // => []
Reflect.getOwnMetadataKeys(object); // => ['foo']
Reflect.getOwnMetadata("foo", object); // => 'bar'