@typescript-deploys/pr-build 4.8.0-pr-49245-7 → 4.8.0-pr-49285-2

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/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-insiders.20220525";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220531";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -3510,16 +3510,34 @@ var ts;
3510
3510
  /** Performance measurements for the compiler. */
3511
3511
  var ts;
3512
3512
  (function (ts) {
3513
- var performance;
3514
- (function (performance) {
3513
+ var nullTimer = { enter: ts.noop, exit: ts.noop };
3514
+ ts.performance = createPerformanceTracker();
3515
+ ts.solutionPerformance = createPerformanceTracker();
3516
+ function createPerformanceTracker() {
3515
3517
  var perfHooks;
3516
3518
  // when set, indicates the implementation of `Performance` to use for user timing.
3517
3519
  // when unset, indicates user timing is unavailable or disabled.
3518
3520
  var performanceImpl;
3521
+ var enabled = false;
3522
+ var timeorigin = ts.timestamp();
3523
+ var marks = new ts.Map();
3524
+ var counts = new ts.Map();
3525
+ var durations = new ts.Map();
3526
+ return {
3527
+ createTimerIf: createTimerIf,
3528
+ createTimer: createTimer,
3529
+ mark: mark,
3530
+ measure: measure,
3531
+ getCount: getCount,
3532
+ getDuration: getDuration,
3533
+ forEachMeasure: forEachMeasure,
3534
+ isEnabled: isEnabled,
3535
+ enable: enable,
3536
+ disable: disable,
3537
+ };
3519
3538
  function createTimerIf(condition, measureName, startMarkName, endMarkName) {
3520
- return condition ? createTimer(measureName, startMarkName, endMarkName) : performance.nullTimer;
3539
+ return condition ? createTimer(measureName, startMarkName, endMarkName) : nullTimer;
3521
3540
  }
3522
- performance.createTimerIf = createTimerIf;
3523
3541
  function createTimer(measureName, startMarkName, endMarkName) {
3524
3542
  var enterCount = 0;
3525
3543
  return {
@@ -3541,13 +3559,6 @@ var ts;
3541
3559
  }
3542
3560
  }
3543
3561
  }
3544
- performance.createTimer = createTimer;
3545
- performance.nullTimer = { enter: ts.noop, exit: ts.noop };
3546
- var enabled = false;
3547
- var timeorigin = ts.timestamp();
3548
- var marks = new ts.Map();
3549
- var counts = new ts.Map();
3550
- var durations = new ts.Map();
3551
3562
  /**
3552
3563
  * Marks a performance event.
3553
3564
  *
@@ -3562,7 +3573,6 @@ var ts;
3562
3573
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.mark(markName);
3563
3574
  }
3564
3575
  }
3565
- performance.mark = mark;
3566
3576
  /**
3567
3577
  * Adds a performance measurement with the specified name.
3568
3578
  *
@@ -3575,14 +3585,13 @@ var ts;
3575
3585
  function measure(measureName, startMarkName, endMarkName) {
3576
3586
  var _a, _b;
3577
3587
  if (enabled) {
3578
- var end = (_a = (endMarkName !== undefined ? marks.get(endMarkName) : undefined)) !== null && _a !== void 0 ? _a : ts.timestamp();
3579
- var start = (_b = (startMarkName !== undefined ? marks.get(startMarkName) : undefined)) !== null && _b !== void 0 ? _b : timeorigin;
3588
+ var end = (_a = marks.get(endMarkName)) !== null && _a !== void 0 ? _a : ts.timestamp();
3589
+ var start = (_b = marks.get(startMarkName)) !== null && _b !== void 0 ? _b : timeorigin;
3580
3590
  var previousDuration = durations.get(measureName) || 0;
3581
3591
  durations.set(measureName, previousDuration + (end - start));
3582
3592
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName);
3583
3593
  }
3584
3594
  }
3585
- performance.measure = measure;
3586
3595
  /**
3587
3596
  * Gets the number of times a marker was encountered.
3588
3597
  *
@@ -3591,7 +3600,6 @@ var ts;
3591
3600
  function getCount(markName) {
3592
3601
  return counts.get(markName) || 0;
3593
3602
  }
3594
- performance.getCount = getCount;
3595
3603
  /**
3596
3604
  * Gets the total duration of all measurements with the supplied name.
3597
3605
  *
@@ -3600,7 +3608,6 @@ var ts;
3600
3608
  function getDuration(measureName) {
3601
3609
  return durations.get(measureName) || 0;
3602
3610
  }
3603
- performance.getDuration = getDuration;
3604
3611
  /**
3605
3612
  * Iterate over each measure, performing some action
3606
3613
  *
@@ -3609,14 +3616,12 @@ var ts;
3609
3616
  function forEachMeasure(cb) {
3610
3617
  durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3611
3618
  }
3612
- performance.forEachMeasure = forEachMeasure;
3613
3619
  /**
3614
3620
  * Indicates whether the performance API is enabled.
3615
3621
  */
3616
3622
  function isEnabled() {
3617
3623
  return enabled;
3618
3624
  }
3619
- performance.isEnabled = isEnabled;
3620
3625
  /** Enables (and resets) performance measurements for the compiler. */
3621
3626
  function enable(system) {
3622
3627
  var _a;
@@ -3637,7 +3642,6 @@ var ts;
3637
3642
  }
3638
3643
  return true;
3639
3644
  }
3640
- performance.enable = enable;
3641
3645
  /** Disables performance measurements for the compiler. */
3642
3646
  function disable() {
3643
3647
  if (enabled) {
@@ -3648,8 +3652,7 @@ var ts;
3648
3652
  enabled = false;
3649
3653
  }
3650
3654
  }
3651
- performance.disable = disable;
3652
- })(performance = ts.performance || (ts.performance = {}));
3655
+ }
3653
3656
  })(ts || (ts = {}));
3654
3657
  /* @internal */
3655
3658
  var ts;
@@ -5101,6 +5104,11 @@ var ts;
5101
5104
  // Flags that require TypeFlags.Union
5102
5105
  /* @internal */
5103
5106
  ObjectFlags[ObjectFlags["ContainsIntersections"] = 16777216] = "ContainsIntersections";
5107
+ /* @internal */
5108
+ ObjectFlags[ObjectFlags["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
5109
+ /* @internal */
5110
+ ObjectFlags[ObjectFlags["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
5111
+ /* @internal */
5104
5112
  // Flags that require TypeFlags.Intersection
5105
5113
  /* @internal */
5106
5114
  ObjectFlags[ObjectFlags["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
@@ -8414,6 +8422,7 @@ var ts;
8414
8422
  Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
8415
8423
  The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
8416
8424
  The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
8425
+ This_type_parameter_probably_needs_an_extends_object_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_probably_needs_an_extends_object_constraint_2208", "This type parameter probably needs an `extends object` constraint."),
8417
8426
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8418
8427
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8419
8428
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
@@ -16218,9 +16227,6 @@ var ts;
16218
16227
  }
16219
16228
  ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
16220
16229
  function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
16221
- if (node.kind === 203 /* BindingElement */) {
16222
- node = node.parent.parent;
16223
- }
16224
16230
  return ts.isVariableDeclaration(node) &&
16225
16231
  !!node.initializer &&
16226
16232
  isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true);
@@ -20032,8 +20038,9 @@ var ts;
20032
20038
  */
20033
20039
  function isFileForcedToBeModuleByFormat(file) {
20034
20040
  // Excludes declaration files - they still require an explicit `export {}` or the like
20035
- // for back compat purposes.
20036
- return file.impliedNodeFormat === ts.ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined;
20041
+ // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
20042
+ // that aren't esm-mode (meaning not in a `type: module` scope).
20043
+ return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) && !file.isDeclarationFile ? true : undefined;
20037
20044
  }
20038
20045
  function getSetExternalModuleIndicator(options) {
20039
20046
  // TODO: Should this callback be cached?
@@ -20041,7 +20048,7 @@ var ts;
20041
20048
  case ts.ModuleDetectionKind.Force:
20042
20049
  // All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule
20043
20050
  return function (file) {
20044
- file.externalModuleIndicator = !file.isDeclarationFile || ts.isFileProbablyExternalModule(file);
20051
+ file.externalModuleIndicator = ts.isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined;
20045
20052
  };
20046
20053
  case ts.ModuleDetectionKind.Legacy:
20047
20054
  // Files are modules if they have imports, exports, or import.meta
@@ -20101,7 +20108,8 @@ var ts;
20101
20108
  }
20102
20109
  ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
20103
20110
  function getEmitModuleDetectionKind(options) {
20104
- return options.moduleDetection || ts.ModuleDetectionKind.Auto;
20111
+ return options.moduleDetection ||
20112
+ (getEmitModuleKind(options) === ts.ModuleKind.Node16 || getEmitModuleKind(options) === ts.ModuleKind.NodeNext ? ts.ModuleDetectionKind.Force : ts.ModuleDetectionKind.Auto);
20105
20113
  }
20106
20114
  ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
20107
20115
  function hasJsonModuleEmitEnabled(options) {
@@ -42043,7 +42051,7 @@ var ts;
42043
42051
  }
42044
42052
  if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
42045
42053
  return {
42046
- key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
42054
+ key: ts.removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec)),
42047
42055
  flags: 1 /* Recursive */
42048
42056
  };
42049
42057
  }
