In React, the Ref type corresponds to the Ref type in preact core. However, preact/compat re-exports the Ref type from preact/hooks instead of from core.
The following snippet does not produce a type error in React, but it does when using preact:
coverage: 99.611%. remained the same
when pulling 92fd386204efed31a8f5fb3cc596652bd42227ef on maxbrieiev:main
into d19017e906a204f20c96137b8561a4c10233343e on preactjs:main.
In React, the
Ref
type corresponds to theRef
type in preact core. However,preact/compat
re-exports theRef
type frompreact/hooks
instead of from core.The following snippet does not produce a type error in React, but it does when using preact:
In preact it produces
Type 'ForwardedRef<HTMLElement>' is not assignable to type 'Ref<HTMLElement>'.
This pull requests fixes this issue.