typescript 4.6.0-dev.20211203 → 4.6.0-dev.20211204

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/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.6";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20211203";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20211204";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -738,7 +738,11 @@ var ts;
738
738
  }
739
739
  return deduplicated;
740
740
  }
741
- function insertSorted(array, insert, compare) {
741
+ function createSortedArray() {
742
+ return [];
743
+ }
744
+ ts.createSortedArray = createSortedArray;
745
+ function insertSorted(array, insert, compare, allowDuplicates) {
742
746
  if (array.length === 0) {
743
747
  array.push(insert);
744
748
  return;
@@ -747,6 +751,9 @@ var ts;
747
751
  if (insertIndex < 0) {
748
752
  array.splice(~insertIndex, 0, insert);
749
753
  }
754
+ else if (allowDuplicates) {
755
+ array.splice(insertIndex, 0, insert);
756
+ }
750
757
  }
751
758
  ts.insertSorted = insertSorted;
752
759
  function sortAndDeduplicate(array, comparer, equalityComparer) {
@@ -5431,6 +5438,7 @@ var ts;
5431
5438
  Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: diag(2308, ts.DiagnosticCategory.Error, "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity."),
5432
5439
  An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: diag(2309, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", "An export assignment cannot be used in a module with other exported elements."),
5433
5440
  Type_0_recursively_references_itself_as_a_base_type: diag(2310, ts.DiagnosticCategory.Error, "Type_0_recursively_references_itself_as_a_base_type_2310", "Type '{0}' recursively references itself as a base type."),
5441
+ Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function: diag(2311, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function_2311", "Cannot find name '{0}'. Did you mean to write this in an async function?"),
5434
5442
  An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members: diag(2312, ts.DiagnosticCategory.Error, "An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_me_2312", "An interface can only extend an object type or intersection of object types with statically known members."),
5435
5443
  Type_parameter_0_has_a_circular_constraint: diag(2313, ts.DiagnosticCategory.Error, "Type_parameter_0_has_a_circular_constraint_2313", "Type parameter '{0}' has a circular constraint."),
5436
5444
  Generic_type_0_requires_1_type_argument_s: diag(2314, ts.DiagnosticCategory.Error, "Generic_type_0_requires_1_type_argument_s_2314", "Generic type '{0}' requires {1} type argument(s)."),
@@ -16516,6 +16524,10 @@ var ts;
16516
16524
  return text.replace(/\$/gm, "\\$");
16517
16525
  }
16518
16526
  ts.escapeSnippetText = escapeSnippetText;
16527
+ function isThisTypeParameter(type) {
16528
+ return !!(type.flags & 262144 && type.isThisType);
16529
+ }
16530
+ ts.isThisTypeParameter = isThisTypeParameter;
16519
16531
  })(ts || (ts = {}));
16520
16532
  var ts;
16521
16533
  (function (ts) {
@@ -38297,6 +38309,7 @@ var ts;
38297
38309
  getIndexInfosOfType: getIndexInfosOfType,
38298
38310
  getSignaturesOfType: getSignaturesOfType,
38299
38311
  getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 ? stringType : numberType); },
38312
+ getIndexType: function (type) { return getIndexType(type); },
38300
38313
  getBaseTypes: getBaseTypes,
38301
38314
  getBaseTypeOfLiteralType: getBaseTypeOfLiteralType,
38302
38315
  getWidenedType: getWidenedType,
@@ -39447,11 +39460,12 @@ var ts;
39447
39460
  }
39448
39461
  }
39449
39462
  }
39450
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals) {
39463
+ function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) {
39451
39464
  if (excludeGlobals === void 0) { excludeGlobals = false; }
39452
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol);
39465
+ if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; }
39466
+ return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol);
39453
39467
  }
39454
- function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup) {
39468
+ function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
39455
39469
  var _a, _b, _c;
39456
39470
  var originalLocation = location;
39457
39471
  var result;
@@ -39686,7 +39700,7 @@ var ts;
39686
39700
  }
39687
39701
  }
