@@ -222,6 +222,9 @@ export function decorate(decorators: (ClassDecorator | MemberDecorator)[], targe
222
222
*
223
223
*/
224
224
export function metadata ( metadataKey : any , metadataValue : any ) : { ( target : Function ) : void ; ( target : any , propertyKey : string | symbol ) : void ; } {
225
+ if ( typeof Reflect !== "undefined" && typeof Reflect . metadata === "function" && Reflect . metadata !== metadata ) {
226
+ return Reflect . metadata ( metadataKey , metadataValue ) ;
227
+ }
225
228
function decorator ( target : Function ) : void ;
226
229
function decorator ( target : any , propertyKey : string | symbol ) : void ;
227
230
function decorator ( target : any , propertyKey ?: string | symbol ) : void {
@@ -333,6 +336,9 @@ export function defineMetadata(metadataKey: any, metadataValue: any, target: any
333
336
*
334
337
*/
335
338
export function defineMetadata ( metadataKey : any , metadataValue : any , target : any , propertyKey ?: string | symbol ) : void {
339
+ if ( typeof Reflect !== "undefined" && typeof Reflect . defineMetadata === "function" && Reflect . defineMetadata !== defineMetadata ) {
340
+ return Reflect . defineMetadata ( metadataKey , metadataValue , target , propertyKey ! ) ;
341
+ }
336
342
if ( ! IsObject ( target ) ) throw new TypeError ( ) ;
337
343
if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ;
338
344
return OrdinaryDefineOwnMetadata ( metadataKey , metadataValue , target , propertyKey ) ;
@@ -424,6 +430,9 @@ export function hasMetadata(metadataKey: any, target: any, propertyKey: string |
424
430
*
425
431
*/
426
432
export function hasMetadata ( metadataKey : any , target : any , propertyKey ?: string | symbol ) : boolean {
433
+ if ( typeof Reflect !== "undefined" && typeof Reflect . hasMetadata === "function" && Reflect . hasMetadata !== hasMetadata ) {
434
+ return Reflect . hasMetadata ( metadataKey , target , propertyKey ! ) ;
435
+ }
427
436
if ( ! IsObject ( target ) ) throw new TypeError ( ) ;
428
437
if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ;
429
438
return OrdinaryHasMetadata ( metadataKey , target , propertyKey ) ;
@@ -515,6 +524,9 @@ export function hasOwnMetadata(metadataKey: any, target: any, propertyKey: strin
515
524
*
516
525
*/
517
526
export function hasOwnMetadata ( metadataKey : any , target : any , propertyKey ?: string | symbol ) : boolean {
527
+ if ( typeof Reflect !== "undefined" && typeof Reflect . hasOwnMetadata === "function" && Reflect . hasOwnMetadata !== hasOwnMetadata ) {
528
+ return Reflect . hasOwnMetadata ( metadataKey , target , propertyKey ! ) ;
529
+ }
518
530
if ( ! IsObject ( target ) ) throw new TypeError ( ) ;
519
531
if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ;
520
532
return OrdinaryHasOwnMetadata ( metadataKey , target , propertyKey ) ;
@@ -606,6 +618,9 @@ export function getMetadata(metadataKey: any, target: any, propertyKey: string |
606
618
*
607
619
*/
608
620
export function getMetadata ( metadataKey : any , target : any , propertyKey ?: string | symbol ) : any {
621
+ if ( typeof Reflect !== "undefined" && typeof Reflect . getMetadata === "function" && Reflect . getMetadata !== getMetadata ) {
622
+ return Reflect . getMetadata ( metadataKey , target , propertyKey ! ) ;
623
+ }
609
624
if ( ! IsObject ( target ) ) throw new TypeError ( ) ;
610
625
if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ;
611
626
return OrdinaryGetMetadata ( metadataKey , target , propertyKey ) ;
@@ -697,6 +712,9 @@ export function getOwnMetadata(metadataKey: any, target: any, propertyKey: strin
697
712
*
698
713
*/
699
714
export function getOwnMetadata ( metadataKey : any , target : any , propertyKey ?: string | symbol ) : any {
715
+ if ( typeof Reflect !== "undefined" && typeof Reflect . getOwnMetadata === "function" && Reflect . getOwnMetadata !== getOwnMetadata ) {
716
+ return Reflect . getOwnMetadata ( metadataKey , target , propertyKey ! ) ;
717
+ }
700
718
if ( ! IsObject ( target ) ) throw new TypeError ( ) ;
701
719
if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ;
702
720
return OrdinaryGetOwnMetadata ( metadataKey , target , propertyKey ) ;
@@ -785,6 +803,9 @@ export function getMetadataKeys(target: any, propertyKey: string | symbol): any[
785
803
*
786
804
*/
787
805
export function getMetadataKeys ( target : any , propertyKey ?: string | symbol ) : any [ ] {
806
+ if ( typeof Reflect !== "undefined" && typeof Reflect . getMetadataKeys === "function" && Reflect . getMetadataKeys !== getMetadataKeys ) {
807
+ return Reflect . getMetadataKeys ( target , propertyKey ! ) ;
808
+ }
788
809
if ( ! IsObject ( target ) ) throw new TypeError ( ) ;
789
810
if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ;
790
811
return OrdinaryMetadataKeys ( target , propertyKey ) ;
@@ -873,6 +894,9 @@ export function getOwnMetadataKeys(target: any, propertyKey: string | symbol): a
873
894
*
874
895
*/
875
896
export function getOwnMetadataKeys ( target : any , propertyKey ?: string | symbol ) : any [ ] {
897
+ if ( typeof Reflect !== "undefined" && typeof Reflect . getOwnMetadataKeys === "function" && Reflect . getOwnMetadataKeys !== getOwnMetadataKeys ) {
898
+ return Reflect . getOwnMetadataKeys ( target , propertyKey ! ) ;
899
+ }
876
900
if ( ! IsObject ( target ) ) throw new TypeError ( ) ;
877
901
if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ;
878
902
return OrdinaryOwnMetadataKeys ( target , propertyKey ) ;
@@ -964,6 +988,9 @@ export function deleteMetadata(metadataKey: any, target: any, propertyKey: strin
964
988
*
965
989
*/
966
990
export function deleteMetadata ( metadataKey : any , target : any , propertyKey ?: string | symbol ) : boolean {
991
+ if ( typeof Reflect !== "undefined" && typeof Reflect . deleteMetadata === "function" && Reflect . deleteMetadata !== deleteMetadata ) {
992
+ return Reflect . deleteMetadata ( metadataKey , target , propertyKey ! ) ;
993
+ }
967
994
if ( ! IsObject ( target ) ) throw new TypeError ( ) ;
968
995
if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ;
969
996
const metadataMap = GetOrCreateMetadataMap ( target , propertyKey , /*Create*/ false ) ;
0 commit comments