Skip to content

Commit

Permalink
Add transitive typecheck output group
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMitchell-at committed Oct 11, 2024
1 parent 5e25e91 commit 4ffb628
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ts/private/ts_project.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ def _gather_types_from_js_infos(targets):
])
return depset([], transitive = files_depsets)

def _gather_transitive_typecheck_from_output_group_infos(typecheck_outs, targets):
files_depsets = []
files_depsets.extend([
target[OutputGroupInfo].transitive_typecheck
for target in targets
if OutputGroupInfo in target and "transitive_typecheck" in target[OutputGroupInfo]
])
return depset(typecheck_outs, transitive = files_depsets)

def _ts_project_impl(ctx):
"""Creates the action which spawns `tsc`.
Expand Down Expand Up @@ -308,6 +317,8 @@ See https://github.com/aspect-build/rules_ts/issues/361 for more details.

transitive_types = js_lib_helpers.gather_transitive_types(output_types, srcs_tsconfig_deps)

transitive_typecheck = _gather_transitive_typecheck_from_output_group_infos(typecheck_outs, ctx.attr.deps)

npm_sources = js_lib_helpers.gather_npm_sources(
srcs = ctx.attr.srcs + [ctx.attr.tsconfig],
deps = ctx.attr.deps,
Expand Down Expand Up @@ -345,6 +356,7 @@ See https://github.com/aspect-build/rules_ts/issues/361 for more details.
OutputGroupInfo(
types = output_types_depset,
typecheck = depset(typecheck_outs),
transitive_typecheck = transitive_typecheck,
# make the inputs to the tsc action available for analysis testing
_action_inputs = transitive_inputs_depset,
# https://bazel.build/extending/rules#validations_output_group
Expand Down

0 comments on commit 4ffb628

Please sign in to comment.