39688
39702
  if (!result) {
39689
- if (nameNotFoundMessage) {
39703
+ if (nameNotFoundMessage && produceDiagnostics) {
39690
39704
  if (!errorLocation ||
39691
39705
  !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
39692
39706
  !checkAndReportErrorForExtendingInterface(errorLocation) &&
@@ -39696,7 +39710,7 @@ var ts;
39696
39710
  !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
39697
39711
  !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
39698
39712
  var suggestion = void 0;
39699
- if (suggestionCount < maximumSuggestionCount) {
39713
+ if (getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
39700
39714
  suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
39701
39715
  var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
39702
39716
  if (isGlobalScopeAugmentationDeclaration) {
@@ -39731,7 +39745,7 @@ var ts;
39731
39745
  }
39732
39746
  return undefined;
39733
39747
  }
39734
- if (nameNotFoundMessage) {
39748
+ if (nameNotFoundMessage && produceDiagnostics) {
39735
39749
  if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields)) {
39736
39750
  var propertyName = propertyWithInvalidInitializer.name;
39737
39751
  error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg));
@@ -41923,7 +41937,7 @@ var ts;
41923
41937
  context.approximateLength += 6;
41924
41938
  return ts.factory.createKeywordTypeNode(147);
41925
41939
  }
41926
- if (isThisTypeParameter(type)) {
41940
+ if (ts.isThisTypeParameter(type)) {
41927
41941
  if (context.flags & 4194304) {
41928
41942
  if (!context.encounteredError && !(context.flags & 32768)) {
41929
41943
  context.encounteredError = true;
@@ -48811,7 +48825,7 @@ var ts;
48811
48825
  return symbol;
48812
48826
  }
48813
48827
  function getGlobalSymbol(name, meaning, diagnostic) {
48814
- return resolveName(undefined, name, meaning, diagnostic, name, false);
48828
+ return resolveName(undefined, name, meaning, diagnostic, name, false, false, false);
48815
48829
  }
48816
48830
  function getGlobalType(name, arity, reportErrors) {
48817
48831
  var symbol = getGlobalTypeSymbol(name, reportErrors);
@@ -50240,9 +50254,6 @@ var ts;
50240
50254
  return (type.flags & 58982400 || isGenericMappedType(type) || isGenericTupleType(type) ? 8388608 : 0) |
50241
50255
  (type.flags & (58982400 | 4194304 | 134217728 | 268435456) && !isPatternLiteralType(type) ? 16777216 : 0);
50242
50256
  }
50243
- function isThisTypeParameter(type) {
50244
- return !!(type.flags & 262144 && type.isThisType);
50245
- }
50246
50257
  function getSimplifiedType(type, writing) {
50247
50258
  return type.flags & 8388608 ? getSimplifiedIndexedAccessType(type, writing) :
50248
50259
  type.flags & 16777216 ? getSimplifiedConditionalType(type, writing) :
@@ -54742,7 +54753,7 @@ var ts;
54742
54753
  return result;
54743
54754
  }
54744
54755
  function getFalsyFlags(type) {
54745
- return type.flags & 1048576 ? getFalsyFlagsOfTypes(type.types) :
54756
+ return type.flags & 3145728 ? getFalsyFlagsOfTypes(type.types) :
54746
54757
  type.flags & 128 ? type.value === "" ? 128 : 0 :
54747
54758
  type.flags & 256 ? type.value === 0 ? 256 : 0 :
54748
54759
  type.flags & 2048 ? isZeroBigInt(type) ? 2048 : 0 :
@@ -56130,6 +56141,10 @@ var ts;
56130
56141
  case "BigInt64Array":
56131
56142
  case "BigUint64Array":
56132
56143
  return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later;
56144
+ case "await":
56145
+ if (ts.isCallExpression(node.parent)) {
56146
+ return ts.Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function;
56147
+ }
56133
56148
  default:
56134
56149
  if (node.parent.kind === 295) {
56135
56150
  return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
@@ -57534,7 +57549,7 @@ var ts;
57534
57549
  function narrowByInKeyword(type, name, assumeTrue) {
57535
57550
  if (type.flags & 1048576
57536
57551
  || type.flags & 524288 && declaredType !== type
57537
- || isThisTypeParameter(type)
57552
+ || ts.isThisTypeParameter(type)
57538
57553
  || type.flags & 2097152 && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
57539
57554
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
57540
57555
  }
@@ -59872,15 +59887,9 @@ var ts;
59872
59887
  }
59873
59888
  }
59874
59889
  function isValidSpreadType(type) {
59875
- if (type.flags & 465829888) {
59876
- var constraint = getBaseConstraintOfType(type);
59877
- if (constraint !== undefined) {
59878
- return isValidSpreadType(constraint);
59879
- }
59880
- }
59881
- return !!(type.flags & (1 | 67108864 | 524288 | 58982400) ||
59882
- getFalsyFlags(type) & 117632 && isValidSpreadType(removeDefinitelyFalsyTypes(type)) ||
59883
- type.flags & 3145728 && ts.every(type.types, isValidSpreadType));
59890
+ var t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType));
59891
+ return !!(t.flags & (1 | 67108864 | 524288 | 58982400) ||
59892
+ t.flags & 3145728 && ts.every(t.types, isValidSpreadType));
59884
59893
  }
59885
59894
  function checkJsxSelfClosingElementDeferred(node) {
59886
59895
  checkJsxOpeningLikeElementOrOpeningFragment(node);
@@ -60666,7 +60675,7 @@ var ts;
60666
60675
  }
60667
60676
  var propType;
60668
60677
  if (!prop) {
60669
- var indexInfo = !ts.isPrivateIdentifier(right) && (assignmentKind === 0 || !isGenericObjectType(leftType) || isThisTypeParameter(leftType)) ?
60678
+ var indexInfo = !ts.isPrivateIdentifier(right) && (assignmentKind === 0 || !isGenericObjectType(leftType) || ts.isThisTypeParameter(leftType)) ?
60670
60679
  getApplicableIndexInfoForName(apparentType, right.escapedText) : undefined;
60671
60680
  if (!(indexInfo && indexInfo.type)) {
60672
60681
  var isUncheckedJS = isUncheckedJSSuggestion(node, leftType.symbol, true);
@@ -60683,7 +60692,7 @@ var ts;
60683
60692
  return anyType;
60684
60693
  }
60685
60694
  if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) {
60686
- reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType, isUncheckedJS);
60695
+ reportNonexistentProperty(right, ts.isThisTypeParameter(leftType) ? apparentType : leftType, isUncheckedJS);
60687
60696
  }
60688
60697
  return errorType;
60689
60698
  }
@@ -60957,7 +60966,7 @@ var ts;
60957
60966
  }
60958
60967
  function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
60959
60968
  ts.Debug.assert(outerName !== undefined, "outername should always be defined");
60960
- var result = resolveNameHelper(location, outerName, meaning, undefined, outerName, false, false, function (symbols, name, meaning) {
60969
+ var result = resolveNameHelper(location, outerName, meaning, undefined, outerName, false, false, true, function (symbols, name, meaning) {
60961
60970
  ts.Debug.assertEqual(outerName, name, "name should equal outerName");
60962
60971
  var symbol = getSymbol(symbols, name, meaning);
60963
60972
  if (symbol)
@@ -61147,7 +61156,7 @@ var ts;
61147
61156
  }
61148
61157
  var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
61149
61158
  var accessFlags = ts.isAssignmentTarget(node) ?
61150
- 4 | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 : 0) :
61159
+ 4 | (isGenericObjectType(objectType) && !ts.isThisTypeParameter(objectType) ? 2 : 0) :
61151
61160
  32;
61152
61161
  var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
61153
61162
  return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
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-dev.20211203";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20211204";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -843,7 +843,11 @@ var ts;
843
843
  }
844
844
  return deduplicated;
845
845
  }
846
- function insertSorted(array, insert, compare) {
846
+ function createSortedArray() {
847
+ return []; // TODO: GH#19873
848
+ }
849
+ ts.createSortedArray = createSortedArray;
850
+ function insertSorted(array, insert, compare, allowDuplicates) {
847
851
  if (array.length === 0) {
848
852
  array.push(insert);
849
853
  return;
@@ -852,6 +856,9 @@ var ts;
852
856
  if (insertIndex < 0) {
853
857
  array.splice(~insertIndex, 0, insert);
854
858
  }
859
+ else if (allowDuplicates) {
860
+ array.splice(insertIndex, 0, insert);
861
+ }
855
862
  }
856
863
  ts.insertSorted = insertSorted;
857
864
  function sortAndDeduplicate(array, comparer, equalityComparer) {
@@ -8217,6 +8224,7 @@ var ts;
8217
8224
  Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: diag(2308, ts.DiagnosticCategory.Error, "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity."),
8218
8225
  An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: diag(2309, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", "An export assignment cannot be used in a module with other exported elements."),
8219
8226
  Type_0_recursively_references_itself_as_a_base_type: diag(2310, ts.DiagnosticCategory.Error, "Type_0_recursively_references_itself_as_a_base_type_2310", "Type '{0}' recursively references itself as a base type."),
8227
+ Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function: diag(2311, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function_2311", "Cannot find name '{0}'. Did you mean to write this in an async function?"),
8220
8228
  An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members: diag(2312, ts.DiagnosticCategory.Error, "An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_me_2312", "An interface can only extend an object type or intersection of object types with statically known members."),
8221
8229
  Type_parameter_0_has_a_circular_constraint: diag(2313, ts.DiagnosticCategory.Error, "Type_parameter_0_has_a_circular_constraint_2313", "Type parameter '{0}' has a circular constraint."),
8222
8230
  Generic_type_0_requires_1_type_argument_s: diag(2314, ts.DiagnosticCategory.Error, "Generic_type_0_requires_1_type_argument_s_2314", "Generic type '{0}' requires {1} type argument(s)."),
@@ -20758,6 +20766,10 @@ var ts;
20758
20766
  return text.replace(/\$/gm, "\\$");
20759
20767
  }
20760
20768
  ts.escapeSnippetText = escapeSnippetText;
20769
+ function isThisTypeParameter(type) {
20770
+ return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
20771
+ }
20772
+ ts.isThisTypeParameter = isThisTypeParameter;
20761
20773
  })(ts || (ts = {}));
20762
20774
  /* @internal */
20763
20775
  var ts;
@@ -46840,6 +46852,7 @@ var ts;
46840
46852
  getIndexInfosOfType: getIndexInfosOfType,
46841
46853
  getSignaturesOfType: getSignaturesOfType,
46842
46854
  getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* String */ ? stringType : numberType); },
46855
+ getIndexType: function (type) { return getIndexType(type); },
46843
46856
  getBaseTypes: getBaseTypes,
46844
46857
  getBaseTypeOfLiteralType: getBaseTypeOfLiteralType,
46845
46858
  getWidenedType: getWidenedType,
@@ -48097,11 +48110,12 @@ var ts;
48097
48110
  *
48098
48111
  * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
48099
48112
  */
48100
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals) {
48113
+ function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) {
48101
48114
  if (excludeGlobals === void 0) { excludeGlobals = false; }
48102
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol);
48115
+ if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; }
48116
+ return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol);
48103
48117
  }
