Incorrect info about Declaration Maps
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
The docs say
> TypeScript declaration maps are mainly used to quickly jump to type definitions in the context of a monorepo (see [source issue](https://github.com/Microsoft/TypeScript/issues/14479) and [official documentation](https://www.typescriptlang.org/tsconfig/#declarationMap)).
> They should not be included in a published NPM package and should not be confused with sourcemaps.
But this is 100% wrong.
Without declaration maps there is no way for a consumer of the package to be able to use the `go to definition` in IDEs like VSCode. Without declaration maps, this will do to a d.ts file, which is already where the `go to type definition` goes.
Without the declaration maps, the consumer has to easy way to find the actual code that is being run when using a function from an imported library.
I'm sure all of you here have been annoyed by that once, and THIS HERE IS THE REASON. Including declaration maps means the `go to definition` will actually work.
I don't know if there is any way for TSUP to support this without just using TSC, but this advice here is absolutely incorrect. All libraries should include the declaration maps and TS source for our dev tools to work properly.
Contributor guide
Research direction
Review the declaration-map guidance quoted in this issue against the linked TypeScript declarationMap documentation and source issue. Identify the documentation location containing this advice, verify the behavior for published packages and IDE navigation, and update the guidance so its recommendation is accurate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100