@@ -43148,16 +43156,20 @@ var ts;
43148
43156
  function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43149
43157
  return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
43150
43158
  }
43159
+ var jsOnlyExtensions = [Extensions.JavaScript];
43160
+ var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
43161
+ var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
43162
+ var tsconfigExtensions = [Extensions.TSConfig];
43151
43163
  function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43152
43164
  var containingDirectory = ts.getDirectoryPath(containingFile);
43153
43165
  // es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features
43154
43166
  var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
43155
- return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
43167
+ var extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions;
43168
+ if (compilerOptions.resolveJsonModule) {
43169
+ extensions = __spreadArray(__spreadArray([], extensions, true), [Extensions.Json], false);
43170
+ }
43171
+ return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
43156
43172
  }
43157
- var jsOnlyExtensions = [Extensions.JavaScript];
43158
- var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
43159
- var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
43160
- var tsconfigExtensions = [Extensions.TSConfig];
43161
43173
  function tryResolveJSModuleWorker(moduleName, initialDir, host) {
43162
43174
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
43163
43175
  }
@@ -46942,12 +46954,14 @@ var ts;
46942
46954
  }
46943
46955
  }
46944
46956
  function setCommonJsModuleIndicator(node) {
46945
- if (file.externalModuleIndicator) {
46957
+ if (file.externalModuleIndicator && file.externalModuleIndicator !== true) {
46946
46958
  return false;
46947
46959
  }
46948
46960
  if (!file.commonJsModuleIndicator) {
46949
46961
  file.commonJsModuleIndicator = node;
46950
- bindSourceFileAsExternalModule();
46962
+ if (!file.externalModuleIndicator) {
46963
+ bindSourceFileAsExternalModule();
46964
+ }
46951
46965
  }
46952
46966
  return true;
46953
46967
  }
@@ -47361,7 +47375,11 @@ var ts;
47361
47375
  checkStrictModeEvalOrArguments(node, node.name);
47362
47376
  }
47363
47377
  if (!ts.isBindingPattern(node.name)) {
47364
- if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node) && !(ts.getCombinedModifierFlags(node) & 1 /* Export */)) {
47378
+ var possibleVariableDecl = node.kind === 254 /* VariableDeclaration */ ? node : node.parent.parent;
47379
+ if (ts.isInJSFile(node) &&
47380
+ ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) &&
47381
+ !ts.getJSDocTypeTag(node) &&
47382
+ !(ts.getCombinedModifierFlags(node) & 1 /* Export */)) {
47365
47383
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
47366
47384
  }
47367
47385
  else if (ts.isBlockOrCatchScoped(node)) {
@@ -48538,6 +48556,7 @@ var ts;
48538
48556
  var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
48539
48557
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
48540
48558
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48559
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
48541
48560
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48542
48561
  emptyGenericType.instantiations = new ts.Map();
48543
48562
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -50188,7 +50207,8 @@ var ts;
50188
50207
  && isAliasableOrJsExpression(node.parent.right)
50189
50208
  || node.kind === 297 /* ShorthandPropertyAssignment */
50190
50209
  || node.kind === 296 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
50191
- || ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
50210
+ || node.kind === 254 /* VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
50211
+ || node.kind === 203 /* BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
50192
50212
  }
50193
50213
  function isAliasableOrJsExpression(e) {
50194
50214
  return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
@@ -50281,7 +50301,7 @@ var ts;
50281
50301
  return hasExportAssignmentSymbol(moduleSymbol);
50282
50302
  }
50283
50303
  // JS files have a synthetic default if they do not contain ES2015+ module syntax (export = is not valid in js) _and_ do not have an __esModule marker
50284
- return !file.externalModuleIndicator && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
50304
+ return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
50285
50305
  }
50286
50306
  function getTargetOfImportClause(node, dontResolveAlias) {
50287
50307
  var _a;
@@ -58707,7 +58727,7 @@ var ts;
58707
58727
  }
58708
58728
  }
58709
58729
  }
58710
- else if (t.flags & 469892092 /* DisjointDomains */) {
58730
+ else if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
58711
58731
  hasDisjointDomainType = true;
58712
58732
  }
58713
58733
  }
@@ -58719,7 +58739,7 @@ var ts;
58719
58739
  // intersection operation to reduce the union constraints.
58720
58740
  for (var _a = 0, types_6 = types; _a < types_6.length; _a++) {
58721
58741
  var t = types_6[_a];
58722
- if (t.flags & 469892092 /* DisjointDomains */) {
58742
+ if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
58723
58743
  constraints = ts.append(constraints, t);
58724
58744
  }
58725
58745
  }
@@ -61268,7 +61288,7 @@ var ts;
61268
61288
  }
61269
61289
  return includes;
61270
61290
  }
61271
- function removeRedundantPrimitiveTypes(types, includes) {
61291
+ function removeRedundantSupertypes(types, includes) {
61272
61292
  var i = types.length;
61273
61293
  while (i > 0) {
61274
61294
  i--;
@@ -61276,7 +61296,9 @@ var ts;
61276
61296
  var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61277
61297
  t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61278
61298
  t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61279
- t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
61299
+ t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61300
+ t.flags & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61301
+ isEmptyAnonymousObjectType(t) && includes & 470302716 /* DefinitelyNonNullable */;
61280
61302
  if (remove) {
61281
61303
  ts.orderedRemoveItemAt(types, i);
61282
61304
  }
@@ -61398,7 +61420,7 @@ var ts;
61398
61420
  // a type alias of the form "type List<T> = T & { next: List<T> }" cannot be reduced during its declaration.
61399
61421
  // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
61400
61422
  // for intersections of types with signatures can be deterministic.
61401
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
61423
+ function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
61402
61424
  var typeMembershipMap = new ts.Map();
61403
61425
  var includes = addTypesToIntersection(typeMembershipMap, 0, types);
61404
61426
  var typeSet = ts.arrayFrom(typeMembershipMap.values());
@@ -61435,11 +61457,11 @@ var ts;
61435
61457
  if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61436
61458
  includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61437
61459
  includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61438
- includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
61439
- removeRedundantPrimitiveTypes(typeSet, includes);
61440
- }
61441
- if (includes & 16777216 /* IncludesEmptyObject */ && includes & 524288 /* Object */) {
61442
- ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
61460
+ includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61461
+ includes & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61462
+ includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
61463
+ if (!noSupertypeReduction)
61464
+ removeRedundantSupertypes(typeSet, includes);
61443
61465
  }
61444
61466
  if (includes & 262144 /* IncludesMissingType */) {
61445
61467
  typeSet[typeSet.indexOf(undefinedType)] = missingType;
@@ -61478,8 +61500,9 @@ var ts;
61478
61500
  }
61479
61501
  var constituents = getCrossProductIntersections(typeSet);
61480
61502
  // We attach a denormalized origin type when at least one constituent of the cross-product union is an
61481
- // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions).
61482
- var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61503
+ // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions) and
61504
+ // the denormalized origin has fewer constituents than the union itself.
61505
+ var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61483
61506
  result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
61484
61507
  }
61485
61508
  }
@@ -61522,11 +61545,21 @@ var ts;
61522
61545
  }
61523
61546
  return intersections;
61524
61547
  }
61548
+ function getConstituentCount(type) {
61549
+ return !(type.flags & 3145728 /* UnionOrIntersection */) || type.aliasSymbol ? 1 :
61550
+ type.flags & 1048576 /* Union */ && type.origin ? getConstituentCount(type.origin) :
61551
+ getConstituentCountOfTypes(type.types);
61552
+ }
61553
+ function getConstituentCountOfTypes(types) {
61554
+ return ts.reduceLeft(types, function (n, t) { return n + getConstituentCount(t); }, 0);
61555
+ }
61525
61556
  function getTypeFromIntersectionTypeNode(node) {
61526
61557
  var links = getNodeLinks(node);
61527
61558
  if (!links.resolvedType) {
61528
61559
  var aliasSymbol = getAliasSymbolForTypeNode(node);
61529
- links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
61560
+ var types = ts.map(node.types, getTypeFromTypeNode);
61561
+ var noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && types[1] === emptyTypeLiteralType;
61562
+ links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
61530
61563
  }
61531
61564
  return links.resolvedType;
61532
61565
  }