48104
- function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup) {
48118
+ function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
48105
48119
  var _a, _b, _c;
48106
48120
  var originalLocation = location; // needed for did-you-mean error reporting, which gathers candidates starting from the original location
48107
48121
  var result;
@@ -48418,7 +48432,7 @@ var ts;
48418
48432
  }
48419
48433
  }
48420
48434
  if (!result) {
48421
- if (nameNotFoundMessage) {
48435
+ if (nameNotFoundMessage && produceDiagnostics) {
48422
48436
  if (!errorLocation ||
48423
48437
  !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
48424
48438
  !checkAndReportErrorForExtendingInterface(errorLocation) &&
@@ -48428,7 +48442,7 @@ var ts;
48428
48442
  !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
48429
48443
  !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
48430
48444
  var suggestion = void 0;
48431
- if (suggestionCount < maximumSuggestionCount) {
48445
+ if (getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
48432
48446
  suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
48433
48447
  var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
48434
48448
  if (isGlobalScopeAugmentationDeclaration) {
@@ -48464,7 +48478,7 @@ var ts;
48464
48478
  return undefined;
48465
48479
  }
48466
48480
  // Perform extra checks only if error reporting was requested
48467
- if (nameNotFoundMessage) {
48481
+ if (nameNotFoundMessage && produceDiagnostics) {
48468
48482
  if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && useDefineForClassFields)) {
48469
48483
  // We have a match, but the reference occurred within a property initializer and the identifier also binds
48470
48484
  // to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
@@ -50940,7 +50954,7 @@ var ts;
50940
50954
  context.approximateLength += 6;
50941
50955
  return ts.factory.createKeywordTypeNode(147 /* ObjectKeyword */);
50942
50956
  }
50943
- if (isThisTypeParameter(type)) {
50957
+ if (ts.isThisTypeParameter(type)) {
50944
50958
  if (context.flags & 4194304 /* InObjectTypeLiteral */) {
50945
50959
  if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) {
50946
50960
  context.encounteredError = true;
@@ -58885,7 +58899,7 @@ var ts;
58885
58899
  }
58886
58900
  function getGlobalSymbol(name, meaning, diagnostic) {
58887
58901
  // Don't track references for global symbols anyway, so value if `isReference` is arbitrary
58888
- return resolveName(undefined, name, meaning, diagnostic, name, /*isUse*/ false);
58902
+ return resolveName(undefined, name, meaning, diagnostic, name, /*isUse*/ false, /*excludeGlobals*/ false, /*getSpellingSuggestions*/ false);
58889
58903
  }
58890
58904
  function getGlobalType(name, arity, reportErrors) {
58891
58905
  var symbol = getGlobalTypeSymbol(name, reportErrors);
@@ -60464,9 +60478,6 @@ var ts;
60464
60478
  return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 8388608 /* IsGenericObjectType */ : 0) |
60465
60479
  (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 16777216 /* IsGenericIndexType */ : 0);
60466
60480
  }
60467
- function isThisTypeParameter(type) {
60468
- return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
60469
- }
60470
60481
  function getSimplifiedType(type, writing) {
60471
60482
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) :
60472
60483
  type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) :
@@ -65664,7 +65675,7 @@ var ts;
65664
65675
  // flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
65665
65676
  // no flags for all other types (including non-falsy literal types).
65666
65677
  function getFalsyFlags(type) {
65667
- return type.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(type.types) :
65678
+ return type.flags & 3145728 /* UnionOrIntersection */ ? getFalsyFlagsOfTypes(type.types) :
65668
65679
  type.flags & 128 /* StringLiteral */ ? type.value === "" ? 128 /* StringLiteral */ : 0 :
65669
65680
  type.flags & 256 /* NumberLiteral */ ? type.value === 0 ? 256 /* NumberLiteral */ : 0 :
65670
65681
  type.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(type) ? 2048 /* BigIntLiteral */ : 0 :
@@ -67280,6 +67291,11 @@ var ts;
67280
67291
  case "BigInt64Array":
67281
67292
  case "BigUint64Array":
67282
67293
  return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later;
67294
+ case "await":
67295
+ if (ts.isCallExpression(node.parent)) {
67296
+ return ts.Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function;
67297
+ }
67298
+ // falls through
67283
67299
  default:
67284
67300
  if (node.parent.kind === 295 /* ShorthandPropertyAssignment */) {
67285
67301
  return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
@@ -68837,7 +68853,7 @@ var ts;
68837
68853
  function narrowByInKeyword(type, name, assumeTrue) {
68838
68854
  if (type.flags & 1048576 /* Union */
68839
68855
  || type.flags & 524288 /* Object */ && declaredType !== type
68840
- || isThisTypeParameter(type)
68856
+ || ts.isThisTypeParameter(type)
68841
68857
  || type.flags & 2097152 /* Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
68842
68858
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
68843
68859
  }
@@ -71657,15 +71673,9 @@ var ts;
71657
71673
  }
71658
71674
  }
71659
71675
  function isValidSpreadType(type) {
71660
- if (type.flags & 465829888 /* Instantiable */) {
71661
- var constraint = getBaseConstraintOfType(type);
71662
- if (constraint !== undefined) {
71663
- return isValidSpreadType(constraint);
71664
- }
71665
- }
71666
- return !!(type.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) ||
71667
- getFalsyFlags(type) & 117632 /* DefinitelyFalsy */ && isValidSpreadType(removeDefinitelyFalsyTypes(type)) ||
71668
- type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isValidSpreadType));
71676
+ var t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType));
71677
+ return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) ||
71678
+ t.flags & 3145728 /* UnionOrIntersection */ && ts.every(t.types, isValidSpreadType));
71669
71679
  }
71670
71680
  function checkJsxSelfClosingElementDeferred(node) {
71671
71681
  checkJsxOpeningLikeElementOrOpeningFragment(node);
@@ -72616,7 +72626,7 @@ var ts;
72616
72626
  }
72617
72627
  var propType;
72618
72628
  if (!prop) {
72619
- var indexInfo = !ts.isPrivateIdentifier(right) && (assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) || isThisTypeParameter(leftType)) ?
72629
+ var indexInfo = !ts.isPrivateIdentifier(right) && (assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) || ts.isThisTypeParameter(leftType)) ?
72620
72630
  getApplicableIndexInfoForName(apparentType, right.escapedText) : undefined;
72621
72631
  if (!(indexInfo && indexInfo.type)) {
72622
72632
  var isUncheckedJS = isUncheckedJSSuggestion(node, leftType.symbol, /*excludeClasses*/ true);
@@ -72633,7 +72643,7 @@ var ts;
72633
72643
  return anyType;
72634
72644
  }
72635
72645
  if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) {
72636
- reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType, isUncheckedJS);
72646
+ reportNonexistentProperty(right, ts.isThisTypeParameter(leftType) ? apparentType : leftType, isUncheckedJS);
72637
72647
  }
