@typescript-deploys/pr-build 4.9.0-pr-50903-10 → 4.9.0-pr-50976-13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220922");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220929");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -3205,11 +3205,13 @@ var ts;
3205
3205
  // > alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers
3206
3206
  // > MUST NOT include leading zeroes.
3207
3207
  var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i;
3208
+ var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i;
3208
3209
  // https://semver.org/#spec-item-10
3209
3210
  // > Build metadata MAY be denoted by appending a plus sign and a series of dot separated
3210
3211
  // > identifiers immediately following the patch or pre-release version. Identifiers MUST
3211
3212
  // > comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty.
3212
3213
  var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
3214
+ var buildPartRegExp = /^[a-z0-9-]+$/i;
3213
3215
  // https://semver.org/#spec-item-9
3214
3216
  // > Numeric identifiers MUST NOT include leading zeroes.
3215
3217
  var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
@@ -3229,13 +3231,15 @@ var ts;
3229
3231
  ts.Debug.assert(major >= 0, "Invalid argument: major");
3230
3232
  ts.Debug.assert(minor >= 0, "Invalid argument: minor");
3231
3233
  ts.Debug.assert(patch >= 0, "Invalid argument: patch");
3232
- ts.Debug.assert(!prerelease || prereleaseRegExp.test(prerelease), "Invalid argument: prerelease");
3233
- ts.Debug.assert(!build || buildRegExp.test(build), "Invalid argument: build");
3234
+ var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray;
3235
+ var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray;
3236
+ ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease");
3237
+ ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build");
3234
3238
  this.major = major;
3235
3239
  this.minor = minor;
3236
3240
  this.patch = patch;
3237
- this.prerelease = prerelease ? prerelease.split(".") : ts.emptyArray;
3238
- this.build = build ? build.split(".") : ts.emptyArray;
3241
+ this.prerelease = prereleaseArray;
3242
+ this.build = buildArray;
3239
3243
  }
3240
3244
  Version.tryParse = function (text) {
3241
3245
  var result = tryParseComponents(text);
@@ -3274,6 +3278,10 @@ var ts;
3274
3278
  default: return ts.Debug.assertNever(field);
3275
3279
  }
3276
3280
  };
3281
+ Version.prototype.with = function (fields) {
3282
+ var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e;
3283
+ return new Version(major, minor, patch, prerelease, build);
3284
+ };
3277
3285
  Version.prototype.toString = function () {
3278
3286
  var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
3279
3287
  if (ts.some(this.prerelease))
@@ -3282,7 +3290,7 @@ var ts;
3282
3290
  result += "+".concat(this.build.join("."));
3283
3291
  return result;
3284
3292
  };
3285
- Version.zero = new Version(0, 0, 0);
3293
+ Version.zero = new Version(0, 0, 0, ["0"]);
3286
3294
  return Version;
3287
3295
  }());
3288
3296
  ts.Version = Version;
@@ -3365,6 +3373,10 @@ var ts;
3365
3373
  }
3366
3374
  return undefined;
3367
3375
  };
3376
+ /**
3377
+ * Tests whether a version matches the range. This is equivalent to `satisfies(version, range, { includePrerelease: true })`.
3378
+ * in `node-semver`.
3379
+ */
3368
3380
  VersionRange.prototype.test = function (version) {
3369
3381
  if (typeof version === "string")
3370
3382
  version = new Version(version);
@@ -3475,19 +3487,20 @@ var ts;
3475
3487
  break;
3476
3488
  case "<":
3477
3489
  case ">=":
3478
- comparators.push(createComparator(operator, version));
3490
+ comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) :
3491
+ createComparator(operator, version));
3479
3492
  break;
3480
3493
  case "<=":
3481
3494
  case ">":
3482
- comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) :
3483
- isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) :
3495
+ comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) :
3496
+ isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) :
3484
3497
  createComparator(operator, version));
3485
3498
  break;
3486
3499
  case "=":
3487
3500
  case undefined:
3488
3501
  if (isWildcard(minor) || isWildcard(patch)) {
3489
- comparators.push(createComparator(">=", version));
3490
- comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor")));
3502
+ comparators.push(createComparator(">=", version.with({ prerelease: "0" })));
3503
+ comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" })));
3491
3504
  }
3492
3505
  else {
3493
3506
  comparators.push(createComparator("=", version));
@@ -57597,16 +57610,32 @@ var ts;
57597
57610
  return getTypeFromTypeNode(typeNode);
57598
57611
  }
57599
57612
  }
