You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That means doing "Go to Definition" sends you to the appropriate generated .d.ts file instead of your source file.
Proposed Solution
I've implemented two patches in my codebase where I'm using dts: { inferTypes: true } in my bunup config. Apologies in advance for only working with dist instead of the source files.
Note
The bunup change works as-is, but the @bunup/dts change only covers inferTypes: true. The full solution would absolutely need to consider the branch that handles isolatedDeclarations.
If options.declarationMap is true, the map file should be passed along via the bundledFiles array with a dtsMap key. Here's a working patch for bunup in src/build.ts:
For @bunup/dts, we can check for declarationMap in the tsconfig options, pull in the declaration map, update the relative source paths, and append the source map link in the .d.ts file.
It's possible a restructuring of the declaration branch could be done or some simplifications like setting declarationPath for both branches, which would limit the scope of the changes required for the declaration map feature.
Alternatives Considered
No response
Code Examples
API Design (if applicable)
Additional Context
No response
Priority
Medium - Would significantly improve my workflow
Contribution
I'm willing to submit a PR to implement this feature
Prerequisites
Problem Statement
When
declarationMapis set totruein a tsconfig, tsc emits .d.ts.map files that support "Go to Definition" directly to the source files in IDEs.In /src/typescript-compiler.ts, tsc or tsgo respects
declarationMapand will create .d.ts.map files, if appropriate.Then in /src/generate.ts, the map files are not included in
bundledFilesand ultimately rm'd 👋 .That means doing "Go to Definition" sends you to the appropriate generated .d.ts file instead of your source file.
Proposed Solution
I've implemented two patches in my codebase where I'm using
dts: { inferTypes: true }in my bunup config. Apologies in advance for only working with dist instead of the source files.Note
The bunup change works as-is, but the
@bunup/dtschange only coversinferTypes: true. The full solution would absolutely need to consider the branch that handlesisolatedDeclarations.If
options.declarationMapistrue, the map file should be passed along via thebundledFilesarray with adtsMapkey. Here's a working patch forbunupin src/build.ts:For
@bunup/dts, we can check fordeclarationMapin the tsconfig options, pull in the declaration map, update the relative source paths, and append the source map link in the .d.ts file.It's possible a restructuring of the declaration branch could be done or some simplifications like setting
declarationPathfor both branches, which would limit the scope of the changes required for the declaration map feature.Alternatives Considered
No response
Code Examples
API Design (if applicable)
Additional Context
No response
Priority
Medium - Would significantly improve my workflow
Contribution