72638
72648
  return errorType;
72639
72649
  }
@@ -72926,7 +72936,7 @@ var ts;
72926
72936
  }
72927
72937
  function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
72928
72938
  ts.Debug.assert(outerName !== undefined, "outername should always be defined");
72929
- var result = resolveNameHelper(location, outerName, meaning, /*nameNotFoundMessage*/ undefined, outerName, /*isUse*/ false, /*excludeGlobals*/ false, function (symbols, name, meaning) {
72939
+ var result = resolveNameHelper(location, outerName, meaning, /*nameNotFoundMessage*/ undefined, outerName, /*isUse*/ false, /*excludeGlobals*/ false, /*getSpellingSuggestions*/ true, function (symbols, name, meaning) {
72930
72940
  ts.Debug.assertEqual(outerName, name, "name should equal outerName");
72931
72941
  var symbol = getSymbol(symbols, name, meaning);
72932
72942
  // Sometimes the symbol is found when location is a return type of a function: `typeof x` and `x` is declared in the body of the function
@@ -73172,7 +73182,7 @@ var ts;
73172
73182
  }
73173
73183
  var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
73174
73184
  var accessFlags = ts.isAssignmentTarget(node) ?
73175
- 4 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 /* NoIndexSignatures */ : 0) :
73185
+ 4 /* Writing */ | (isGenericObjectType(objectType) && !ts.isThisTypeParameter(objectType) ? 2 /* NoIndexSignatures */ : 0) :
73176
73186
  32 /* ExpressionPosition */;
73177
73187
  var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
73178
73188
  return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
@@ -127615,7 +127625,7 @@ var ts;
127615
127625
  case 0 /* Paths */:
127616
127626
  return convertPathCompletions(completion.paths);
127617
127627
  case 1 /* Properties */: {
127618
- var entries = [];
127628
+ var entries = ts.createSortedArray();
127619
127629
  Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, contextToken, contextToken, sourceFile, sourceFile, host, program, 99 /* ESNext */, log, 4 /* String */, preferences, options); // Target will not be used, so arbitrary
127620
127630
  return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan: optionalReplacementSpan, entries: entries };
127621
127631
  }
