egoist / egoist/tsup

Correct way to bundle dependencies types in generated .d.ts

Open
#1,071 4 comments 10 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

Hi, My library: https://github.com/meshtastic/js bundles one of it's dependencies as it comes from another package registry, this part is working, however I need the dependencies types to also be bundled.

My library re-exports the dependency as follows:
```ts
export * as Admin from "@buf/meshtastic_protobufs.bufbuild_es/meshtastic/admin_pb.js";
```
The JS code is correctly bundled, but the generated .d.ts file still has an import from the original dependency that is not resolved when using the library:
```ts
import * as config_pb_js from '@buf/meshtastic_protobufs.bufbuild_es/meshtastic/config_pb.js';
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the meshtastic/js setup described in the issue and inspect the generated .d.ts output, especially its import from @buf/meshtastic_protobufs.bufbuild_es. Trace how declaration output handles the re-export, then verify that the dependency types are bundled or resolved for consumers without the original registry dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.