From 83688a15071ccdf96d6d73a8b4cf1ab98da392cf Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Sun, 16 Aug 2020 14:08:07 -0700 Subject: [PATCH] fix(typescript): only expect .js outs for .tsx? srcs (#2118) Fixes #2115 --- packages/typescript/internal/ts_project.bzl | 6 +++++- packages/typescript/test/ts_project/json/BUILD.bazel | 2 ++ packages/typescript/test/ts_project/json/baz.svg | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 packages/typescript/test/ts_project/json/baz.svg diff --git a/packages/typescript/internal/ts_project.bzl b/packages/typescript/internal/ts_project.bzl index f7029dd180..6d53f0c874 100644 --- a/packages/typescript/internal/ts_project.bzl +++ b/packages/typescript/internal/ts_project.bzl @@ -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", diff --git a/packages/typescript/test/ts_project/json/BUILD.bazel b/packages/typescript/test/ts_project/json/BUILD.bazel index af6f4b4736..b14abdc6f9 100644 --- a/packages/typescript/test/ts_project/json/BUILD.bazel +++ b/packages/typescript/test/ts_project/json/BUILD.bazel @@ -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( diff --git a/packages/typescript/test/ts_project/json/baz.svg b/packages/typescript/test/ts_project/json/baz.svg new file mode 100644 index 0000000000..5670437c4f --- /dev/null +++ b/packages/typescript/test/ts_project/json/baz.svg @@ -0,0 +1 @@ +