Skip to content

Commit

Permalink
Flow: add some missing types in react-reconciler (#25316)
Browse files Browse the repository at this point in the history
To enable the next Flow version, we need to annotate exported values. This adds a few automatically inferred types that didn't look huge or just `any`.
  • Loading branch information
kassens authored Sep 23, 2022
1 parent 112d049 commit cc8cb14
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions packages/react-reconciler/src/ReactFiber.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ export function createFiberFromSuspense(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
fiber.elementType = REACT_SUSPENSE_TYPE;
fiber.lanes = lanes;
Expand All @@ -705,7 +705,7 @@ export function createFiberFromSuspenseList(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
fiber.elementType = REACT_SUSPENSE_LIST_TYPE;
fiber.lanes = lanes;
Expand All @@ -717,7 +717,7 @@ export function createFiberFromOffscreen(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(OffscreenComponent, pendingProps, key, mode);
fiber.elementType = REACT_OFFSCREEN_TYPE;
fiber.lanes = lanes;
Expand All @@ -736,7 +736,7 @@ export function createFiberFromLegacyHidden(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(LegacyHiddenComponent, pendingProps, key, mode);
fiber.elementType = REACT_LEGACY_HIDDEN_TYPE;
fiber.lanes = lanes;
Expand All @@ -757,7 +757,7 @@ export function createFiberFromCache(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(CacheComponent, pendingProps, key, mode);
fiber.elementType = REACT_CACHE_TYPE;
fiber.lanes = lanes;
Expand All @@ -769,7 +769,7 @@ export function createFiberFromTracingMarker(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(TracingMarkerComponent, pendingProps, key, mode);
fiber.elementType = REACT_TRACING_MARKER_TYPE;
fiber.lanes = lanes;
Expand Down
12 changes: 6 additions & 6 deletions packages/react-reconciler/src/ReactFiber.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ export function createFiberFromSuspense(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
fiber.elementType = REACT_SUSPENSE_TYPE;
fiber.lanes = lanes;
Expand All @@ -705,7 +705,7 @@ export function createFiberFromSuspenseList(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
fiber.elementType = REACT_SUSPENSE_LIST_TYPE;
fiber.lanes = lanes;
Expand All @@ -717,7 +717,7 @@ export function createFiberFromOffscreen(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(OffscreenComponent, pendingProps, key, mode);
fiber.elementType = REACT_OFFSCREEN_TYPE;
fiber.lanes = lanes;
Expand All @@ -736,7 +736,7 @@ export function createFiberFromLegacyHidden(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(LegacyHiddenComponent, pendingProps, key, mode);
fiber.elementType = REACT_LEGACY_HIDDEN_TYPE;
fiber.lanes = lanes;
Expand All @@ -757,7 +757,7 @@ export function createFiberFromCache(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(CacheComponent, pendingProps, key, mode);
fiber.elementType = REACT_CACHE_TYPE;
fiber.lanes = lanes;
Expand All @@ -769,7 +769,7 @@ export function createFiberFromTracingMarker(
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
) {
): Fiber {
const fiber = createFiber(TracingMarkerComponent, pendingProps, key, mode);
fiber.elementType = REACT_TRACING_MARKER_TYPE;
fiber.lanes = lanes;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberAct.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function isLegacyActEnvironment(fiber: Fiber): boolean {
return false;
}

export function isConcurrentActEnvironment() {
export function isConcurrentActEnvironment(): void | boolean {
if (__DEV__) {
const isReactActEnvironmentGlobal =
// $FlowFixMe – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberAct.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function isLegacyActEnvironment(fiber: Fiber): boolean {
return false;
}

export function isConcurrentActEnvironment() {
export function isConcurrentActEnvironment(): void | boolean {
if (__DEV__) {
const isReactActEnvironmentGlobal =
// $FlowFixMe – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
Expand Down

0 comments on commit cc8cb14

Please sign in to comment.