Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit d23ce0c

Browse files
LucasSloanKeen Yee Liau
authored andcommitted
Add the option to entirely disable type checking.
PiperOrigin-RevId: 315771891
1 parent daa08b4 commit d23ce0c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

internal/common/tsconfig.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def create_tsconfig(
3232
extra_root_dirs = [],
3333
module_path_prefixes = None,
3434
module_roots = None,
35-
node_modules_root = None):
35+
node_modules_root = None,
36+
type_check = True):
3637
"""Creates an object representing the TypeScript configuration to run the compiler under Bazel.
3738
3839
Args:
@@ -156,6 +157,7 @@ def create_tsconfig(
156157
"addDtsClutzAliases": getattr(ctx.attr, "add_dts_clutz_aliases", False),
157158
"typeCheckDependencies": getattr(ctx.attr, "internal_testing_type_check_dependencies", False),
158159
"expectedDiagnostics": getattr(ctx.attr, "expected_diagnostics", []),
160+
"typeCheck": True,
159161
}
160162

161163
if getattr(ctx.attr, "use_angular_plugin", False):

internal/tsc_wrapped/tsc_wrapped.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export function gatherDiagnostics(
5959

6060
const diagnostics: ts.Diagnostic[] = [];
6161
perfTrace.wrap('type checking', () => {
62+
if (!bazelOpts.typeCheck) {
63+
return;
64+
}
6265
// These checks mirror ts.getPreEmitDiagnostics, with the important
6366
// exception of avoiding b/30708240, which is that if you call
6467
// program.getDeclarationDiagnostics() it somehow corrupts the emit.

internal/tsc_wrapped/tsconfig.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ export interface BazelOptions {
201201
* future.
202202
*/
203203
devmodeTargetOverride?: string;
204+
205+
/**
206+
* Whether to type check. Differs from typeCheckDependencies in that this
207+
* avoids type checking the srcs in addition to the dependencies.
208+
*/
209+
typeCheck: boolean;
204210
}
205211

206212
export interface ParsedTsConfig {

0 commit comments

Comments
 (0)