Skip to content

Commit dff5194

Browse files
authored
refactor: align handling of non-transpiled .js/.d.ts (#746)
1 parent 82a1ac0 commit dff5194

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

ts/private/ts_project.bzl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,13 @@ See https://github.com/aspect-build/rules_ts/issues/361 for more details.
176176
outputs.append(ctx.outputs.buildinfo_out)
177177

178178
output_sources = js_outs + map_outs + assets_outs + ctx.files.pretranspiled_js
179+
output_types = typings_outs + typing_maps_outs + ctx.files.pretranspiled_dts
179180

180181
# Add JS inputs that collide with outputs (see #250).
181182
#
182183
# Unfortunately this duplicates logic in ts_lib._to_js_out_paths:
183184
# files collide iff the following conditions are met:
184-
# - They are JS files (ext in [js, json])
185+
# - They are files not renamed when transpiled (ext in [.d.ts, js, json])
185186
# - out_dir == root_dir
186187
#
187188
# The duplication is hard to avoid, since out_paths works on path strings
@@ -190,15 +191,13 @@ See https://github.com/aspect-build/rules_ts/issues/361 for more details.
190191
for s in srcs_inputs:
191192
if _lib.is_js_src(s.path, ctx.attr.allow_js, ctx.attr.resolve_json_module):
192193
output_sources.append(s)
193-
194-
typings_srcs = [s for s in srcs_inputs if _lib.is_typings_src(s.path)]
194+
if _lib.is_typings_src(s.path):
195+
output_types.append(s)
195196

196197
# Make sure the user has acknowledged that transpiling is slow
197198
if len(outputs) > 0 and ctx.attr.transpile == -1 and not ctx.attr.emit_declaration_only and not options.default_to_tsc_transpiler:
198199
fail(transpiler_selection_required)
199200

200-
output_types = typings_outs + typing_maps_outs + typings_srcs + ctx.files.pretranspiled_dts
201-
202201
# What tsc will be emitting
203202
use_tsc_for_js = len(js_outs) > 0
204203
use_tsc_for_dts = len(typings_outs) > 0

0 commit comments

Comments
 (0)