Skip to content

Commit

Permalink
ts: improve preact compat types adding a few missing @types/react use…
Browse files Browse the repository at this point in the history
…d by styled-components (#4271)
  • Loading branch information
jduthon authored Feb 2, 2024
1 parent 49433b3 commit a3f7c33
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 @@ -47,6 +47,7 @@ declare namespace React {
export import Component = preact.Component;
export import FunctionComponent = preact.FunctionComponent;
export import ComponentType = preact.ComponentType;
export import ComponentClass = preact.ComponentClass;
export import FC = preact.FunctionComponent;
export import createContext = preact.createContext;
export import createRef = preact.createRef;
Expand All @@ -55,6 +56,8 @@ declare namespace React {
export import cloneElement = preact.cloneElement;
export import ComponentProps = preact.ComponentProps;
export import ReactNode = preact.ComponentChild;
export import ReactElement = preact.VNode;
export import Consumer = preact.Consumer;

// Suspense
export import Suspense = _Suspense.Suspense;
Expand Down Expand Up @@ -169,6 +172,12 @@ declare namespace React {
| MutableRefObject<T | null>
| null;

export type ComponentPropsWithRef<
C extends ComponentType<any> | keyof JSXInternal.IntrinsicElements
> = C extends (new(props: infer P) => Component<any, any>)
? PropsWithoutRef<P> & RefAttributes<InstanceType<C>>
: ComponentProps<C>;

export function flushSync<R>(fn: () => R): R;
export function flushSync<A, R>(fn: (a: A) => R, a: A): R;

Expand Down

0 comments on commit a3f7c33

Please sign in to comment.