Properly handle duplicate enum types in type inference (#42943)

* Ensure no duplicates in named union list

* Add regression test
This commit is contained in:
Anders Hejlsberg
2021-02-25 13:54:14 -08:00
committed by GitHub
parent a2f09ed4fc
commit ccdd688e4f
5 changed files with 120 additions and 1 deletions

View File

@@ -13460,7 +13460,7 @@ namespace ts {
if (t.flags & TypeFlags.Union) {
const origin = (<UnionType>t).origin;
if (t.aliasSymbol || origin && !(origin.flags & TypeFlags.Union)) {
namedUnions.push(t);
pushIfUnique(namedUnions, t);
}
else if (origin && origin.flags & TypeFlags.Union) {
addNamedUnions(namedUnions, (<UnionType>origin).types);