Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 6 additions & 3 deletions compat/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as _hooks from '../../hooks';
import * as preact from '../../src';
import { JSXInternal } from '../../src/jsx'
import * as _internal from './internal';
import * as _Suspense from './suspense';

// export default React;
Expand Down Expand Up @@ -43,7 +42,6 @@ declare namespace React {
export import lazy = _Suspense.lazy;

// Compat
export import ForwardFn = _internal.ForwardFn;
export const version: string;

export function createPortal(vnode: preact.VNode, container: Element): preact.VNode<any>;
Expand All @@ -64,7 +62,12 @@ declare namespace React {

export function memo<P = {}>(component: preact.FunctionalComponent<P>, comparer?: (prev: P, next: P) => boolean): preact.FunctionComponent<P>;

export function forwardRef<R, P = {}>(fn: _internal.ForwardFn<P, R>): preact.FunctionalComponent<P>;
export interface ForwardFn<P = {}, T = any> {
(props: P, ref: Ref<T>): preact.ComponentChild;
displayName?: string;
}

export function forwardRef<R, P = {}>(fn: ForwardFn<P, R>): preact.FunctionalComponent<P>;

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

Expand Down
6 changes: 0 additions & 6 deletions compat/src/internal.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Ref, ComponentChild } from '../..';
import {
Component as PreactComponent,
VNode as PreactVNode,
Expand Down Expand Up @@ -27,11 +26,6 @@ export interface VNode<T = any> extends PreactVNode<T> {
preactCompatNormalized?: boolean;
}

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

export interface SuspenseState {
_parkedChildren: VNode<any>[];
}
Expand Down
2 changes: 1 addition & 1 deletion compat/test/ts/forward-ref.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from '../../src';
import React from '../../src';

const MyInput: React.ForwardFn<{ id: string }, { focus(): void }> = (props, ref) => {
const inputRef = React.useRef<HTMLInputElement>()
Expand Down