interface Props works, but type Props does not
Version
3.2.31
Reproduction link
Steps to reproduce
Steps
git checkout demo1
pnpm i
open main.tsx
there is a error hint at line 19
src/main.tsx:19:33 - error TS2322: Type '() => number' is not assignable to type 'void'. 19 const app = createApp(<div><App onClick={() => 1} /></div>)
comment out
type Props
(lines 7 ~ 9), uncommentinterface Props
(lines 4 ~ 6), then it works without errors.
What is expected?
type Props
works without type errors in code below
type Props = {
onClick: () => void
}
const App = defineComponent<Props>({
setup() {
return () => (
<div>App</div>
)
}
})
const app = createApp(<div><App onClick={() => 1} /></div>)
app.mount('#app')
What is actually happening?
type Props
does not work as expected