Skip to content

Commit

Permalink
[ez] Update useMemoCache return type
Browse files Browse the repository at this point in the history
Use `mixed` instead of `any`
  • Loading branch information
poteto committed Nov 14, 2024
1 parent 380f5d6 commit 6be51b0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/react-debug-tools/src/ReactDebugHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ function useId(): string {

// useMemoCache is an implementation detail of Forget's memoization
// it should not be called directly in user-generated code
function useMemoCache(size: number): Array<any> {
function useMemoCache(size: number): Array<mixed> {
const fiber = currentFiber;
// Don't throw, in case this is called from getPrimitiveStackCache
if (fiber == null) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ function use<T>(usable: Usable<T>): T {
throw new Error('An unsupported type was passed to use(): ' + String(usable));
}

function useMemoCache(size: number): Array<any> {
function useMemoCache(size: number): Array<mixed> {
let memoCache = null;
// Fast-path, load memo cache from wip fiber if already prepared
let updateQueue: FunctionComponentUpdateQueue | null =
Expand Down
2 changes: 1 addition & 1 deletion packages/react-server/src/ReactFizzHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ function useCacheRefresh(): <T>(?() => T, ?T) => void {
return unsupportedRefresh;
}

function useMemoCache(size: number): Array<any> {
function useMemoCache(size: number): Array<mixed> {
const data = new Array<any>(size);
for (let i = 0; i < size; i++) {
data[i] = REACT_MEMO_CACHE_SENTINEL;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/ReactHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export function use<T>(usable: Usable<T>): T {
return dispatcher.use(usable);
}

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

0 comments on commit 6be51b0

Please sign in to comment.