From fe9e227ae4f9fa96dd4143e954e58e87016ed2d4 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 7 Jul 2020 12:43:05 -0400 Subject: [PATCH] types: adjust resolveDynamicComponent return type --- packages/runtime-core/src/helpers/resolveAssets.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/runtime-core/src/helpers/resolveAssets.ts b/packages/runtime-core/src/helpers/resolveAssets.ts index c0e38772..03a83337 100644 --- a/packages/runtime-core/src/helpers/resolveAssets.ts +++ b/packages/runtime-core/src/helpers/resolveAssets.ts @@ -3,6 +3,7 @@ import { currentInstance, Component, FunctionalComponent } from '../component' import { Directive } from '../directives' import { camelize, capitalize, isString } from '@vue/shared' import { warn } from '../warning' +import { VNodeTypes } from '../vnode' const COMPONENTS = 'components' const DIRECTIVES = 'directives' @@ -19,14 +20,12 @@ export const NULL_DYNAMIC_COMPONENT = Symbol() /** * @private */ -export function resolveDynamicComponent( - component: unknown -): Component | string | typeof NULL_DYNAMIC_COMPONENT { +export function resolveDynamicComponent(component: unknown): VNodeTypes { if (isString(component)) { return resolveAsset(COMPONENTS, component, false) || component } else { // invalid types will fallthrough to createVNode and raise warning - return (component as any) || NULL_DYNAMIC_COMPONENT + return (component || NULL_DYNAMIC_COMPONENT) as any } }