123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494 |
- /*! *****************************************************************************
- Copyright (C) Microsoft. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
-
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
-
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */
-
- // NOTE: This file is obsolete and may be removed in a later release.
- // For CommonJS/AMD/UMD/SystemJS declarations please use 'index.d.ts'.
- // For standalone browser declarations, please use 'standalone.d.ts'.
-
- declare module "reflect-metadata" {
- // The "reflect-metadata" module has no imports or exports, but can be used by modules to load the polyfill.
- }
-
- declare namespace Reflect {
- /**
- * Applies a set of decorators to a target object.
- * @param decorators An array of decorators.
- * @param target The target object.
- * @returns The result of applying the provided decorators.
- * @remarks Decorators are applied in reverse order of their positions in the array.
- * @example
- *
- * class Example { }
- *
- * // constructor
- * Example = Reflect.decorate(decoratorsArray, Example);
- *
- */
- function decorate(decorators: ClassDecorator[], target: Function): Function;
- /**
- * Applies a set of decorators to a property of a target object.
- * @param decorators An array of decorators.
- * @param target The target object.
- * @param targetKey The property key to decorate.
- * @param descriptor A property descriptor
- * @remarks Decorators are applied in reverse order.
- * @example
- *
- * class Example {
- * // property declarations are not part of ES6, though they are valid in TypeScript:
- * // static staticProperty;
- * // property;
- *
- * static staticMethod() { }
- * method() { }
- * }
- *
- * // property (on constructor)
- * Reflect.decorate(decoratorsArray, Example, "staticProperty");
- *
- * // property (on prototype)
- * Reflect.decorate(decoratorsArray, Example.prototype, "property");
- *
- * // method (on constructor)
- * Object.defineProperty(Example, "staticMethod",
- * Reflect.decorate(decoratorsArray, Example, "staticMethod",
- * Object.getOwnPropertyDescriptor(Example, "staticMethod")));
- *
- * // method (on prototype)
- * Object.defineProperty(Example.prototype, "method",
- * Reflect.decorate(decoratorsArray, Example.prototype, "method",
- * Object.getOwnPropertyDescriptor(Example.prototype, "method")));
- *
- */
- function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, targetKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor;
- /**
- * A default metadata decorator factory that can be used on a class, class member, or parameter.
- * @param metadataKey The key for the metadata entry.
- * @param metadataValue The value for the metadata entry.
- * @returns A decorator function.
- * @remarks
- * If `metadataKey` is already defined for the target and target key, the
- * metadataValue for that key will be overwritten.
- * @example
- *
- * // constructor
- * @Reflect.metadata(key, value)
- * class Example {
- * }
- *
- * // property (on constructor, TypeScript only)
- * class Example {
- * @Reflect.metadata(key, value)
- * static staticProperty;
- * }
- *
- * // property (on prototype, TypeScript only)
- * class Example {
- * @Reflect.metadata(key, value)
- * property;
- * }
- *
- * // method (on constructor)
- * class Example {
- * @Reflect.metadata(key, value)
- * static staticMethod() { }
- * }
- *
- * // method (on prototype)
- * class Example {
- * @Reflect.metadata(key, value)
- * method() { }
- * }
- *
- */
- function metadata(metadataKey: any, metadataValue: any): {
- (target: Function): void;
- (target: Object, targetKey: string | symbol): void;
- };
- /**
- * Define a unique metadata entry on the target.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param metadataValue A value that contains attached metadata.
- * @param target The target object on which to define metadata.
- * @example
- *
- * class Example {
- * }
- *
- * // constructor
- * Reflect.defineMetadata("custom:annotation", options, Example);
- *
- * // decorator factory as metadata-producing annotation.
- * function MyAnnotation(options): ClassDecorator {
- * return target => Reflect.defineMetadata("custom:annotation", options, target);
- * }
- *
- */
- function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void;
- /**
- * Define a unique metadata entry on the target.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param metadataValue A value that contains attached metadata.
- * @param target The target object on which to define metadata.
- * @param targetKey The property key for the target.
- * @example
- *
- * class Example {
- * // property declarations are not part of ES6, though they are valid in TypeScript:
- * // static staticProperty;
- * // property;
- *
- * static staticMethod(p) { }
- * method(p) { }
- * }
- *
- * // property (on constructor)
- * Reflect.defineMetadata("custom:annotation", Number, Example, "staticProperty");
- *
- * // property (on prototype)
- * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "property");
- *
- * // method (on constructor)
- * Reflect.defineMetadata("custom:annotation", Number, Example, "staticMethod");
- *
- * // method (on prototype)
- * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "method");
- *
- * // decorator factory as metadata-producing annotation.
- * function MyAnnotation(options): PropertyDecorator {
- * return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key);
- * }
- *
- */
- function defineMetadata(metadataKey: any, metadataValue: any, target: Object, targetKey: string | symbol): void;
- /**
- * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param target The target object on which the metadata is defined.
- * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
- * @example
- *
- * class Example {
- * }
- *
- * // constructor
- * result = Reflect.hasMetadata("custom:annotation", Example);
- *
- */
- function hasMetadata(metadataKey: any, target: Object): boolean;
- /**
- * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param target The target object on which the metadata is defined.
- * @param targetKey The property key for the target.
- * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
- * @example
- *
- * class Example {
- * // property declarations are not part of ES6, though they are valid in TypeScript:
- * // static staticProperty;
- * // property;
- *
- * static staticMethod(p) { }
- * method(p) { }
- * }
- *
- * // property (on constructor)
- * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty");
- *
- * // property (on prototype)
- * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property");
- *
- * // method (on constructor)
- * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod");
- *
- * // method (on prototype)
- * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method");
- *
- */
- function hasMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean;
- /**
- * Gets a value indicating whether the target object has the provided metadata key defined.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param target The target object on which the metadata is defined.
- * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
- * @example
- *
- * class Example {
- * }
- *
- * // constructor
- * result = Reflect.hasOwnMetadata("custom:annotation", Example);
- *
- */
- function hasOwnMetadata(metadataKey: any, target: Object): boolean;
- /**
- * Gets a value indicating whether the target object has the provided metadata key defined.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param target The target object on which the metadata is defined.
- * @param targetKey The property key for the target.
- * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
- * @example
- *
- * class Example {
- * // property declarations are not part of ES6, though they are valid in TypeScript:
- * // static staticProperty;
- * // property;
- *
- * static staticMethod(p) { }
- * method(p) { }
- * }
- *
- * // property (on constructor)
- * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty");
- *
- * // property (on prototype)
- * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property");
- *
- * // method (on constructor)
- * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod");
- *
- * // method (on prototype)
- * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method");
- *
- */
- function hasOwnMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean;
- /**
- * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param target The target object on which the metadata is defined.
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
- * @example
- *
- * class Example {
- * }
- *
- * // constructor
- * result = Reflect.getMetadata("custom:annotation", Example);
- *
- */
- function getMetadata(metadataKey: any, target: Object): any;
- /**
- * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param target The target object on which the metadata is defined.
- * @param targetKey The property key for the target.
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
- * @example
- *
- * class Example {
- * // property declarations are not part of ES6, though they are valid in TypeScript:
- * // static staticProperty;
- * // property;
- *
- * static staticMethod(p) { }
- * method(p) { }
- * }
- *
- * // property (on constructor)
- * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty");
- *
- * // property (on prototype)
- * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property");
- *
- * // method (on constructor)
- * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod");
- *
- * // method (on prototype)
- * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method");
- *
- */
- function getMetadata(metadataKey: any, target: Object, targetKey: string | symbol): any;
- /**
- * Gets the metadata value for the provided metadata key on the target object.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param target The target object on which the metadata is defined.
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
- * @example
- *
- * class Example {
- * }
- *
- * // constructor
- * result = Reflect.getOwnMetadata("custom:annotation", Example);
- *
- */
- function getOwnMetadata(metadataKey: any, target: Object): any;
- /**
- * Gets the metadata value for the provided metadata key on the target object.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param target The target object on which the metadata is defined.
- * @param targetKey The property key for the target.
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
- * @example
- *
- * class Example {
- * // property declarations are not part of ES6, though they are valid in TypeScript:
- * // static staticProperty;
- * // property;
- *
- * static staticMethod(p) { }
- * method(p) { }
- * }
- *
- * // property (on constructor)
- * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty");
- *
- * // property (on prototype)
- * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property");
- *
- * // method (on constructor)
- * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod");
- *
- * // method (on prototype)
- * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method");
- *
- */
- function getOwnMetadata(metadataKey: any, target: Object, targetKey: string | symbol): any;
- /**
- * Gets the metadata keys defined on the target object or its prototype chain.
- * @param target The target object on which the metadata is defined.
- * @returns An array of unique metadata keys.
- * @example
- *
- * class Example {
- * }
- *
- * // constructor
- * result = Reflect.getMetadataKeys(Example);
- *
- */
- function getMetadataKeys(target: Object): any[];
- /**
- * Gets the metadata keys defined on the target object or its prototype chain.
- * @param target The target object on which the metadata is defined.
- * @param targetKey The property key for the target.
- * @returns An array of unique metadata keys.
- * @example
- *
- * class Example {
- * // property declarations are not part of ES6, though they are valid in TypeScript:
- * // static staticProperty;
- * // property;
- *
- * static staticMethod(p) { }
- * method(p) { }
- * }
- *
- * // property (on constructor)
- * result = Reflect.getMetadataKeys(Example, "staticProperty");
- *
- * // property (on prototype)
- * result = Reflect.getMetadataKeys(Example.prototype, "property");
- *
- * // method (on constructor)
- * result = Reflect.getMetadataKeys(Example, "staticMethod");
- *
- * // method (on prototype)
- * result = Reflect.getMetadataKeys(Example.prototype, "method");
- *
- */
- function getMetadataKeys(target: Object, targetKey: string | symbol): any[];
- /**
- * Gets the unique metadata keys defined on the target object.
- * @param target The target object on which the metadata is defined.
- * @returns An array of unique metadata keys.
- * @example
- *
- * class Example {
- * }
- *
- * // constructor
- * result = Reflect.getOwnMetadataKeys(Example);
- *
- */
- function getOwnMetadataKeys(target: Object): any[];
- /**
- * Gets the unique metadata keys defined on the target object.
- * @param target The target object on which the metadata is defined.
- * @param targetKey The property key for the target.
- * @returns An array of unique metadata keys.
- * @example
- *
- * class Example {
- * // property declarations are not part of ES6, though they are valid in TypeScript:
- * // static staticProperty;
- * // property;
- *
- * static staticMethod(p) { }
- * method(p) { }
- * }
- *
- * // property (on constructor)
- * result = Reflect.getOwnMetadataKeys(Example, "staticProperty");
- *
- * // property (on prototype)
- * result = Reflect.getOwnMetadataKeys(Example.prototype, "property");
- *
- * // method (on constructor)
- * result = Reflect.getOwnMetadataKeys(Example, "staticMethod");
- *
- * // method (on prototype)
- * result = Reflect.getOwnMetadataKeys(Example.prototype, "method");
- *
- */
- function getOwnMetadataKeys(target: Object, targetKey: string | symbol): any[];
- /**
- * Deletes the metadata entry from the target object with the provided key.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param target The target object on which the metadata is defined.
- * @returns `true` if the metadata entry was found and deleted; otherwise, false.
- * @example
- *
- * class Example {
- * }
- *
- * // constructor
- * result = Reflect.deleteMetadata("custom:annotation", Example);
- *
- */
- function deleteMetadata(metadataKey: any, target: Object): boolean;
- /**
- * Deletes the metadata entry from the target object with the provided key.
- * @param metadataKey A key used to store and retrieve metadata.
- * @param target The target object on which the metadata is defined.
- * @param targetKey The property key for the target.
- * @returns `true` if the metadata entry was found and deleted; otherwise, false.
- * @example
- *
- * class Example {
- * // property declarations are not part of ES6, though they are valid in TypeScript:
- * // static staticProperty;
- * // property;
- *
- * static staticMethod(p) { }
- * method(p) { }
- * }
- *
- * // property (on constructor)
- * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty");
- *
- * // property (on prototype)
- * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property");
- *
- * // method (on constructor)
- * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod");
- *
- * // method (on prototype)
- * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method");
- *
- */
- function deleteMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean;
- }
|