Skip to content

Commit b15135b

Browse files
authored
[ez] Update useMemoCache return type (#31539)
Use `mixed` instead of `any`
1 parent 7aa5dda commit b15135b

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

packages/react-debug-tools/src/ReactDebugHooks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ function useId(): string {
560560

561561
// useMemoCache is an implementation detail of Forget's memoization
562562
// it should not be called directly in user-generated code
563-
function useMemoCache(size: number): Array<any> {
563+
function useMemoCache(size: number): Array<mixed> {
564564
const fiber = currentFiber;
565565
// Don't throw, in case this is called from getPrimitiveStackCache
566566
if (fiber == null) {

packages/react-reconciler/src/ReactFiberHooks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ function use<T>(usable: Usable<T>): T {
11991199
throw new Error('An unsupported type was passed to use(): ' + String(usable));
12001200
}
12011201

1202-
function useMemoCache(size: number): Array<any> {
1202+
function useMemoCache(size: number): Array<mixed> {
12031203
let memoCache = null;
12041204
// Fast-path, load memo cache from wip fiber if already prepared
12051205
let updateQueue: FunctionComponentUpdateQueue | null =

packages/react-server/src/ReactFizzHooks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ function useCacheRefresh(): <T>(?() => T, ?T) => void {
792792
return unsupportedRefresh;
793793
}
794794

795-
function useMemoCache(size: number): Array<any> {
795+
function useMemoCache(size: number): Array<mixed> {
796796
const data = new Array<any>(size);
797797
for (let i = 0; i < size; i++) {
798798
data[i] = REACT_MEMO_CACHE_SENTINEL;

packages/react/src/ReactHooks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export function use<T>(usable: Usable<T>): T {
212212
return dispatcher.use(usable);
213213
}
214214

215-
export function useMemoCache(size: number): Array<any> {
215+
export function useMemoCache(size: number): Array<mixed> {
216216
const dispatcher = resolveDispatcher();
217217
// $FlowFixMe[not-a-function] This is unstable, thus optional
218218
return dispatcher.useMemoCache(size);

0 commit comments

Comments
 (0)