Skip to content

Commit 0612e18

Browse files
committed
Fix checker initialization crash
1 parent 670ad45 commit 0612e18

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/compiler/checker.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ namespace ts {
21222122
}
21232123
}
21242124
if (!result) {
2125-
if (nameNotFoundMessage) {
2125+
if (nameNotFoundMessage && produceDiagnostics) {
21262126
if (!errorLocation ||
21272127
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg!) && // TODO: GH#18217
21282128
!checkAndReportErrorForExtendingInterface(errorLocation) &&
@@ -2172,7 +2172,7 @@ namespace ts {
21722172
}
21732173

21742174
// Perform extra checks only if error reporting was requested
2175-
if (nameNotFoundMessage) {
2175+
if (nameNotFoundMessage && produceDiagnostics) {
21762176
if (propertyWithInvalidInitializer && !(getEmitScriptTarget(compilerOptions) === ScriptTarget.ESNext && useDefineForClassFields)) {
21772177
// We have a match, but the reference occurred within a property initializer and the identifier also binds
21782178
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
@@ -28816,7 +28816,8 @@ namespace ts {
2881628816
return candidateName;
2881728817
}
2881828818

28819-
if (candidate.flags & SymbolFlags.Alias) {
28819+
// Don't try to resolve aliases if global types aren't initialized yet
28820+
if (globalObjectType && candidate.flags & SymbolFlags.Alias) {
2882028821
const alias = tryResolveAlias(candidate);
2882128822
if (alias && alias.flags & meaning) {
2882228823
return candidateName;

0 commit comments

Comments
 (0)