ReviewOS

stacks/bun-router

fix(types): expose supported server options on Router.serve

#885
Closed chris opened this 8 days ago ·
8 days ago

The runtime serve() extension accepts ServerOptions, including nativeRoutes, static and development settings, but the public Router class declares only { port?: number, hostname?: string }.

A real HTTP regression test for #884 exposed TS2353 for router.serve({ port: 0, nativeRoutes: true }). Existing tests bypassed this with any casts. The fix should use the existing runtime ServerOptions type in the class declaration and verify valid options plus rejection of invalid option values. No cast or alternate configuration path is needed.

Related framework performance work: stacksjs/stacks#2462.

8 days ago

Fixed in ddfda2c: Router.serve() now uses the existing runtime ServerOptions type. Supported native/static/development settings typecheck, while invalid and unknown fields remain rejected. Both TypeScript projects and pickier lint pass; the generic/native HTTP tests from #884 execute without casts. Independent Standards and Spec reviews passed.

Sign in to comment on this issue.