From 2a48b0e3a795f5685f426e6a0e1d9cdf8959f791 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 16 Aug 2026 03:06:24 +0000 Subject: [PATCH] bun-types: declare MatchedRoute.scriptSrc Bun.FileSystemRouter's MatchedRoute prototype installs scriptSrc as a second name for src (filesystem_router.classes.ts), but the MatchedRoute interface in bun.d.ts did not declare it, so reading it failed to type-check. Declare it as a deprecated alias of src, and read both names in the fsrouter fixture that bun-types.test.ts type-checks. --- packages/bun-types/bun.d.ts | 5 +++++ test/integration/bun-types/fixture/fsrouter.ts | 3 +++ 2 files changed, 8 insertions(+) diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index d8c9402e2871..541d9ea1a705 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -8421,6 +8421,11 @@ declare module "bun" { readonly name: string; readonly kind: "exact" | "catch-all" | "optional-catch-all" | "dynamic"; readonly src: string; + /** + * Legacy name for {@link MatchedRoute.src} (same value) + * @deprecated Use src instead + */ + readonly scriptSrc: string; } /** diff --git a/test/integration/bun-types/fixture/fsrouter.ts b/test/integration/bun-types/fixture/fsrouter.ts index d3a13d039c74..1a1dca053d43 100644 --- a/test/integration/bun-types/fixture/fsrouter.ts +++ b/test/integration/bun-types/fixture/fsrouter.ts @@ -8,6 +8,9 @@ const router = new FileSystemRouter({ const match = router.match("/"); expectType(match?.name!); +// scriptSrc is the runtime's legacy name for src. +expectType(match?.src!); +expectType(match?.scriptSrc!); expectType(match?.pathname!); expectType>(match?.query!); expectType>(match?.params!);