Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for undefined globalObjectType in getPropertyOfObjectType #47183

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/compiler/checker.ts
Expand Up @@ -12360,7 +12360,9 @@ namespace ts {
return symbol;
}
}
return getPropertyOfObjectType(globalObjectType, name);
// TODO: In some cases, the containing function may be called before global types have been initialized.
// This simple guard avoids issues with those cases, but in the future we may need to reconsider how these steps are ordered.
return globalObjectType && getPropertyOfObjectType(globalObjectType, name);
}
if (type.flags & TypeFlags.UnionOrIntersection) {
return getPropertyOfUnionOrIntersectionType(type as UnionOrIntersectionType, name, skipObjectFunctionPropertyAugment);
Expand Down