Bug
When a .ts source contains an interface with an extends clause inside a declare module block, the generated .d.ts is missing the space between the interface name and extends, producing output that fails to parse.
Input (src/request-augmentation.ts):
export type StacksRequestExtensions = StacksRequestMarkers & StacksRequestMacros
declare module '@stacksjs/bun-router' {
interface EnhancedRequest extends StacksRequestExtensions {}
}Output (dist/request-augmentation.d.ts):
declare module '@stacksjs/bun-router' {
interface EnhancedRequestextends StacksRequestExtensions {}
}tsc then fails with error TS1005: '{' expected — and since TS1005 is a syntax error, skipLibCheck cannot suppress it, so any downstream project consuming the generated types fails to typecheck.
Notes
- Reproduced on both
@stacksjs/dtsx/bun-plugin-dtsx0.9.23 and 0.10.8 (latest). - The exact formatting of the source doesn't matter — single-line body, multi-line body, single parent, and multiple parents (
extends A, B) all emit the same mangled output (name andextendsfused, double space before the body). - Interfaces with
extendsat the top level of a module emit correctly; the bug only appears for interfaces nested insidedeclare module '...' { }augmentation blocks. - Encountered in a Stacks app:
storage/framework/core/router/src/request-augmentation.ts. We're currently working around it with a post-build string repair in the package'sbuild.ts.
🤖 Generated with Claude Code