@@ -64312,6 +64345,17 @@ var ts;
64312
64345
  return !!(ts.getObjectFlags(type) & 16 /* Anonymous */ && (type.members && isEmptyResolvedType(type) ||
64313
64346
  type.symbol && type.symbol.flags & 2048 /* TypeLiteral */ && getMembersOfSymbol(type.symbol).size === 0));
64314
64347
  }
64348
+ function isUnknownLikeUnionType(type) {
64349
+ if (strictNullChecks && type.flags & 1048576 /* Union */) {
64350
+ if (!(type.objectFlags & 33554432 /* IsUnknownLikeUnionComputed */)) {
64351
+ var types = type.types;
64352
+ type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 32768 /* Undefined */ &&
64353
+ types[1].flags & 65536 /* Null */ && ts.some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0);
64354
+ }
64355
+ return !!(type.objectFlags & 67108864 /* IsUnknownLikeUnion */);
64356
+ }
64357
+ return false;
64358
+ }
64315
64359
  function isStringIndexSignatureOnlyType(type) {
64316
64360
  return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
64317
64361
  type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
@@ -64391,7 +64435,7 @@ var ts;
64391
64435
  return true;
64392
64436
  if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
64393
64437
  return true;
64394
- if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
64438
+ if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source)))
64395
64439
  return true;
64396
64440
  if (relation === assignableRelation || relation === comparableRelation) {
64397
64441
  if (s & 1 /* Any */)
@@ -64401,6 +64445,9 @@ var ts;
64401
64445
  // bit-flag enum types sometimes look like literal enum types with numeric literal values.
64402
64446
  if (s & (8 /* Number */ | 256 /* NumberLiteral */) && !(s & 1024 /* EnumLiteral */) && (t & 32 /* Enum */ || relation === assignableRelation && t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */))
64403
64447
  return true;
64448
+ // Anything is assignable to a union containing undefined, null, and {}
64449
+ if (isUnknownLikeUnionType(target))
64450
+ return true;
64404
64451
  }
64405
64452
  return false;
64406
64453
  }
@@ -64443,16 +64490,27 @@ var ts;
64443
64490
  function getNormalizedType(type, writing) {
64444
64491
  while (true) {
64445
64492
  var t = isFreshLiteralType(type) ? type.regularType :
64446
- ts.getObjectFlags(type) & 4 /* Reference */ && type.node ? createTypeReference(type.target, getTypeArguments(type)) :
64447
- type.flags & 3145728 /* UnionOrIntersection */ ? getReducedType(type) :
64493
+ ts.getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type :
64494
+ type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) :
64448
64495
  type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : type.substitute :
64449
64496
  type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) :
64450
64497
  type;
64451
- t = getSingleBaseForNonAugmentingSubtype(t) || t;
64452
64498
  if (t === type)
64453
- break;
64499
+ return t;
64454
64500
  type = t;
64455
64501
  }
64502
+ }
64503
+ function getNormalizedUnionOrIntersectionType(type, writing) {
64504
+ var reduced = getReducedType(type);
64505
+ if (reduced !== type) {
64506
+ return reduced;
64507
+ }
64508
+ if (type.flags & 2097152 /* Intersection */) {
64509
+ var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
64510
+ if (normalizedTypes !== type.types) {
64511
+ return getIntersectionType(normalizedTypes);
64512
+ }
64513
+ }
64456
64514
  return type;
64457
64515
  }
64458
64516
  /**
@@ -64899,6 +64957,7 @@ var ts;
64899
64957
  return 0 /* False */;
64900
64958
  }
64901
64959
  function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
64960
+ var _a, _b;
64902
64961
  var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
64903
64962
  var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
64904
64963
  source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
@@ -64939,6 +64998,9 @@ var ts;
64939
64998
  return;
64940
64999
  }
64941
65000
  reportRelationError(headMessage, source, target);
65001
+ if (strictNullChecks && source.flags & 8650752 /* TypeVariable */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source) && isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */))) {
65002
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
65003
+ }
64942
65004
  }
64943
65005
  function traceUnionsOrIntersectionsTooLarge(source, target) {
64944
65006
  if (!ts.tracing) {
@@ -65725,13 +65787,6 @@ var ts;
65725
65787
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65726
65788
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65727
65789
  var constraint = getConstraintOfType(source) || unknownType;
65728
- if (!getConstraintOfType(source) || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
65729
- // A type variable with no constraint is not related to the non-primitive object type.
65730
- if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
65731
- resetErrorInfo(saveErrorInfo);
65732
- return result;
65733
- }
65734
- }
65735
65790
  // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
65736
65791
  if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65737
65792
  resetErrorInfo(saveErrorInfo);
@@ -67205,9 +67260,11 @@ var ts;
67205
67260
  return getSupertypeOrUnion(types);
67206
67261
  }
67207
67262
  var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 98304 /* Nullable */); });
67208
- return primaryTypes.length ?
67209
- getNullableType(getSupertypeOrUnion(primaryTypes), getFalsyFlagsOfTypes(types) & 98304 /* Nullable */) :
67210
- getUnionType(types, 2 /* Subtype */);
67263
+ if (primaryTypes.length) {
67264
+ var supertypeOrUnion = getSupertypeOrUnion(primaryTypes);
67265
+ return primaryTypes === types ? supertypeOrUnion : getUnionType(__spreadArray([supertypeOrUnion], ts.filter(types, function (t) { return !!(t.flags & 98304 /* Nullable */); }), true));
67266
+ }
67267
+ return getUnionType(types, 2 /* Subtype */);
67211
67268
  }
67212
67269
  // Return the leftmost type for which no type to the right is a subtype.
