Skip to content

Commit a473d08

Browse files
authored
Update to Flow from 0.97 to 0.122 (#25204)
* flow 0.122 * update ReactModel type
1 parent fe55c0e commit a473d08

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+109
-51
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
6464
"fbjs-scripts": "1.2.0",
6565
"filesize": "^6.0.1",
66-
"flow-bin": "0.97",
66+
"flow-bin": "^0.122",
6767
"glob": "^7.1.6",
6868
"glob-stream": "^6.1.0",
6969
"google-closure-compiler": "^20200517.0.0",

packages/jest-react/src/internalAct.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export function act<T>(scope: () => Thenable<T> | T): Thenable<T> {
2828
'This version of `act` requires a special mock build of Scheduler.',
2929
);
3030
}
31+
32+
// $FlowFixMe: _isMockFunction doesn't exist on function
3133
if (setTimeout._isMockFunction !== true) {
3234
throw Error(
3335
"This version of `act` requires Jest's timer mocks " +

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ function handleRenderFunctionError(error: any): void {
683683
// TODO: refactor this if we ever combine the devtools and debug tools packages
684684
wrapperError.name = 'ReactDebugToolsRenderError';
685685
// this stage-4 proposal is not supported by all environments yet.
686+
// $FlowFixMe Flow doesn't have this type yet.
686687
wrapperError.cause = error;
687688
throw wrapperError;
688689
}

packages/react-devtools-shared/src/backend/StyleX/utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ function getPropertyValueForStyleName(styleName: string): string | null {
9292
]: any): CSSStyleSheet);
9393
// $FlowFixMe Flow doesn't konw about these properties
9494
const rules = styleSheet.rules || styleSheet.cssRules;
95+
// $FlowFixMe `rules` is mixed
9596
for (let ruleIndex = 0; ruleIndex < rules.length; ruleIndex++) {
97+
// $FlowFixMe `rules` is mixed
9698
const rule = rules[ruleIndex];
9799
// $FlowFixMe Flow doesn't konw about these properties
98100
const {cssText, selectorText, style} = rule;

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ import type {
124124
} from 'react-devtools-shared/src/types';
125125

126126
type getDisplayNameForFiberType = (fiber: Fiber) => string | null;
127-
type getTypeSymbolType = (type: any) => Symbol | number;
127+
type getTypeSymbolType = (type: any) => symbol | number;
128128

129129
type ReactPriorityLevelsType = {|
130130
ImmediatePriority: number,
@@ -382,13 +382,14 @@ export function getInternalReactConstants(
382382
// End of copied code.
383383
// **********************************************************
384384

385-
function getTypeSymbol(type: any): Symbol | number {
385+
function getTypeSymbol(type: any): symbol | number {
386386
const symbolOrNumber =
387387
typeof type === 'object' && type !== null ? type.$$typeof : type;
388388

389389
// $FlowFixMe Flow doesn't know about typeof "symbol"
390390
return typeof symbolOrNumber === 'symbol'
391-
? symbolOrNumber.toString()
391+
? // $FlowFixMe `toString()` doesn't match the type signature?
392+
symbolOrNumber.toString()
392393
: symbolOrNumber;
393394
}
394395

packages/react-devtools-shared/src/backend/types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export type GetFiberIDForNative = (
8484
export type FindNativeNodesForFiberID = (id: number) => ?Array<NativeType>;
8585

8686
export type ReactProviderType<T> = {
87-
$$typeof: Symbol | number,
87+
$$typeof: symbol | number,
8888
_context: ReactContext<T>,
8989
...
9090
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default function Button({
2828
...rest
2929
}: Props) {
3030
let button = (
31+
// $FlowFixMe unsafe spread
3132
<button
3233
className={`${styles.Button} ${className}`}
3334
data-testname={testName}

packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default function AutoSizeInput({
4242
const isEmpty = value === '' || value === '""';
4343

4444
return (
45+
// $FlowFixMe unsafe rest spread
4546
<input
4647
className={[styles.Input, className].join(' ')}
4748
data-testname={testName}

packages/react-devtools-shared/src/devtools/views/Components/reach-ui/menu-button.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import useThemeStyles from '../../useThemeStyles';
1919
const MenuList = ({children, ...props}: {children: React$Node, ...}) => {
2020
const style = useThemeStyles();
2121
return (
22+
// $FlowFixMe unsafe spread
2223
<ReachMenuList style={style} {...props}>
2324
{children}
2425
</ReachMenuList>

packages/react-devtools-shared/src/devtools/views/Components/reach-ui/tooltip.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const Tooltip = ({
2323
}) => {
2424
const style = useThemeStyles();
2525
return (
26+
// $FlowFixMe unsafe spread
2627
<ReachTooltip
2728
className={`${tooltipStyles.Tooltip} ${className}`}
2829
style={style}

0 commit comments

Comments
 (0)