@@ -127813,7 +127823,7 @@ var ts;
127813
127823
  var types = ts.flatMap(candidates, function (candidate) {
127814
127824
  if (!ts.signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length)
127815
127825
  return;
127816
- var type = checker.getParameterType(candidate, argumentInfo.argumentIndex);
127826
+ var type = candidate.getTypeParameterAtPosition(argumentInfo.argumentIndex);
127817
127827
  isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* String */);
127818
127828
  return getStringLiteralTypes(type, uniques);
127819
127829
  });
@@ -128497,6 +128507,29 @@ var ts;
128497
128507
  }
128498
128508
  }
128499
128509
  Completions.getCompletionsAtPosition = getCompletionsAtPosition;
128510
+ // Editors will use the `sortText` and then fall back to `name` for sorting, but leave ties in response order.
128511
+ // So, it's important that we sort those ties in the order we want them displayed if it matters. We don't
128512
+ // strictly need to sort by name or SortText here since clients are going to do it anyway, but we have to
128513
+ // do the work of comparing them so we can sort those ties appropriately; plus, it makes the order returned
128514
+ // by the language service consistent with what TS Server does and what editors typically do. This also makes
128515
+ // completions tests make more sense. We used to sort only alphabetically and only in the server layer, but
128516
+ // this made tests really weird, since most fourslash tests don't use the server.
128517
+ function compareCompletionEntries(entryInArray, entryToInsert) {
128518
+ var _a, _b;
128519
+ var result = ts.compareStringsCaseSensitiveUI(entryInArray.sortText, entryToInsert.sortText);
128520
+ if (result === 0 /* EqualTo */) {
128521
+ result = ts.compareStringsCaseSensitiveUI(entryInArray.name, entryToInsert.name);
128522
+ }
128523
+ if (result === 0 /* EqualTo */ && ((_a = entryInArray.data) === null || _a === void 0 ? void 0 : _a.moduleSpecifier) && ((_b = entryToInsert.data) === null || _b === void 0 ? void 0 : _b.moduleSpecifier)) {
128524
+ // Sort same-named auto-imports by module specifier
128525
+ result = ts.compareNumberOfDirectorySeparators(entryInArray.data.moduleSpecifier, entryToInsert.data.moduleSpecifier);
128526
+ }
128527
+ if (result === 0 /* EqualTo */) {
128528
+ // Fall back to symbol order - if we return `EqualTo`, `insertSorted` will put later symbols first.
128529
+ return -1 /* LessThan */;
128530
+ }
128531
+ return result;
128532
+ }
128500
128533
  function completionEntryDataIsResolved(data) {
128501
128534
  return !!(data === null || data === void 0 ? void 0 : data.moduleSpecifier);
128502
128535
  }
