generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
14 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
"""Only type-checks the input file, but does no transpilation or output any typings files. | ||
As such, it cannot run as a Bazel action under `bazel build`, as Bazel will only run actions when | ||
their outputs are requested. | ||
Therefore this is a test target and should be run with `bazel test`. | ||
Therefore type-checking is done with a validation action within the `ts_project` rule. | ||
""" | ||
|
||
load("@npm//examples:typescript/package_json.bzl", "bin") | ||
load("@aspect_rules_ts//ts:defs.bzl", "ts_project") | ||
|
||
bin.tsc_test( | ||
ts_project( | ||
name = "typecheck_only", | ||
args = [ | ||
"--noEmit", | ||
"$(location check-me.ts)", | ||
srcs = [ | ||
"check-me.ts", | ||
"lib.js", | ||
], | ||
data = ["check-me.ts"], | ||
# It should fail because we made a typing mistake | ||
# TypeScript ReturnCode: | ||
# OutputGeneratedWithErrors = 2, // .js and .map generated with semantic errors | ||
expected_exit_code = 2, | ||
tsconfig = { | ||
"compilerOptions": { | ||
"noEmit": True, | ||
}, | ||
}, | ||
) |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
const a: number = 'a-string' | ||
// Ensure importing from .js works | ||
export * from './lib' |
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 @@ | ||
export const a = 42 |