Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@typescript-eslint/parser": "^6.21.0",
"abortcontroller-polyfill": "^1.7.5",
"art": "0.10.1",
"babel-plugin-syntax-hermes-parser": "^0.32.0",
"babel-plugin-syntax-trailing-function-commas": "^6.5.0",
"chalk": "^3.0.0",
"cli-table": "^0.3.1",
Expand All @@ -72,8 +73,8 @@
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
"fbjs-scripts": "^3.0.1",
"filesize": "^6.0.1",
"flow-bin": "^0.247",
"flow-remove-types": "^2.247",
"flow-bin": "^0.258",
"flow-remove-types": "^2.258",
"glob": "^7.1.6",
"glob-stream": "^6.1.0",
"google-closure-compiler": "^20230206.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,26 @@ export function handleDevToolsPageMessage(message) {
payload: {tabId, url},
} = message;

if (!tabId) {
throw new Error("Couldn't fetch file sources: tabId not specified");
}

if (!url) {
throw new Error("Couldn't fetch file sources: url not specified");
if (!tabId || !url) {
// Send a response straight away to get the Promise fulfilled.
chrome.runtime.sendMessage({
source: 'react-devtools-background',
payload: {
type: 'fetch-file-with-cache-error',
url,
value: null,
},
});
} else {
chrome.tabs.sendMessage(tabId, {
source: 'devtools-page',
payload: {
type: 'fetch-file-with-cache',
url,
},
});
}

chrome.tabs.sendMessage(tabId, {
source: 'devtools-page',
payload: {
type: 'fetch-file-with-cache',
url,
},
});

break;
}

