diff --git a/packages/react-reconciler/src/ReactInternalTypes.js b/packages/react-reconciler/src/ReactInternalTypes.js index 7f01daa5240da..a672b9669abcf 100644 --- a/packages/react-reconciler/src/ReactInternalTypes.js +++ b/packages/react-reconciler/src/ReactInternalTypes.js @@ -383,9 +383,7 @@ export type Dispatcher = { create: () => (() => void) | void, deps: Array | void | null, ): void, - useEffectEvent?: ) => Return>( - callback: F, - ) => F, + useEffectEvent?: ) => mixed>(callback: F) => F, useInsertionEffect( create: () => (() => void) | void, deps: Array | void | null, diff --git a/packages/react/src/ReactHooks.js b/packages/react/src/ReactHooks.js index 7f1bc8d5e133b..6d157cbc60289 100644 --- a/packages/react/src/ReactHooks.js +++ b/packages/react/src/ReactHooks.js @@ -218,24 +218,26 @@ export function useSyncExternalStore( export function useCacheRefresh(): (?() => T, ?T) => void { const dispatcher = resolveDispatcher(); - // $FlowFixMe This is unstable, thus optional + // $FlowFixMe[not-a-function] This is unstable, thus optional return dispatcher.useCacheRefresh(); } export function use(usable: Usable): T { const dispatcher = resolveDispatcher(); - // $FlowFixMe This is unstable, thus optional + // $FlowFixMe[not-a-function] This is unstable, thus optional return dispatcher.use(usable); } export function useMemoCache(size: number): Array { const dispatcher = resolveDispatcher(); - // $FlowFixMe This is unstable, thus optional + // $FlowFixMe[not-a-function] This is unstable, thus optional return dispatcher.useMemoCache(size); } -export function useEffectEvent(callback: T): void { +export function useEffectEvent) => mixed>( + callback: F, +): F { const dispatcher = resolveDispatcher(); - // $FlowFixMe This is unstable, thus optional + // $FlowFixMe[not-a-function] This is unstable, thus optional return dispatcher.useEffectEvent(callback); }