Skip to content

Commit d1f8760

Browse files
rschristianJoviDeCroock
authored andcommitted
refactor (v11): Remove deprecated 'ForwardFn' type from compat (#4777)
* refactor: Remove deprecated 'ForwardFn' type from compat * test: Correct type test
1 parent 1b1d77b commit d1f8760

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

compat/src/forwardRef.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const REACT_FORWARD_SYMBOL = Symbol.for('react.forward_ref');
66
* Pass ref down to a child. This is mainly used in libraries with HOCs that
77
* wrap components. Using `forwardRef` there is an easy way to get a reference
88
* of the wrapped component instead of one of the wrapper itself.
9-
* @param {import('./index').ForwardFn} fn
9+
* @param {import('./index').ForwardRefRenderFunction} fn
1010
* @returns {import('./internal').FunctionComponent}
1111
*/
1212
export function forwardRef(fn) {

compat/src/index.d.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,6 @@ declare namespace React {
335335
ref?: preact1.Ref<R> | undefined;
336336
}
337337

338-
/**
339-
* @deprecated Please use `ForwardRefRenderFunction` instead.
340-
*/
341-
export interface ForwardFn<P = {}, T = any> {
342-
(props: P, ref: ForwardedRef<T>): preact1.ComponentChild;
343-
displayName?: string;
344-
}
345-
346338
export interface ForwardRefRenderFunction<T = any, P = {}> {
347339
(props: P, ref: ForwardedRef<T>): preact1.ComponentChild;
348340
displayName?: string;

compat/test/ts/forward-ref.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from '../../src';
22

3-
const MyInput: React.ForwardFn<{ id: string }, { focus(): void }> = (
4-
props,
5-
ref
6-
) => {
3+
const MyInput: React.ForwardRefRenderFunction<
4+
{ focus(): void },
5+
{ id: string }
6+
> = (props, ref) => {
77
const inputRef = React.useRef<HTMLInputElement>(null);
88

99
React.useImperativeHandle(ref, () => ({

0 commit comments

Comments
 (0)