-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typescript): document tsc_test for typecheck-only
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
load("@npm//typescript:index.bzl", "tsc_test") | ||
|
||
# Bazel only runs actions as required to produce requested outputs. | ||
# If we don't want TypeScript to emit anything at all, even .d.ts files, | ||
# then we can't make it a build step as it will never run. | ||
# Instead we invoke the bare `tsc` binary as a *_test rule, so that Bazel | ||
# always runs it to produce an exit code. | ||
tsc_test( | ||
name = "typecheck_only", | ||
args = ["$(location check_me.ts)"], | ||
data = ["check_me.ts"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export const a: string = 'a' | ||
|
||
// Uncomment this last line to observe the typecheck_only test fails: | ||
// FAIL: //packages/typescript/test/tsc_test:typecheck_only | ||
// (see execroot/build_bazel_rules_nodejs/bazel-out/k8-fastbuild/testlogs/packages/typescript/test/tsc_test/typecheck_only/test.log) | ||
// INFO: From Testing //packages/typescript/test/tsc_test:typecheck_only: | ||
// ==================== Test output for //packages/typescript/test/tsc_test:typecheck_only: | ||
// packages/typescript/test/tsc_test/check_me.ts(11,14): error TS2322: Type 'string' is not assignable to type 'number'. | ||
// ================================================================================ | ||
|
||
// export const b: number = 'b' |