57613
+ function isParameterOfContextSensitiveSignature(symbol) {
57614
+ var decl = symbol.valueDeclaration;
57615
+ if (!decl) {
57616
+ return false;
57617
+ }
57618
+ if (ts.isBindingElement(decl)) {
57619
+ decl = ts.walkUpBindingElementsAndPatterns(decl);
57620
+ }
57621
+ if (ts.isParameter(decl)) {
57622
+ return isContextSensitiveFunctionOrObjectLiteralMethod(decl.parent);
57623
+ }
57624
+ return false;
57625
+ }
57600
57626
  function getTypeOfVariableOrParameterOrProperty(symbol) {
57601
57627
  var links = getSymbolLinks(symbol);
57602
57628
  if (!links.type) {
57603
57629
  var type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
57604
57630
  // For a contextually typed parameter it is possible that a type has already
57605
57631
  // been assigned (in assignTypeToParameterAndFixTypeParameters), and we want
57606
- // to preserve this type.
57607
- if (!links.type) {
57632
+ // to preserve this type. In fact, we need to _prefer_ that type, but it won't
57633
+ // be assigned until contextual typing is complete, so we need to defer in
57634
+ // cases where contextual typing may take place.
57635
+ if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
57608
57636
  links.type = type;
57609
57637
  }
57638
+ return type;
57610
57639
  }
57611
57640
  return links.type;
57612
57641
  }
@@ -63333,7 +63362,18 @@ var ts;
63333
63362
  return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
63334
63363
  }
63335
63364
  errorIfWritingToReadonlyIndex(indexInfo);
63336
- return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
63365
+ // When accessing an enum object with its own type,
63366
+ // e.g. E[E.A] for enum E { A }, undefined shouldn't
63367
+ // be included in the result type
63368
+ if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) &&
63369
+ !(objectType.symbol &&
63370
+ objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) &&
63371
+ (indexType.symbol &&
63372
+ indexType.flags & 1024 /* TypeFlags.EnumLiteral */ &&
63373
+ getParentOfSymbol(indexType.symbol) === objectType.symbol))) {
63374
+ return getUnionType([indexInfo.type, undefinedType]);
63375
+ }
63376
+ return indexInfo.type;
63337
63377
  }
63338
63378
  if (indexType.flags & 131072 /* TypeFlags.Never */) {
63339
63379
  return neverType;
@@ -65026,13 +65066,8 @@ var ts;
65026
65066
  return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
65027
65067
  }
65028
65068
  function hasContextSensitiveReturnExpression(node) {
65029
- if (node.typeParameters || ts.getEffectiveReturnTypeNode(node) || !node.body) {
65030
- return false;
65031
- }
65032
- if (node.body.kind !== 238 /* SyntaxKind.Block */) {
65033
- return isContextSensitive(node.body);
65034
- }
65035
- return !!ts.forEachReturnStatement(node.body, function (statement) { return !!statement.expression && isContextSensitive(statement.expression); });
65069
+ // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
65070
+ return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body);
65036
65071
  }
65037
65072
  function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
65038
65073
  return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
@@ -66995,7 +67030,7 @@ var ts;
66995
67030
  // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
66996
67031
  var constraint = getConstraintOfTypeParameter(source);
66997
67032
  if (constraint && hasNonCircularBaseConstraint(source)) {
66998
- while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) {
67033
+ while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) {
66999
67034
  if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) {
67000
67035
  return result;
67001
67036
  }
@@ -70757,7 +70792,7 @@ var ts;
70757
70792
  }
70758
70793
  if (ts.isEntityNameExpression(node.argumentExpression)) {
70759
70794
  var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true);
70760
- if (!symbol || !isConstVariable(symbol))
70795
+ if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */)))
70761
70796
  return undefined;
70762
70797
  var declaration = symbol.valueDeclaration;
70763
70798
  if (declaration === undefined)
@@ -70771,7 +70806,12 @@ var ts;
70771
70806
  }
70772
70807
  if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
70773
70808
  var initializer = ts.getEffectiveInitializer(declaration);
70774
- return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
70809
+ if (initializer) {
70810
+ return tryGetNameFromType(getTypeOfExpression(initializer));
70811
+ }
70812
+ if (ts.isEnumMember(declaration)) {
70813
+ return ts.getTextOfPropertyName(declaration.name);
70814
+ }
70775
70815
  }
70776
70816
  }
70777
70817
  return undefined;
@@ -118835,7 +118875,7 @@ var ts;
118835
118875
  * Determines if program structure is upto date or needs to be recreated
118836
118876
  */
118837
118877
  /* @internal */
118838
- function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
118878
+ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
118839
118879
  // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date
118840
118880
  if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames()))
118841
118881
  return false;
@@ -118863,7 +118903,7 @@ var ts;
118863
118903
  return true;
118864
118904
  function sourceFileNotUptoDate(sourceFile) {
118865
118905
  return !sourceFileVersionUptoDate(sourceFile) ||
118866
- hasInvalidatedResolution(sourceFile.path);
118906
+ hasInvalidatedResolutions(sourceFile.path);
118867
118907
  }
