From 797d14da9e76a96dd8294a0c730730bfe65dfaab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Mon, 28 Jul 2025 10:02:25 -0700 Subject: [PATCH] Expose types for benchmark options (#52875) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52875 Changelog: [internal] This simplifies typing tests. Reviewed By: christophpurrer Differential Revision: D79086359 fbshipit-source-id: 683a713e0182f18c9b26e515921d17cf7873aa06 --- private/react-native-fantom/src/Benchmark.js | 8 +++++--- private/react-native-fantom/src/index.js | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/private/react-native-fantom/src/Benchmark.js b/private/react-native-fantom/src/Benchmark.js index ae7c5fb78e3..2e62afa1b41 100644 --- a/private/react-native-fantom/src/Benchmark.js +++ b/private/react-native-fantom/src/Benchmark.js @@ -18,7 +18,7 @@ import { type TaskResult, } from 'tinybench'; -type SuiteOptions = $ReadOnly<{ +export type SuiteOptions = $ReadOnly<{ minIterations?: number, minDuration?: number, warmup?: boolean, @@ -28,7 +28,9 @@ type SuiteOptions = $ReadOnly<{ testOnly?: boolean, }>; -type TestOptions = $ReadOnly<{ +export type TestOptions = FnOptions; + +type InternalTestOptions = $ReadOnly<{ ...FnOptions, only?: boolean, }>; @@ -71,7 +73,7 @@ interface SuiteAPI { interface TestTask { name: string; fn: () => void; - options: TestOptions | void; + options: InternalTestOptions | void; } export function suite( diff --git a/private/react-native-fantom/src/index.js b/private/react-native-fantom/src/index.js index 5fe2b88d1ca..1be3fd4af5b 100644 --- a/private/react-native-fantom/src/index.js +++ b/private/react-native-fantom/src/index.js @@ -567,6 +567,11 @@ export function enqueueModalSizeUpdate( export const unstable_benchmark = Benchmark; +export type { + SuiteOptions as BenchmarkSuiteOptions, + TestOptions as BenchmarkTestOptions, +} from './Benchmark'; + /** * Quick and dirty polyfills required by tinybench. */