Skip to content

Commit

Permalink
always include tsc in sources
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMitchell-at committed Oct 6, 2024
1 parent db95040 commit b332742
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ts/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -373,18 +373,20 @@ def ts_project(
if transpile_target_name or declarations_target_name:
tsc_target_name = "%s_tsc" % name

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

# Include the transpiler targets for both js+dts if they exist.
if transpile_target_name:
lib_srcs.append(transpile_target_name)
if declarations_target_name:
lib_srcs.append(declarations_target_name)

# If tsc outputs anything (js or dts) then it should be included in the srcs.
if not (transpile_target_name and declarations_target_name):
lib_srcs.append(tsc_target_name)

# Include direct & transitive deps in addition to transpiled sources so
# that this js_library can be a valid dep for downstream ts_project or other rules_js derivative rules.
js_library(
Expand Down

0 comments on commit b332742

Please sign in to comment.