With React you are able to use React.ComponentPropsWithoutRef<"img"> to elegantly type a component that passes through props to a native element.
How are you supposed to do this with Preact?
With React you are able to use React.ComponentPropsWithoutRef<"img"> to elegantly type a component that passes through props to a native element.
How are you supposed to do this with Preact?
There is exactly no utility type similar to ComponentPropsWithoutRef provided in React typings. But you can make use of IntrinsicElements interface defined in JSXInternal namespace.
import { JSXInternal } from 'preact/src/jsx';
type ImgAttrs = JSXInternal.IntrinsicElements['img'];
let x = {} as ImgAttrs;
This works with Preact version 10.x.x.