Make origin union cache key unique for key lists still under construction (#43339)

This commit is contained in:
Wesley Wigham
2021-04-05 11:47:49 -07:00
committed by GitHub
parent d1b43429c2
commit cf8798d977
5 changed files with 143 additions and 1 deletions

View File

@@ -13823,7 +13823,7 @@ namespace ts {
const typeKey = !origin ? getTypeListId(types) :
origin.flags & TypeFlags.Union ? `|${getTypeListId((<UnionType>origin).types)}` :
origin.flags & TypeFlags.Intersection ? `&${getTypeListId((<IntersectionType>origin).types)}` :
`#${(<IndexType>origin).type.id}`;
`#${(<IndexType>origin).type.id}|${getTypeListId(types)}`; // origin type id alone is insufficient, as `keyof x` may resolve to multiple WIP values while `x` is still resolving
const id = typeKey + getAliasId(aliasSymbol, aliasTypeArguments);
let type = unionTypes.get(id);
if (!type) {