Skip to content

Commit c978f70

Browse files
committed
Update Flow to 0.279
1 parent 9eede45 commit c978f70

File tree

25 files changed

+104
-70
lines changed

25 files changed

+104
-70
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,11 @@ module.exports = {
583583
mixin$Animatable: 'readonly',
584584
MouseEventHandler: 'readonly',
585585
NavigateEvent: 'readonly',
586+
PerformanceMeasureOptions: 'readonly',
586587
PropagationPhases: 'readonly',
587588
PropertyDescriptor: 'readonly',
589+
PropertyDescriptorMap: 'readonly',
590+
Proxy$traps: 'readonly',
588591
React$Component: 'readonly',
589592
React$Config: 'readonly',
590593
React$Context: 'readonly',

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@
7474
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
7575
"fbjs-scripts": "^3.0.1",
7676
"filesize": "^6.0.1",
77-
"flow-bin": "^0.274",
78-
"flow-remove-types": "^2.274",
77+
"flow-bin": "^0.279.0",
78+
"flow-remove-types": "^2.279.0",
7979
"flow-typed": "^4.1.1",
8080
"glob": "^7.1.6",
8181
"glob-stream": "^6.1.0",
8282
"google-closure-compiler": "^20230206.0.0",
8383
"gzip-size": "^5.1.1",
84-
"hermes-eslint": "^0.25.1",
85-
"hermes-parser": "^0.25.1",
84+
"hermes-eslint": "^0.32.0",
85+
"hermes-parser": "^0.32.0",
8686
"jest": "^29.4.2",
8787
"jest-cli": "^29.4.2",
8888
"jest-diff": "^29.4.2",

packages/react-client/src/ReactFlightPerformanceTrack.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export function logComponentAborted(
153153
const entryName =
154154
isPrimaryEnv || env === undefined ? name : name + ' [' + env + ']';
155155
if (__DEV__) {
156-
const properties = [
156+
const properties: Array<[string, string]> = [
157157
[
158158
'Aborted',
159159
'The stream was aborted before this Component finished rendering.',
@@ -215,7 +215,7 @@ export function logComponentErrored(
215215
String(error.message)
216216
: // eslint-disable-next-line react-internal/safe-string-coercion
217217
String(error);
218-
const properties = [['Error', message]];
218+
const properties: Array<[string, string]> = [['Error', message]];
219219
if (componentInfo.key != null) {
220220
addValueToProperties('key', componentInfo.key, properties, 0, '');
221221
}

packages/react-debug-tools/src/ReactDebugHooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ const Dispatcher: DispatcherType = {
789789

790790
// create a proxy to throw a custom error
791791
// in case future versions of React adds more hooks
792-
const DispatcherProxyHandler = {
792+
const DispatcherProxyHandler: Proxy$traps<DispatcherType> = {
793793
get(target: DispatcherType, prop: string) {
794794
if (target.hasOwnProperty(prop)) {
795795
// $FlowFixMe[invalid-computed-prop]

packages/react-devtools-shared/src/backend/fiber/renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,7 @@ export function attach(
22172217
}
22182218
if (typeof instance.getClientRects === 'function') {
22192219
// DOM
2220-
const result = [];
2220+
const result: Array<Rect> = [];
22212221
const doc = instance.ownerDocument;
22222222
const win = doc && doc.defaultView;
22232223
const scrollX = win ? win.scrollX : 0;

packages/react-devtools-shared/src/devtools/views/Components/InspectedElementHooksTree.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ function HookView({
223223
const hookDisplayName = hookName ? (
224224
<>
225225
{name}
226-
{!!hookName && <span className={styles.HookName}>({hookName})</span>}
226+
{
227+
// $FlowFixMe[constant-condition]
228+
!!hookName && <span className={styles.HookName}>({hookName})</span>
229+
}
227230
</>
228231
) : (
229232
name

packages/react-devtools-shared/src/devtools/views/ModalDialog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function dialogReducer(state: State, action: Action) {
7575
content: action.content,
7676
id: action.id,
7777
title: action.title || null,
78-
},
78+
} as Dialog,
7979
],
8080
};
8181
default:

packages/react-devtools-shared/src/devtools/views/Profiler/Tooltip.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function getTooltipPosition(
6464
mouseY: number,
6565
width: number,
6666
},
67-
) {
67+
): {left: string, top: string} {
6868
const {height, mouseX, mouseY, width} = mousePosition;
6969
let top: number | string = 0;
7070
let left: number | string = 0;
@@ -108,7 +108,13 @@ function getMousePosition(
108108
}
109109
}
110110

111-
const {height, left, top, width} = targetContainer.getBoundingClientRect();
111+
const {height, left, top, width} =
112+
targetContainer.getBoundingClientRect() as {
113+
height: number,
114+
left: number,
115+
top: number,
116+
width: number,
117+
};
112118

113119
const mouseX = mouseEvent.clientX - left;
114120
const mouseY = mouseEvent.clientY - top;

packages/react-devtools-shared/src/hooks/SourceMapConsumer.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,21 @@ type Section = {
145145
};
146146

147147
function IndexedSourceMapConsumer(sourceMapJSON: IndexSourceMap) {
148-
let lastOffset = {
148+
let lastOffset: {
149+
line: number,
150+
column: number,
151+
...
152+
} = {
149153
line: -1,
150154
column: 0,
151155
};
152156

153157
const sections: Array<Section> = sourceMapJSON.sections.map(section => {
154-
const offset = section.offset;
158+
const offset: {
159+
line: number,
160+
column: number,
161+
...
162+
} = section.offset;
155163
const offsetLine = offset.line;
156164
const offsetColumn = offset.column;
157165

packages/react-devtools-shell/src/app/InspectableElements/Contexts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const contextData = {
2828
bool: true,
2929
func: someNamedFunction,
3030
number: 123,
31-
object: {outer: {inner: {}}},
31+
object: {outer: {inner: {} as {...}}},
3232
string: 'abc',
3333
symbol: Symbol.for('symbol'),
3434
null: null,

0 commit comments

Comments
 (0)