diff --git a/README.md b/README.md index 4b2c21ea..6d761aac 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,11 @@ Then build it: `bazel build //path/to/package:target` The resulting `.d.ts` file paths will be printed. Additionally, the `.js` -outputs from TypeScript will be written to disk, next to the `.d.ts` files. +outputs from TypeScript will be written to disk, next to the `.d.ts` files 1. + +> 1 The +> [declarationDir](https://www.typescriptlang.org/docs/handbook/compiler-options.html) +> compiler option will be silently overwritten if present. ## Notes @@ -92,4 +96,3 @@ In the meantime, we suggest associating the `.bazel` extension with Python in your editor, so that you get useful syntax highlighting. [gazelle]: https://github.com/bazelbuild/rules_go/tree/master/go/tools/gazelle - diff --git a/internal/common/tsconfig.bzl b/internal/common/tsconfig.bzl index 219230a9..2e12e04e 100644 --- a/internal/common/tsconfig.bzl +++ b/internal/common/tsconfig.bzl @@ -156,6 +156,10 @@ def create_tsconfig(ctx, files, srcs, "noEmitOnError": False, "declaration": True, + + # We don't support this compiler option (See github #32), so + # always emit declaration files in the same location as outDir. + "declarationDir": "/".join([workspace_path, outdir_path]), "stripInternal": True, # Embed source maps and sources in .js outputs