Skip to content

Commit

Permalink
fix(typescript): only expect .js outs for .tsx? srcs (#2118)
Browse files Browse the repository at this point in the history
Fixes #2115
  • Loading branch information
alexeagle authored Aug 16, 2020
1 parent b97f3e9 commit 83688a1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/typescript/internal/ts_project.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ validate_options = rule(

def _out_paths(srcs, outdir, rootdir, ext):
rootdir_replace_pattern = rootdir + "/" if rootdir else ""
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")]
return [
_join(outdir, f[:f.rindex(".")].replace(rootdir_replace_pattern, "") + ext)
for f in srcs
if not f.endswith(".d.ts") and (f.endswith(".ts") or f.endswith(".tsx"))
]

def ts_project_macro(
name = "tsconfig",
Expand Down
2 changes: 2 additions & 0 deletions packages/typescript/test/ts_project/json/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ SRCS = [
"subdir/a.ts",
"subdir/foo.json",
"bar.json",
# Regression test for #2115 - should not expect baz.js output
"baz.svg",
]

ts_project(
Expand Down
1 change: 1 addition & 0 deletions packages/typescript/test/ts_project/json/baz.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 83688a1

Please sign in to comment.