Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Missing MemoExoticComponent type in compat #3898

Merged
merged 3 commits into from
Feb 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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