这是indexloc提供的服务,不要输入任何密码
Skip to content

Incorrect info about Declaration Maps #885

@ekwoka

Description

@ekwoka

The docs say

TypeScript declaration maps are mainly used to quickly jump to type definitions in the context of a monorepo (see source issue and official documentation).

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions