Skip to content

Commit 9483b90

Browse files
committed
Fix Flow errors in globalEvalWithSourceUrl Fantom test
Use unknown instead of the deprecated mixed, and read the host function untyped in the arity test so Flow does not reject the deliberate bad call.
1 parent c19158b commit 9483b90

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎packages/react-native/Libraries/Core/Devtools/__tests__/globalEvalWithSourceUrl-itest.js‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
1212

1313
const SOURCE_URL = 'globalEvalWithSourceUrl-itest.bundle';
1414

15-
function getHelper(): (code: string, sourceUrl?: string) => mixed {
15+
function getHelper(): (code: string, sourceUrl?: string) => unknown {
1616
// $FlowFixMe[prop-missing]
1717
const helper = global.globalEvalWithSourceUrl;
1818
if (typeof helper !== 'function') {
@@ -23,7 +23,7 @@ function getHelper(): (code: string, sourceUrl?: string) => mixed {
2323
return helper;
2424
}
2525

26-
function getStack(fn: () => mixed): string {
26+
function getStack(fn: () => unknown): string {
2727
try {
2828
fn();
2929
} catch (e) {
@@ -71,8 +71,11 @@ describe('globalEvalWithSourceUrl', () => {
7171
});
7272

7373
it('rejects an invalid argument count', () => {
74-
const helper = getHelper();
75-
// $FlowFixMe[incompatible-call]
74+
// Read it untyped on purpose: this test calls the host function with an
75+
// arity the typed wrapper would not allow.
76+
const helper: (...args: Array<unknown>) => unknown =
77+
// $FlowFixMe[prop-missing]
78+
global.globalEvalWithSourceUrl;
7679
expect(() => helper()).toThrow(
7780
'globalEvalWithSourceUrl arg count must be 1 or 2',
7881
);

0 commit comments

Comments
 (0)