Skip to content

Commit 83688a1

Browse files
authored
fix(typescript): only expect .js outs for .tsx? srcs (#2118)
Fixes #2115
1 parent b97f3e9 commit 83688a1

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

packages/typescript/internal/ts_project.bzl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ validate_options = rule(
215215

216216
def _out_paths(srcs, outdir, rootdir, ext):
217217
rootdir_replace_pattern = rootdir + "/" if rootdir else ""
218-
return [_join(outdir, f[:f.rindex(".")].replace(rootdir_replace_pattern, "") + ext) for f in srcs if not f.endswith(".d.ts") and not f.endswith(".json")]
218+
return [
219+
_join(outdir, f[:f.rindex(".")].replace(rootdir_replace_pattern, "") + ext)
220+
for f in srcs
221+
if not f.endswith(".d.ts") and (f.endswith(".ts") or f.endswith(".tsx"))
222+
]
219223

220224
def ts_project_macro(
221225
name = "tsconfig",

packages/typescript/test/ts_project/json/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ SRCS = [
55
"subdir/a.ts",
66
"subdir/foo.json",
77
"bar.json",
8+
# Regression test for #2115 - should not expect baz.js output
9+
"baz.svg",
810
]
911

1012
ts_project(
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)