fix(npm): respect npm_package include_transitive_sources attribute (#1912)

diff --git a/npm/private/npm_package.bzl b/npm/private/npm_package.bzl
index 4620478..2674da2 100644
--- a/npm/private/npm_package.bzl
+++ b/npm/private/npm_package.bzl
@@ -49,7 +49,7 @@
         ctx.attr.srcs,
         include_sources = ctx.attr.include_sources,
         include_types = ctx.attr.include_types,
-        include_transitive_sources = ctx.attr.include_types,
+        include_transitive_sources = ctx.attr.include_transitive_sources,
         include_transitive_types = ctx.attr.include_transitive_types,
         include_npm_sources = ctx.attr.include_npm_sources,
     ))
diff --git a/npm/private/test/npm_package/BUILD.bazel b/npm/private/test/npm_package/BUILD.bazel
index cb697e6..186906f 100644
--- a/npm/private/test/npm_package/BUILD.bazel
+++ b/npm/private/test/npm_package/BUILD.bazel
@@ -9,6 +9,7 @@
 js_library(
     name = "lib_a",
     srcs = [
+        ":index.d.ts",
         ":index.js",
         ":package.json",
     ],
@@ -20,6 +21,12 @@
     ],
 )
 
+# Wrap lib_a in another library to test transitive dependencies
+js_library(
+    name = "lib_a_a",
+    deps = [":lib_a"],
+)
+
 npm_package(
     name = "pkg",
     srcs = [":lib_a"],
@@ -39,6 +46,7 @@
 copy_to_directory(
     name = "expected_pkg",
     srcs = [
+        "index.d.ts",
         "index.js",
         ":package.json",
     ],
@@ -57,6 +65,86 @@
 )
 
 npm_package(
+    name = "pkg_3",
+    srcs = [
+        ":lib_a",
+    ],
+    include_transitive_types = False,
+    include_types = False,
+    visibility = ["//visibility:public"],
+)
+
+npm_package(
+    name = "pkg_4",
+    srcs = [
+        ":lib_a_a",
+    ],
+    include_transitive_types = False,
+    include_types = True,  # should not include transitive
+    visibility = ["//visibility:public"],
+)
+
+copy_to_directory(
+    name = "expected_no-types_pkg",
+    srcs = [
+        "index.js",
+        ":package.json",
+    ],
+)
+
+diff_test(
+    name = "test_pkg_3",
+    file1 = ":pkg_3",
+    file2 = ":expected_no-types_pkg",
+)
+
+diff_test(
+    name = "test_pkg_4",
+    file1 = ":pkg_4",
+    file2 = ":expected_no-types_pkg",
+)
+
+npm_package(
+    name = "pkg_5",
+    srcs = [
+        ":lib_a",
+    ],
+    include_sources = False,
+    include_transitive_sources = False,
+    visibility = ["//visibility:public"],
+)
+
+npm_package(
+    name = "pkg_6",
+    srcs = [
+        ":lib_a_a",
+    ],
+    include_sources = True,  # should not include transitive
+    include_transitive_sources = False,
+    visibility = ["//visibility:public"],
+)
+
+copy_to_directory(
+    name = "expected_no-sources_pkg",
+    srcs = [
+        "index.d.ts",
+        ":package.json",
+    ],
+)
+
+diff_test(
+    name = "test_pkg_5",
+    file1 = ":pkg_5",
+    file2 = ":expected_pkg",  # NOTE: includes everything because .js is in the DefaultInfo
+)
+
+diff_test(
+    name = "test_pkg_6",
+    file1 = ":pkg_6",
+    file2 = ":expected_no-sources_pkg",
+)
+
+npm_package(
     name = "pkg_with_node_modules",
     srcs = [":lib_a"],
     exclude_srcs_patterns = [],