Skip to content

Commit 8003ab9

Browse files
authored
Flow: remove explicit object syntax (#25223)
1 parent 492c6e2 commit 8003ab9

File tree

259 files changed

+1439
-1444
lines changed

Some content is hidden

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

259 files changed

+1439
-1444
lines changed

packages/react-cache/src/LRU.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ const {
1616
unstable_IdlePriority: IdlePriority,
1717
} = Scheduler;
1818

19-
type Entry<T> = {|
19+
type Entry<T> = {
2020
value: T,
2121
onDelete: () => mixed,
2222
previous: Entry<T>,
2323
next: Entry<T>,
24-
|};
24+
};
2525

2626
export function createLRU<T>(limit: number) {
2727
let LIMIT = limit;

packages/react-cache/src/ReactCacheOld.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ import {createLRU} from './LRU';
1515

1616
type Suspender = {then(resolve: () => mixed, reject: () => mixed): mixed, ...};
1717

18-
type PendingResult = {|
18+
type PendingResult = {
1919
status: 0,
2020
value: Suspender,
21-
|};
21+
};
2222

23-
type ResolvedResult<V> = {|
23+
type ResolvedResult<V> = {
2424
status: 1,
2525
value: V,
26-
|};
26+
};
2727

28-
type RejectedResult = {|
28+
type RejectedResult = {
2929
status: 2,
3030
value: mixed,
31-
|};
31+
};
3232

3333
type Result<V> = PendingResult | ResolvedResult<V> | RejectedResult;
3434

packages/react-client/src/ReactFlightClient.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export type JSONValue =
3434
| null
3535
| boolean
3636
| string
37-
| {|+[key: string]: JSONValue|}
37+
| {+[key: string]: JSONValue}
3838
| $ReadOnlyArray<JSONValue>;
3939

4040
const PENDING = 0;
@@ -43,36 +43,36 @@ const RESOLVED_MODULE = 2;
4343
const INITIALIZED = 3;
4444
const ERRORED = 4;
4545

46-
type PendingChunk = {|
46+
type PendingChunk = {
4747
_status: 0,
4848
_value: null | Array<() => mixed>,
4949
_response: Response,
5050
then(resolve: () => mixed): void,
51-
|};
52-
type ResolvedModelChunk = {|
51+
};
52+
type ResolvedModelChunk = {
5353
_status: 1,
5454
_value: UninitializedModel,
5555
_response: Response,
5656
then(resolve: () => mixed): void,
57-
|};
58-
type ResolvedModuleChunk<T> = {|
57+
};
58+
type ResolvedModuleChunk<T> = {
5959
_status: 2,
6060
_value: ModuleReference<T>,
6161
_response: Response,
6262
then(resolve: () => mixed): void,
63-
|};
64-
type InitializedChunk<T> = {|
63+
};
64+
type InitializedChunk<T> = {
6565
_status: 3,
6666
_value: T,
6767
_response: Response,
6868
then(resolve: () => mixed): void,
69-
|};
70-
type ErroredChunk = {|
69+
};
70+
type ErroredChunk = {
7171
_status: 4,
7272
_value: Error,
7373
_response: Response,
7474
then(resolve: () => mixed): void,
75-
|};
75+
};
7676
type SomeChunk<T> =
7777
| PendingChunk
7878
| ResolvedModelChunk
@@ -338,7 +338,7 @@ export function parseModelString(
338338

339339
export function parseModelTuple(
340340
response: Response,
341-
value: {|+[key: string]: JSONValue|} | $ReadOnlyArray<JSONValue>,
341+
value: {+[key: string]: JSONValue} | $ReadOnlyArray<JSONValue>,
342342
): any {
343343
const tuple: [mixed, mixed, mixed, mixed] = (value: any);
344344

packages/react-client/src/ReactFlightClientHostConfigStream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
import type {ResponseBase} from './ReactFlightClient';
1111
import type {StringDecoder} from './ReactFlightClientHostConfig';
1212

13-
export type Response = ResponseBase & {|
13+
export type Response = ResponseBase & {
1414
_partialRow: string,
1515
_fromJSON: (key: string, value: JSONValue) => any,
1616
_stringDecoder: StringDecoder,
17-
|};
17+
};
1818

1919
export type UninitializedModel = string;
2020

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ type Dispatch<A> = A => void;
5151

5252
let primitiveStackCache: null | Map<string, Array<any>> = null;
5353

54-
type Hook = {|
54+
type Hook = {
5555
memoizedState: any,
5656
next: Hook | null,
57-
|};
57+
};
5858

5959
function getPrimitiveStackCache(): Map<string, Array<any>> {
6060
// This initializes a cache of all primitive hooks so that the top
@@ -154,7 +154,7 @@ function useReducer<S, I, A>(
154154
return [state, (action: A) => {}];
155155
}
156156

157-
function useRef<T>(initialValue: T): {|current: T|} {
157+
function useRef<T>(initialValue: T): {current: T} {
158158
const hook = nextHook();
159159
const ref = hook !== null ? hook.memoizedState : {current: initialValue};
160160
hookLog.push({
@@ -208,7 +208,7 @@ function useEffect(
208208
}
209209

210210
function useImperativeHandle<T>(
211-
ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
211+
ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
212212
create: () => T,
213213
inputs: Array<mixed> | void | null,
214214
): void {
@@ -371,12 +371,12 @@ const DispatcherProxy = new Proxy(Dispatcher, DispatcherProxyHandler);
371371

372372
// Inspect
373373

374-
export type HookSource = {|
374+
export type HookSource = {
375375
lineNumber: number | null,
376376
columnNumber: number | null,
377377
fileName: string | null,
378378
functionName: string | null,
379-
|};
379+
};
380380

381381
export type HooksNode = {
382382
id: number | null,

packages/react-devtools-core/src/standalone.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,14 @@ function connectToSocket(socket: WebSocket) {
284284
};
285285
}
286286

287-
type ServerOptions = {|
287+
type ServerOptions = {
288288
key?: string,
289289
cert?: string,
290-
|};
290+
};
291291

292-
type LoggerOptions = {|
292+
type LoggerOptions = {
293293
surface?: ?string,
294-
|};
294+
};
295295

296296
function startServer(
297297
port?: number = 8097,

packages/react-devtools-extensions/flow-typed/jest.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ type EnzymeMatchersType = {
206206
toIncludeText(text: string): void,
207207
toMatchElement(
208208
element: React$Element<any>,
209-
options?: {|ignoreProps?: boolean, verbose?: boolean|}
209+
options?: {ignoreProps?: boolean, verbose?: boolean}
210210
): void,
211211
toMatchSelector(selector: string): void,
212212
// 7.x
@@ -1095,7 +1095,7 @@ type JestPrettyFormatPrint = any => string;
10951095
// eslint-disable-next-line no-unused-vars
10961096
type JestPrettyFormatStringOrNull = string | null;
10971097

1098-
type JestPrettyFormatOptions = {|
1098+
type JestPrettyFormatOptions = {
10991099
callToJSON: boolean,
11001100
edgeSpacing: string,
11011101
escapeRegex: boolean,
@@ -1107,14 +1107,14 @@ type JestPrettyFormatOptions = {|
11071107
plugins: JestPrettyFormatPlugins,
11081108
printFunctionName: boolean,
11091109
spacing: string,
1110-
theme: {|
1110+
theme: {
11111111
comment: string,
11121112
content: string,
11131113
prop: string,
11141114
tag: string,
11151115
value: string,
1116-
|},
1117-
|};
1116+
},
1117+
};
11181118

11191119
type JestPrettyFormatPlugin = {
11201120
print: (

packages/react-devtools-inline/src/backend.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ export function activate(
7878
contentWindow: window,
7979
{
8080
bridge,
81-
}: {|
81+
}: {
8282
bridge?: BackendBridge,
83-
|} = {},
83+
} = {},
8484
): void {
8585
if (bridge == null) {
8686
bridge = createBridge(contentWindow);

packages/react-devtools-inline/src/frontend.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import type {Wall} from 'react-devtools-shared/src/types';
1717
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
1818
import type {Props} from 'react-devtools-shared/src/devtools/views/DevTools';
1919

20-
type Config = {|
20+
type Config = {
2121
checkBridgeProtocolCompatibility?: boolean,
2222
supportsNativeInspection?: boolean,
2323
supportsProfiling?: boolean,
24-
|};
24+
};
2525

2626
export function createStore(bridge: FrontendBridge, config?: Config): Store {
2727
return new Store(bridge, {
@@ -62,10 +62,10 @@ export function initialize(
6262
{
6363
bridge,
6464
store,
65-
}: {|
65+
}: {
6666
bridge?: FrontendBridge,
6767
store?: Store,
68-
|} = {},
68+
} = {},
6969
): React.AbstractComponent<Props, mixed> {
7070
if (bridge == null) {
7171
bridge = createBridge(contentWindow);

packages/react-devtools-shared/src/Logger.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,57 @@
1010
import {enableLogger} from 'react-devtools-feature-flags';
1111

1212
export type LoggerEvent =
13-
| {|
13+
| {
1414
+event_name: 'loaded-dev-tools',
15-
|}
16-
| {|
15+
}
16+
| {
1717
+event_name: 'error',
1818
+error_message: string | null,
1919
+error_stack: string | null,
2020
+error_component_stack: string | null,
21-
|}
22-
| {|
21+
}
22+
| {
2323
+event_name: 'selected-components-tab',
24-
|}
25-
| {|
24+
}
25+
| {
2626
+event_name: 'selected-profiler-tab',
27-
|}
28-
| {|
27+
}
28+
| {
2929
+event_name: 'load-hook-names',
3030
+event_status: 'success' | 'error' | 'timeout' | 'unknown',
3131
+duration_ms: number,
3232
+inspected_element_display_name: string | null,
3333
+inspected_element_number_of_hooks: number | null,
34-
|}
35-
| {|
34+
}
35+
| {
3636
+event_name: 'select-element',
37-
+metadata: {|
37+
+metadata: {
3838
+source: string,
39-
|},
40-
|}
41-
| {|
39+
},
40+
}
41+
| {
4242
+event_name: 'inspect-element-button-clicked',
43-
|}
44-
| {|
43+
}
44+
| {
4545
+event_name: 'profiling-start',
46-
+metadata: {|
46+
+metadata: {
4747
+current_tab: string,
48-
|},
49-
|}
50-
| {|
48+
},
49+
}
50+
| {
5151
+event_name: 'profiler-tab-changed',
52-
+metadata: {|
52+
+metadata: {
5353
+tabId: string,
54-
|},
55-
|}
56-
| {|
54+
},
55+
}
56+
| {
5757
+event_name: 'settings-changed',
5858
+metadata: {
5959
+key: string,
6060
+value: any,
6161
...
6262
},
63-
|};
63+
};
6464

6565
export type LogFunction = LoggerEvent => void | Promise<void>;
6666

packages/react-devtools-shared/src/__tests__/profilingCache-test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,7 @@ describe('ProfilingCache', () => {
202202

203203
const ModernContext = React.createContext(0);
204204

205-
class LegacyContextProvider extends React.Component<
206-
any,
207-
{|count: number|},
208-
> {
205+
class LegacyContextProvider extends React.Component<any, {count: number}> {
209206
static childContextTypes = {
210207
count: PropTypes.number,
211208
};

packages/react-devtools-shared/src/__tests__/profilingCharts-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('profiling charts', () => {
6161
describe('flamegraph chart', () => {
6262
// @reactVersion >= 16.9
6363
it('should contain valid data', () => {
64-
const Parent = (_: {||}) => {
64+
const Parent = (_: {}) => {
6565
Scheduler.unstable_advanceTime(10);
6666
return (
6767
<React.Fragment>
@@ -211,7 +211,7 @@ describe('profiling charts', () => {
211211
describe('ranked chart', () => {
212212
// @reactVersion >= 16.9
213213
it('should contain valid data', () => {
214-
const Parent = (_: {||}) => {
214+
const Parent = (_: {}) => {
215215
Scheduler.unstable_advanceTime(10);
216216
return (
217217
<React.Fragment>

packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('Store component filters', () => {
5151

5252
// @reactVersion >= 16.0
5353
it('should support filtering by element type', () => {
54-
class ClassComponent extends React.Component<{|children: React$Node|}> {
54+
class ClassComponent extends React.Component<{children: React$Node}> {
5555
render() {
5656
return <div>{this.props.children}</div>;
5757
}

0 commit comments

Comments
 (0)