Skip to content

Commit

Permalink
test: add h
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jan 4, 2024
1 parent 0d6afa8 commit b47844b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/dts-test/h.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import {
type Component,
type DefineComponent,
Fragment,
type FunctionalComponent,
Suspense,
Teleport,
type VNode,
defineComponent,
h,
ref,
Expand Down Expand Up @@ -77,6 +79,19 @@ describe('h inference w/ Suspense', () => {
h(Suspense, { onResolve: 1 })
})

declare const fc: FunctionalComponent<
{
foo: string
bar?: number
onClick: (evt: MouseEvent) => void
},
['click'],
{
default: () => VNode
title: (scope: { id: number }) => VNode
}
>
declare const vnode: VNode
describe('h inference w/ functional component', () => {
const Func = (_props: { foo: string; bar?: number }) => ''
h(Func, { foo: 'hello' })
Expand All @@ -87,6 +102,15 @@ describe('h inference w/ functional component', () => {
h(Func, {})
// @ts-expect-error
h(Func, { bar: 123 })

h(
fc,
{ foo: 'hello', onClick: () => {} },
{
default: () => vnode,
title: ({ id }: { id: number }) => vnode,
},
)
})

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

0 comments on commit b47844b

Please sign in to comment.