Skip to content

Commit aebad71

Browse files
committed
test: add h
1 parent 0d6afa8 commit aebad71

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import {
22
type Component,
33
type DefineComponent,
44
Fragment,
5+
type FunctionalComponent,
56
Suspense,
67
Teleport,
8+
type VNode,
79
defineComponent,
810
h,
911
ref,
@@ -77,6 +79,19 @@ describe('h inference w/ Suspense', () => {
7779
h(Suspense, { onResolve: 1 })
7880
})
7981

82+
declare const fc: FunctionalComponent<
83+
{
84+
foo: string
85+
bar?: number
86+
onClick: (evt: MouseEvent) => void
87+
},
88+
['click'],
89+
{
90+
default: () => VNode
91+
title: (scope: { id: number }) => VNode
92+
}
93+
>
94+
declare const vnode: VNode
8095
describe('h inference w/ functional component', () => {
8196
const Func = (_props: { foo: string; bar?: number }) => ''
8297
h(Func, { foo: 'hello' })
@@ -87,6 +102,24 @@ describe('h inference w/ functional component', () => {
87102
h(Func, {})
88103
// @ts-expect-error
89104
h(Func, { bar: 123 })
105+
106+
h(
107+
fc,
108+
{ foo: 'hello', onClick: () => {} },
109+
{
110+
default: () => vnode,
111+
title: ({ id }: { id: number }) => vnode,
112+
},
113+
)
114+
115+
h(
116+
fc,
117+
{ foo: 'hello', onClick: () => {} },
118+
{
119+
default: () => vnode,
120+
title: ({ id }: { id: number }) => vnode,
121+
},
122+
)
90123
})
91124

92125
describe('h support w/ plain object component', () => {

0 commit comments

Comments
 (0)