From 1aee0954793831f043c64c7f3e57965d60e0a93b Mon Sep 17 00:00:00 2001 From: Luke Parker <10430890+Hona@users.noreply.github.com> Date: Mon, 9 Nov 2026 14:55:36 -0600 Subject: [PATCH] fix(perf): type navigation.bench.ts's setup key on its target (#62952) --- packages/app/perf/navigation.bench.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/app/perf/navigation.bench.ts b/packages/app/perf/navigation.bench.ts index 838764ac862..94a480cfbaf 100644 --- a/packages/app/perf/navigation.bench.ts +++ b/packages/app/perf/navigation.bench.ts @@ -87,6 +87,9 @@ const scenes = { } satisfies Record /** Where each case starts. */ +/** What a launch sets up: the scene, and whether setup opens the command palette. */ +type Setup = { scene: keyof typeof scenes; palette: boolean } + const sceneOf = new Map([ ["open a session from home", "home"], ["close the last tab", "source"], @@ -113,7 +116,7 @@ const metrics = ["run.duration", "interaction.p50"] export default bench({ // A case's scene, and whether setup opens the command palette: cases with the same ones share a launch. - setupKey: ({ case: name }) => { + setupKey: ({ case: name }): Setup => { const scene = sceneOf.get(name) if (!scene) throw new Error(`navigation.bench.ts: no scene for "${name}"`) @@ -122,7 +125,8 @@ export default bench({ }, targets: { - web: web({ + // A target is made before the bench, so its hooks see the setup key as typed here. + web: web<{}, Setup>({ expect: { title: "OpenCode" }, viewport: { width: 1440, height: 900 }, async prepare(ctx) {