From be7abbcf3f67c5338026bdfae5ffe5e733621ce0 Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Mon, 24 Mar 2025 15:32:25 -0700 Subject: [PATCH] Minor fixes for jest libdef (#50235) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50235 - Remove duplicate definition for `toBeCalledWith` and `lastCalledWith`. - Replace `typeof undefined` with `void` - Make some Array types readonly where we can. Changelog: [Internal] Reviewed By: gkz Differential Revision: D71762238 fbshipit-source-id: 5c20bd7e941a8c36084e291f23cd6caa27f07eb9 --- packages/react-native/flow/jest.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-native/flow/jest.js b/packages/react-native/flow/jest.js index fe6ae3cfd82..9fe23df97db 100644 --- a/packages/react-native/flow/jest.js +++ b/packages/react-native/flow/jest.js @@ -219,7 +219,7 @@ type JestStyledComponentsMatcherValue = | string | JestAsymmetricEqualityType | RegExp - | typeof undefined; + | void; type JestStyledComponentsMatcherOptions = { media?: string, @@ -755,13 +755,11 @@ interface JestExpectType { * specific arguments. */ toHaveBeenCalledWith(...args: Array): void; - toBeCalledWith(...args: Array): void; /** * Use .toHaveBeenLastCalledWith to ensure that a mock function was last called * with specific arguments. */ toHaveBeenLastCalledWith(...args: Array): void; - lastCalledWith(...args: Array): void; /** * Check that an object has a .length property and it is set to a certain * numeric value. @@ -1131,7 +1129,9 @@ declare var it: { * @param {table} table of Test */ each( - ...table: Array | mixed> | [Array, string] + ...table: + | $ReadOnlyArray<$ReadOnlyArray | mixed> + | [$ReadOnlyArray, string] ): ( name: JestTestName, fn?: (...args: Array) => ?Promise,