Tsup generates hashes in names of `.d.ts` files
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
How can I prevent tsup from generating these files with hashes at the end of the name? They only are `.d.ts` (generated when I set `dts: true`) and they cause this error in my monorepo when indirectly importing code from them (e.g I import from another file in a separate workspace of my monorepo, but that file imports from the file with the hash):
```
The inferred type of 'DEFAULT_TOOL_SYSTEM_PROMPT' cannot be named without a reference to '../../../../../node_modules/@langchain/core/dist/prompt-f7938666.js'. This is likely not portable. A type annotation is necessary.ts(2742)
```
If I manually delete the file it's referencing `prompt-f7938666.d.ts` then the error goes away.
Does anyone know how I can resolve this issue without adding type annotations?
-----
Contributor guide
Research direction
Start by reproducing the monorepo case with tsup configured with dts: true and inspect the generated .d.ts filenames and their imports. Done means declaration files no longer receive content hashes, or the reported indirect-import TypeScript error is resolved without requiring manual deletion or added type annotations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100