Remove ts_declaration from the managed rule classes
PiperOrigin-RevId: 208817782
diff --git a/ts_auto_deps/analyze/loader.go b/ts_auto_deps/analyze/loader.go
index 00948cd..a873edd 100644
--- a/ts_auto_deps/analyze/loader.go
+++ b/ts_auto_deps/analyze/loader.go
@@ -268,7 +268,8 @@
func isTazeManagedRuleClass(class string) bool {
for _, c := range []string{
"ts_library",
- "ts_declaration",
+ // TODO(alexeagle): Add ts_declaration once it can be determined
+ // if they are unused.
"ng_module",
"js_library",
} {
diff --git a/ts_auto_deps/analyze/query.go b/ts_auto_deps/analyze/query.go
index f62dc91..1deb627 100644
--- a/ts_auto_deps/analyze/query.go
+++ b/ts_auto_deps/analyze/query.go
@@ -397,6 +397,10 @@
for label, rule := range labelToRule {
if isTazeManagedRuleClass(rule.GetRuleClass()) || isGenerated(rule) {
report.UnnecessaryDependency = append(report.UnnecessaryDependency, label)
+ } else if c := rule.GetRuleClass(); c == "ts_declaration" {
+ // ts_declarations may be used even if there is no explicit import
+ // since ambient types can't be detected.
+ report.AmbiguousDependency = append(report.AmbiguousDependency, label)
}
}
return report, nil
diff --git a/ts_auto_deps/proto/analyze_result.proto b/ts_auto_deps/proto/analyze_result.proto
index 50208c5..e81d51b 100644
--- a/ts_auto_deps/proto/analyze_result.proto
+++ b/ts_auto_deps/proto/analyze_result.proto
@@ -60,6 +60,10 @@
// the build.
repeated string unnecessary_dependency = 3;
+ // Can't tell. These may be dependencies where no corresponding imports
+ // were found, but alwayslink=1.
+ repeated string ambiguous_dependency = 4;
+
// Needed but not declared. If there are imports which can be satisfied
// by more than one dependency declared in a best-matching package, list
// all of them. If this list is not empty, we expect the build to break.