Skip to content

Commit b332742

Browse files
author
MichaelMitchell-at
committed
always include tsc in sources
1 parent db95040 commit b332742

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ts/defs.bzl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,18 +373,20 @@ def ts_project(
373373
if transpile_target_name or declarations_target_name:
374374
tsc_target_name = "%s_tsc" % name
375375

376-
lib_srcs = []
376+
# Always include tsc target since even if it doesn't output js+dts, it may
377+
# still be needed for JSON files to be included in the sources. Downstream
378+
# dependencies of the js_library won't inadvertently cause this target to be
379+
# typechecked when both transpiler targets for js+dts are present because
380+
# the js_library doesn't include the ".typecheck" file which is only in the
381+
# "typecheck" output group.
382+
lib_srcs = [tsc_target_name]
377383

378384
# Include the transpiler targets for both js+dts if they exist.
379385
if transpile_target_name:
380386
lib_srcs.append(transpile_target_name)
381387
if declarations_target_name:
382388
lib_srcs.append(declarations_target_name)
383389

384-
# If tsc outputs anything (js or dts) then it should be included in the srcs.
385-
if not (transpile_target_name and declarations_target_name):
386-
lib_srcs.append(tsc_target_name)
387-
388390
# Include direct & transitive deps in addition to transpiled sources so
389391
# that this js_library can be a valid dep for downstream ts_project or other rules_js derivative rules.
390392
js_library(

0 commit comments

Comments
 (0)