mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[ez] Update useMemoCache return type
Use `mixed` instead of `any`
This commit is contained in:
+1
-1
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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 =
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user