67213
67270
  function getCommonSubtype(types) {
@@ -67406,12 +67463,13 @@ var ts;
67406
67463
  // flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
67407
67464
  // no flags for all other types (including non-falsy literal types).
67408
67465
  function getFalsyFlags(type) {
67409
- return type.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(type.types) :
67410
- type.flags & 128 /* StringLiteral */ ? type.value === "" ? 128 /* StringLiteral */ : 0 :
67411
- type.flags & 256 /* NumberLiteral */ ? type.value === 0 ? 256 /* NumberLiteral */ : 0 :
67412
- type.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(type) ? 2048 /* BigIntLiteral */ : 0 :
67413
- type.flags & 512 /* BooleanLiteral */ ? (type === falseType || type === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
67414
- type.flags & 117724 /* PossiblyFalsy */;
67466
+ var t = type.flags & 2097152 /* Intersection */ ? getBaseConstraintOrType(type) : type;
67467
+ return t.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(t.types) :
67468
+ t.flags & 128 /* StringLiteral */ ? t.value === "" ? 128 /* StringLiteral */ : 0 :
67469
+ t.flags & 256 /* NumberLiteral */ ? t.value === 0 ? 256 /* NumberLiteral */ : 0 :
67470
+ t.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(t) ? 2048 /* BigIntLiteral */ : 0 :
67471
+ t.flags & 512 /* BooleanLiteral */ ? (t === falseType || t === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
67472
+ t.flags & 117724 /* PossiblyFalsy */;
67415
67473
  }
67416
67474
  function removeDefinitelyFalsyTypes(type) {
67417
67475
  return getFalsyFlags(type) & 117632 /* DefinitelyFalsy */ ?
@@ -67451,20 +67509,22 @@ var ts;
67451
67509
  return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
67452
67510
  }
67453
67511
  function getGlobalNonNullableTypeInstantiation(type) {
67454
- // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67455
- // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67456
- // that isn't eliminated by a NonNullable<T> instantiation.
67457
- var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
67458
67512
  if (!deferredGlobalNonNullableTypeAlias) {
67459
67513
  deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
67460
67514
  }
67461
- // If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
67462
67515
  return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
67463
- getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
67464
- reducedType;
67516
+ getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]) :
67517
+ getIntersectionType([type, emptyObjectType]);
67465
67518
  }
67466
67519
  function getNonNullableType(type) {
67467
- return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
67520
+ if (strictNullChecks) {
67521
+ // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67522
+ // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67523
+ // that isn't eliminated by a NonNullable<T> instantiation.
67524
+ var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
67525
+ return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
67526
+ }
67527
+ return type;
67468
67528
  }
67469
67529
  function addOptionalTypeMarker(type) {
67470
67530
  return strictNullChecks ? getUnionType([type, optionalType]) : type;
@@ -68145,13 +68205,40 @@ var ts;
68145
68205
  return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
68146
68206
  sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
68147
68207
  }
68148
- function isValidBigIntString(s) {
68208
+ /**
68209
+ * Tests whether the provided string can be parsed as a number.
68210
+ * @param s The string to test.
68211
+ * @param roundTripOnly Indicates the resulting number matches the input when converted back to a string.
68212
+ */
68213
+ function isValidNumberString(s, roundTripOnly) {
68214
+ if (s === "")
68215
+ return false;
68216
+ var n = +s;
68217
+ return isFinite(n) && (!roundTripOnly || "" + n === s);
68218
+ }
68219
+ /**
68220
+ * @param text a valid bigint string excluding a trailing `n`, but including a possible prefix `-`. Use `isValidBigIntString(text, roundTripOnly)` before calling this function.
68221
+ */
68222
+ function parseBigIntLiteralType(text) {
68223
+ var negative = text.startsWith("-");
68224
+ var base10Value = ts.parsePseudoBigInt((negative ? text.slice(1) : text) + "n");
68225
+ return getBigIntLiteralType({ negative: negative, base10Value: base10Value });
68226
+ }
68227
+ /**
68228
+ * Tests whether the provided string can be parsed as a bigint.
68229
+ * @param s The string to test.
68230
+ * @param roundTripOnly Indicates the resulting bigint matches the input when converted back to a string.
68231
+ */
68232
+ function isValidBigIntString(s, roundTripOnly) {
68233
+ if (s === "")
68234
+ return false;
68149
68235
  var scanner = ts.createScanner(99 /* ESNext */, /*skipTrivia*/ false);
68150
68236
  var success = true;
68151
68237
  scanner.setOnError(function () { return success = false; });
68152
68238
  scanner.setText(s + "n");
68153
68239
  var result = scanner.scan();
68154
- if (result === 40 /* MinusToken */) {
68240
+ var negative = result === 40 /* MinusToken */;
68241
+ if (negative) {
68155
68242
  result = scanner.scan();
68156
68243
  }
68157
68244
  var flags = scanner.getTokenFlags();
@@ -68160,7 +68247,8 @@ var ts;
68160
68247
  // * a bigint can be scanned, and that when it is scanned, it is
68161
68248
  // * the full length of the input string (so the scanner is one character beyond the augmented input length)
68162
68249
  // * it does not contain a numeric seperator (the `BigInt` constructor does not accept a numeric seperator in its input)
68163
- return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */);
68250
+ return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */)
68251
+ && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
68164
68252
  }
68165
68253
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
68166
68254
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
@@ -68168,8 +68256,8 @@ var ts;
68168
68256
  }
68169
68257
  if (source.flags & 128 /* StringLiteral */) {
68170
68258
  var value = source.value;
68171
- return !!(target.flags & 8 /* Number */ && value !== "" && isFinite(+value) ||
68172
- target.flags & 64 /* BigInt */ && value !== "" && isValidBigIntString(value) ||
68259
+ return !!(target.flags & 8 /* Number */ && isValidNumberString(value, /*roundTripOnly*/ false) ||
68260
+ target.flags & 64 /* BigInt */ && isValidBigIntString(value, /*roundTripOnly*/ false) ||
68173
68261
  target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName);
68174
68262
  }
68175
68263
  if (source.flags & 134217728 /* TemplateLiteral */) {
@@ -68742,8 +68830,57 @@ var ts;
68742
68830
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
68743
68831
  // succeed. That would be a pointless and confusing outcome.
68744
68832
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
68833
+ var _loop_23 = function (i) {
68834
+ var source_1 = matches ? matches[i] : neverType;
68835
+ var target_3 = types[i];
68836
+ // If we are inferring from a string literal type to a type variable whose constraint includes one of the
68837
+ // allowed template literal placeholder types, infer from a literal type corresponding to the constraint.
68838
+ if (source_1.flags & 128 /* StringLiteral */ && target_3.flags & 8650752 /* TypeVariable */) {
68839
+ var inferenceContext = getInferenceInfoForType(target_3);
68840
+ var constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : undefined;
68841
+ if (constraint && !isTypeAny(constraint)) {
68842
+ var constraintTypes = constraint.flags & 1048576 /* Union */ ? constraint.types : [constraint];
68843
+ var allTypeFlags_1 = ts.reduceLeft(constraintTypes, function (flags, t) { return flags | t.flags; }, 0);
68844
+ // If the constraint contains `string`, we don't need to look for a more preferred type
68845
+ if (!(allTypeFlags_1 & 4 /* String */)) {
68846
+ var str_1 = source_1.value;
68847
+ // If the type contains `number` or a number literal and the string isn't a valid number, exclude numbers
68848
+ if (allTypeFlags_1 & 296 /* NumberLike */ && !isValidNumberString(str_1, /*roundTripOnly*/ true)) {
68849
+ allTypeFlags_1 &= ~296 /* NumberLike */;
68850
+ }
68851
+ // If the type contains `bigint` or a bigint literal and the string isn't a valid bigint, exclude bigints
68852
+ if (allTypeFlags_1 & 2112 /* BigIntLike */ && !isValidBigIntString(str_1, /*roundTripOnly*/ true)) {
68853
+ allTypeFlags_1 &= ~2112 /* BigIntLike */;
68854
+ }
68855
+ // for each type in the constraint, find the highest priority matching type
68856
+ var matchingType = ts.reduceLeft(constraintTypes, function (left, right) {
68857
+ return !(right.flags & allTypeFlags_1) ? left :
68858
+ left.flags & 4 /* String */ ? left : right.flags & 4 /* String */ ? source_1 :
68859
+ left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source_1, right) ? source_1 :
68860
+ left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str_1 === applyStringMapping(right.symbol, str_1) ? source_1 :
68861
+ left.flags & 128 /* StringLiteral */ ? left : right.flags & 128 /* StringLiteral */ && right.value === str_1 ? right :
68862
+ left.flags & 8 /* Number */ ? left : right.flags & 8 /* Number */ ? getNumberLiteralType(+str_1) :
68863
+ left.flags & 32 /* Enum */ ? left : right.flags & 32 /* Enum */ ? getNumberLiteralType(+str_1) :
68864
+ left.flags & 256 /* NumberLiteral */ ? left : right.flags & 256 /* NumberLiteral */ && right.value === +str_1 ? right :
68865
+ left.flags & 64 /* BigInt */ ? left : right.flags & 64 /* BigInt */ ? parseBigIntLiteralType(str_1) :
68866
+ left.flags & 2048 /* BigIntLiteral */ ? left : right.flags & 2048 /* BigIntLiteral */ && ts.pseudoBigIntToString(right.value) === str_1 ? right :
68867
+ left.flags & 16 /* Boolean */ ? left : right.flags & 16 /* Boolean */ ? str_1 === "true" ? trueType : str_1 === "false" ? falseType : booleanType :
68868
+ left.flags & 512 /* BooleanLiteral */ ? left : right.flags & 512 /* BooleanLiteral */ && right.intrinsicName === str_1 ? right :
68869
+ left.flags & 32768 /* Undefined */ ? left : right.flags & 32768 /* Undefined */ && right.intrinsicName === str_1 ? right :
68870
+ left.flags & 65536 /* Null */ ? left : right.flags & 65536 /* Null */ && right.intrinsicName === str_1 ? right :
68871
+ left;
68872
+ }, neverType);
68873
+ if (!(matchingType.flags & 131072 /* Never */)) {
68874
+ inferFromTypes(matchingType, target_3);
68875
+ return "continue";
68876
+ }
68877
+ }
68878
+ }
68879
+ }
68880
+ inferFromTypes(source_1, target_3);
68881
+ };
68745
68882
  for (var i = 0; i < types.length; i++) {
68746
- inferFromTypes(matches ? matches[i] : neverType, types[i]);
68883
+ _loop_23(i);
68747
68884
  }
68748
68885
  }
68749
68886
  }
