@mdcc/at-json
Version:
A declarative mapper to and from JSON.
25 lines (24 loc) • 1.11 kB
TypeScript
/**
* Defines a metadata on the target object.
*
* Replaces `Reflect.defineMetadata`.
*
* @param {string | symbol} key the key of the metadata
* @param {any} value the value to be set in the metadata
* @param {object} target the target on which the metadata should be set
* @param {string | symbol} propertyName optional property name to add to the path on where value is set
*/
export declare function defineMetadata(key: string | symbol, value: any, target: object, propertyName?: string | symbol): void;
/**
* Retrieves the metadata associated to `target` and `propertyName`.
*
* If not found, follows the prototype chain.
*
* Replaces `Reflect.getMedadata`.
*
* @param {string | symbol} key the key of the metadata
* @param {object} target the target from which the metadata should be retrieved
* @param {string | symbol} propertyName optional property name to add to the path on where value is retrieved
* @returns {any} the value found, or `undefined` if not found
*/
export declare function getMetadata(key: string | symbol, target: object, propertyName?: string | symbol): any;