From 2d7cf78a4ffc2f87fd5361621bf86fb221d306de Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Tue, 21 Apr 2020 08:55:34 +0200 Subject: [PATCH] fix: remove globalProperties `globalProperties` is not supported AFAIK and was removed from the original PR except in the `mergeGlobalProperties` utils. With the various parameters correctly typed, the code was throwing a compilation error as TS can spot that `globalProperties` is not a key of `GlobalMountOptions`. --- src/utils.ts | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 1f7723442..ca7eb4106 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -10,20 +10,24 @@ const pascalCase = flow(camelCase, upperFirst) export { kebabCase, pascalCase } export function mergeGlobalProperties( - configGlobal = {}, - mountGlobal = {} + configGlobal: GlobalMountOptions = {}, + mountGlobal: GlobalMountOptions = {} ): GlobalMountOptions { - return mergeWith({}, configGlobal, mountGlobal, (objValue, srcValue, key) => { - switch (key) { - case 'mocks': - case 'provide': - case 'components': - case 'directives': - case 'globalProperties': - return { ...objValue, ...srcValue } - case 'plugins': - case 'mixins': - return [...(objValue || []), ...(srcValue || [])].filter(Boolean) + return mergeWith( + {}, + configGlobal, + mountGlobal, + (objValue, srcValue, key: keyof GlobalMountOptions) => { + switch (key) { + case 'mocks': + case 'provide': + case 'components': + case 'directives': + return { ...objValue, ...srcValue } + case 'plugins': + case 'mixins': + return [...(objValue || []), ...(srcValue || [])].filter(Boolean) + } } - }) + ) }