[6a3a178] | 1 | /*! *****************************************************************************
|
---|
| 2 | Copyright (C) Microsoft. All rights reserved.
|
---|
| 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
---|
| 4 | this file except in compliance with the License. You may obtain a copy of the
|
---|
| 5 | License at http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 6 |
|
---|
| 7 | THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
---|
| 8 | KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
---|
| 9 | WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
---|
| 10 | MERCHANTABLITY OR NON-INFRINGEMENT.
|
---|
| 11 |
|
---|
| 12 | See the Apache Version 2.0 License for specific language governing permissions
|
---|
| 13 | and limitations under the License.
|
---|
| 14 | ***************************************************************************** */
|
---|
| 15 | declare namespace Reflect {
|
---|
| 16 | /**
|
---|
| 17 | * Applies a set of decorators to a target object.
|
---|
| 18 | * @param decorators An array of decorators.
|
---|
| 19 | * @param target The target object.
|
---|
| 20 | * @returns The result of applying the provided decorators.
|
---|
| 21 | * @remarks Decorators are applied in reverse order of their positions in the array.
|
---|
| 22 | * @example
|
---|
| 23 | *
|
---|
| 24 | * class Example { }
|
---|
| 25 | *
|
---|
| 26 | * // constructor
|
---|
| 27 | * Example = Reflect.decorate(decoratorsArray, Example);
|
---|
| 28 | *
|
---|
| 29 | */
|
---|
| 30 | function decorate(decorators: ClassDecorator[], target: Function): Function;
|
---|
| 31 | /**
|
---|
| 32 | * Applies a set of decorators to a property of a target object.
|
---|
| 33 | * @param decorators An array of decorators.
|
---|
| 34 | * @param target The target object.
|
---|
| 35 | * @param propertyKey The property key to decorate.
|
---|
| 36 | * @param attributes A property descriptor.
|
---|
| 37 | * @remarks Decorators are applied in reverse order.
|
---|
| 38 | * @example
|
---|
| 39 | *
|
---|
| 40 | * class Example {
|
---|
| 41 | * // property declarations are not part of ES6, though they are valid in TypeScript:
|
---|
| 42 | * // static staticProperty;
|
---|
| 43 | * // property;
|
---|
| 44 | *
|
---|
| 45 | * static staticMethod() { }
|
---|
| 46 | * method() { }
|
---|
| 47 | * }
|
---|
| 48 | *
|
---|
| 49 | * // property (on constructor)
|
---|
| 50 | * Reflect.decorate(decoratorsArray, Example, "staticProperty");
|
---|
| 51 | *
|
---|
| 52 | * // property (on prototype)
|
---|
| 53 | * Reflect.decorate(decoratorsArray, Example.prototype, "property");
|
---|
| 54 | *
|
---|
| 55 | * // method (on constructor)
|
---|
| 56 | * Object.defineProperty(Example, "staticMethod",
|
---|
| 57 | * Reflect.decorate(decoratorsArray, Example, "staticMethod",
|
---|
| 58 | * Object.getOwnPropertyDescriptor(Example, "staticMethod")));
|
---|
| 59 | *
|
---|
| 60 | * // method (on prototype)
|
---|
| 61 | * Object.defineProperty(Example.prototype, "method",
|
---|
| 62 | * Reflect.decorate(decoratorsArray, Example.prototype, "method",
|
---|
| 63 | * Object.getOwnPropertyDescriptor(Example.prototype, "method")));
|
---|
| 64 | *
|
---|
| 65 | */
|
---|
| 66 | function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, propertyKey: string | symbol, attributes?: PropertyDescriptor): PropertyDescriptor;
|
---|
| 67 | /**
|
---|
| 68 | * A default metadata decorator factory that can be used on a class, class member, or parameter.
|
---|
| 69 | * @param metadataKey The key for the metadata entry.
|
---|
| 70 | * @param metadataValue The value for the metadata entry.
|
---|
| 71 | * @returns A decorator function.
|
---|
| 72 | * @remarks
|
---|
| 73 | * If `metadataKey` is already defined for the target and target key, the
|
---|
| 74 | * metadataValue for that key will be overwritten.
|
---|
| 75 | * @example
|
---|
| 76 | *
|
---|
| 77 | * // constructor
|
---|
| 78 | * @Reflect.metadata(key, value)
|
---|
| 79 | * class Example {
|
---|
| 80 | * }
|
---|
| 81 | *
|
---|
| 82 | * // property (on constructor, TypeScript only)
|
---|
| 83 | * class Example {
|
---|
| 84 | * @Reflect.metadata(key, value)
|
---|
| 85 | * static staticProperty;
|
---|
| 86 | * }
|
---|
| 87 | *
|
---|
| 88 | * // property (on prototype, TypeScript only)
|
---|
| 89 | * class Example {
|
---|
| 90 | * @Reflect.metadata(key, value)
|
---|
| 91 | * property;
|
---|
| 92 | * }
|
---|
| 93 | *
|
---|
| 94 | * // method (on constructor)
|
---|
| 95 | * class Example {
|
---|
| 96 | * @Reflect.metadata(key, value)
|
---|
| 97 | * static staticMethod() { }
|
---|
| 98 | * }
|
---|
| 99 | *
|
---|
| 100 | * // method (on prototype)
|
---|
| 101 | * class Example {
|
---|
| 102 | * @Reflect.metadata(key, value)
|
---|
| 103 | * method() { }
|
---|
| 104 | * }
|
---|
| 105 | *
|
---|
| 106 | */
|
---|
| 107 | function metadata(metadataKey: any, metadataValue: any): {
|
---|
| 108 | (target: Function): void;
|
---|
| 109 | (target: Object, propertyKey: string | symbol): void;
|
---|
| 110 | };
|
---|
| 111 | /**
|
---|
| 112 | * Define a unique metadata entry on the target.
|
---|
| 113 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 114 | * @param metadataValue A value that contains attached metadata.
|
---|
| 115 | * @param target The target object on which to define metadata.
|
---|
| 116 | * @example
|
---|
| 117 | *
|
---|
| 118 | * class Example {
|
---|
| 119 | * }
|
---|
| 120 | *
|
---|
| 121 | * // constructor
|
---|
| 122 | * Reflect.defineMetadata("custom:annotation", options, Example);
|
---|
| 123 | *
|
---|
| 124 | * // decorator factory as metadata-producing annotation.
|
---|
| 125 | * function MyAnnotation(options): ClassDecorator {
|
---|
| 126 | * return target => Reflect.defineMetadata("custom:annotation", options, target);
|
---|
| 127 | * }
|
---|
| 128 | *
|
---|
| 129 | */
|
---|
| 130 | function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void;
|
---|
| 131 | /**
|
---|
| 132 | * Define a unique metadata entry on the target.
|
---|
| 133 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 134 | * @param metadataValue A value that contains attached metadata.
|
---|
| 135 | * @param target The target object on which to define metadata.
|
---|
| 136 | * @param propertyKey The property key for the target.
|
---|
| 137 | * @example
|
---|
| 138 | *
|
---|
| 139 | * class Example {
|
---|
| 140 | * // property declarations are not part of ES6, though they are valid in TypeScript:
|
---|
| 141 | * // static staticProperty;
|
---|
| 142 | * // property;
|
---|
| 143 | *
|
---|
| 144 | * static staticMethod(p) { }
|
---|
| 145 | * method(p) { }
|
---|
| 146 | * }
|
---|
| 147 | *
|
---|
| 148 | * // property (on constructor)
|
---|
| 149 | * Reflect.defineMetadata("custom:annotation", Number, Example, "staticProperty");
|
---|
| 150 | *
|
---|
| 151 | * // property (on prototype)
|
---|
| 152 | * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "property");
|
---|
| 153 | *
|
---|
| 154 | * // method (on constructor)
|
---|
| 155 | * Reflect.defineMetadata("custom:annotation", Number, Example, "staticMethod");
|
---|
| 156 | *
|
---|
| 157 | * // method (on prototype)
|
---|
| 158 | * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "method");
|
---|
| 159 | *
|
---|
| 160 | * // decorator factory as metadata-producing annotation.
|
---|
| 161 | * function MyAnnotation(options): PropertyDecorator {
|
---|
| 162 | * return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key);
|
---|
| 163 | * }
|
---|
| 164 | *
|
---|
| 165 | */
|
---|
| 166 | function defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey: string | symbol): void;
|
---|
| 167 | /**
|
---|
| 168 | * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
|
---|
| 169 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 170 | * @param target The target object on which the metadata is defined.
|
---|
| 171 | * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
|
---|
| 172 | * @example
|
---|
| 173 | *
|
---|
| 174 | * class Example {
|
---|
| 175 | * }
|
---|
| 176 | *
|
---|
| 177 | * // constructor
|
---|
| 178 | * result = Reflect.hasMetadata("custom:annotation", Example);
|
---|
| 179 | *
|
---|
| 180 | */
|
---|
| 181 | function hasMetadata(metadataKey: any, target: Object): boolean;
|
---|
| 182 | /**
|
---|
| 183 | * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
|
---|
| 184 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 185 | * @param target The target object on which the metadata is defined.
|
---|
| 186 | * @param propertyKey The property key for the target.
|
---|
| 187 | * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
|
---|
| 188 | * @example
|
---|
| 189 | *
|
---|
| 190 | * class Example {
|
---|
| 191 | * // property declarations are not part of ES6, though they are valid in TypeScript:
|
---|
| 192 | * // static staticProperty;
|
---|
| 193 | * // property;
|
---|
| 194 | *
|
---|
| 195 | * static staticMethod(p) { }
|
---|
| 196 | * method(p) { }
|
---|
| 197 | * }
|
---|
| 198 | *
|
---|
| 199 | * // property (on constructor)
|
---|
| 200 | * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty");
|
---|
| 201 | *
|
---|
| 202 | * // property (on prototype)
|
---|
| 203 | * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property");
|
---|
| 204 | *
|
---|
| 205 | * // method (on constructor)
|
---|
| 206 | * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod");
|
---|
| 207 | *
|
---|
| 208 | * // method (on prototype)
|
---|
| 209 | * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method");
|
---|
| 210 | *
|
---|
| 211 | */
|
---|
| 212 | function hasMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
---|
| 213 | /**
|
---|
| 214 | * Gets a value indicating whether the target object has the provided metadata key defined.
|
---|
| 215 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 216 | * @param target The target object on which the metadata is defined.
|
---|
| 217 | * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
|
---|
| 218 | * @example
|
---|
| 219 | *
|
---|
| 220 | * class Example {
|
---|
| 221 | * }
|
---|
| 222 | *
|
---|
| 223 | * // constructor
|
---|
| 224 | * result = Reflect.hasOwnMetadata("custom:annotation", Example);
|
---|
| 225 | *
|
---|
| 226 | */
|
---|
| 227 | function hasOwnMetadata(metadataKey: any, target: Object): boolean;
|
---|
| 228 | /**
|
---|
| 229 | * Gets a value indicating whether the target object has the provided metadata key defined.
|
---|
| 230 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 231 | * @param target The target object on which the metadata is defined.
|
---|
| 232 | * @param propertyKey The property key for the target.
|
---|
| 233 | * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
|
---|
| 234 | * @example
|
---|
| 235 | *
|
---|
| 236 | * class Example {
|
---|
| 237 | * // property declarations are not part of ES6, though they are valid in TypeScript:
|
---|
| 238 | * // static staticProperty;
|
---|
| 239 | * // property;
|
---|
| 240 | *
|
---|
| 241 | * static staticMethod(p) { }
|
---|
| 242 | * method(p) { }
|
---|
| 243 | * }
|
---|
| 244 | *
|
---|
| 245 | * // property (on constructor)
|
---|
| 246 | * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty");
|
---|
| 247 | *
|
---|
| 248 | * // property (on prototype)
|
---|
| 249 | * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property");
|
---|
| 250 | *
|
---|
| 251 | * // method (on constructor)
|
---|
| 252 | * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod");
|
---|
| 253 | *
|
---|
| 254 | * // method (on prototype)
|
---|
| 255 | * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method");
|
---|
| 256 | *
|
---|
| 257 | */
|
---|
| 258 | function hasOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
---|
| 259 | /**
|
---|
| 260 | * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
|
---|
| 261 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 262 | * @param target The target object on which the metadata is defined.
|
---|
| 263 | * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
---|
| 264 | * @example
|
---|
| 265 | *
|
---|
| 266 | * class Example {
|
---|
| 267 | * }
|
---|
| 268 | *
|
---|
| 269 | * // constructor
|
---|
| 270 | * result = Reflect.getMetadata("custom:annotation", Example);
|
---|
| 271 | *
|
---|
| 272 | */
|
---|
| 273 | function getMetadata(metadataKey: any, target: Object): any;
|
---|
| 274 | /**
|
---|
| 275 | * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
|
---|
| 276 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 277 | * @param target The target object on which the metadata is defined.
|
---|
| 278 | * @param propertyKey The property key for the target.
|
---|
| 279 | * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
---|
| 280 | * @example
|
---|
| 281 | *
|
---|
| 282 | * class Example {
|
---|
| 283 | * // property declarations are not part of ES6, though they are valid in TypeScript:
|
---|
| 284 | * // static staticProperty;
|
---|
| 285 | * // property;
|
---|
| 286 | *
|
---|
| 287 | * static staticMethod(p) { }
|
---|
| 288 | * method(p) { }
|
---|
| 289 | * }
|
---|
| 290 | *
|
---|
| 291 | * // property (on constructor)
|
---|
| 292 | * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty");
|
---|
| 293 | *
|
---|
| 294 | * // property (on prototype)
|
---|
| 295 | * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property");
|
---|
| 296 | *
|
---|
| 297 | * // method (on constructor)
|
---|
| 298 | * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod");
|
---|
| 299 | *
|
---|
| 300 | * // method (on prototype)
|
---|
| 301 | * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method");
|
---|
| 302 | *
|
---|
| 303 | */
|
---|
| 304 | function getMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any;
|
---|
| 305 | /**
|
---|
| 306 | * Gets the metadata value for the provided metadata key on the target object.
|
---|
| 307 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 308 | * @param target The target object on which the metadata is defined.
|
---|
| 309 | * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
---|
| 310 | * @example
|
---|
| 311 | *
|
---|
| 312 | * class Example {
|
---|
| 313 | * }
|
---|
| 314 | *
|
---|
| 315 | * // constructor
|
---|
| 316 | * result = Reflect.getOwnMetadata("custom:annotation", Example);
|
---|
| 317 | *
|
---|
| 318 | */
|
---|
| 319 | function getOwnMetadata(metadataKey: any, target: Object): any;
|
---|
| 320 | /**
|
---|
| 321 | * Gets the metadata value for the provided metadata key on the target object.
|
---|
| 322 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 323 | * @param target The target object on which the metadata is defined.
|
---|
| 324 | * @param propertyKey The property key for the target.
|
---|
| 325 | * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
---|
| 326 | * @example
|
---|
| 327 | *
|
---|
| 328 | * class Example {
|
---|
| 329 | * // property declarations are not part of ES6, though they are valid in TypeScript:
|
---|
| 330 | * // static staticProperty;
|
---|
| 331 | * // property;
|
---|
| 332 | *
|
---|
| 333 | * static staticMethod(p) { }
|
---|
| 334 | * method(p) { }
|
---|
| 335 | * }
|
---|
| 336 | *
|
---|
| 337 | * // property (on constructor)
|
---|
| 338 | * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty");
|
---|
| 339 | *
|
---|
| 340 | * // property (on prototype)
|
---|
| 341 | * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property");
|
---|
| 342 | *
|
---|
| 343 | * // method (on constructor)
|
---|
| 344 | * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod");
|
---|
| 345 | *
|
---|
| 346 | * // method (on prototype)
|
---|
| 347 | * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method");
|
---|
| 348 | *
|
---|
| 349 | */
|
---|
| 350 | function getOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any;
|
---|
| 351 | /**
|
---|
| 352 | * Gets the metadata keys defined on the target object or its prototype chain.
|
---|
| 353 | * @param target The target object on which the metadata is defined.
|
---|
| 354 | * @returns An array of unique metadata keys.
|
---|
| 355 | * @example
|
---|
| 356 | *
|
---|
| 357 | * class Example {
|
---|
| 358 | * }
|
---|
| 359 | *
|
---|
| 360 | * // constructor
|
---|
| 361 | * result = Reflect.getMetadataKeys(Example);
|
---|
| 362 | *
|
---|
| 363 | */
|
---|
| 364 | function getMetadataKeys(target: Object): any[];
|
---|
| 365 | /**
|
---|
| 366 | * Gets the metadata keys defined on the target object or its prototype chain.
|
---|
| 367 | * @param target The target object on which the metadata is defined.
|
---|
| 368 | * @param propertyKey The property key for the target.
|
---|
| 369 | * @returns An array of unique metadata keys.
|
---|
| 370 | * @example
|
---|
| 371 | *
|
---|
| 372 | * class Example {
|
---|
| 373 | * // property declarations are not part of ES6, though they are valid in TypeScript:
|
---|
| 374 | * // static staticProperty;
|
---|
| 375 | * // property;
|
---|
| 376 | *
|
---|
| 377 | * static staticMethod(p) { }
|
---|
| 378 | * method(p) { }
|
---|
| 379 | * }
|
---|
| 380 | *
|
---|
| 381 | * // property (on constructor)
|
---|
| 382 | * result = Reflect.getMetadataKeys(Example, "staticProperty");
|
---|
| 383 | *
|
---|
| 384 | * // property (on prototype)
|
---|
| 385 | * result = Reflect.getMetadataKeys(Example.prototype, "property");
|
---|
| 386 | *
|
---|
| 387 | * // method (on constructor)
|
---|
| 388 | * result = Reflect.getMetadataKeys(Example, "staticMethod");
|
---|
| 389 | *
|
---|
| 390 | * // method (on prototype)
|
---|
| 391 | * result = Reflect.getMetadataKeys(Example.prototype, "method");
|
---|
| 392 | *
|
---|
| 393 | */
|
---|
| 394 | function getMetadataKeys(target: Object, propertyKey: string | symbol): any[];
|
---|
| 395 | /**
|
---|
| 396 | * Gets the unique metadata keys defined on the target object.
|
---|
| 397 | * @param target The target object on which the metadata is defined.
|
---|
| 398 | * @returns An array of unique metadata keys.
|
---|
| 399 | * @example
|
---|
| 400 | *
|
---|
| 401 | * class Example {
|
---|
| 402 | * }
|
---|
| 403 | *
|
---|
| 404 | * // constructor
|
---|
| 405 | * result = Reflect.getOwnMetadataKeys(Example);
|
---|
| 406 | *
|
---|
| 407 | */
|
---|
| 408 | function getOwnMetadataKeys(target: Object): any[];
|
---|
| 409 | /**
|
---|
| 410 | * Gets the unique metadata keys defined on the target object.
|
---|
| 411 | * @param target The target object on which the metadata is defined.
|
---|
| 412 | * @param propertyKey The property key for the target.
|
---|
| 413 | * @returns An array of unique metadata keys.
|
---|
| 414 | * @example
|
---|
| 415 | *
|
---|
| 416 | * class Example {
|
---|
| 417 | * // property declarations are not part of ES6, though they are valid in TypeScript:
|
---|
| 418 | * // static staticProperty;
|
---|
| 419 | * // property;
|
---|
| 420 | *
|
---|
| 421 | * static staticMethod(p) { }
|
---|
| 422 | * method(p) { }
|
---|
| 423 | * }
|
---|
| 424 | *
|
---|
| 425 | * // property (on constructor)
|
---|
| 426 | * result = Reflect.getOwnMetadataKeys(Example, "staticProperty");
|
---|
| 427 | *
|
---|
| 428 | * // property (on prototype)
|
---|
| 429 | * result = Reflect.getOwnMetadataKeys(Example.prototype, "property");
|
---|
| 430 | *
|
---|
| 431 | * // method (on constructor)
|
---|
| 432 | * result = Reflect.getOwnMetadataKeys(Example, "staticMethod");
|
---|
| 433 | *
|
---|
| 434 | * // method (on prototype)
|
---|
| 435 | * result = Reflect.getOwnMetadataKeys(Example.prototype, "method");
|
---|
| 436 | *
|
---|
| 437 | */
|
---|
| 438 | function getOwnMetadataKeys(target: Object, propertyKey: string | symbol): any[];
|
---|
| 439 | /**
|
---|
| 440 | * Deletes the metadata entry from the target object with the provided key.
|
---|
| 441 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 442 | * @param target The target object on which the metadata is defined.
|
---|
| 443 | * @returns `true` if the metadata entry was found and deleted; otherwise, false.
|
---|
| 444 | * @example
|
---|
| 445 | *
|
---|
| 446 | * class Example {
|
---|
| 447 | * }
|
---|
| 448 | *
|
---|
| 449 | * // constructor
|
---|
| 450 | * result = Reflect.deleteMetadata("custom:annotation", Example);
|
---|
| 451 | *
|
---|
| 452 | */
|
---|
| 453 | function deleteMetadata(metadataKey: any, target: Object): boolean;
|
---|
| 454 | /**
|
---|
| 455 | * Deletes the metadata entry from the target object with the provided key.
|
---|
| 456 | * @param metadataKey A key used to store and retrieve metadata.
|
---|
| 457 | * @param target The target object on which the metadata is defined.
|
---|
| 458 | * @param propertyKey The property key for the target.
|
---|
| 459 | * @returns `true` if the metadata entry was found and deleted; otherwise, false.
|
---|
| 460 | * @example
|
---|
| 461 | *
|
---|
| 462 | * class Example {
|
---|
| 463 | * // property declarations are not part of ES6, though they are valid in TypeScript:
|
---|
| 464 | * // static staticProperty;
|
---|
| 465 | * // property;
|
---|
| 466 | *
|
---|
| 467 | * static staticMethod(p) { }
|
---|
| 468 | * method(p) { }
|
---|
| 469 | * }
|
---|
| 470 | *
|
---|
| 471 | * // property (on constructor)
|
---|
| 472 | * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty");
|
---|
| 473 | *
|
---|
| 474 | * // property (on prototype)
|
---|
| 475 | * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property");
|
---|
| 476 | *
|
---|
| 477 | * // method (on constructor)
|
---|
| 478 | * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod");
|
---|
| 479 | *
|
---|
| 480 | * // method (on prototype)
|
---|
| 481 | * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method");
|
---|
| 482 | *
|
---|
| 483 | */
|
---|
| 484 | function deleteMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
---|
| 485 | } |
---|