Expand Down
1 change: 1 addition & 0 deletions packages/react-devtools-shared/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = api => {
}
}
const plugins = [
['babel-plugin-syntax-hermes-parser'],
['@babel/plugin-transform-flow-strip-types'],
['@babel/plugin-proposal-class-properties', {loose: false}],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function renameStyle(
const {instance, style} = data;

const newStyle = newName
? {[oldName]: undefined, [newName]: value}
? {[oldName]: (undefined: string | void), [newName]: value}
: {[oldName]: undefined};

let customStyle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* It should always be imported from "react-devtools-feature-flags".
************************************************************************/

export const enableLogger = true;
export const enableStyleXFeatures = true;
export const isInternalFacebookBuild = true;
export const enableLogger: boolean = true;
export const enableStyleXFeatures: boolean = true;
export const isInternalFacebookBuild: boolean = true;

/************************************************************************
* Do not edit the code below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* It should always be imported from "react-devtools-feature-flags".
************************************************************************/

export const enableLogger = false;
export const enableStyleXFeatures = false;
export const isInternalFacebookBuild = false;
export const enableLogger: boolean = false;
export const enableStyleXFeatures: boolean = false;
export const isInternalFacebookBuild: boolean = false;

/************************************************************************
* Do not edit the code below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
* It should always be imported from "react-devtools-feature-flags".
************************************************************************/

export const enableLogger = false;
export const enableStyleXFeatures = false;
export const isInternalFacebookBuild = false;
export const enableLogger: boolean = false;
export const enableStyleXFeatures: boolean = false;
export const isInternalFacebookBuild: boolean = false;
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* It should always be imported from "react-devtools-feature-flags".
************************************************************************/

export const enableLogger = true;
export const enableStyleXFeatures = true;
export const isInternalFacebookBuild = true;
export const enableLogger: boolean = true;
export const enableStyleXFeatures: boolean = true;
export const isInternalFacebookBuild: boolean = true;

/************************************************************************
* Do not edit the code below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* It should always be imported from "react-devtools-feature-flags".
************************************************************************/

export const enableLogger = false;
export const enableStyleXFeatures = false;
export const isInternalFacebookBuild = false;
export const enableLogger: boolean = false;
export const enableStyleXFeatures: boolean = false;
export const isInternalFacebookBuild: boolean = false;

/************************************************************************
* Do not edit the code below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const MARKER_TEXT_PADDING = 8;
export const COLOR_HOVER_DIM_DELTA = 5;
export const TOP_ROW_PADDING = 4;
export const NATIVE_EVENT_HEIGHT = 14;
export const SUSPENSE_EVENT_HEIGHT = 14;
export const SUSPENSE_EVENT_HEIGHT: number = 14;
export const PENDING_SUSPENSE_EVENT_SIZE = 8;
export const REACT_EVENT_DIAMETER = 6;
export const USER_TIMING_MARK_SIZE = 8;
Expand Down
7 changes: 5 additions & 2 deletions packages/react-devtools-timeline/src/utils/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
*
* @flow
*/
import type {SchedulingEvent} from '../types';
import type {ReactScheduleStateUpdateEvent, SchedulingEvent} from '../types';

export function isStateUpdateEvent(event: SchedulingEvent): boolean %checks {
export function isStateUpdateEvent(
event: SchedulingEvent,
// eslint-disable-next-line
): event is ReactScheduleStateUpdateEvent {
return event.type === 'schedule-state-update';
}
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ export const scheduleTimeout: any =
typeof setTimeout === 'function' ? setTimeout : (undefined: any);
export const cancelTimeout: any =
typeof clearTimeout === 'function' ? clearTimeout : (undefined: any);
export const noTimeout = -1;
export const noTimeout: -1 = -1;
const localPromise = typeof Promise === 'function' ? Promise : undefined;
const localRequestAnimationFrame =
typeof requestAnimationFrame === 'function'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ export function listenToNativeEventForNonManagedEventTarget(
isCapturePhaseListener: boolean,
target: EventTarget,
): void {
let eventSystemFlags = IS_EVENT_HANDLE_NON_MANAGED_NODE;
let eventSystemFlags: number = IS_EVENT_HANDLE_NON_MANAGED_NODE;
const listenerSet = getEventListenerSet(target);
const listenerSetKey = getListenerSetKey(
domEventName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ export const warnsIfNotActing = false;

export const scheduleTimeout = setTimeout;
export const cancelTimeout = clearTimeout;
export const noTimeout = -1;
export const noTimeout: -1 = -1;

// -------------------
// Persistence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export const warnsIfNotActing = true;

export const scheduleTimeout = setTimeout;
export const cancelTimeout = clearTimeout;
export const noTimeout = -1;
export const noTimeout: -1 = -1;

export function shouldSetTextContent(type: string, props: Props): boolean {
// TODO (bvaughn) Revisit this decision.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ function accumulate<T>(
// Both are not empty. Warning: Never call x.concat(y) when you are not
// certain that x is an Array (x could be a string with concat method).
if (isArray(current)) {
/* $FlowFixMe[incompatible-return] if `current` is `T` and `T` an array,
* `isArray` might refine to the array element type of `T` */
// $FlowFixMe[incompatible-use] `isArray` does not ensure array is mutable
return current.concat(next);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ function accumulateInto<T>(
// certain that x is an Array (x could be a string with concat method).
if (isArray(current)) {
if (isArray(next)) {
// $FlowFixMe[prop-missing] `isArray` does not ensure array is mutable
// $FlowFixMe[incompatible-use] `isArray` does not ensure array is mutable
// $FlowFixMe[method-unbinding]
current.push.apply(current, next);
return current;
}
// $FlowFixMe[prop-missing] `isArray` does not ensure array is mutable
// $FlowFixMe[incompatible-use] `isArray` does not ensure array is mutable
current.push(next);
return current;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ export function createHostRootFiber(
tag: RootTag,
isStrictMode: boolean,
): Fiber {
let mode;
let mode: number;
if (disableLegacyMode || tag === ConcurrentRoot) {
mode = ConcurrentMode;
if (isStrictMode === true) {
Expand Down Expand Up @@ -551,7 +551,7 @@ export function createFiberFromTypeAndProps(
mode: TypeOfMode,
lanes: Lanes,
): Fiber {
let fiberTag = FunctionComponent;
let fiberTag: WorkTag = FunctionComponent;
// The resolved type is set if we know what the final type will be. I.e. it's not lazy.
let resolvedType = type;
if (typeof type === 'function') {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberCacheComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import * as Scheduler from 'scheduler';
const AbortControllerLocal: typeof AbortController =
typeof AbortController !== 'undefined'
? AbortController
: // $FlowFixMe[missing-this-annot]
// $FlowFixMe[prop-missing]
: // $FlowFixMe[incompatible-type]
// $FlowFixMe[missing-this-annot]
function AbortControllerShim() {
const listeners = [];
const signal = (this.signal = {
Expand Down
3 changes: 2 additions & 1 deletion packages/react-reconciler/src/ReactFiberCommitWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ import {
untrackNamedViewTransition,
} from './ReactFiberDuplicateViewTransitions';
import {markIndicatorHandled} from './ReactFiberRootScheduler';
import type {Flags} from './ReactFiberFlags';

// Used during the commit phase to track the state of the Offscreen component stack.
// Allows us to avoid traversing the return path to find the nearest Offscreen ancestor.
Expand Down Expand Up @@ -4490,7 +4491,7 @@ export function commitPassiveUnmountEffects(finishedWork: Fiber): void {
// Note that MaySuspendCommit and ShouldSuspendCommit also includes named
// ViewTransitions so that we know to also visit those to collect appearing
// pairs.
let suspenseyCommitFlag = ShouldSuspendCommit;
let suspenseyCommitFlag: Flags = ShouldSuspendCommit;
export function accumulateSuspenseyCommit(
finishedWork: Fiber,
committedLanes: Lanes,
Expand Down
3 changes: 2 additions & 1 deletion packages/react-reconciler/src/ReactFiberCompleteWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ import {
popRootMarkerInstance,
} from './ReactFiberTracingMarkerComponent';
import {suspendCommit} from './ReactFiberThenable';
import type {Flags} from './ReactFiberFlags';

/**
* Tag the fiber with an update effect. This turns a Placement into
Expand Down Expand Up @@ -780,7 +781,7 @@ function bubbleProperties(completedWork: Fiber) {
completedWork.alternate.child === completedWork.child;

let newChildLanes: Lanes = NoLanes;
let subtreeFlags = NoFlags;
let subtreeFlags: Flags = NoFlags;

if (!didBailout) {
// Bubble up the earliest expiration time.
Expand Down
1 change: 1 addition & 0 deletions packages/react-server/src/ReactServerStreamConfigBun.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export function byteLengthOfBinaryChunk(chunk: BinaryChunk): number {
}

export function closeWithError(destination: Destination, error: mixed): void {
// $FlowFixMe[method-unbinding]
if (typeof destination.error === 'function') {
// $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
destination.error(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export const warnsIfNotActing = true;
export const scheduleTimeout = setTimeout;
export const cancelTimeout = clearTimeout;

export const noTimeout = -1;
export const noTimeout: -1 = -1;

// -------------------
// Mutation
Expand Down
3 changes: 2 additions & 1 deletion packages/react-test-renderer/src/ReactTestRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import {
} from 'shared/ReactFeatureFlags';

import noop from 'shared/noop';
import type {WorkTag} from 'react-reconciler/src/ReactWorkTags';

const defaultOnDefaultTransitionIndicator: () => void | (() => void) = noop;

Expand Down Expand Up @@ -244,7 +245,7 @@ function toTree(node: null | Fiber): $FlowFixMe {
}
}

const validWrapperTypes = new Set([
const validWrapperTypes: Set<WorkTag> = new Set([
FunctionComponent,
ClassComponent,
HostComponent,
Expand Down
1 change: 0 additions & 1 deletion packages/react/index.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export type Portal = React$Portal;
export type ElementProps<C> = React$ElementProps<C>;
export type ElementConfig<C> = React$ElementConfig<C>;
export type ElementRef<C> = React$ElementRef<C>;
export type Config<Props, DefaultProps> = React$Config<Props, DefaultProps>;
export type ChildrenArray<+T> = $ReadOnlyArray<ChildrenArray<T>> | T;

// Export all exports so that they're available in tests.
Expand Down
1 change: 0 additions & 1 deletion packages/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export type RefSetter<-I> = React$RefSetter<I>;
export type ElementProps<C> = React$ElementProps<C>;
export type ElementConfig<C> = React$ElementConfig<C>;
export type ElementRef<C> = React$ElementRef<C>;
export type Config<Props, DefaultProps> = React$Config<Props, DefaultProps>;
export type ChildrenArray<+T> = $ReadOnlyArray<ChildrenArray<T>> | T;

export {
Expand Down
4 changes: 2 additions & 2 deletions packages/scheduler/src/forks/Scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var timerQueue: Array<Task> = [];
var taskIdCounter = 1;

var currentTask = null;
var currentPriorityLevel = NormalPriority;
var currentPriorityLevel: PriorityLevel = NormalPriority;

// This is set while performing work, to prevent re-entrance.
var isPerformingWork = false;
Expand Down Expand Up @@ -441,7 +441,7 @@ let taskTimeoutID: TimeoutID = (-1: any);
// thread, like user events. By default, it yields multiple times per frame.
// It does not attempt to align with frame boundaries, since most tasks don't
// need to be frame aligned; for those that do, use requestAnimationFrame.
let frameInterval = frameYieldMs;
let frameInterval: number = frameYieldMs;
let startTime = -1;

function shouldYieldToHost(): boolean {
Expand Down
2 changes: 1 addition & 1 deletion packages/scheduler/src/forks/SchedulerMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var timerQueue: Array<Task> = [];
var taskIdCounter = 1;

var currentTask = null;
var currentPriorityLevel = NormalPriority;
var currentPriorityLevel: PriorityLevel = NormalPriority;

// This is set while performing work, to prevent re-entrance.
var isPerformingWork = false;
Expand Down
Loading
Loading