Skip to content

Commit 1d40c76

Browse files
committed
add vnode support
1 parent bbad2f8 commit 1d40c76

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

packages/dts-test/defineComponent.test-d.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ describe('with object props', () => {
320320
props: {
321321
myProp: {
322322
type: Number,
323-
validator: (val: unknown) => {
323+
validator(val) {
324324
// @ts-expect-error
325325
return val !== this.otherProp
326326
},

packages/dts-test/h.test-d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
Suspense,
99
Component,
1010
resolveComponent,
11-
ConcreteComponent
11+
ConcreteComponent,
12+
VNode
1213
} from 'vue'
1314
import { describe, expectAssignable, expectType } from './utils'
1415

@@ -254,6 +255,8 @@ describe('h should work with multiple types', () => {
254255
h(sampleComponent, {}, [])
255256
})
256257

258+
// usage in test-utils
257259
describe('should allow to assign vnode', () => {
258260
h(h('div', 'test'))
261+
h({} as unknown as VNode | string | { render: Function } | Component)
259262
})

packages/runtime-core/src/h.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,12 @@ export function h<P>(
180180
): VNode
181181

182182
// catch all types
183-
export function h(type: string | Constructor, children?: RawChildren): VNode
183+
export function h(
184+
type: VNode | string | Constructor,
185+
children?: RawChildren
186+
): VNode
184187
export function h<P>(
185-
type: string | Component<P>,
188+
type: VNode | string | Component<P>,
186189
props?: (RawProps & P) | ({} extends P ? null : never),
187190
children?: RawChildren | RawSlots
188191
): VNode

0 commit comments

Comments
 (0)