Skip to content

Commit 2fc6ab5

Browse files
vitalishapovalovktsn
authored andcommitted
fix: check reflectionIsSupported in decorator runtime (#350)
* check reflectionIsSupported in decorator runtime * fix lint
1 parent f25f35b commit 2fc6ab5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: src/component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function componentFactory (
8383

8484
forwardStaticMembers(Extended, Component, Super)
8585

86-
if (reflectionIsSupported) {
86+
if (reflectionIsSupported()) {
8787
copyReflectionMetadata(Extended, Component)
8888
}
8989

Diff for: src/reflect.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { VueClass } from './declarations'
44
// The rational behind the verbose Reflect-feature check below is the fact that there are polyfills
55
// which add an implementation for Reflect.defineMetadata but not for Reflect.getOwnMetadataKeys.
66
// Without this check consumers will encounter hard to track down runtime errors.
7-
export const reflectionIsSupported = typeof Reflect !== 'undefined' && Reflect.defineMetadata && Reflect.getOwnMetadataKeys
7+
export function reflectionIsSupported () {
8+
return typeof Reflect !== 'undefined' && Reflect.defineMetadata && Reflect.getOwnMetadataKeys
9+
}
810

911
export function copyReflectionMetadata (
1012
to: VueConstructor,

0 commit comments

Comments
 (0)