@@ -128583,7 +128616,7 @@ var ts;
128583
128616
  return completionInfo;
128584
128617
  }
128585
128618
  }
128586
- var entries = [];
128619
+ var entries = ts.createSortedArray();
128587
128620
  if (isUncheckedFile(sourceFile, compilerOptions)) {
128588
128621
  var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
128589
128622
  /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
@@ -128601,13 +128634,13 @@ var ts;
128601
128634
  for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
128602
128635
  var keywordEntry = _a[_i];
128603
128636
  if (!entryNames.has(keywordEntry.name)) {
128604
- entries.push(keywordEntry);
128637
+ ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
128605
128638
  }
128606
128639
  }
128607
128640
  }
128608
128641
  for (var _b = 0, literals_1 = literals; _b < literals_1.length; _b++) {
128609
128642
  var literal = literals_1[_b];
128610
- entries.push(createCompletionEntryForLiteral(sourceFile, preferences, literal));
128643
+ ts.insertSorted(entries, createCompletionEntryForLiteral(sourceFile, preferences, literal), compareCompletionEntries, /*allowDuplicates*/ true);
128611
128644
  }
128612
128645
  return {
128613
128646
  isGlobalCompletion: isInSnippetScope,
@@ -128683,13 +128716,13 @@ var ts;
128683
128716
  var realName = ts.unescapeLeadingUnderscores(name);
128684
128717
  if (!uniqueNames.has(realName) && ts.isIdentifierText(realName, target)) {
128685
128718
  uniqueNames.add(realName);
128686
- entries.push({
128719
+ ts.insertSorted(entries, {
128687
128720
  name: realName,
128688
128721
  kind: "warning" /* warning */,
128689
128722
  kindModifiers: "",
128690
128723
  sortText: SortText.JavascriptIdentifiers,
128691
128724
  isFromUncheckedFile: true
128692
- });
128725
+ }, compareCompletionEntries);
128693
128726
  }
128694
128727
  });
