Skip to content

Commit a6d7276

Browse files
authored
Annotate spread values as inexact objects instead of Object
Summary: A few values that are spread into object literals, or are props of components whose props get spread, are annotated as `Object`. Flow is about to declare `Object` as an interface, as TypeScript does, and Flow doesn't allow spreading interfaces. These are now annotated as inexact object types (`{...}`), which describe the same values and can be spread. Changelog: [Internal] Differential Revision: D130475155 Pull Request resolved: #59860
1 parent 880b108 commit a6d7276

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎packages/debugger-shell/src/electron/SettingsStore.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const path = require('node:path');
1616

1717
type Options = Readonly<{
1818
name?: string,
19-
defaults?: Object,
19+
defaults?: {...},
2020
}>;
2121

2222
/**

‎packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExBobble.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const BOBBLE_SPOTS = [...Array(NUM_BOBBLES)].map((_, i) => {
2727
};
2828
});
2929

30-
class AnExBobble extends React.Component<Object, any> {
31-
constructor(props: Object) {
30+
class AnExBobble extends React.Component<{...}, any> {
31+
constructor(props: {...}) {
3232
super(props);
3333
this.state = {};
3434
// $FlowFixMe[prop-missing]

‎packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExChained.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import type {
1818
import * as React from 'react';
1919
import {Animated, PanResponder, StyleSheet, View} from 'react-native';
2020

21-
class AnExChained extends React.Component<Object, any> {
22-
constructor(props: Object) {
21+
class AnExChained extends React.Component<{...}, any> {
22+
constructor(props: {...}) {
2323
super(props);
2424
this.state = {
2525
stickers: [new Animated.ValueXY()], // 1 leader

‎packages/rn-tester/js/examples/NativeAnimation/NativeAnimationsExample.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Tester extends React.Component<$FlowFixMe, $FlowFixMe> {
3737
? this.props.reverseConfig
3838
: this.props.config;
3939
this.current = this.current ? 0 : 1;
40-
const config: Object = {
40+
const config: {...} = {
4141
...animConfig,
4242
toValue: this.current,
4343
};

‎scripts/build/config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function getBabelConfig(
8787

8888
function getTypeScriptCompilerOptions(
8989
packageName: keyof BuildConfig['packages'],
90-
): Object {
90+
): {...} {
9191
const {target} = getBuildOptions(packageName);
9292

9393
switch (target) {

0 commit comments

Comments
 (0)