Skip to content

Commit ca8eb87

Browse files
xielJoviDeCroock
andauthored
Fix incompatible ref typing with ReactElement (& popular react libraries) (#2099)
* Update index.d.ts * Update index.d.ts Co-authored-by: Jovi De Croock <[email protected]>
1 parent 7948701 commit ca8eb87

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ declare namespace preact {
1414
type: ComponentType<P> | string;
1515
props: P & { children: ComponentChildren };
1616
key: Key;
17-
ref: Ref<any> | null;
17+
/**
18+
* ref is not guaranteed by React.ReactElement, for compatiblity reasons
19+
* with popular react libs we define it as optional too
20+
*/
21+
ref?: Ref<any> | null;
1822
/**
1923
* The time this `vnode` started rendering. Will only be set when
2024
* the devtools are attached.

0 commit comments

Comments
 (0)