From 82e86c459d6efe3650c4ebca9de3554de50113e2 Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Tue, 18 Oct 2022 12:49:22 -0700 Subject: [PATCH] Annotate empty arrays in xplat (2/n) Summary: Changelog: [Internal] Reviewed By: pieterv Differential Revision: D40460690 fbshipit-source-id: 1e10b0bcf874dc9a3702b4d17d30d448653602ca --- Libraries/Alert/Alert.js | 2 +- .../src/parsers/__tests__/error-utils-test.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Libraries/Alert/Alert.js b/Libraries/Alert/Alert.js index 68bf6fea03c..a6a0ccbfecc 100644 --- a/Libraries/Alert/Alert.js +++ b/Libraries/Alert/Alert.js @@ -123,7 +123,7 @@ class Alert { options?: Options, ): void { if (Platform.OS === 'ios') { - let callbacks = []; + let callbacks: Array = []; const buttons = []; let cancelButtonKey; let destructiveButtonKey; diff --git a/packages/react-native-codegen/src/parsers/__tests__/error-utils-test.js b/packages/react-native-codegen/src/parsers/__tests__/error-utils-test.js index 1b16f4a12e9..16f8b8ae9f0 100644 --- a/packages/react-native-codegen/src/parsers/__tests__/error-utils-test.js +++ b/packages/react-native-codegen/src/parsers/__tests__/error-utils-test.js @@ -108,7 +108,7 @@ describe('throwIfMoreThanOneModuleRegistryCalls', () => { describe('throwIfUnusedModuleInterfaceParserError', () => { it('throw error if unused module', () => { const nativeModuleName = 'moduleName'; - const callExpressions = []; + const callExpressions: Array<$FlowFixMe> = []; const spec = {name: 'Spec'}; const parserType = 'Flow'; expect(() => { @@ -140,7 +140,7 @@ describe('throwIfUnusedModuleInterfaceParserError', () => { describe('throwErrorIfWrongNumberOfCallExpressionArgs', () => { it('throw error if wrong number of call expression args is used', () => { const nativeModuleName = 'moduleName'; - const flowCallExpression = {argument: []}; + const flowCallExpression: {argument: Array<$FlowFixMe>} = {argument: []}; const methodName = 'methodName'; const numberOfCallExpressionArgs = flowCallExpression.argument.length; const language = 'Flow'; @@ -204,7 +204,7 @@ describe('throwIfIncorrectModuleRegistryCallTypeParameterParserError', () => { }); it('throw error if flowTypeArguments params length is not 1', () => { - const flowTypeArguments = { + const flowTypeArguments: $FlowFixMe = { type: 'TypeParameterInstantiation', params: [], }; @@ -327,7 +327,7 @@ describe('throwIfIncorrectModuleRegistryCallTypeParameterParserError', () => { }); it('throw error if typeScriptTypeArguments params length is not equal to 1', () => { - const typeScriptTypeArguments = { + const typeScriptTypeArguments: $FlowFixMe = { type: 'TSTypeParameterInstantiation', params: [], }; @@ -430,7 +430,7 @@ describe('throwIfUntypedModule', () => { const hasteModuleName = 'moduleName'; const methodName = 'methodName'; const moduleName = 'moduleName'; - const callExpressions = []; + const callExpressions: Array<$FlowFixMe> = []; it('should throw error if module does not have a type', () => { const typeArguments = null; @@ -448,7 +448,7 @@ describe('throwIfUntypedModule', () => { }); it('should not throw error if module have a type', () => { - const typeArguments = { + const typeArguments: $FlowFixMe = { type: 'TSTypeParameterInstantiations', params: [], };