File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,12 @@ import { Teleport, TeleportProps } from './components/Teleport'
1010import { Suspense , SuspenseProps } from './components/Suspense'
1111import { isObject , isArray } from '@vue/shared'
1212import { RawSlots } from './componentSlots'
13- import { FunctionalComponent , Component , ComponentOptions } from './component'
13+ import {
14+ FunctionalComponent ,
15+ Component ,
16+ ComponentOptions ,
17+ ConcreteComponent
18+ } from './component'
1419import { EmitsOptions } from './componentEmits'
1520import { DefineComponent } from './apiDefineComponent'
1621
@@ -112,6 +117,17 @@ export function h<P, E extends EmitsOptions = {}>(
112117// catch-all for generic component types
113118export function h ( type : Component , children ?: RawChildren ) : VNode
114119
120+ // concrete component
121+ export function h < P > (
122+ type : ConcreteComponent | string ,
123+ children ?: RawChildren
124+ ) : VNode
125+ export function h < P > (
126+ type : ConcreteComponent < P > | string ,
127+ props ?: ( RawProps & P ) | ( { } extends P ? null : never ) ,
128+ children ?: RawChildren
129+ ) : VNode
130+
115131// component without props
116132export function h (
117133 type : Component ,
Original file line number Diff line number Diff line change @@ -16,9 +16,7 @@ const DIRECTIVES = 'directives'
1616/**
1717 * @private
1818 */
19- export function resolveComponent (
20- name : string
21- ) : ConcreteComponent | string | undefined {
19+ export function resolveComponent ( name : string ) : ConcreteComponent | string {
2220 return resolveAsset ( COMPONENTS , name ) || name
2321}
2422
Original file line number Diff line number Diff line change 88 Suspense ,
99 Component ,
1010 expectError ,
11- expectAssignable
11+ expectAssignable ,
12+ resolveComponent
1213} from './index'
1314
1415describe ( 'h inference w/ element' , ( ) => {
@@ -224,3 +225,11 @@ describe('Boolean prop implicit false', () => {
224225 // @ts -expect-error
225226 expectError ( h ( RequiredComponent , { } ) )
226227} )
228+
229+ // #2357
230+ describe ( 'resolveComponent should work' , ( ) => {
231+ h ( resolveComponent ( 'test' ) )
232+ h ( resolveComponent ( 'test' ) , {
233+ message : '1'
234+ } )
235+ } )
You can’t perform that action at this time.
0 commit comments