@@ -69261,7 +69398,7 @@ var ts;
69261
69398
  function mapTypesByKeyProperty(types, name) {
69262
69399
  var map = new ts.Map();
69263
69400
  var count = 0;
69264
- var _loop_23 = function (type) {
69401
+ var _loop_24 = function (type) {
69265
69402
  if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
69266
69403
  var discriminant = getTypeOfPropertyOfType(type, name);
69267
69404
  if (discriminant) {
@@ -69287,7 +69424,7 @@ var ts;
69287
69424
  };
69288
69425
  for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
69289
69426
  var type = types_16[_i];
69290
- var state_9 = _loop_23(type);
69427
+ var state_9 = _loop_24(type);
69291
69428
  if (typeof state_9 === "object")
69292
69429
  return state_9.value;
69293
69430
  }
@@ -69495,6 +69632,24 @@ var ts;
69495
69632
  function getTypeWithFacts(type, include) {
69496
69633
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
69497
69634
  }
69635
+ function getIntersectionWithFacts(type, facts) {
69636
+ var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69637
+ if (strictNullChecks) {
69638
+ switch (facts) {
69639
+ case 524288 /* NEUndefined */:
69640
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t; });
69641
+ case 1048576 /* NENull */:
69642
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t; });
69643
+ case 2097152 /* NEUndefinedOrNull */:
69644
+ case 4194304 /* Truthy */:
69645
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t; });
69646
+ }
69647
+ }
69648
+ return reduced;
69649
+ }
69650
+ function recombineUnknownType(type) {
69651
+ return type === unknownUnionType ? unknownType : type;
69652
+ }
69498
69653
  function getTypeWithDefault(type, defaultExpression) {
69499
69654
  return defaultExpression ?
69500
69655
  getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
@@ -70552,7 +70707,7 @@ var ts;
70552
70707
  if (isEvolvingArrayTypeList(types)) {
70553
70708
  return getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType)));
70554
70709
  }
70555
- var result = getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
70710
+ var result = recombineUnknownType(getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction));
70556
70711
  if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && ts.arraysEqual(result.types, declaredType.types)) {
70557
70712
  return declaredType;
70558
70713
  }
@@ -70654,8 +70809,7 @@ var ts;
70654
70809
  }
70655
70810
  function narrowTypeByTruthiness(type, expr, assumeTrue) {
70656
70811
  if (isMatchingReference(reference, expr)) {
70657
- return type.flags & 2 /* Unknown */ && assumeTrue ? nonNullUnknownType :
70658
- getTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70812
+ return getIntersectionWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70659
70813
  }
70660
70814
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
70661
70815
  type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
@@ -70808,9 +70962,6 @@ var ts;
70808
70962
  assumeTrue = !assumeTrue;
70809
70963
  }
70810
70964
  var valueType = getTypeOfExpression(value);
70811
- if (assumeTrue && (type.flags & 2 /* Unknown */) && (operator === 34 /* EqualsEqualsToken */ || operator === 35 /* ExclamationEqualsToken */) && (valueType.flags & 65536 /* Null */)) {
70812
- return getUnionType([nullType, undefinedType]);
70813
- }
70814
70965
  if ((type.flags & 2 /* Unknown */) && assumeTrue && (operator === 36 /* EqualsEqualsEqualsToken */ || operator === 37 /* ExclamationEqualsEqualsToken */)) {
70815
70966
  if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
70816
70967
  return valueType;
@@ -70830,7 +70981,7 @@ var ts;
70830
70981
  valueType.flags & 65536 /* Null */ ?
70831
70982
  assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
70832
70983
  assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
70833
- return type.flags & 2 /* Unknown */ && facts & (1048576 /* NENull */ | 2097152 /* NEUndefinedOrNull */) ? nonNullUnknownType : getTypeWithFacts(type, facts);
70984
+ return getIntersectionWithFacts(type, facts);
70834
70985
  }
70835
70986
  if (assumeTrue) {
70836
70987
  var filterFn = operator === 34 /* EqualsEqualsToken */ ?
@@ -70858,17 +71009,11 @@ var ts;
70858
71009
  if (type.flags & 1 /* Any */ && literal.text === "function") {
70859
71010
  return type;
70860
71011
  }
70861
- if (assumeTrue && type.flags & 2 /* Unknown */ && literal.text === "object") {
70862
- // The non-null unknown type is used to track whether a previous narrowing operation has removed the null type
70863
- // from the unknown type. For example, the expression `x && typeof x === 'object'` first narrows x to the non-null
70864
- // unknown type, and then narrows that to the non-primitive type.
70865
- return type === nonNullUnknownType ? nonPrimitiveType : getUnionType([nonPrimitiveType, nullType]);
70866
- }
70867
71012
  var facts = assumeTrue ?
70868
71013
  typeofEQFacts.get(literal.text) || 128 /* TypeofEQHostObject */ :
70869
71014
  typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */;
70870
71015
  var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
70871
- return getTypeWithFacts(assumeTrue && impliedType ? mapType(type, narrowUnionMemberByTypeof(impliedType)) : type, facts);
71016
+ return getTypeWithFacts(assumeTrue && impliedType ? narrowTypeByImpliedType(type, impliedType) : type, facts);
70872
71017
  }
70873
71018
  function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
70874
71019
  var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -70917,10 +71062,10 @@ var ts;
70917
71062
  }
70918
71063
  function getImpliedTypeFromTypeofGuard(type, text) {
70919
71064
  switch (text) {
71065
+ case "object":
71066
+ return type.flags & 1 /* Any */ ? type : getUnionType([nullType, nonPrimitiveType]);
70920
71067
  case "function":
70921
71068
  return type.flags & 1 /* Any */ ? type : globalFunctionType;
70922
- case "object":
70923
- return type.flags & 2 /* Unknown */ ? getUnionType([nonPrimitiveType, nullType]) : type;
70924
71069
  default:
70925
71070
  return typeofTypesByName.get(text);
70926
71071
  }
@@ -70931,22 +71076,27 @@ var ts;
70931
71076
  // the guard. For example: narrowing `{} | undefined` by `"boolean"` should produce the type `boolean`, not
70932
71077
  // the filtered type `{}`. For this reason we narrow constituents of the union individually, in addition to
70933
71078
  // filtering by type-facts.
70934
- function narrowUnionMemberByTypeof(candidate) {
70935
- return function (type) {
70936
- if (isTypeSubtypeOf(type, candidate)) {
70937
- return type;
70938
- }
70939
- if (isTypeSubtypeOf(candidate, type)) {
70940
- return candidate;
71079
+ function narrowTypeByImpliedType(type, candidate) {
71080
+ if (type.flags & 3 /* AnyOrUnknown */) {
71081
+ return candidate;
71082
+ }
71083
+ return mapType(type, function (t) {
71084
+ if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
71085
+ return t;
70941
71086
  }
70942
- if (type.flags & 465829888 /* Instantiable */) {
70943
- var constraint = getBaseConstraintOfType(type) || anyType;
70944
- if (isTypeSubtypeOf(candidate, constraint)) {
70945
- return getIntersectionType([type, candidate]);
71087
+ return mapType(candidate, function (c) {
71088
+ if (!areTypesComparable(t, c)) {
71089
+ return neverType;
70946
71090
  }
70947
- }
70948
- return type;
70949
- };
71091
+ if (c.flags & 131068 /* Primitive */ && t.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(t)) {
71092
+ return isTypeSubtypeOf(c, t) ? c : neverType;
71093
+ }
71094
+ if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
71095
+ return c;
71096
+ }
71097
+ return getIntersectionType([t, c]);
71098
+ });
71099
+ });
70950
71100
  }
70951
71101
  function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
70952
71102
  var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, /*retainDefault*/ true);
@@ -71005,7 +71155,7 @@ var ts;
71005
71155
  because it is caught in the first clause.
71006
71156
  */
71007
71157
  var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
71008
- return getTypeWithFacts(mapType(type, narrowUnionMemberByTypeof(impliedType)), switchFacts);
71158
+ return getTypeWithFacts(narrowTypeByImpliedType(type, impliedType), switchFacts);
71009
71159
  }
71010
71160
  function isMatchingConstructorReference(expr) {
71011
71161
  return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
@@ -71309,7 +71459,9 @@ var ts;
71309
71459
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
71310
71460
  }
71311
71461
  function isGenericTypeWithUnionConstraint(type) {
71312
- return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71462
+ return type.flags & 2097152 /* Intersection */ ?
71463
+ ts.some(type.types, isGenericTypeWithUnionConstraint) :
71464
+ !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71313
71465
  }
