Why can React props take async function with () => void
signature instead of () => Promise<void>
signature without type errors?
Is it intended or misusage?
interface Props {
onFunc: () => Promise<void>
}
const Child = ({onFunc}: Props) => {
// something
}
const Parent = ({onFunc}: Props) => {
const func: () => Promise<void> = async () => {
// something
}
return <Child onFunc={func}>
}
1