Return Type Preact Forward
I make tsx component in fresh preact but have a error said it need a return type, what is the return type for a forwardref?
66 | const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref): JSX.Element => {
| ^^^^^^^^ this symbol is missing an explicit type
|
= hint: add an explicit type annotation to the symbol
info: all symbols in the public API must have an explicit type
docs: https://jsr.io/go/slow-type-missing-explicit-type
const Button = forwardRef<HTMLButtonElement, ButtonProps>((props,ref)=> {
return (
<button>a example </button>
)}
JSR
About "slow types" - Docs - JSR
JSR uses TypeScript types to generate documentation and improve Node.js compatibility. "Slow types" can get in the way of this.
2 Replies
If you hover the
Button
variable you'll see the typeWe cant use any JSX.Element or JSX.InstrinctElement["button"] will throw error