71314
71466
  function isGenericTypeWithoutNullableConstraint(type) {
71315
71467
  return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
@@ -71337,7 +71489,7 @@ var ts;
71337
71489
  var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
71338
71490
  someType(type, isGenericTypeWithUnionConstraint) &&
71339
71491
  (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
71340
- return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
71492
+ return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
71341
71493
  }
71342
71494
  function isExportOrExportExpression(location) {
71343
71495
  return !!ts.findAncestor(location, function (n) {
@@ -75675,7 +75827,7 @@ var ts;
75675
75827
  if (spreadIndex >= 0) {
75676
75828
  // Create synthetic arguments from spreads of tuple types.
75677
75829
  var effectiveArgs_1 = args.slice(0, spreadIndex);
75678
- var _loop_24 = function (i) {
75830
+ var _loop_25 = function (i) {
75679
75831
  var arg = args[i];
75680
75832
  // We can call checkExpressionCached because spread expressions never have a contextual type.
75681
75833
  var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -75692,7 +75844,7 @@ var ts;
75692
75844
  }
75693
75845
  };
75694
75846
  for (var i = spreadIndex; i < args.length; i++) {
75695
- _loop_24(i);
75847
+ _loop_25(i);
75696
75848
  }
75697
75849
  return effectiveArgs_1;
75698
75850
  }
@@ -76012,7 +76164,7 @@ var ts;
76012
76164
  var min_3 = Number.MAX_VALUE;
76013
76165
  var minIndex = 0;
76014
76166
  var i_1 = 0;
76015
- var _loop_25 = function (c) {
76167
+ var _loop_26 = function (c) {
76016
76168
  var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
76017
76169
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
76018
76170
  if (diags_2) {
@@ -76030,7 +76182,7 @@ var ts;
76030
76182
  };
76031
76183
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
76032
76184
  var c = candidatesForArgumentError_1[_a];
76033
- _loop_25(c);
76185
+ _loop_26(c);
76034
76186
  }
76035
76187
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
76036
76188
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -76188,7 +76340,7 @@ var ts;
76188
76340
  }
76189
76341
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
76190
76342
  var parameters = [];
76191
- var _loop_26 = function (i) {
76343
+ var _loop_27 = function (i) {
76192
76344
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
76193
76345
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
76194
76346
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -76196,7 +76348,7 @@ var ts;
76196
76348
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
76197
76349
  };
76198
76350
  for (var i = 0; i < maxNonRestParam; i++) {
76199
- _loop_26(i);
76351
+ _loop_27(i);
76200
76352
  }
76201
76353
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
76202
76354
  var flags = 0 /* None */;
@@ -78433,11 +78585,6 @@ var ts;
78433
78585
  ts.every(source.types, function (subType) { return allTypesAssignableToKind(subType, kind, strict); }) :
78434
78586
  isTypeAssignableToKind(source, kind, strict);
78435
78587
  }
78436
- function anyTypesAssignableToKind(source, kind, strict) {
78437
- return source.flags & 1048576 /* Union */ ?
78438
- ts.some(source.types, function (subType) { return allTypesAssignableToKind(subType, kind, strict); }) :
78439
- isTypeAssignableToKind(source, kind, strict);
78440
- }
78441
78588
  function isConstEnumObjectType(type) {
78442
78589
  return !!(ts.getObjectFlags(type) & 16 /* Anonymous */) && !!type.symbol && isConstEnumSymbol(type.symbol);
78443
78590
  }
@@ -80258,7 +80405,7 @@ var ts;
80258
80405
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
80259
80406
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
80260
80407
  var indexSignatureMap_1 = new ts.Map();
80261
- var _loop_27 = function (declaration) {
80408
+ var _loop_28 = function (declaration) {
80262
80409
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
80263
80410
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
80264
80411
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -80273,7 +80420,7 @@ var ts;
80273
80420
  };
80274
80421
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
80275
80422
  var declaration = _a[_i];
80276
- _loop_27(declaration);
80423
+ _loop_28(declaration);
80277
80424
  }
80278
80425
  indexSignatureMap_1.forEach(function (entry) {
80279
80426
  if (entry.declarations.length > 1) {
@@ -82442,7 +82589,7 @@ var ts;
82442
82589
  // For a binding pattern, validate the initializer and exit
82443
82590
  if (ts.isBindingPattern(node.name)) {
82444
82591
  var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
82445
- var needCheckWidenedType = node.name.elements.length === 0;
82592
+ var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
82446
82593
  if (needCheckInitializer || needCheckWidenedType) {
82447
82594
  // Don't validate for-in initializer as it is already an error
82448
82595
  var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
@@ -82469,7 +82616,7 @@ var ts;
82469
82616
  }
82470
82617
  // For a commonjs `const x = require`, validate the alias and exit
82471
82618
  var symbol = getSymbolOfNode(node);
82472
- if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
82619
+ if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* BindingElement */ ? node.parent.parent : node)) {
82473
82620
  checkAliasSymbol(node);
82474
82621
  return;
82475
82622
  }
@@ -82818,9 +82965,7 @@ var ts;
82818
82965
  }
82819
82966
  // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved
82820
82967
  // in this case error about missing name is already reported - do not report extra one
82821
- // TypeFlags.Nullable must be explicitly checked for in rightType for this check for non-strict modes, where
82822
- // `getNonNullableTypeIfNeeded` is a noop (and the nullable types as any-ish).
82823
- if (!isTypeAny(rightType) && !(rightType.flags & 98304 /* Nullable */) && anyTypesAssignableToKind(getBaseConstraintOrType(rightType), (131068 /* Primitive */ | 131072 /* Never */) & ~98304 /* Nullable */)) {
82968
+ if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
82824
82969
  error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType));
82825
82970
  }
82826
82971
  checkSourceElement(node.statement);
@@ -83736,7 +83881,7 @@ var ts;
83736
83881
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
83737
83882
  var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
83738
83883
  name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
83739
- var _loop_28 = function (info) {
83884
+ var _loop_29 = function (info) {
83740
83885
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
83741
83886
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
83742
83887
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -83749,7 +83894,7 @@ var ts;
83749
83894
  };
83750
83895
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
83751
83896
  var info = indexInfos_9[_i];
83752
- _loop_28(info);
83897
+ _loop_29(info);
83753
83898
  }
83754
83899
  }
83755
83900
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -83757,7 +83902,7 @@ var ts;
83757
83902
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
83758
83903
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
83759
83904
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
83760
- var _loop_29 = function (info) {
83905
+ var _loop_30 = function (info) {
83761
83906
  if (info === checkInfo)
83762
83907
  return "continue";
83763
83908
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -83772,7 +83917,7 @@ var ts;
83772
83917
  };
83773
83918
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
83774
83919
  var info = indexInfos_10[_i];
83775
- _loop_29(info);
83920
+ _loop_30(info);
83776
83921
  }
83777
83922
  }
83778
83923
  function checkTypeNameIsReserved(name, message) {
@@ -84091,7 +84236,7 @@ var ts;
84091
84236
  var baseTypes = baseTypeNode && getBaseTypes(type);
84092
84237
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
84093
84238
  var baseStaticType = getBaseConstructorTypeOfClass(type);
84094
- var _loop_30 = function (member) {
84239
+ var _loop_31 = function (member) {
84095
84240
  if (ts.hasAmbientModifier(member)) {
84096
84241
  return "continue";
84097
84242
  }
@@ -84108,7 +84253,7 @@ var ts;
84108
84253
  };
84109
84254
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
84110
84255
  var member = _a[_i];
84111
- _loop_30(member);
84256
+ _loop_31(member);
84112
84257
  }
84113
84258
  }
84114
84259
  /**
@@ -84196,7 +84341,7 @@ var ts;
84196
84341
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
84197
84342
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
84198
84343
  var issuedMemberError = false;
84199
- var _loop_31 = function (member) {
84344
+ var _loop_32 = function (member) {
84200
84345
  if (ts.isStatic(member)) {
84201
84346
  return "continue";
84202
84347
  }
@@ -84215,7 +84360,7 @@ var ts;
84215
84360
  };
84216
84361
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
84217
84362
  var member = _a[_i];
84218
- _loop_31(member);
84363
+ _loop_32(member);
84219
84364
  }
84220
84365
  if (!issuedMemberError) {
84221
84366
  // check again with diagnostics to generate a less-specific error
@@ -89875,9 +90020,7 @@ var ts;
89875
90020
  var ts;
89876
90021
  (function (ts) {
89877
90022
  function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
89878
- var _a = generatorOptions.extendedDiagnostics
89879
- ? ts.performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap")
89880
- : ts.performance.nullTimer, enter = _a.enter, exit = _a.exit;
90023
+ var _a = ts.performance.createTimerIf(!!generatorOptions.extendedDiagnostics, "Source Map", "beforeSourcemap", "afterSourcemap"), enter = _a.enter, exit = _a.exit;
89881
90024
  // Current source map file and its index in the sources list
89882
90025
  var rawSources = [];
89883
90026
  var sources = [];
@@ -122183,7 +122326,7 @@ var ts;
122183
122326
  });
122184
122327
  // Sort by paths closest to importing file Name directory
122185
122328
  var sortedPaths = [];
122186
- var _loop_32 = function (directory) {
122329
+ var _loop_33 = function (directory) {
122187
122330
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
122188
122331
  var pathsInDirectory;
122189
122332
  allFileNames.forEach(function (_a, fileName) {
@@ -122207,7 +122350,7 @@ var ts;
122207
122350
  };
122208
122351
  var out_directory_1;
122209
122352
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
122210
- var state_10 = _loop_32(directory);
122353
+ var state_10 = _loop_33(directory);
122211
122354
  directory = out_directory_1;
122212
122355
  if (state_10 === "break")
122213
122356
  break;
@@ -123654,6 +123797,7 @@ var ts;
123654
123797
  }
123655
123798
  function reloadFileNamesFromConfigFile() {
123656
123799
  writeLog("Reloading new file names and options");
123800
+ reloadLevel = ts.ConfigFileProgramReloadLevel.None;
123657
123801
  rootFileNames = ts.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
123658
123802
  if (ts.updateErrorForNoInputFiles(rootFileNames, ts.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
123659
123803
  hasChangedConfigFileParsingErrors = true;
@@ -124152,6 +124296,7 @@ var ts;
124152
124296
  if (value) {
124153
124297
  return isParsedCommandLine(value) ? value : undefined;
124154
124298
  }
124299
+ ts.solutionPerformance.mark("beforeParseConfigFile");
124155
124300
  var diagnostic;
124156
124301
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
124157
124302
  var parsed;
@@ -124166,6 +124311,8 @@ var ts;
124166
124311
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
124167
124312
  }
124168
124313
  configFileCache.set(configFilePath, parsed || diagnostic);
124314
+ ts.solutionPerformance.mark("afterParseConfigFile");
124315
+ ts.solutionPerformance.measure("ParseConfigFile", "beforeParseConfigFile", "afterParseConfigFile");
124169
124316
  return parsed;
124170
124317
  }
124171
124318
  function resolveProjectName(state, name) {
@@ -124215,6 +124362,7 @@ var ts;
124215
124362
  return state.buildOrder || createStateBuildOrder(state);
124216
124363
  }
124217
124364
  function createStateBuildOrder(state) {
124365
+ ts.solutionPerformance.mark("beforeCreateBuildOrder");
124218
124366
  var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
124219
124367
  // Clear all to ResolvedConfigFilePaths cache to start fresh
124220
124368
  state.resolvedConfigFilePaths.clear();
@@ -124244,6 +124392,8 @@ var ts;
124244
124392
  ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
124245
124393
  ts.mutateMapSkippingNewValues(state.allWatchedPackageJsonFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
124246
124394
  }
124395
+ ts.solutionPerformance.mark("afterCreateBuildOrder");
124396
+ ts.solutionPerformance.measure("CreateBuildOrder", "beforeCreateBuildOrder", "afterCreateBuildOrder");
124247
124397
  return state.buildOrder = buildOrder;
124248
124398
  }
124249
124399
  function getBuildOrderFor(state, project, onlyReferences) {
@@ -124364,6 +124514,7 @@ var ts;
124364
124514
  if (updateOutputFileStampsPending) {
124365
124515
  updateOutputTimestamps(state, config, projectPath);
124366
124516
  }
124517
+ ts.solutionPerformance.mark("timestampUpdated");
124367
124518
  return doneInvalidatedProject(state, projectPath);
124368
124519
  }
124369
124520
  };
@@ -124457,6 +124608,10 @@ var ts;
124457
124608
  };
124458
124609
  function done(cancellationToken, writeFile, customTransformers) {
124459
124610
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
124611
+ if (kind === InvalidatedProjectKind.Build)
124612
+ ts.solutionPerformance.mark("projectsBuilt");
124613
+ else
124614
+ ts.solutionPerformance.mark("bundlesUpdated");
124460
124615
  return doneInvalidatedProject(state, projectPath);
124461
124616
  }
124462
124617
  function withProgramOrUndefined(action) {
@@ -124546,6 +124701,7 @@ var ts;
124546
124701
  var anyDtsChanged = false;
124547
124702
  var emitterDiagnostics = ts.createDiagnosticCollection();
124548
124703
  var emittedOutputs = new ts.Map();
124704
+ ts.solutionPerformance.mark("beforeOutputFilesWrite");
124549
124705
  outputFiles.forEach(function (_a) {
124550
124706
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124551
124707
  var priorChangeTime;
@@ -124565,6 +124721,8 @@ var ts;
124565
124721
  newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124566
124722
  }
124567
124723
  });
124724
+ ts.solutionPerformance.mark("afterOutputFilesWrite");
124725
+ ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
124568
124726
  finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124569
124727
  /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124570
124728
  return emitResult;
@@ -124694,6 +124852,13 @@ var ts;
124694
124852
  !ts.isIncrementalCompilation(config.options);
124695
124853
  }
124696
124854
  function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
124855
+ ts.solutionPerformance.mark("beforeGetNextInvalidatedProjectCreateInfo");
124856
+ var result = getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue);
124857
+ ts.solutionPerformance.mark("afterGetNextInvalidatedProjectCreateInfo");
124858
+ ts.solutionPerformance.measure("GetNextInvalidatedProjectCreateInfo", "beforeGetNextInvalidatedProjectCreateInfo", "afterGetNextInvalidatedProjectCreateInfo");
124859
+ return result;
124860
+ }
124861
+ function getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue) {
124697
124862
  if (!state.projectPendingBuild.size)
124698
124863
  return undefined;
124699
124864
  if (isCircularBuildOrder(buildOrder))
@@ -124793,9 +124958,7 @@ var ts;
124793
124958
  }
124794
124959
  function getNextInvalidatedProject(state, buildOrder, reportQueue) {
124795
124960
  var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue);
124796
- if (!info)
124797
- return info;
124798
- return createInvalidatedProjectWithInfo(state, info, buildOrder);
124961
+ return info && createInvalidatedProjectWithInfo(state, info, buildOrder);
124799
124962
  }
124800
124963
  function listEmittedFile(_a, proj, file) {
124801
124964
  var write = _a.write;
@@ -124803,14 +124966,17 @@ var ts;
124803
124966
  write("TSFILE: " + file);
124804
124967
  }
124805
124968
  }
124806
- function getOldProgram(_a, proj, parsed) {
124807
- var options = _a.options, builderPrograms = _a.builderPrograms, compilerHost = _a.compilerHost;
124808
- if (options.force)
124969
+ function getOldProgram(state, proj, parsed) {
124970
+ if (state.options.force)
124809
124971
  return undefined;
124810
- var value = builderPrograms.get(proj);
124972
+ var value = state.builderPrograms.get(proj);
124811
124973
  if (value)
124812
124974
  return value;
124813
- return ts.readBuilderProgram(parsed.options, compilerHost);
124975
+ ts.solutionPerformance.mark("beforeReadBuilderProgram");
124976
+ var program = ts.readBuilderProgram(parsed.options, state.compilerHost);
124977
+ ts.solutionPerformance.mark("afterReadBuilderProgram");
124978
+ ts.solutionPerformance.measure("ReadBuilderProgram", "beforeReadBuilderProgram", "afterReadBuilderProgram");
124979
+ return program;
124814
124980
  }
124815
124981
  function afterProgramDone(state, program, config) {
124816
124982
  if (program) {
@@ -125009,7 +125175,10 @@ var ts;
125009
125175
  state.buildInfoChecked.set(resolvedPath, true);
125010
125176
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125011
125177
  if (buildInfoPath) {
125178
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
125012
125179
  var value = state.readFileWithCache(buildInfoPath);
125180
+ ts.solutionPerformance.mark("afterBuildInfoRead");
125181
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125013
125182
  var buildInfo = value && ts.getBuildInfo(value);
125014
125183
  if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125015
125184
  return {
@@ -125045,13 +125214,17 @@ var ts;
125045
125214
  if (prior !== undefined) {
125046
125215
  return prior;
125047
125216
  }
125217
+ ts.solutionPerformance.mark("beforeGetUpToDateStatus");
125048
125218
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
125219
+ ts.solutionPerformance.mark("afterGetUpToDateStatus");
125220
+ ts.solutionPerformance.measure("GetUpToDateStatus", "beforeGetUpToDateStatus", "afterGetUpToDateStatus");
125049
125221
  state.projectStatus.set(resolvedPath, actual);
125050
125222
  return actual;
125051
125223
  }
125052
125224
  function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125053
125225
  if (proj.options.noEmit)
125054
125226
  return priorNewestUpdateTime;
125227
+ ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
125055
125228
  var host = state.host;
125056
125229
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125057
125230
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
@@ -125072,6 +125245,8 @@ var ts;
125072
125245
  host.setModifiedTime(file, now);
125073
125246
  }
125074
125247
  }
125248
+ ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
125249
+ ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
125075
125250
  return priorNewestUpdateTime;
125076
125251
  }
125077
125252
  function updateOutputTimestamps(state, proj, resolvedPath) {
@@ -125150,6 +125325,13 @@ var ts;
125150
125325
  }
125151
125326
  }
125152
125327
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
125328
+ ts.solutionPerformance.mark("beforeBuild");
125329
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
125330
+ ts.solutionPerformance.mark("afterBuild");
125331
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
125332
+ return result;
125333
+ }
125334
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
125153
125335
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
125154
125336
  if (!buildOrder)
125155
125337
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -125161,7 +125343,10 @@ var ts;
125161
125343
  if (!invalidatedProject)
125162
125344
  break;
125163
125345
  reportQueue = false;
125346
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125164
125347
  invalidatedProject.done(cancellationToken, writeFile, getCustomTransformers === null || getCustomTransformers === void 0 ? void 0 : getCustomTransformers(invalidatedProject.project));
125348
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125349
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125165
125350
  if (!state.diagnostics.has(invalidatedProject.projectPath))
125166
125351
  successfulProjects++;
125167
125352
  }
@@ -125250,6 +125435,14 @@ var ts;
125250
125435
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
125251
125436
  }
125252
125437
  function buildNextInvalidatedProject(state, changeDetected) {
125438
+ ts.solutionPerformance.mark("beforeBuild");
125439
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
125440
+ ts.solutionPerformance.mark("afterBuild");
125441
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
125442
+ if (buildOrder)
125443
+ reportErrorSummary(state, buildOrder);
125444
+ }
125445
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
125253
125446
  state.timerToBuildInvalidatedProject = undefined;
125254
125447
  if (state.reportFileChangeDetected) {
125255
125448
  state.reportFileChangeDetected = false;
@@ -125260,7 +125453,10 @@ var ts;
125260
125453
  var buildOrder = getBuildOrder(state);
125261
125454
  var invalidatedProject = getNextInvalidatedProject(state, buildOrder, /*reportQueue*/ false);
