@@ -51,6 +51,20 @@ Then call it, using the [`npm_package_bin`](Built-ins#npm_package_bin) documenta
51
51
Here is an example:
52
52
https://github.com/bazelbuild/rules_nodejs/blob/3.2.2/internal/node/test/BUILD.bazel#L491-L507
53
53
54
+ ### tsc_test
55
+
56
+ `tsc_test` is generated alongside `tsc`.
57
+ It is identical, except that Bazel treats it as a test target, producing only an exit code
58
+ rather than files to be consumed by other steps in the build.
59
+
60
+ This can be used for a build with `--noEmit`, so that TypeScript is purely used for
61
+ type-checking and not for producing any build outputs.
62
+
63
+ To use it, add the load statement `load("@npm//typescript:index.bzl", "tsc_test")` to your BUILD file.
64
+ (Possibly replacing `@npm` with the name of the repository where you installed dependencies)
65
+
66
+ See example in https://github.com/bazelbuild/rules_nodejs/tree/stable/packages/typescript/test/tsc_test
67
+
54
68
### ts_project
55
69
56
70
`ts_project` simply runs `tsc --project`, with Bazel knowing which outputs to expect based on the TypeScript compiler options,
@@ -150,6 +164,10 @@ your editor references, or `extends` from it, to keep consistent settings for th
150
164
151
165
Anything you do with TypeScript is possible with `ts_project`, including json imports, type-checking only,
152
166
transpile only, outdir, rootdir, and so on.
167
+
168
+ > To use `ts_project` for typecheck-only, you'll still need to use --declaration so that .d.ts files are produced.
169
+ > Alternatively, see the `tsc_test` rule documented above.
170
+
153
171
See many examples in our test cases:
154
172
https://github.com/bazelbuild/rules_nodejs/tree/stable/packages/typescript/test/ts_project
155
173
"""
0 commit comments