Skip to content

Commit

Permalink
test: add test case for #12778
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Nov 9, 2022
1 parent f7db7f3 commit 5aed733
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions types/test/v3/tsx-test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VNode, defineComponent, ref } from '../../index'
import { VNode, defineComponent, ref, RenderContext } from '../../index'
import { expectType } from '../utils'

expectType<VNode>(<div />)
Expand All @@ -25,7 +25,13 @@ expectType<JSX.Element>(<div ref="bar" />)
// allow Ref type type on arbitrary element
const fooRef = ref<HTMLElement>()
expectType<JSX.Element>(<div ref={fooRef} />)
expectType<JSX.Element>(<div ref={(el) => {fooRef.value = el as HTMLElement}} />)
expectType<JSX.Element>(
<div
ref={el => {
fooRef.value = el as HTMLElement
}}
/>
)

expectType<JSX.Element>(
<input
Expand Down Expand Up @@ -56,5 +62,8 @@ const Foo = defineComponent({
// working
;<Foo bar={1} />
;<Foo bar={1} foo="baz" />

;<div slot="x" />

export default ({ data }: RenderContext) => {
return <button {...data} />
}

0 comments on commit 5aed733

Please sign in to comment.