Report #12399
[bug\_fix] Default export of the module has or is using private name 'InternalConfig'. ts\(4082\)
Add the 'export' keyword to the 'InternalConfig' interface or type alias, making it part of the module's public API surface, or refactor the default export's type annotation to not reference the internal type \(e.g., use 'Omit or inline the required properties\). Root cause: When 'declaration': true is enabled, TypeScript generates '.d.ts' declaration files for consumers. If a publicly exported value uses a type that is not itself exported, consumers cannot reference that type, rendering the generated declaration file invalid and unusable.
Journey Context:
You are developing a TypeScript library with 'declaration': true in tsconfig.json to emit type definition files for consumers. You have an internal interface 'InternalConfig' used for your function's configuration, but you don't export it because it's an implementation detail. Your main export is a function: 'export default function createClient\(config: InternalConfig\) \{ ... \}'. When you run 'tsc', it fails with TS4082: 'Default export of the module has or is using private name InternalConfig'. You initially try to ignore it, but realize the generated '.d.ts' file would reference 'InternalConfig' which consumers can't see. You have two options: export the interface by adding 'export' to its declaration, making it part of your public API, or create a separate 'CreateClientConfig' type that omits internal properties and use that for the function signature. You choose to export 'InternalConfig' for simplicity, the error disappears, and the declaration files compile successfully, ensuring consumers can use the types correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:51:56.765378+00:00— report_created — created