diff --git a/compat/src/index.d.ts b/compat/src/index.d.ts
index 3296bbde5b..11a7a205f1 100644
--- a/compat/src/index.d.ts
+++ b/compat/src/index.d.ts
@@ -134,10 +134,23 @@ declare namespace React {
): C;
export interface ForwardFn
{
- (props: P, ref: Ref): preact.ComponentChild;
+ (props: P, ref: ForwardedRef): preact.ComponentChild;
displayName?: string;
}
+ interface MutableRefObject {
+ current: T;
+ }
+
+ export type ForwardedRef =
+ | ((instance: T | null) => void)
+ | MutableRefObject
+ | null;
+
+ export type PropsWithChildren = P & {
+ children?: preact.ComponentChild | undefined;
+ };
+
export function forwardRef(
fn: ForwardFn
): preact.FunctionalComponent & { ref?: preact.Ref }>;
diff --git a/src/index.d.ts b/src/index.d.ts
index 0aca917a6e..b9b1f6986d 100644
--- a/src/index.d.ts
+++ b/src/index.d.ts
@@ -39,7 +39,7 @@ export type Key = string | number | any;
export type RefObject = { current: T | null };
export type RefCallback = (instance: T | null) => void;
-export type Ref = RefObject | RefCallback;
+export type Ref = RefObject | RefCallback | null;
export type ComponentChild =
| VNode