Skip to content

Commit

Permalink
Merge branch 'master' into fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Sep 23, 2022
2 parents 05222dd + 2cafede commit 1ad2429
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion compat/src/index.d.ts
Expand Up @@ -124,19 +124,29 @@ declare namespace React {
): C;

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

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

interface MutableRefObject<T> {
current: T;
}

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
};

export const Children: {
map<T extends preact.ComponentChild, R>(
children: T | T[],
Expand Down
2 changes: 1 addition & 1 deletion src/index.d.ts
Expand Up @@ -39,7 +39,7 @@ export type Key = string | number | any;

export type RefObject<T> = { current: T | null };
export type RefCallback<T> = (instance: T | null) => void;
export type Ref<T> = RefObject<T> | RefCallback<T>;
export type Ref<T> = RefObject<T> | RefCallback<T> | null;

export type ComponentChild =
| VNode<any>
Expand Down

0 comments on commit 1ad2429

Please sign in to comment.