reflect-metadata
Advanced tools
Comparing version 0.1.7 to 0.1.8
{ | ||
"name": "reflect-metadata", | ||
"version": "0.1.3", | ||
"version": "0.1.8", | ||
"description": "Polyfill for Metadata Reflection API", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/rbuckton/ReflectDecorators", |
{ | ||
"name": "reflect-metadata", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Polyfill for Metadata Reflection API", | ||
@@ -8,3 +8,3 @@ "main": "Reflect.js", | ||
"typescript": { | ||
"definition": "reflect-metadata.d.ts" | ||
"definition": "Reflect.d.ts" | ||
}, | ||
@@ -11,0 +11,0 @@ "scripts": { |
@@ -7,2 +7,8 @@ Proposal to add Decorators to ES7, along with a prototype for an ES7 Reflection API for Decorator Metadata | ||
## Installation | ||
``` | ||
npm install reflect-metadata | ||
``` | ||
## Background | ||
@@ -165,2 +171,6 @@ | ||
* To enable experimental support for metadata decorators in your TypeScript project, you must add `"experimentalDecorators": true` to your tsconfig.json file. | ||
* To enable experimental support for auto-generated type metadata in your TypeScript project, you must add `"emitDecoratorMetadata": true` to your tsconfig.json file. | ||
* Please note that auto-generated type metadata may have issues with circular or forward references for types. | ||
## Issues | ||
@@ -167,0 +177,0 @@ |
@@ -15,476 +15,2 @@ /*! ***************************************************************************** | ||
***************************************************************************** */ | ||
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 C { } | ||
* | ||
* // constructor | ||
* C = Reflect.decorate(decoratorsArray, C); | ||
* | ||
*/ | ||
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 C { | ||
* // 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, C, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* Reflect.decorate(decoratorsArray, C.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* Object.defineProperty(C, "staticMethod", | ||
* Reflect.decorate(decoratorsArray, C, "staticMethod", | ||
* Object.getOwnPropertyDescriptor(C, "staticMethod"))); | ||
* | ||
* // method (on prototype) | ||
* Object.defineProperty(C.prototype, "method", | ||
* Reflect.decorate(decoratorsArray, C.prototype, "method", | ||
* Object.getOwnPropertyDescriptor(C.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 C { | ||
* } | ||
* | ||
* // property (on constructor, TypeScript only) | ||
* class C { | ||
* @Reflect.metadata(key, value) | ||
* static staticProperty; | ||
* } | ||
* | ||
* // property (on prototype, TypeScript only) | ||
* class C { | ||
* @Reflect.metadata(key, value) | ||
* property; | ||
* } | ||
* | ||
* // method (on constructor) | ||
* class C { | ||
* @Reflect.metadata(key, value) | ||
* static staticMethod() { } | ||
* } | ||
* | ||
* // method (on prototype) | ||
* class C { | ||
* @Reflect.metadata(key, value) | ||
* method() { } | ||
* } | ||
* | ||
*/ | ||
function metadata(metadataKey: any, metadataValue: any): { | ||
(target: Function): void; | ||
(target: Object, propertyKey: 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 C { | ||
* } | ||
* | ||
* // constructor | ||
* Reflect.defineMetadata("custom:annotation", options, C); | ||
* | ||
* // 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 C { | ||
* // 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, C, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* Reflect.defineMetadata("custom:annotation", Number, C.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* Reflect.defineMetadata("custom:annotation", Number, C, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* Reflect.defineMetadata("custom:annotation", Number, C.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 C { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.hasMetadata("custom:annotation", C); | ||
* | ||
*/ | ||
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 C { | ||
* // 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", C, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.hasMetadata("custom:annotation", C.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 C { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C); | ||
* | ||
*/ | ||
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 C { | ||
* // 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", C, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C.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 C { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.getMetadata("custom:annotation", C); | ||
* | ||
*/ | ||
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 C { | ||
* // 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", C, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getMetadata("custom:annotation", C.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 C { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.getOwnMetadata("custom:annotation", C); | ||
* | ||
*/ | ||
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 C { | ||
* // 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", C, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C.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 C { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.getMetadataKeys(C); | ||
* | ||
*/ | ||
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 C { | ||
* // 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(C, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getMetadataKeys(C.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getMetadataKeys(C, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getMetadataKeys(C.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 C { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.getOwnMetadataKeys(C); | ||
* | ||
*/ | ||
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 C { | ||
* // 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(C, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getOwnMetadataKeys(C.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getOwnMetadataKeys(C, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getOwnMetadataKeys(C.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 C { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.deleteMetadata("custom:annotation", C); | ||
* | ||
*/ | ||
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 C { | ||
* // 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", C, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); | ||
* | ||
*/ | ||
function deleteMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean; | ||
} | ||
/// <reference path="./Reflect.d.ts" /> |
130
Reflect.js
@@ -59,3 +59,3 @@ /*! ***************************************************************************** | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -71,19 +71,19 @@ * // static staticProperty; | ||
* // constructor | ||
* C = Reflect.decorate(decoratorsArray, C); | ||
* Example = Reflect.decorate(decoratorsArray, Example); | ||
* | ||
* // property (on constructor) | ||
* Reflect.decorate(decoratorsArray, C, "staticProperty"); | ||
* Reflect.decorate(decoratorsArray, Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* Reflect.decorate(decoratorsArray, C.prototype, "property"); | ||
* Reflect.decorate(decoratorsArray, Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* Object.defineProperty(C, "staticMethod", | ||
* Reflect.decorate(decoratorsArray, C, "staticMethod", | ||
* Object.getOwnPropertyDescriptor(C, "staticMethod"))); | ||
* Object.defineProperty(Example, "staticMethod", | ||
* Reflect.decorate(decoratorsArray, Example, "staticMethod", | ||
* Object.getOwnPropertyDescriptor(Example, "staticMethod"))); | ||
* | ||
* // method (on prototype) | ||
* Object.defineProperty(C.prototype, "method", | ||
* Reflect.decorate(decoratorsArray, C.prototype, "method", | ||
* Object.getOwnPropertyDescriptor(C.prototype, "method"))); | ||
* Object.defineProperty(Example.prototype, "method", | ||
* Reflect.decorate(decoratorsArray, Example.prototype, "method", | ||
* Object.getOwnPropertyDescriptor(Example.prototype, "method"))); | ||
* | ||
@@ -133,7 +133,7 @@ */ | ||
* @Reflect.metadata(key, value) | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // property (on constructor, TypeScript only) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -144,3 +144,3 @@ * static staticProperty; | ||
* // property (on prototype, TypeScript only) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -151,3 +151,3 @@ * property; | ||
* // method (on constructor) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -158,3 +158,3 @@ * static staticMethod() { } | ||
* // method (on prototype) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -190,3 +190,3 @@ * method() { } | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -202,15 +202,15 @@ * // static staticProperty; | ||
* // constructor | ||
* Reflect.defineMetadata("custom:annotation", options, C); | ||
* Reflect.defineMetadata("custom:annotation", options, Example); | ||
* | ||
* // property (on constructor) | ||
* Reflect.defineMetadata("custom:annotation", options, C, "staticProperty"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* Reflect.defineMetadata("custom:annotation", options, C.prototype, "property"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* Reflect.defineMetadata("custom:annotation", options, C, "staticMethod"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* Reflect.defineMetadata("custom:annotation", options, C.prototype, "method"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); | ||
* | ||
@@ -239,3 +239,3 @@ * // decorator factory as metadata-producing annotation. | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -251,15 +251,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.hasMetadata("custom:annotation", C); | ||
* result = Reflect.hasMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -283,3 +283,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -295,15 +295,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -327,3 +327,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -339,15 +339,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getMetadata("custom:annotation", C); | ||
* result = Reflect.getMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -371,3 +371,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -383,15 +383,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getOwnMetadata("custom:annotation", C); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -414,3 +414,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -426,15 +426,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getMetadataKeys(C); | ||
* result = Reflect.getMetadataKeys(Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getMetadataKeys(C, "staticProperty"); | ||
* result = Reflect.getMetadataKeys(Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getMetadataKeys(C.prototype, "property"); | ||
* result = Reflect.getMetadataKeys(Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getMetadataKeys(C, "staticMethod"); | ||
* result = Reflect.getMetadataKeys(Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getMetadataKeys(C.prototype, "method"); | ||
* result = Reflect.getMetadataKeys(Example.prototype, "method"); | ||
* | ||
@@ -457,3 +457,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -469,15 +469,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getOwnMetadataKeys(C); | ||
* result = Reflect.getOwnMetadataKeys(Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getOwnMetadataKeys(C, "staticProperty"); | ||
* result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getOwnMetadataKeys(C.prototype, "property"); | ||
* result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getOwnMetadataKeys(C, "staticMethod"); | ||
* result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getOwnMetadataKeys(C.prototype, "method"); | ||
* result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); | ||
* | ||
@@ -501,3 +501,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -513,15 +513,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.deleteMetadata("custom:annotation", C); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -688,4 +688,4 @@ */ | ||
// TypeScript doesn't set __proto__ in ES5, as it's non-standard. | ||
// Try to determine the superclass constructor. Compatible implementations | ||
// must either set __proto__ on a subclass constructor to the superclass constructor, | ||
// Try to determine the superclass Exampleonstructor. Compatible implementations | ||
// must either set __proto__ on a subclass Exampleonstructor to the superclass Exampleonstructor, | ||
// or ensure each class has a valid `constructor` property on its prototype that | ||
@@ -692,0 +692,0 @@ // points back to the constructor. |
264
Reflect.ts
@@ -149,6 +149,6 @@ /*! ***************************************************************************** | ||
* | ||
* class C { } | ||
* class Example { } | ||
* | ||
* // constructor | ||
* C = Reflect.decorate(decoratorsArray, C); | ||
* Example = Reflect.decorate(decoratorsArray, Example); | ||
* | ||
@@ -167,3 +167,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -178,16 +178,16 @@ * // static staticProperty; | ||
* // property (on constructor) | ||
* Reflect.decorate(decoratorsArray, C, "staticProperty"); | ||
* Reflect.decorate(decoratorsArray, Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* Reflect.decorate(decoratorsArray, C.prototype, "property"); | ||
* Reflect.decorate(decoratorsArray, Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* Object.defineProperty(C, "staticMethod", | ||
* Reflect.decorate(decoratorsArray, C, "staticMethod", | ||
* Object.getOwnPropertyDescriptor(C, "staticMethod"))); | ||
* Object.defineProperty(Example, "staticMethod", | ||
* Reflect.decorate(decoratorsArray, Example, "staticMethod", | ||
* Object.getOwnPropertyDescriptor(Example, "staticMethod"))); | ||
* | ||
* // method (on prototype) | ||
* Object.defineProperty(C.prototype, "method", | ||
* Reflect.decorate(decoratorsArray, C.prototype, "method", | ||
* Object.getOwnPropertyDescriptor(C.prototype, "method"))); | ||
* Object.defineProperty(Example.prototype, "method", | ||
* Reflect.decorate(decoratorsArray, Example.prototype, "method", | ||
* Object.getOwnPropertyDescriptor(Example.prototype, "method"))); | ||
* | ||
@@ -206,3 +206,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -218,19 +218,19 @@ * // static staticProperty; | ||
* // constructor | ||
* C = Reflect.decorate(decoratorsArray, C); | ||
* Example = Reflect.decorate(decoratorsArray, Example); | ||
* | ||
* // property (on constructor) | ||
* Reflect.decorate(decoratorsArray, C, "staticProperty"); | ||
* Reflect.decorate(decoratorsArray, Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* Reflect.decorate(decoratorsArray, C.prototype, "property"); | ||
* Reflect.decorate(decoratorsArray, Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* Object.defineProperty(C, "staticMethod", | ||
* Reflect.decorate(decoratorsArray, C, "staticMethod", | ||
* Object.getOwnPropertyDescriptor(C, "staticMethod"))); | ||
* Object.defineProperty(Example, "staticMethod", | ||
* Reflect.decorate(decoratorsArray, Example, "staticMethod", | ||
* Object.getOwnPropertyDescriptor(Example, "staticMethod"))); | ||
* | ||
* // method (on prototype) | ||
* Object.defineProperty(C.prototype, "method", | ||
* Reflect.decorate(decoratorsArray, C.prototype, "method", | ||
* Object.getOwnPropertyDescriptor(C.prototype, "method"))); | ||
* Object.defineProperty(Example.prototype, "method", | ||
* Reflect.decorate(decoratorsArray, Example.prototype, "method", | ||
* Object.getOwnPropertyDescriptor(Example.prototype, "method"))); | ||
* | ||
@@ -272,7 +272,7 @@ */ | ||
* @Reflect.metadata(key, value) | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // property (on constructor, TypeScript only) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -283,3 +283,3 @@ * static staticProperty; | ||
* // property (on prototype, TypeScript only) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -290,3 +290,3 @@ * property; | ||
* // method (on constructor) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -297,3 +297,3 @@ * static staticMethod() { } | ||
* // method (on prototype) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -328,7 +328,7 @@ * method() { } | ||
* | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // constructor | ||
* Reflect.defineMetadata("custom:annotation", options, C); | ||
* Reflect.defineMetadata("custom:annotation", options, Example); | ||
* | ||
@@ -351,3 +351,3 @@ * // decorator factory as metadata-producing annotation. | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -362,12 +362,12 @@ * // static staticProperty; | ||
* // property (on constructor) | ||
* Reflect.defineMetadata("custom:annotation", Number, C, "staticProperty"); | ||
* Reflect.defineMetadata("custom:annotation", Number, Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* Reflect.defineMetadata("custom:annotation", Number, C.prototype, "property"); | ||
* Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* Reflect.defineMetadata("custom:annotation", Number, C, "staticMethod"); | ||
* Reflect.defineMetadata("custom:annotation", Number, Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* Reflect.defineMetadata("custom:annotation", Number, C.prototype, "method"); | ||
* Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "method"); | ||
* | ||
@@ -390,3 +390,3 @@ * // decorator factory as metadata-producing annotation. | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -402,15 +402,15 @@ * // static staticProperty; | ||
* // constructor | ||
* Reflect.defineMetadata("custom:annotation", options, C); | ||
* Reflect.defineMetadata("custom:annotation", options, Example); | ||
* | ||
* // property (on constructor) | ||
* Reflect.defineMetadata("custom:annotation", options, C, "staticProperty"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* Reflect.defineMetadata("custom:annotation", options, C.prototype, "property"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* Reflect.defineMetadata("custom:annotation", options, C, "staticMethod"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* Reflect.defineMetadata("custom:annotation", options, C.prototype, "method"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); | ||
* | ||
@@ -436,7 +436,7 @@ * // decorator factory as metadata-producing annotation. | ||
* | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.hasMetadata("custom:annotation", C); | ||
* result = Reflect.hasMetadata("custom:annotation", Example); | ||
* | ||
@@ -454,3 +454,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -465,12 +465,12 @@ * // static staticProperty; | ||
* // property (on constructor) | ||
* result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -488,3 +488,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -500,15 +500,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.hasMetadata("custom:annotation", C); | ||
* result = Reflect.hasMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -529,7 +529,7 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example); | ||
* | ||
@@ -547,3 +547,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -558,12 +558,12 @@ * // static staticProperty; | ||
* // property (on constructor) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -581,3 +581,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -593,15 +593,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -622,7 +622,7 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.getMetadata("custom:annotation", C); | ||
* result = Reflect.getMetadata("custom:annotation", Example); | ||
* | ||
@@ -640,3 +640,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -651,12 +651,12 @@ * // static staticProperty; | ||
* // property (on constructor) | ||
* result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -674,3 +674,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -686,15 +686,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getMetadata("custom:annotation", C); | ||
* result = Reflect.getMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -715,7 +715,7 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.getOwnMetadata("custom:annotation", C); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example); | ||
* | ||
@@ -733,3 +733,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -744,12 +744,12 @@ * // static staticProperty; | ||
* // property (on constructor) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -767,3 +767,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -779,15 +779,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getOwnMetadata("custom:annotation", C); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -807,7 +807,7 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.getMetadataKeys(C); | ||
* result = Reflect.getMetadataKeys(Example); | ||
* | ||
@@ -824,3 +824,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -835,12 +835,12 @@ * // static staticProperty; | ||
* // property (on constructor) | ||
* result = Reflect.getMetadataKeys(C, "staticProperty"); | ||
* result = Reflect.getMetadataKeys(Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getMetadataKeys(C.prototype, "property"); | ||
* result = Reflect.getMetadataKeys(Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getMetadataKeys(C, "staticMethod"); | ||
* result = Reflect.getMetadataKeys(Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getMetadataKeys(C.prototype, "method"); | ||
* result = Reflect.getMetadataKeys(Example.prototype, "method"); | ||
* | ||
@@ -857,3 +857,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -869,15 +869,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getMetadataKeys(C); | ||
* result = Reflect.getMetadataKeys(Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getMetadataKeys(C, "staticProperty"); | ||
* result = Reflect.getMetadataKeys(Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getMetadataKeys(C.prototype, "property"); | ||
* result = Reflect.getMetadataKeys(Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getMetadataKeys(C, "staticMethod"); | ||
* result = Reflect.getMetadataKeys(Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getMetadataKeys(C.prototype, "method"); | ||
* result = Reflect.getMetadataKeys(Example.prototype, "method"); | ||
* | ||
@@ -897,7 +897,7 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.getOwnMetadataKeys(C); | ||
* result = Reflect.getOwnMetadataKeys(Example); | ||
* | ||
@@ -914,3 +914,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -925,12 +925,12 @@ * // static staticProperty; | ||
* // property (on constructor) | ||
* result = Reflect.getOwnMetadataKeys(C, "staticProperty"); | ||
* result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getOwnMetadataKeys(C.prototype, "property"); | ||
* result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getOwnMetadataKeys(C, "staticMethod"); | ||
* result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getOwnMetadataKeys(C.prototype, "method"); | ||
* result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); | ||
* | ||
@@ -947,3 +947,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -959,15 +959,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getOwnMetadataKeys(C); | ||
* result = Reflect.getOwnMetadataKeys(Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getOwnMetadataKeys(C, "staticProperty"); | ||
* result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getOwnMetadataKeys(C.prototype, "property"); | ||
* result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getOwnMetadataKeys(C, "staticMethod"); | ||
* result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getOwnMetadataKeys(C.prototype, "method"); | ||
* result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); | ||
* | ||
@@ -988,7 +988,7 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // constructor | ||
* result = Reflect.deleteMetadata("custom:annotation", C); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example); | ||
* | ||
@@ -1006,3 +1006,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -1017,12 +1017,12 @@ * // static staticProperty; | ||
* // property (on constructor) | ||
* result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -1040,3 +1040,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -1052,15 +1052,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.deleteMetadata("custom:annotation", C); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -1222,4 +1222,4 @@ */ | ||
// TypeScript doesn't set __proto__ in ES5, as it's non-standard. | ||
// Try to determine the superclass constructor. Compatible implementations | ||
// must either set __proto__ on a subclass constructor to the superclass constructor, | ||
// Try to determine the superclass Exampleonstructor. Compatible implementations | ||
// must either set __proto__ on a subclass Exampleonstructor to the superclass Exampleonstructor, | ||
// or ensure each class has a valid `constructor` property on its prototype that | ||
@@ -1226,0 +1226,0 @@ // points back to the constructor. |
@@ -59,3 +59,3 @@ /*! ***************************************************************************** | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -71,19 +71,19 @@ * // static staticProperty; | ||
* // constructor | ||
* C = Reflect.decorate(decoratorsArray, C); | ||
* Example = Reflect.decorate(decoratorsArray, Example); | ||
* | ||
* // property (on constructor) | ||
* Reflect.decorate(decoratorsArray, C, "staticProperty"); | ||
* Reflect.decorate(decoratorsArray, Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* Reflect.decorate(decoratorsArray, C.prototype, "property"); | ||
* Reflect.decorate(decoratorsArray, Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* Object.defineProperty(C, "staticMethod", | ||
* Reflect.decorate(decoratorsArray, C, "staticMethod", | ||
* Object.getOwnPropertyDescriptor(C, "staticMethod"))); | ||
* Object.defineProperty(Example, "staticMethod", | ||
* Reflect.decorate(decoratorsArray, Example, "staticMethod", | ||
* Object.getOwnPropertyDescriptor(Example, "staticMethod"))); | ||
* | ||
* // method (on prototype) | ||
* Object.defineProperty(C.prototype, "method", | ||
* Reflect.decorate(decoratorsArray, C.prototype, "method", | ||
* Object.getOwnPropertyDescriptor(C.prototype, "method"))); | ||
* Object.defineProperty(Example.prototype, "method", | ||
* Reflect.decorate(decoratorsArray, Example.prototype, "method", | ||
* Object.getOwnPropertyDescriptor(Example.prototype, "method"))); | ||
* | ||
@@ -133,7 +133,7 @@ */ | ||
* @Reflect.metadata(key, value) | ||
* class C { | ||
* class Example { | ||
* } | ||
* | ||
* // property (on constructor, TypeScript only) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -144,3 +144,3 @@ * static staticProperty; | ||
* // property (on prototype, TypeScript only) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -151,3 +151,3 @@ * property; | ||
* // method (on constructor) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -158,3 +158,3 @@ * static staticMethod() { } | ||
* // method (on prototype) | ||
* class C { | ||
* class Example { | ||
* @Reflect.metadata(key, value) | ||
@@ -190,3 +190,3 @@ * method() { } | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -202,15 +202,15 @@ * // static staticProperty; | ||
* // constructor | ||
* Reflect.defineMetadata("custom:annotation", options, C); | ||
* Reflect.defineMetadata("custom:annotation", options, Example); | ||
* | ||
* // property (on constructor) | ||
* Reflect.defineMetadata("custom:annotation", options, C, "staticProperty"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* Reflect.defineMetadata("custom:annotation", options, C.prototype, "property"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* Reflect.defineMetadata("custom:annotation", options, C, "staticMethod"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* Reflect.defineMetadata("custom:annotation", options, C.prototype, "method"); | ||
* Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); | ||
* | ||
@@ -239,3 +239,3 @@ * // decorator factory as metadata-producing annotation. | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -251,15 +251,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.hasMetadata("custom:annotation", C); | ||
* result = Reflect.hasMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -283,3 +283,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -295,15 +295,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -327,3 +327,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -339,15 +339,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getMetadata("custom:annotation", C); | ||
* result = Reflect.getMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -371,3 +371,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -383,15 +383,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getOwnMetadata("custom:annotation", C); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -414,3 +414,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -426,15 +426,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getMetadataKeys(C); | ||
* result = Reflect.getMetadataKeys(Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getMetadataKeys(C, "staticProperty"); | ||
* result = Reflect.getMetadataKeys(Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getMetadataKeys(C.prototype, "property"); | ||
* result = Reflect.getMetadataKeys(Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getMetadataKeys(C, "staticMethod"); | ||
* result = Reflect.getMetadataKeys(Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getMetadataKeys(C.prototype, "method"); | ||
* result = Reflect.getMetadataKeys(Example.prototype, "method"); | ||
* | ||
@@ -457,3 +457,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -469,15 +469,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.getOwnMetadataKeys(C); | ||
* result = Reflect.getOwnMetadataKeys(Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.getOwnMetadataKeys(C, "staticProperty"); | ||
* result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.getOwnMetadataKeys(C.prototype, "property"); | ||
* result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.getOwnMetadataKeys(C, "staticMethod"); | ||
* result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.getOwnMetadataKeys(C.prototype, "method"); | ||
* result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); | ||
* | ||
@@ -501,3 +501,3 @@ */ | ||
* | ||
* class C { | ||
* class Example { | ||
* // property declarations are not part of ES6, though they are valid in TypeScript: | ||
@@ -513,15 +513,15 @@ * // static staticProperty; | ||
* // constructor | ||
* result = Reflect.deleteMetadata("custom:annotation", C); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example); | ||
* | ||
* // property (on constructor) | ||
* result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); | ||
* | ||
* // property (on prototype) | ||
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); | ||
* | ||
* // method (on constructor) | ||
* result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); | ||
* | ||
* // method (on prototype) | ||
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); | ||
* result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); | ||
* | ||
@@ -688,4 +688,4 @@ */ | ||
// TypeScript doesn't set __proto__ in ES5, as it's non-standard. | ||
// Try to determine the superclass constructor. Compatible implementations | ||
// must either set __proto__ on a subclass constructor to the superclass constructor, | ||
// Try to determine the superclass Exampleonstructor. Compatible implementations | ||
// must either set __proto__ on a subclass Exampleonstructor to the superclass Exampleonstructor, | ||
// or ensure each class has a valid `constructor` property on its prototype that | ||
@@ -692,0 +692,0 @@ // points back to the constructor. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
581754
77
5957
180