Skip to content

Commit 80ca42e

Browse files
SamChou19815meta-codesync[bot]
authored andcommitted
Replace Object/Function annotations with any (#59094)
Summary: Pull Request resolved: #59094 With `experimental.function_and_object_type_is_no_longer_any`, Flow resolves `Object` and `Function` to the builtin class types instead of `any`. Changelog: [Internal] Reviewed By: panagosg7 Differential Revision: D125312021 fbshipit-source-id: 1646441aa3c2728313cf56b347d04e62d69712e4
1 parent 43c9b88 commit 80ca42e

29 files changed

Lines changed: 40 additions & 41 deletions

File tree

‎packages/react-native-codegen/src/parsers/flow/components/commands.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type {TypeDeclarationMap} from '../../utils';
2222
const {getValueFromTypes} = require('../utils.js');
2323

2424
// $FlowFixMe[unclear-type] there's no flowtype for ASTs
25-
type EventTypeAST = Object;
25+
type EventTypeAST = any;
2626

2727
function buildCommandSchema(
2828
property: EventTypeAST,

‎packages/react-native-codegen/src/parsers/flow/components/events.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ function buildEventSchema(
266266
}
267267

268268
// $FlowFixMe[unclear-type] there's no flowtype for ASTs
269-
type EventTypeAST = Object;
269+
type EventTypeAST = any;
270270

271271
type TypeMap = {
272272
// $FlowFixMe[unclear-type] there's no flowtype for ASTs
273-
[string]: Object,
273+
[string]: any,
274274
...
275275
};
276276

‎packages/react-native-codegen/src/parsers/parsers-commons.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export type CommandOptions = Readonly<{
8383
}>;
8484

8585
// $FlowFixMe[unclear-type] TODO(T108222691): Use flow-types for @babel/parser
86-
type OptionsAST = Object;
86+
type OptionsAST = any;
8787

8888
type ExtendedPropResult = {
8989
type: 'ReactNativeBuiltInType',

‎packages/react-native-codegen/src/parsers/typescript/components/commands.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const {parseTopLevelType} = require('../parseTopLevelType');
2323
const {getPrimitiveTypeAnnotation} = require('./componentsUtils');
2424

2525
// $FlowFixMe[unclear-type] there's no flowtype for ASTs
26-
type EventTypeAST = Object;
26+
type EventTypeAST = any;
2727

2828
function buildCommandSchemaInternal(
2929
name: string,

‎packages/react-native-codegen/src/parsers/typescript/components/events.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ function findEventArgumentsAndType(
238238
}
239239

240240
// $FlowFixMe[unclear-type] TODO(T108222691): Use flow-types for @babel/parser
241-
type EventTypeAST = Object;
241+
type EventTypeAST = any;
242242

243243
function buildEventSchema(
244244
types: TypeDeclarationMap,

‎packages/react-native-codegen/src/parsers/typescript/components/extends.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function isEvent(typeAnnotation: $FlowFixMe, parser: Parser): boolean {
2424
}
2525

2626
// $FlowFixMe[unclear-type] TODO(T108222691): Use flow-types for @babel/parser
27-
type PropsAST = Object;
27+
type PropsAST = any;
2828

2929
function categorizeProps(
3030
typeDefinition: ReadonlyArray<PropsAST>,

‎packages/react-native/Libraries/Animated/AnimatedEvent.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ function validateMapping(argMapping: ReadonlyArray<?Mapping>, args: any) {
156156
export class AnimatedEvent {
157157
_argMapping: ReadonlyArray<?Mapping>;
158158
// $FlowFixMe[unclear-type]
159-
_listeners: Array<Function> = [];
159+
_listeners: Array<any> = [];
160160
_attachedEvent: ?{detach: () => void, ...};
161161
__isNative: boolean;
162162
__platformConfig: ?PlatformConfig;

‎packages/react-native/Libraries/Animated/AnimatedImplementation.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ const _combineCallbacks = function (
128128
const maybeVectorAnim = function (
129129
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
130130
// $FlowFixMe[unclear-type]
131-
config: Object,
131+
config: any,
132132
// $FlowFixMe[unclear-type]
133-
anim: (value: AnimatedValue, config: Object) => CompositeAnimation,
133+
anim: (value: AnimatedValue, config: any) => CompositeAnimation,
134134
): ?CompositeAnimation {
135135
if (value instanceof AnimatedValueXY) {
136136
const configX = {...config};

‎packages/react-native/Libraries/Animated/nodes/AnimatedNode.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export default class AnimatedNode {
228228
}
229229

230230
// $FlowFixMe[unclear-type]
231-
__getNativeConfig(): Object {
231+
__getNativeConfig(): any {
232232
throw new Error(
233233
'This JS animated node type cannot be used as native animated node',
234234
);

‎packages/react-native/Libraries/Animated/nodes/AnimatedProps.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export default class AnimatedProps extends AnimatedNode {
120120
}
121121

122122
// $FlowFixMe[unclear-type]
123-
__getValue(): Object {
123+
__getValue(): any {
124124
const props: {[string]: unknown} = {};
125125

126126
const keys = Object.keys(this._props);
@@ -146,7 +146,7 @@ export default class AnimatedProps extends AnimatedNode {
146146
* created by this `AnimatedProps` instance.
147147
*/
148148
// $FlowFixMe[unclear-type]
149-
__getValueWithStaticProps(staticProps: Object): Object {
149+
__getValueWithStaticProps(staticProps: any): any {
150150
const props: {[string]: unknown} = {...staticProps};
151151

152152
const keys = Object.keys(staticProps);

0 commit comments

Comments
 (0)