Skip to content

Commit

Permalink
Merge pull request #3898 from preactjs/types/compat-memo-exotic-compo…
Browse files Browse the repository at this point in the history
…nent

fix: Add `MemoExoticComponent` type to compat
  • Loading branch information
rschristian committed Feb 21, 2023
2 parents 5624b3c + c68a6b2 commit a96e644
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions compat/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ declare namespace React {
isPureReactComponent: boolean;
}

export type MemoExoticComponent<
C extends preact.FunctionalComponent<any>
> = preact.FunctionComponent<ComponentProps<C>> & {
readonly type: C;
};

export function memo<P = {}>(
component: preact.FunctionalComponent<P>,
comparer?: (prev: P, next: P) => boolean
Expand All @@ -135,18 +141,21 @@ declare namespace React {
interface MutableRefObject<T> {
current: T;
}

export type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;

export type ForwardedRef<T> =
| ((instance: T | null) => void)
| MutableRefObject<T | null>
| null;

export function unstable_batchedUpdates(
callback: (arg?: any) => void,
arg?: any
): void;

export type PropsWithChildren<P = unknown> = P & {
children?: preact.ComponentChild | undefined
children?: preact.ComponentChild | undefined;
};

export const Children: {
map<T extends preact.ComponentChild, R>(
children: T | T[],
Expand Down

0 comments on commit a96e644

Please sign in to comment.