refactor(types): widen Component type to include consutructor types
returned from `defineComponent` ref: https://github.com/vuejs/vue-router-next/pull/421 also close #1880 Previous `Component` type is now exported as `ConcreteComponent`. This introduces a minor breaking change when calling `h(comp, { ... })` will now fail if `comp` is a of generic `Component` type, since it does not specify what props it expects.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { currentRenderingInstance } from '../componentRenderUtils'
|
||||
import {
|
||||
currentInstance,
|
||||
Component,
|
||||
ConcreteComponent,
|
||||
FunctionalComponent,
|
||||
ComponentOptions
|
||||
} from '../component'
|
||||
@@ -16,7 +16,9 @@ const DIRECTIVES = 'directives'
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function resolveComponent(name: string): Component | string | undefined {
|
||||
export function resolveComponent(
|
||||
name: string
|
||||
): ConcreteComponent | string | undefined {
|
||||
return resolveAsset(COMPONENTS, name) || name
|
||||
}
|
||||
|
||||
@@ -49,7 +51,7 @@ function resolveAsset(
|
||||
type: typeof COMPONENTS,
|
||||
name: string,
|
||||
warnMissing?: boolean
|
||||
): Component | undefined
|
||||
): ConcreteComponent | undefined
|
||||
// overload 2: directives
|
||||
function resolveAsset(
|
||||
type: typeof DIRECTIVES,
|
||||
|
||||
Reference in New Issue
Block a user