Summary
dtsx generates three types of invalid .d.ts syntax that cause TypeScript errors in downstream consumers.
Bug 1: Getter accessor syntax
Source:
export const ENV = {
get TRACE() { return process.env.PICKIER_TRACE === '1' },
}dtsx output (broken):
export declare const ENV: {
get TRACE: () => unknown;
}Correct output:
export declare const ENV: {
get TRACE(): unknown;
}TypeScript error: TS1005: '(' expected.
The getter is emitted as get PROP: () => T (property with function type) instead of get PROP(): T (accessor declaration).
Affected package: pickier@0.1.21 — dist/utils.d.ts lines 52-56
Bug 2: Missing semicolons between object type properties
Source:
export function resilient(config: { sentryDsn?: string, bugsnagApiKey?: string, services?: string[] } = {}) {}dtsx output (broken):
resilient: (config: { sentryDsn?: string bugsnagApiKey?: string services?: string[] } = {}) => anyCorrect output:
resilient: (config: { sentryDsn?: string; bugsnagApiKey?: string; services?: string[] }) => anyTypeScript error: TS1005: ';' expected.
Properties in inline object types need ; or , separators.
Affected package: @stacksjs/bun-router — dist/errors/error-handler.d.ts line 21
Bug 3: Default parameter values in declarations
Source:
function resilient(config: { sentryDsn?: string } = {}) {}dtsx output (broken):
resilient: (config: { sentryDsn?: string } = {}) => anyCorrect output:
resilient: (config?: { sentryDsn?: string }) => anyDefault values (= {}) are not valid in .d.ts files. Parameters with defaults should be marked as optional (?) instead.
Impact
These bugs cause typecheck failures in any downstream package that imports from pickier or @stacksjs/bun-router:
ts-analytics— 11 typecheck errors from bun-routerts-video-player— 7 typecheck errors from pickier
Versions
bun-plugin-dtsx: 0.9.13pickier: 0.1.21@stacksjs/bun-router: latest