diff --git a/compat/src/index.d.ts b/compat/src/index.d.ts index 79bb447c45..a9cc4fa458 100644 --- a/compat/src/index.d.ts +++ b/compat/src/index.d.ts @@ -117,7 +117,6 @@ declare namespace React { export import CreateHandle = _hooks.CreateHandle; export import EffectCallback = _hooks.EffectCallback; export import Inputs = _hooks.Inputs; - export import PropRef = _hooks.PropRef; export import Reducer = _hooks.Reducer; export import Dispatch = _hooks.Dispatch; export import SetStateAction = _hooks.StateUpdater; diff --git a/hooks/src/index.d.ts b/hooks/src/index.d.ts index d7f77dbb49..22147a2bd4 100644 --- a/hooks/src/index.d.ts +++ b/hooks/src/index.d.ts @@ -52,13 +52,6 @@ export function useReducer( init: (arg: I) => S ): [S, Dispatch]; -/** @deprecated Use the `Ref` type instead. */ -type PropRef = MutableRef; - -interface MutableRef { - current: T; -} - /** * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument * (`initialValue`). The returned object will persist for the full lifetime of the component. @@ -68,9 +61,9 @@ interface MutableRef { * * @param initialValue the initial value to store in the ref object */ -export function useRef(initialValue: T): MutableRef; -export function useRef(initialValue: T | null): RefObject; -export function useRef(): MutableRef; +export function useRef(initialValue: T): RefObject; +export function useRef(initialValue: T | null): RefObject; +export function useRef(initialValue: T | undefined): RefObject; type EffectCallback = () => void | (() => void); /** diff --git a/src/index.d.ts b/src/index.d.ts index 51321916f9..e6b8fd549e 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -37,9 +37,9 @@ export interface VNode

{ export type Key = string | number | any; -export type RefObject = { current: T | null }; +export type RefObject = { current: T }; export type RefCallback = (instance: T | null) => void; -export type Ref = RefObject | RefCallback | null; +export type Ref = RefCallback | RefObject | null; export type ComponentChild = | VNode