125262
125455
  if (invalidatedProject) {
125456
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125263
125457
  invalidatedProject.done();
125458
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125459
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125264
125460
  projectsBuilt++;
125265
125461
  while (state.projectPendingBuild.size) {
125266
125462
  // If already scheduled, skip
@@ -125276,13 +125472,16 @@ var ts;
125276
125472
  return;
125277
125473
  }
125278
125474
  var project = createInvalidatedProjectWithInfo(state, info, buildOrder);
125475
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125279
125476
  project.done();
125477
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125478
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125280
125479
  if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps)
125281
125480
  projectsBuilt++;
125282
125481
  }
125283
125482
  }
125284
125483
  disableCache(state);
125285
- reportErrorSummary(state, buildOrder);
125484
+ return buildOrder;
125286
125485
  }
125287
125486
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125288
125487
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
@@ -125339,6 +125538,7 @@ var ts;
125339
125538
  function startWatching(state, buildOrder) {
125340
125539
  if (!state.watchAllProjectsPending)
125341
125540
  return;
125541
+ ts.solutionPerformance.mark("beforeStartWatching");
125342
125542
  state.watchAllProjectsPending = false;
125343
125543
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
125344
125544
  var resolved = _a[_i];
@@ -125356,6 +125556,8 @@ var ts;
125356
125556
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
125357
125557
  }