128695
128728
  }
@@ -129113,7 +129146,7 @@ var ts;
129113
129146
  /** True for locals; false for globals, module exports from other files, `this.` completions. */
129114
129147
  var shouldShadowLaterSymbols = !origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }));
129115
129148
  uniques.set(name, shouldShadowLaterSymbols);
129116
- entries.push(entry);
129149
+ ts.insertSorted(entries, entry, compareCompletionEntries, /*allowDuplicates*/ true);
129117
129150
  }
129118
129151
  log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start));
129119
129152
  // Prevent consumers of this map from having to worry about
@@ -151590,6 +151623,7 @@ var ts;
151590
151623
  var errorCodes = [
151591
151624
  ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
151592
151625
  ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
151626
+ ts.Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
151593
151627
  ];
151594
151628
  codefix.registerCodeFix({
151595
151629
  errorCodes: errorCodes,
@@ -159400,6 +159434,9 @@ var ts;
159400
159434
  TypeObject.prototype.isClass = function () {
159401
159435
  return !!(ts.getObjectFlags(this) & 1 /* Class */);
159402
159436
  };
159437
+ TypeObject.prototype.isIndexType = function () {
159438
+ return !!(this.flags & 4194304 /* Index */);
159439
+ };
159403
159440
  Object.defineProperty(TypeObject.prototype, "typeArguments", {
159404
159441
  /**
159405
159442
  * This polyfills `referenceType.typeArguments` for API consumers
@@ -159432,6 +159469,16 @@ var ts;
159432
159469
  SignatureObject.prototype.getReturnType = function () {
159433
159470
  return this.checker.getReturnTypeOfSignature(this);
159434
159471
  };
159472
+ SignatureObject.prototype.getTypeParameterAtPosition = function (pos) {
159473
+ var type = this.checker.getParameterType(this, pos);
159474
+ if (type.isIndexType() && ts.isThisTypeParameter(type.type)) {
159475
+ var constraint = type.type.getConstraint();
159476
+ if (constraint) {
159477
+ return this.checker.getIndexType(constraint);
159478
+ }
159479
+ }
159480
+ return type;
159481
+ };
159435
159482
  SignatureObject.prototype.getDocumentationComment = function () {
159436
159483
  return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker));
159437
159484
  };
@@ -171777,14 +171824,14 @@ var ts;
171777
171824
  if (kind === "completions-full" /* CompletionsFull */)
171778
171825
  return completions;
171779
171826
  var prefix = args.prefix || "";
171780
- var entries = ts.stableSort(ts.mapDefined(completions.entries, function (entry) {
171827
+ var entries = ts.mapDefined(completions.entries, function (entry) {
171781
171828
  if (completions.isMemberCompletion || ts.startsWith(entry.name.toLowerCase(), prefix.toLowerCase())) {
171782
171829
  var name = entry.name, kind_1 = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, insertText = entry.insertText, replacementSpan = entry.replacementSpan, hasAction = entry.hasAction, source = entry.source, sourceDisplay = entry.sourceDisplay, isSnippet = entry.isSnippet, isRecommended = entry.isRecommended, isPackageJsonImport = entry.isPackageJsonImport, isImportStatementCompletion = entry.isImportStatementCompletion, data = entry.data;
171783
171830
  var convertedSpan = replacementSpan ? toProtocolTextSpan(replacementSpan, scriptInfo) : undefined;
171784
171831
  // Use `hasAction || undefined` to avoid serializing `false`.
171785
171832
  return { name: name, kind: kind_1, kindModifiers: kindModifiers, sortText: sortText, insertText: insertText, replacementSpan: convertedSpan, isSnippet: isSnippet, hasAction: hasAction || undefined, source: source, sourceDisplay: sourceDisplay, isRecommended: isRecommended, isPackageJsonImport: isPackageJsonImport, isImportStatementCompletion: isImportStatementCompletion, data: data };
171786
171833
  }
171787
- }), function (a, b) { return ts.compareStringsCaseSensitiveUI(a.name, b.name); });
171834
+ });
171788
171835
  if (kind === "completions" /* Completions */) {
171789
171836
  if (completions.metadata)
171790
171837
  entries.metadata = completions.metadata;
@@ -5560,6 +5560,7 @@ declare namespace ts {
5560
5560
  isTypeParameter(): this is TypeParameter;
5561
5561
  isClassOrInterface(): this is InterfaceType;
5562
5562
  isClass(): this is InterfaceType;
5563
+ isIndexType(): this is IndexType;
5563
5564
  }
5564
5565
  interface TypeReference {
5565
5566
  typeArguments?: readonly Type[];
@@ -5568,6 +5569,7 @@ declare namespace ts {
5568
5569
  getDeclaration(): SignatureDeclaration;
5569
5570
  getTypeParameters(): TypeParameter[] | undefined;
5570
5571
  getParameters(): Symbol[];
5572
+ getTypeParameterAtPosition(pos: number): Type;
5571
5573
  getReturnType(): Type;
5572
5574
  getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[];
5573
5575
  getJsDocTags(): JSDocTagInfo[];