From 74c1c5a58533ced7513e07e8d818f7c424a8e571 Mon Sep 17 00:00:00 2001 From: Vitali Shapovalov Date: Sun, 14 Jul 2019 10:48:12 +0300 Subject: [PATCH 1/2] check reflectionIsSupported in decorator runtime --- src/component.ts | 2 +- src/reflect.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/component.ts b/src/component.ts index 6524e7c..54a8192 100644 --- a/src/component.ts +++ b/src/component.ts @@ -83,7 +83,7 @@ export function componentFactory ( forwardStaticMembers(Extended, Component, Super) - if (reflectionIsSupported) { + if (reflectionIsSupported()) { copyReflectionMetadata(Extended, Component) } diff --git a/src/reflect.ts b/src/reflect.ts index 09f40e6..7f279dd 100644 --- a/src/reflect.ts +++ b/src/reflect.ts @@ -4,7 +4,9 @@ import { VueClass } from './declarations' // The rational behind the verbose Reflect-feature check below is the fact that there are polyfills // which add an implementation for Reflect.defineMetadata but not for Reflect.getOwnMetadataKeys. // Without this check consumers will encounter hard to track down runtime errors. -export const reflectionIsSupported = typeof Reflect !== 'undefined' && Reflect.defineMetadata && Reflect.getOwnMetadataKeys +export function reflectionIsSupported () { + return typeof Reflect !== 'undefined' && Reflect.defineMetadata && Reflect.getOwnMetadataKeys; +} export function copyReflectionMetadata ( to: VueConstructor, From 87a31095f5645cee3a5eb06c7cf6af9a4c7df554 Mon Sep 17 00:00:00 2001 From: Vitali Shapovalov Date: Sun, 14 Jul 2019 11:10:19 +0300 Subject: [PATCH 2/2] fix lint --- src/reflect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reflect.ts b/src/reflect.ts index 7f279dd..ab65dff 100644 --- a/src/reflect.ts +++ b/src/reflect.ts @@ -5,7 +5,7 @@ import { VueClass } from './declarations' // which add an implementation for Reflect.defineMetadata but not for Reflect.getOwnMetadataKeys. // Without this check consumers will encounter hard to track down runtime errors. export function reflectionIsSupported () { - return typeof Reflect !== 'undefined' && Reflect.defineMetadata && Reflect.getOwnMetadataKeys; + return typeof Reflect !== 'undefined' && Reflect.defineMetadata && Reflect.getOwnMetadataKeys } export function copyReflectionMetadata (