Skip to content

Commit

Permalink
docs: Add information about .d.ts.map TypeScript declaration maps (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-burel committed Feb 23, 2022
1 parent b753465 commit b9b8170
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/README.md
Expand Up @@ -147,6 +147,16 @@ Note that `--dts` does not resolve external (aka in `node_modules`) types used i

The `--dts-only` flag is the equivalent of the `emitDeclarationOnly` option in `tsc`. Using this flag will only emit the declaration file, without the JavaScript files.

#### Generate TypeScript declaration maps (.d.ts.map)

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.

[Tsup is not able to generate those files](https://github.com/egoist/tsup/issues/564). Instead, you should use the TypeScript compiler directly, by running the following command after the build is done: `tsc --emitDeclarationOnly --declaration`.

You can combine this command with Tsup [`onSuccess`](https://tsup.egoist.sh/#onsuccess) callback.

### Generate sourcemap file

```bash
Expand Down

0 comments on commit b9b8170

Please sign in to comment.