[ez] Update useMemoCache return type (#31539)
Use `mixed` instead of `any`
lauren committed
Nov 14, 2024 at 12:10 UTC
b15135b9f59e4d40e1142342f97cfa18d228d0d4
4 files changed
+4
-4
packages/react-debug-tools/src/ReactDebugHooks.js
+1
-1
@@ -560,7 +560,7 @@ function useId(): string {
560
561
// useMemoCache is an implementation detail of Forget's memoization
562
// it should not be called directly in user-generated code
563
-function useMemoCache(size: number): Array<any> {
563
+function useMemoCache(size: number): Array<mixed> {
564
const fiber = currentFiber;
565
// Don't throw, in case this is called from getPrimitiveStackCache
566
if (fiber == null) {
packages/react-reconciler/src/ReactFiberHooks.js
+1
-1
@@ -1199,7 +1199,7 @@ function use<T>(usable: Usable<T>): T {
1199
throw new Error('An unsupported type was passed to use(): ' + String(usable));
1200
}
1201
1202
-function useMemoCache(size: number): Array<any> {
1202
+function useMemoCache(size: number): Array<mixed> {
1203
let memoCache = null;
1204
// Fast-path, load memo cache from wip fiber if already prepared
1205
let updateQueue: FunctionComponentUpdateQueue | null =
packages/react-server/src/ReactFizzHooks.js
+1
-1
@@ -792,7 +792,7 @@ function useCacheRefresh(): <T>(?() => T, ?T) => void {
792
return unsupportedRefresh;
793
}
794
795
-function useMemoCache(size: number): Array<any> {
795
+function useMemoCache(size: number): Array<mixed> {
796
const data = new Array<any>(size);
797
for (let i = 0; i < size; i++) {
798
data[i] = REACT_MEMO_CACHE_SENTINEL;
packages/react/src/ReactHooks.js
+1
-1
@@ -212,7 +212,7 @@ export function use<T>(usable: Usable<T>): T {
212
return dispatcher.use(usable);
213
}
214
215
-export function useMemoCache(size: number): Array<any> {
215
+export function useMemoCache(size: number): Array<mixed> {
216
const dispatcher = resolveDispatcher();
217
// $FlowFixMe[not-a-function] This is unstable, thus optional
218
return dispatcher.useMemoCache(size);