125358
125558
  }
125559
+ ts.solutionPerformance.mark("afterStartWatching");
125560
+ ts.solutionPerformance.measure("StartWatching", "beforeStartWatching", "afterStartWatching");
125359
125561
  }
125360
125562
  function stopWatching(state) {
125361
125563
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -136334,7 +136536,7 @@ var ts;
136334
136536
  ts.Debug.assert(parent.name === node);
136335
136537
  return true;
136336
136538
  case 203 /* BindingElement */:
136337
- return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent);
136539
+ return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent);
136338
136540
  default:
136339
136541
  return false;
136340
136542
  }
@@ -137800,7 +138002,7 @@ var ts;
137800
138002
  // Use the parent symbol if the location is commonjs require syntax on javascript files only.
137801
138003
  if (ts.isInJSFile(referenceLocation)
137802
138004
  && referenceLocation.parent.kind === 203 /* BindingElement */
137803
- && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent)) {
138005
+ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) {
137804
138006
  referenceSymbol = referenceLocation.parent.symbol;
137805
138007
  // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In
137806
138008
  // this case, just skip it, since the bound identifiers are not an alias of the import.
@@ -143972,6 +144174,10 @@ var ts;
143972
144174
  }
143973
144175
  var typeDisplayString = printTypeInSingleLine(declarationType);
143974
144176
  if (typeDisplayString) {
144177
+ var isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && ts.equateStringsCaseInsensitive(decl.name.getText(), typeDisplayString);
144178
+ if (isVariableNameMatchesType) {
144179
+ return;
144180
+ }
143975
144181
  addTypeHints(typeDisplayString, decl.name.end);
143976
144182
  }
143977
144183
  }
@@ -147172,11 +147378,9 @@ var ts;
147172
147378
  if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
147173
147379
  var tokenInfo = formattingScanner.readTokenInfo(parent);
147174
147380
  if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
147175
- var commaTokenLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
147176
- if (startLine !== commaTokenLine) {
147177
- formattingScanner.advance();
147178
- tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
147179
- }
147381
+ // consume the comma
147382
+ consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
147383
+ tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
147180
147384
  }
147181
147385
  // consume the list end token only if it is still belong to the parent
147182
147386
  // there might be the case when current token matches end token but does not considered as one
@@ -174882,6 +175086,7 @@ var ts;
174882
175086
  return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
174883
175087
  }
174884
175088
  function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
175089
+ var _a;
174885
175090
  var perProjectResults = getPerProjectReferences(projects, defaultProject, initialLocation,
174886
175091
  /*isForRename*/ false, function (project, position) {
174887
175092
  logger.info("Finding references to " + position.fileName + " position " + position.pos + " in project " + project.getProjectName());
@@ -174901,7 +175106,7 @@ var ts;
174901
175106
  // have started the other project searches from related symbols. Propagate the
174902
175107
  // correct results to all other projects.
174903
175108
  var defaultProjectResults = perProjectResults.get(defaultProject);
174904
- if (defaultProjectResults[0].references[0].isDefinition === undefined) {
175109
+ if (((_a = defaultProjectResults === null || defaultProjectResults === void 0 ? void 0 : defaultProjectResults[0].references[0]) === null || _a === void 0 ? void 0 : _a.isDefinition) === undefined) {
174905
175110
  // Clear all isDefinition properties
174906
175111
  perProjectResults.forEach(function (projectResults) {
174907
175112
  for (var _i = 0, projectResults_2 = projectResults; _i < projectResults_2.length; _i++) {
@@ -174918,8 +175123,8 @@ var ts;
174918
175123
  var knownSymbolSpans_1 = createDocumentSpanSet();
174919
175124
  for (var _i = 0, defaultProjectResults_1 = defaultProjectResults; _i < defaultProjectResults_1.length; _i++) {
174920
175125
  var referencedSymbol = defaultProjectResults_1[_i];
174921
- for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
174922
- var ref = _b[_a];
175126
+ for (var _b = 0, _c = referencedSymbol.references; _b < _c.length; _b++) {
175127
+ var ref = _c[_b];
174923
175128
  if (ref.isDefinition) {
174924
175129
  knownSymbolSpans_1.add(ref);
174925
175130
  // One is enough - updateIsDefinitionOfReferencedSymbols will fill out the set based on symbols
@@ -175079,11 +175284,9 @@ var ts;
175079
175284
  // it easier for the caller to skip post-processing.
175080
175285
  if (searchedProjects.size === 1) {
175081
175286
  var it = resultsMap.values().next();
175082
- ts.Debug.assert(!it.done);
175083
- return it.value;
175287
+ return it.done ? server.emptyArray : it.value; // There may not be any results at all
175084
175288
  }
175085
175289
  return resultsMap;
175086
- // May enqueue to otherPositionQueue
175087
175290
  function searchPosition(project, location) {
175088
175291
  var projectResults = getResultsForPosition(project, location);
175089
175292
  if (!projectResults)