Skip to content

Enable consolidateTypeFiles for the TypeScript SDK#589

Open
fern-support wants to merge 1 commit into
mainfrom
consolidate-type-files
Open

Enable consolidateTypeFiles for the TypeScript SDK#589
fern-support wants to merge 1 commit into
mainfrom
consolidate-type-files

Conversation

@fern-support

@fern-support fern-support commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Addresses intercom/intercom-node#527intercom-client ships hundreds of byte-identical empty compiled modules (one per erased type file, doubled across the CJS + ESM builds).

Root cause

With noSerdeLayer: true, every type file is a pure interface/type that tsc erases to an empty .js/.mjs (just the "use strict"; __esModule boilerplate). The TypeScript SDK generator emits one source file per declared type, so these empty runtime modules pile up.

Fix

Set consolidateTypeFiles: true on the ts-sdk generator. This collapses all types in a namespace into a single types.ts, cutting the number of files that erase to empty modules.

Verification (same-spec, flag OFF vs ON)

Regenerated the ts-sdk group from the current spec both ways and built each (CJS + ESM compile clean):

flag OFF flag ON
total published .js 573 375 (−35%)
empty compiled modules 331 166 (−50%)

Non-breaking

Verified the public API surface is unchanged by the flag (same spec):

  • Runtime exports (root require): 6 → 6, identical.
  • Type exports (recursive, incl. all Intercom.* namespaces): 826 → 826, 0 added, 0 removed.

It is purely an internal dist/** file-layout change. The package's exports map only exposes . and ./package.json, so no deep-import path into dist/** is affected.

Collapses per-type source files into one types.ts per namespace,
cutting the number of empty compiled runtime modules shipped in
intercom-client. Addresses intercom/intercom-node#527.

Verified against a local preview regen + build (CJS+ESM):
- total published .js: 1095 -> 375 (-66%)
- byte-identical empty modules: 591 -> 127 (-79%)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant