Skip to content

Commit

Permalink
Merge pull request #3996 from preactjs/types/compat-forward-ref-exoti…
Browse files Browse the repository at this point in the history
…c-component
  • Loading branch information
rschristian committed May 17, 2023
2 parents 19f4176 + a24d26b commit b69428e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions compat/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,20 @@ declare namespace React {
) => boolean
): C;

export interface RefAttributes<R> extends preact.Attributes {
ref?: preact.Ref<R> | undefined;
}

export interface ForwardFn<P = {}, T = any> {
(props: P, ref: ForwardedRef<T>): preact.ComponentChild;
displayName?: string;
}

export interface ForwardRefExoticComponent<P>
extends preact.FunctionComponent<P> {
defaultProps?: Partial<P> | undefined;
}

export function forwardRef<R, P = {}>(
fn: ForwardFn<P, R>
): preact.FunctionalComponent<Omit<P, 'ref'> & { ref?: preact.Ref<R> }>;
Expand Down

0 comments on commit b69428e

Please sign in to comment.