118868
118908
  function sourceFileVersionUptoDate(sourceFile) {
118869
118909
  return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName);
@@ -119109,7 +119149,7 @@ var ts;
119109
119149
  var moduleResolutionCache;
119110
119150
  var typeReferenceDirectiveResolutionCache;
119111
119151
  var actualResolveModuleNamesWorker;
119112
- var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
119152
+ var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse;
119113
119153
  if (host.resolveModuleNames) {
119114
119154
  actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) {
119115
119155
  // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
@@ -119556,7 +119596,7 @@ var ts;
119556
119596
  for (var i = 0; i < moduleNames.length; i++) {
119557
119597
  var moduleName = moduleNames[i];
119558
119598
  // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
119559
- if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
119599
+ if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
119560
119600
  var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i));
119561
119601
  if (oldResolvedModule) {
119562
119602
  if (ts.isTraceEnabled(options, host)) {
@@ -119792,7 +119832,7 @@ var ts;
119792
119832
  // tentatively approve the file
119793
119833
  modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
119794
119834
  }
119795
- else if (hasInvalidatedResolution(oldSourceFile.path)) {
119835
+ else if (hasInvalidatedResolutions(oldSourceFile.path)) {
119796
119836
  // 'module/types' references could have changed
119797
119837
  structureIsReused = 1 /* StructureIsReused.SafeModules */;
119798
119838
  // add file to the modified list so that we will resolve it later
@@ -122536,10 +122576,16 @@ var ts;
122536
122576
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
122537
122577
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
122538
122578
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
122579
+ // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged,
122580
+ // which will eg be depedent on change in options like declarationDir and outDir options are unchanged.
122581
+ // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because
122582
+ // oldCompilerOptions can be undefined if there was change in say module from None to some other option
122583
+ // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc
122584
+ // but that option change does not affect d.ts file name so emitSignatures should still be reused.
122539
122585
  var canCopyEmitSignatures = compilerOptions.composite &&
122540
122586
  (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
122541
122587
  !outFilePath &&
122542
- !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
122588
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
122543
122589
  if (useOldState) {
122544
122590
  // Copy old state's changed files set
122545
122591
  (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
@@ -123838,7 +123884,7 @@ var ts;
123838
123884
  invalidateResolutionOfFile: invalidateResolutionOfFile,
123839
123885
  invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
123840
123886
  setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
123841
- createHasInvalidatedResolution: createHasInvalidatedResolution,
123887
+ createHasInvalidatedResolutions: createHasInvalidatedResolutions,
123842
123888
  isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
123843
123889
  updateTypeRootsWatch: updateTypeRootsWatch,
123844
123890
  closeTypeRootsWatch: closeTypeRootsWatch,
@@ -123893,17 +123939,13 @@ var ts;
123893
123939
  var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
123894
123940
  return !!value && !!value.length;
123895
123941
  }
123896
- function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
123942
+ function createHasInvalidatedResolutions(customHasInvalidatedResolutions) {
123897
123943
  // Ensure pending resolutions are applied
123898
123944
  invalidateResolutionsOfFailedLookupLocations();
123899
- if (forceAllFilesAsInvalidated) {
123900
- // Any file asked would have invalidated resolution
123901
- filesWithInvalidatedResolutions = undefined;
123902
- return ts.returnTrue;
123903
- }
123904
123945
  var collected = filesWithInvalidatedResolutions;
123905
123946
  filesWithInvalidatedResolutions = undefined;
123906
- return function (path) { return (!!collected && collected.has(path)) ||
123947
+ return function (path) { return customHasInvalidatedResolutions(path) ||
123948
+ !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) ||
123907
123949
  isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
123908
123950
  }
123909
123951
  function startCachingPerDirectoryResolution() {
@@ -126283,6 +126325,10 @@ var ts;
126283
126325
  ts.maybeBind(host, host.getModuleResolutionCache) :
126284
126326
  (function () { return resolutionCache.getModuleResolutionCache(); });
126285
126327
  var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
126328
+ // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions
126329
+ var customHasInvalidatedResolutions = userProvidedResolution ?
126330
+ ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue :
126331
+ ts.returnFalse;
126286
126332
  builderProgram = readBuilderProgram(compilerOptions, compilerHost);
126287
126333
  synchronizeProgram();
126288
126334
  // Update the wild card directory watch
@@ -126348,10 +126394,9 @@ var ts;
126348
126394
  resolutionCache.clear();
126349
126395
  }
126350
126396
  }
126351
- // All resolutions are invalid if user provided resolutions
126352
- var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
126397
+ var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
126353
126398
  var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
126354
- if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
126399
+ if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
126355
126400
  if (hasChangedConfigFileParsingErrors) {
126356
126401
  if (reportFileChangeDetectedOnCreateProgram) {
126357
126402
  reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
@@ -126364,7 +126409,7 @@ var ts;
126364
126409
  if (reportFileChangeDetectedOnCreateProgram) {
126365
126410
  reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
126366
126411
  }
126367
- createNewProgram(hasInvalidatedResolution);
126412
+ createNewProgram(hasInvalidatedResolutions);
126368
126413
  }
126369
126414
  reportFileChangeDetectedOnCreateProgram = false;
126370
126415
  if (host.afterProgramCreate && program !== builderProgram) {
@@ -126377,7 +126422,7 @@ var ts;
126377
126422
  compilerHost.writeFile = originalWriteFile;
126378
126423
  return builderProgram;
126379
126424
  }
126380
- function createNewProgram(hasInvalidatedResolution) {
126425
+ function createNewProgram(hasInvalidatedResolutions) {
126381
126426
  // Compile the program
126382
126427
  writeLog("CreatingProgramWith::");
126383
126428
  writeLog(" roots: ".concat(JSON.stringify(rootFileNames)));
@@ -126388,7 +126433,7 @@ var ts;
126388
126433
  hasChangedCompilerOptions = false;
126389
126434
  hasChangedConfigFileParsingErrors = false;
126390
126435
  resolutionCache.startCachingPerDirectoryResolution();
126391
- compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
126436
+ compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions;
126392
126437
  compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
126393
126438
  var oldProgram = getCurrentProgram();
126394
126439
  builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
@@ -127975,8 +128020,15 @@ var ts;
127975
128020
  }
127976
128021
  if (buildInfo.program) {
127977
128022
  // If there are pending changes that are not emitted, project is out of date
128023
+ // When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit)
128024
+ // But in case of semantic error we need special treatment.
128025
+ // Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked
128026
+ // But if noEmit is true, affectedFilesPendingEmit will have file list even if there are no semantic errors to preserve list of files to be emitted when running with noEmit false
128027
+ // So with noEmit set to true, check on semantic diagnostics needs to be explicit as oppose to when it is false when only files pending emit is sufficient
127978
128028
  if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
127979
- (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
128029
+ (!project.options.noEmit ?
128030
+ (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length :
128031
+ ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) {
127980
128032
  return {
127981
128033
  type: ts.UpToDateStatusType.OutOfDateBuildInfo,
127982
128034
  buildInfoFile: buildInfoPath
@@ -139591,7 +139643,7 @@ var ts;
139591
139643
  break;
139592
139644
  case 202 /* SyntaxKind.ImportType */:
139593
139645
  // Only check for typeof import('xyz')
139594
- if (direct.isTypeOf && !direct.qualifier && isExported(direct)) {
139646
+ if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) {
139595
139647
  addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true);
139596
139648
  }
139597
139649
  directImports.push(direct);
@@ -168753,7 +168805,7 @@ var ts;
168753
168805
  var rootFileNames = host.getScriptFileNames().slice();
168754
168806
  // Get a fresh cache of the host information
168755
168807
  var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
168756
- var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
168808
+ var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse;
168757
168809
  var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames);
168758
168810
  var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host);
168759
168811
  var parsedCommandLines;
@@ -168784,7 +168836,7 @@ var ts;
168784
168836
  },
168785
168837
  onReleaseOldSourceFile: onReleaseOldSourceFile,
168786
168838
  onReleaseParsedCommandLine: onReleaseParsedCommandLine,
168787
- hasInvalidatedResolution: hasInvalidatedResolution,
168839
+ hasInvalidatedResolutions: hasInvalidatedResolutions,
168788
168840
  hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
168789
168841
  trace: ts.maybeBind(host, host.trace),
168790
168842
  resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
@@ -168824,7 +168876,7 @@ var ts;
168824
168876
  // as a const variable without downleveling, doesn't crash).
168825
168877
  var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
168826
168878
  // If the program is already up-to-date, we can reuse it
168827
- if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
168879
+ if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
168828
168880
  return;
168829
168881
  }
168830
168882
  // IMPORTANT - It is critical from this moment onward that we do not check
@@ -3320,6 +3320,8 @@ declare namespace ts {
3320
3320
  */
3321
3321
  resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[];
3322
3322
  getEnvironmentVariable?(name: string): string | undefined;
3323
+ /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */
3324
+ hasInvalidatedResolutions?(filePath: Path): boolean;
3323
3325
  createHash?(data: string): string;
3324
3326
  getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
3325
3327
  }
@@ -5442,6 +5444,8 @@ declare namespace ts {
5442
5444
  resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
5443
5445
  /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
5444
5446
  resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[];
5447
+ /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */
5448
+ hasInvalidatedResolutions?(filePath: Path): boolean;
5445
5449
  /**
5446
5450
  * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it
5447
5451
  */