Check for undefined globalObjectType in getPropertyOfObjectType

This can happen during symbol merging when initialising the checker,
because global types aren't set until after symbols are merged.

May stop the crashes in #47179, #47181, #47180.
Does not address the underlying problem of needing to resolve aliases,
and therefore names, during symbol merging when initialising the
checker.
This commit is contained in:
Nathan Shively-Sanders
2021-12-17 15:45:27 -08:00
parent 8a5d476ec9
commit 9256e119c6
+1 -1
View File
@@ -12360,7 +12360,7 @@ namespace ts {
return symbol;
}
}
return getPropertyOfObjectType(globalObjectType, name);
return globalObjectType === undefined ? undefined : getPropertyOfObjectType(globalObjectType, name);
}
if (type.flags & TypeFlags.UnionOrIntersection) {
return getPropertyOfUnionOrIntersectionType(type as UnionOrIntersectionType, name, skipObjectFunctionPropertyAugment);