@@ -268,7 +268,7 @@ let hookTypesUpdateIndexDev: number = -1;
268268// When true, such Hooks will always be "remounted". Only used during hot reload.
269269let ignorePreviousDependencies : boolean = false ;
270270
271- function mountHookTypesDev ( ) {
271+ function mountHookTypesDev ( ) : void {
272272 if ( __DEV__ ) {
273273 const hookName = ( ( currentHookNameInDev : any ) : HookType ) ;
274274
@@ -280,7 +280,7 @@ function mountHookTypesDev() {
280280 }
281281}
282282
283- function updateHookTypesDev ( ) {
283+ function updateHookTypesDev ( ) : void {
284284 if ( __DEV__ ) {
285285 const hookName = ( ( currentHookNameInDev : any ) : HookType ) ;
286286
@@ -293,7 +293,7 @@ function updateHookTypesDev() {
293293 }
294294}
295295
296- function checkDepsAreArrayDev ( deps : mixed ) {
296+ function checkDepsAreArrayDev ( deps : mixed ) : void {
297297 if ( __DEV__ ) {
298298 if ( deps !== undefined && deps !== null && ! isArray ( deps ) ) {
299299 // Verify deps, but only on mount to avoid extra checks.
@@ -308,7 +308,7 @@ function checkDepsAreArrayDev(deps: mixed) {
308308 }
309309}
310310
311- function warnOnHookMismatchInDev ( currentHookName : HookType ) {
311+ function warnOnHookMismatchInDev ( currentHookName : HookType ) : void {
312312 if ( __DEV__ ) {
313313 const componentName = getComponentNameFromFiber ( currentlyRenderingFiber ) ;
314314 if ( ! didWarnAboutMismatchedHooksForComponent . has ( componentName ) ) {
@@ -369,7 +369,7 @@ function throwInvalidHookError() {
369369function areHookInputsEqual (
370370 nextDeps : Array < mixed > ,
371371 prevDeps : Array < mixed > | null ,
372- ) {
372+ ) : boolean {
373373 if ( __DEV__ ) {
374374 if ( ignorePreviousDependencies ) {
375375 // Only true when this component is being hot reloaded.
@@ -681,7 +681,7 @@ function renderWithHooksAgain<Props, SecondArg>(
681681 Component : ( p : Props , arg : SecondArg ) => any ,
682682 props : Props ,
683683 secondArg : SecondArg ,
684- ) {
684+ ) : any {
685685 // This is used to perform another render pass. It's used when setState is
686686 // called during render, and for double invoking components in Strict Mode
687687 // during development.
@@ -745,7 +745,7 @@ export function bailoutHooks(
745745 current : Fiber ,
746746 workInProgress : Fiber ,
747747 lanes : Lanes ,
748- ) {
748+ ) : void {
749749 workInProgress. updateQueue = current . updateQueue ;
750750 // TODO: Don't need to reset the flags here, because they're reset in the
751751 // complete phase (bubbleProperties).
@@ -1732,7 +1732,7 @@ function pushStoreConsistencyCheck<T>(
17321732 fiber: Fiber,
17331733 getSnapshot: () => T ,
17341734 renderedSnapshot : T ,
1735- ) {
1735+ ) : void {
17361736 fiber . flags |= StoreConsistency ;
17371737 const check : StoreConsistencyCheck < T > = {
17381738 getSnapshot,
@@ -1758,7 +1758,7 @@ function updateStoreInstance<T>(
17581758 inst: StoreInstance< T > ,
17591759 nextSnapshot: T,
17601760 getSnapshot: () => T ,
1761- ) {
1761+ ) : void {
17621762 // These are updated in the passive phase
17631763 inst . value = nextSnapshot ;
17641764 inst . getSnapshot = getSnapshot ;
@@ -1773,7 +1773,11 @@ function updateStoreInstance<T>(
17731773 }
17741774}
17751775
1776- function subscribeToStore < T > (fiber, inst: StoreInstance< T > , subscribe) {
1776+ function subscribeToStore < T > (
1777+ fiber: Fiber,
1778+ inst: StoreInstance< T > ,
1779+ subscribe: (() => void ) => ( ) => void ,
1780+ ) : any {
17771781 const handleStoreChange = ( ) => {
17781782 // The store changed. Check if the snapshot changed since the last time we
17791783 // read from the store.
@@ -1843,7 +1847,12 @@ function rerenderState<S>(
18431847 return rerenderReducer ( basicStateReducer , ( initialState : any ) ) ;
18441848}
18451849
1846- function pushEffect(tag, create, destroy, deps: Array< mixed > | void | null) {
1850+ function pushEffect(
1851+ tag: HookFlags,
1852+ create: () => ( ( ) => void ) | void ,
1853+ destroy : ( ( ) => void ) | void ,
1854+ deps : Array < mixed > | void | null,
1855+ ): Effect {
18471856 const effect : Effect = {
18481857 tag,
18491858 create,
@@ -1963,9 +1972,9 @@ function updateRef<T>(initialValue: T): {current: T} {
19631972}
19641973
19651974function mountEffectImpl(
1966- fiberFlags,
1967- hookFlags,
1968- create,
1975+ fiberFlags: Flags ,
1976+ hookFlags: HookFlags ,
1977+ create: () = > ( ( ) => void ) | void ,
19691978 deps : Array < mixed > | void | null,
19701979): void {
19711980 const hook = mountWorkInProgressHook ( ) ;
@@ -1980,9 +1989,9 @@ function mountEffectImpl(
19801989}
19811990
19821991function updateEffectImpl(
1983- fiberFlags,
1984- hookFlags,
1985- create,
1992+ fiberFlags: Flags ,
1993+ hookFlags: HookFlags ,
1994+ create: () = > ( ( ) => void ) | void ,
19861995 deps : Array < mixed > | void | null,
19871996): void {
19881997 const hook = updateWorkInProgressHook ( ) ;
@@ -2019,14 +2028,14 @@ function mountEffect(
20192028 __DEV__ &&
20202029 ( currentlyRenderingFiber . mode & StrictEffectsMode ) !== NoMode
20212030 ) {
2022- return mountEffectImpl (
2031+ mountEffectImpl (
20232032 MountPassiveDevEffect | PassiveEffect | PassiveStaticEffect ,
20242033 HookPassive ,
20252034 create ,
20262035 deps ,
20272036 ) ;
20282037 } else {
2029- return mountEffectImpl (
2038+ mountEffectImpl (
20302039 PassiveEffect | PassiveStaticEffect ,
20312040 HookPassive ,
20322041 create ,
@@ -2039,7 +2048,7 @@ function updateEffect(
20392048 create : ( ) => ( ( ) => void ) | void ,
20402049 deps : Array < mixed > | void | null,
20412050): void {
2042- return updateEffectImpl ( PassiveEffect , HookPassive , create , deps ) ;
2051+ updateEffectImpl ( PassiveEffect , HookPassive , create , deps ) ;
20432052}
20442053
20452054function useEventImpl< Args , Return , F : ( ...Array < Args > ) => Return > (
@@ -2099,7 +2108,7 @@ function mountInsertionEffect(
20992108 create: () => ( ( ) => void ) | void ,
21002109 deps : Array < mixed > | void | null,
21012110): void {
2102- return mountEffectImpl ( UpdateEffect , HookInsertion , create , deps ) ;
2111+ mountEffectImpl ( UpdateEffect , HookInsertion , create , deps ) ;
21032112}
21042113
21052114function updateInsertionEffect(
@@ -2133,7 +2142,7 @@ function updateLayoutEffect(
21332142function imperativeHandleEffect< T > (
21342143 create: () => T ,
21352144 ref : { current : T | null } | ((inst: T | null) => mixed ) | null | void ,
2136- ) {
2145+ ) : void | ( ( ) => void ) {
21372146 if ( typeof ref === 'function' ) {
21382147 const refCallback = ref ;
21392148 const inst = create ( ) ;
@@ -2186,7 +2195,7 @@ function mountImperativeHandle<T>(
21862195 ) {
21872196 fiberFlags |= MountLayoutDevEffect ;
21882197 }
2189- return mountEffectImpl (
2198+ mountEffectImpl (
21902199 fiberFlags ,
21912200 HookLayout ,
21922201 imperativeHandleEffect . bind ( null , create , ref ) ,
@@ -2213,7 +2222,7 @@ function updateImperativeHandle<T>(
22132222 const effectDeps =
22142223 deps !== null && deps !== undefined ? deps . concat ( [ ref ] ) : null ;
22152224
2216- return updateEffectImpl (
2225+ updateEffectImpl (
22172226 UpdateEffect ,
22182227 HookLayout ,
22192228 imperativeHandleEffect . bind ( null , create , ref ) ,
@@ -2361,7 +2370,11 @@ function updateDeferredValueImpl<T>(hook: Hook, prevValue: T, value: T): T {
23612370 }
23622371}
23632372
2364- function startTransition ( setPending , callback , options ) {
2373+ function startTransition (
2374+ setPending : boolean => void ,
2375+ callback : ( ) = > void ,
2376+ options ? : StartTransitionOptions ,
2377+ ) : void {
23652378 const previousPriority = getCurrentUpdatePriority ( ) ;
23662379 setCurrentUpdatePriority (
23672380 higherEventPriority ( previousPriority , ContinuousEventPriority ) ,
@@ -2483,7 +2496,7 @@ function updateId(): string {
24832496 return id ;
24842497}
24852498
2486- function mountRefresh ( ) {
2499+ function mountRefresh(): any {
24872500 const hook = mountWorkInProgressHook ( ) ;
24882501 const refresh = ( hook . memoizedState = refreshCache . bind (
24892502 null ,
@@ -2492,12 +2505,12 @@ function mountRefresh() {
24922505 return refresh ;
24932506}
24942507
2495- function updateRefresh ( ) {
2508+ function updateRefresh(): any {
24962509 const hook = updateWorkInProgressHook ( ) ;
24972510 return hook . memoizedState ;
24982511}
24992512
2500- function refreshCache < T > ( fiber : Fiber , seedKey : ?( ) => T , seedValue : T ) {
2513+ function refreshCache< T > (fiber: Fiber, seedKey: ?() => T , seedValue : T ) : void {
25012514 if ( ! enableCache ) {
25022515 return ;
25032516 }
@@ -2553,7 +2566,7 @@ function dispatchReducerAction<S, A>(
25532566 fiber: Fiber,
25542567 queue: UpdateQueue< S , A > ,
25552568 action: A,
2556- ) {
2569+ ): void {
25572570 if ( __DEV__ ) {
25582571 if ( typeof arguments [ 3 ] === 'function' ) {
25592572 console . error (
@@ -2592,7 +2605,7 @@ function dispatchSetState<S, A>(
25922605 fiber: Fiber,
25932606 queue: UpdateQueue< S , A > ,
25942607 action: A,
2595- ) {
2608+ ): void {
25962609 if ( __DEV__ ) {
25972610 if ( typeof arguments [ 3 ] === 'function' ) {
25982611 console . error (
@@ -2670,7 +2683,7 @@ function dispatchSetState<S, A>(
26702683 markUpdateInDevTools ( fiber , lane , action ) ;
26712684}
26722685
2673- function isRenderPhaseUpdate ( fiber : Fiber ) {
2686+ function isRenderPhaseUpdate ( fiber : Fiber ) : boolean {
26742687 const alternate = fiber . alternate ;
26752688 return (
26762689 fiber === currentlyRenderingFiber ||
@@ -2681,7 +2694,7 @@ function isRenderPhaseUpdate(fiber: Fiber) {
26812694function enqueueRenderPhaseUpdate< S , A > (
26822695 queue: UpdateQueue< S , A > ,
26832696 update: Update< S , A > ,
2684- ) {
2697+ ): void {
26852698 // This is a render phase update. Stash it in a lazily-created map of
26862699 // queue -> linked list of updates. After this render pass, we'll restart
26872700 // and apply the stashed updates on top of the work-in-progress hook.
@@ -2702,7 +2715,7 @@ function entangleTransitionUpdate<S, A>(
27022715 root: FiberRoot,
27032716 queue: UpdateQueue< S , A > ,
27042717 lane: Lane,
2705- ) {
2718+ ): void {
27062719 if ( isTransitionLane ( lane ) ) {
27072720 let queueLanes = queue . lanes ;
27082721
@@ -2723,7 +2736,7 @@ function entangleTransitionUpdate<S, A>(
27232736 }
27242737}
27252738
2726- function markUpdateInDevTools < A > (fiber, lane, action: A) {
2739+ function markUpdateInDevTools < A > (fiber, lane, action: A): void {
27272740 if ( __DEV__ ) {
27282741 if ( enableDebugTracing ) {
27292742 if ( fiber . mode & DebugTracingMode ) {
0 commit comments