Skip to content

Commit 3bde069

Browse files
ChristianKienlektsn
authored andcommitted
fix: adds check for Reflect. Reflect.getOwnMetadataKeys (#305)
1 parent 7ecde38 commit 3bde069

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: src/reflect.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import Vue, { VueConstructor } from 'vue'
22
import { VueClass } from './declarations'
33

4-
export const reflectionIsSupported = typeof Reflect !== 'undefined' && Reflect.defineMetadata
4+
// The rational behind the verbose Reflect-feature check below is the fact that there are polyfills
5+
// which add an implementation for Reflect.defineMetadata but not for Reflect.getOwnMetadataKeys.
6+
// Without this check consumers will encounter hard to track down runtime errors.
7+
export const reflectionIsSupported = typeof Reflect !== 'undefined' && Reflect.defineMetadata && Reflect.getOwnMetadataKeys
58

69
export function copyReflectionMetadata (
710
to: VueConstructor,

0 commit comments

Comments
 (0)