@typescript-deploys/pr-build 5.1.0-pr-52968-5 → 5.1.0-pr-53258-7

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
@@ -91,6 +91,7 @@ __export(server_exports, {
91
91
  ImportKind: () => ImportKind,
92
92
  ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
93
93
  IndentStyle: () => IndentStyle,
94
+ IndexFlags: () => IndexFlags,
94
95
  IndexKind: () => IndexKind,
95
96
  InferenceFlags: () => InferenceFlags,
96
97
  InferencePriority: () => InferencePriority,
@@ -2284,7 +2285,7 @@ module.exports = __toCommonJS(server_exports);
2284
2285
 
2285
2286
  // src/compiler/corePublic.ts
2286
2287
  var versionMajorMinor = "5.1";
2287
- var version = `${versionMajorMinor}.0-insiders.20230313`;
2288
+ var version = `${versionMajorMinor}.0-insiders.20230314`;
2288
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2289
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2290
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6626,7 +6627,6 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
6626
6627
  TypeFlags2[TypeFlags2["NonPrimitive"] = 67108864] = "NonPrimitive";
6627
6628
  TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
6628
6629
  TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
6629
- TypeFlags2[TypeFlags2["NoInfer"] = 536870912] = "NoInfer";
6630
6630
  TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
6631
6631
  TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
6632
6632
  TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
@@ -6650,14 +6650,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
6650
6650
  TypeFlags2[TypeFlags2["UnionOrIntersection"] = 3145728] = "UnionOrIntersection";
6651
6651
  TypeFlags2[TypeFlags2["StructuredType"] = 3670016] = "StructuredType";
6652
6652
  TypeFlags2[TypeFlags2["TypeVariable"] = 8650752] = "TypeVariable";
6653
- TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] = 595853312] = "InstantiableNonPrimitive";
6653
+ TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] = 58982400] = "InstantiableNonPrimitive";
6654
6654
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
6655
- TypeFlags2[TypeFlags2["Instantiable"] = 1002700800] = "Instantiable";
6656
- TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 1006370816] = "StructuredOrInstantiable";
6655
+ TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
6656
+ TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
6657
6657
  TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
6658
6658
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
6659
6659
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
6660
- TypeFlags2[TypeFlags2["Narrowable"] = 1073495039] = "Narrowable";
6660
+ TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
6661
6661
  TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
6662
6662
  TypeFlags2[TypeFlags2["IncludesMissingType"] = 262144 /* TypeParameter */] = "IncludesMissingType";
6663
6663
  TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 4194304 /* Index */] = "IncludesNonWideningType";
@@ -6748,6 +6748,13 @@ var AccessFlags = /* @__PURE__ */ ((AccessFlags2) => {
6748
6748
  AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent";
6749
6749
  return AccessFlags2;
6750
6750
  })(AccessFlags || {});
6751
+ var IndexFlags = /* @__PURE__ */ ((IndexFlags2) => {
6752
+ IndexFlags2[IndexFlags2["None"] = 0] = "None";
6753
+ IndexFlags2[IndexFlags2["StringsOnly"] = 1] = "StringsOnly";
6754
+ IndexFlags2[IndexFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
6755
+ IndexFlags2[IndexFlags2["NoReducibleCheck"] = 4] = "NoReducibleCheck";
6756
+ return IndexFlags2;
6757
+ })(IndexFlags || {});
6751
6758
  var JsxReferenceKind = /* @__PURE__ */ ((JsxReferenceKind2) => {
6752
6759
  JsxReferenceKind2[JsxReferenceKind2["Component"] = 0] = "Component";
6753
6760
  JsxReferenceKind2[JsxReferenceKind2["Function"] = 1] = "Function";
@@ -9390,6 +9397,7 @@ var Diagnostics = {
9390
9397
  Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: diag(1250, 1 /* Error */, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'."),
9391
9398
  Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: diag(1251, 1 /* Error */, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode."),
9392
9399
  Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: diag(1252, 1 /* Error */, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode."),
9400
+ Abstract_properties_can_only_appear_within_an_abstract_class: diag(1253, 1 /* Error */, "Abstract_properties_can_only_appear_within_an_abstract_class_1253", "Abstract properties can only appear within an abstract class."),
9393
9401
  A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference: diag(1254, 1 /* Error */, "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_refere_1254", "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference."),
9394
9402
  A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, 1 /* Error */, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."),
9395
9403
  A_required_element_cannot_follow_an_optional_element: diag(1257, 1 /* Error */, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
@@ -47193,7 +47201,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
47193
47201
  return SignatureCheckMode3;
47194
47202
  })(SignatureCheckMode || {});
47195
47203
  var isNotOverloadAndNotAccessor = and(isNotOverload, isNotAccessor);
47196
- var stringMappingTypeKinds = new Map(Object.entries({
47204
+ var intrinsicTypeKinds = new Map(Object.entries({
47197
47205
  Uppercase: 0 /* Uppercase */,
47198
47206
  Lowercase: 1 /* Lowercase */,
47199
47207
  Capitalize: 2 /* Capitalize */,
@@ -47271,6 +47279,7 @@ function createTypeChecker(host) {
47271
47279
  var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
47272
47280
  var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
47273
47281
  var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
47282
+ var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
47274
47283
  var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
47275
47284
  var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
47276
47285
  var checkBinaryExpression = createCheckBinaryExpression();
@@ -47718,7 +47727,7 @@ function createTypeChecker(host) {
47718
47727
  var enumLiteralTypes = /* @__PURE__ */ new Map();
47719
47728
  var indexedAccessTypes = /* @__PURE__ */ new Map();
47720
47729
  var templateLiteralTypes = /* @__PURE__ */ new Map();
47721
- var intrinsicWrapperTypes = /* @__PURE__ */ new Map();
47730
+ var stringMappingTypes = /* @__PURE__ */ new Map();
47722
47731
  var substitutionTypes = /* @__PURE__ */ new Map();
47723
47732
  var subtypeReductionCache = /* @__PURE__ */ new Map();
47724
47733
  var decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
@@ -51852,10 +51861,6 @@ function createTypeChecker(host) {
51852
51861
  const typeNode = typeToTypeNodeHelper(type.type, context);
51853
51862
  return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
51854
51863
  }
51855
- if (type.flags & 536870912 /* NoInfer */) {
51856
- const typeNode = typeToTypeNodeHelper(type.type, context);
51857
- return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
51858
- }
51859
51864
  if (type.flags & 8388608 /* IndexedAccess */) {
51860
51865
  const objectTypeNode = typeToTypeNodeHelper(type.objectType, context);
51861
51866
  const indexTypeNode = typeToTypeNodeHelper(type.indexType, context);
@@ -55314,10 +55319,10 @@ function createTypeChecker(host) {
55314
55319
  return result;
55315
55320
  }
55316
55321
  function isGenericTypeWithUndefinedConstraint(type) {
55317
- return !!(type.flags & 1002700800 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768 /* Undefined */);
55322
+ return !!(type.flags & 465829888 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768 /* Undefined */);
55318
55323
  }
55319
55324
  function getNonUndefinedType(type) {
55320
- const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 1002700800 /* Instantiable */ ? getBaseConstraintOrType(t) : t) : type;
55325
+ const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t) : type;
55321
55326
  return getTypeWithFacts(typeOrConstraint, 524288 /* NEUndefined */);
55322
55327
  }
55323
55328
  function getFlowTypeOfDestructuring(node, declaredType) {
@@ -58136,7 +58141,7 @@ function createTypeChecker(host) {
58136
58141
  let constraints;
58137
58142
  let hasDisjointDomainType = false;
58138
58143
  for (const t of types) {
58139
- if (t.flags & 1002700800 /* Instantiable */) {
58144
+ if (t.flags & 465829888 /* Instantiable */) {
58140
58145
  let constraint = getConstraintOfType(t);
58141
58146
  while (constraint && constraint.flags & (262144 /* TypeParameter */ | 4194304 /* Index */ | 16777216 /* Conditional */)) {
58142
58147
  constraint = getConstraintOfType(constraint);
@@ -58168,7 +58173,7 @@ function createTypeChecker(host) {
58168
58173
  return void 0;
58169
58174
  }
58170
58175
  function getBaseConstraintOfType(type) {
58171
- if (type.flags & (595853312 /* InstantiableNonPrimitive */ | 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) {
58176
+ if (type.flags & (58982400 /* InstantiableNonPrimitive */ | 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) {
58172
58177
  const constraint = getResolvedBaseConstraint(type);
58173
58178
  return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : void 0;
58174
58179
  }
@@ -58259,9 +58264,6 @@ function createTypeChecker(host) {
58259
58264
  const constraint = getBaseConstraint(t.type);
58260
58265
  return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType;
58261
58266
  }
58262
- if (t.flags & 536870912 /* NoInfer */) {
58263
- return getBaseConstraint(t.type);
58264
- }
58265
58267
  if (t.flags & 8388608 /* IndexedAccess */) {
58266
58268
  if (isMappedTypeGenericIndexedAccess(t)) {
58267
58269
  return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType));
@@ -58335,7 +58337,7 @@ function createTypeChecker(host) {
58335
58337
  return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
58336
58338
  }
58337
58339
  function getApparentType(type) {
58338
- const t = !(type.flags & 1002700800 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
58340
+ const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
58339
58341
  return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
58340
58342
  }
58341
58343
  function getReducedApparentType(type) {
@@ -58546,6 +58548,13 @@ function createTypeChecker(host) {
58546
58548
  function isConflictingPrivateProperty(prop) {
58547
58549
  return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
58548
58550
  }
58551
+ function isGenericReducibleType(type) {
58552
+ return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
58553
+ }
58554
+ function isReducibleIntersection(type) {
58555
+ const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
58556
+ return getReducedType(uniqueFilled) !== uniqueFilled;
58557
+ }
58549
58558
  function elaborateNeverIntersection(errorInfo, type) {
58550
58559
  if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
58551
58560
  const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
@@ -59414,11 +59423,8 @@ function createTypeChecker(host) {
59414
59423
  }
59415
59424
  function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
59416
59425
  const type = getDeclaredTypeOfSymbol(symbol);
59417
- if (type === intrinsicMarkerType && typeArguments && typeArguments.length === 1) {
59418
- if (stringMappingTypeKinds.has(symbol.escapedName)) {
59419
- return getStringMappingType(symbol, typeArguments[0]);
59420
- }
59421
- return getNoInferType(symbol, typeArguments[0]);
59426
+ if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
59427
+ return getStringMappingType(symbol, typeArguments[0]);
59422
59428
  }
59423
59429
  const links = getSymbolLinks(symbol);
59424
59430
  const typeParameters = links.typeParameters;
@@ -60322,7 +60328,7 @@ function createTypeChecker(host) {
60322
60328
  const type = elementTypes[i];
60323
60329
  const flags = target.elementFlags[i];
60324
60330
  if (flags & 8 /* Variadic */) {
60325
- if (type.flags & 595853312 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
60331
+ if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
60326
60332
  addElement(type, 8 /* Variadic */, (_a2 = target.labeledElementDeclarations) == null ? void 0 : _a2[i]);
60327
60333
  } else if (isTupleType(type)) {
60328
60334
  const elements = getTypeArguments(type);
@@ -60431,7 +60437,7 @@ function createTypeChecker(host) {
60431
60437
  }
60432
60438
  if (!(flags & 131072 /* Never */)) {
60433
60439
  includes |= flags & 473694207 /* IncludesMask */;
60434
- if (flags & 1002700800 /* Instantiable */)
60440
+ if (flags & 465829888 /* Instantiable */)
60435
60441
  includes |= 33554432 /* IncludesInstantiable */;
60436
60442
  if (type === wildcardType)
60437
60443
  includes |= 8388608 /* IncludesWildcard */;
@@ -60471,8 +60477,8 @@ function createTypeChecker(host) {
60471
60477
  while (i > 0) {
60472
60478
  i--;
60473
60479
  const source = types[i];
60474
- if (hasEmptyObject || source.flags & 1006370816 /* StructuredOrInstantiable */) {
60475
- const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 595853312 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
60480
+ if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
60481
+ const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
60476
60482
  const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
60477
60483
  for (const target of types) {
60478
60484
  if (source !== target) {
@@ -60485,7 +60491,7 @@ function createTypeChecker(host) {
60485
60491
  }
60486
60492
  }
60487
60493
  count++;
60488
- if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 595853312 /* InstantiableNonPrimitive */)) {
60494
+ if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
60489
60495
  const t = getTypeOfPropertyOfType(target, keyProperty.escapedName);
60490
60496
  if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) {
60491
60497
  continue;
@@ -60918,10 +60924,10 @@ function createTypeChecker(host) {
60918
60924
  }
60919
60925
  return links.resolvedType;
60920
60926
  }
60921
- function createIndexType(type, stringsOnly) {
60927
+ function createIndexType(type, indexFlags) {
60922
60928
  const result = createType(4194304 /* Index */);
60923
60929
  result.type = type;
60924
- result.stringsOnly = stringsOnly;
60930
+ result.indexFlags = indexFlags;
60925
60931
  return result;
60926
60932
  }
60927
60933
  function createOriginIndexType(type) {
@@ -60929,31 +60935,23 @@ function createTypeChecker(host) {
60929
60935
  result.type = type;
60930
60936
  return result;
60931
60937
  }
60932
- function getIndexTypeForGenericType(type, stringsOnly) {
60933
- return stringsOnly ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(
60934
- type,
60935
- /*stringsOnly*/
60936
- true
60937
- )) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
60938
- type,
60939
- /*stringsOnly*/
60940
- false
60941
- ));
60938
+ function getIndexTypeForGenericType(type, indexFlags) {
60939
+ return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */));
60942
60940
  }
60943
- function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) {
60941
+ function getIndexTypeForMappedType(type, indexFlags) {
60944
60942
  const typeParameter = getTypeParameterFromMappedType(type);
60945
60943
  const constraintType = getConstraintTypeFromMappedType(type);
60946
60944
  const nameType = getNameTypeFromMappedType(type.target || type);
60947
- if (!nameType && !noIndexSignatures) {
60945
+ if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
60948
60946
  return constraintType;
60949
60947
  }
60950
60948
  const keyTypes = [];
60951
60949
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
60952
60950
  if (!isGenericIndexType(constraintType)) {
60953
60951
  const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
60954
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, stringsOnly, addMemberForKeyType);
60952
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
60955
60953
  } else {
60956
- return getIndexTypeForGenericType(type, stringsOnly);
60954
+ return getIndexTypeForGenericType(type, indexFlags);
60957
60955
  }
60958
60956
  } else {
60959
60957
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
@@ -60961,7 +60959,7 @@ function createTypeChecker(host) {
60961
60959
  if (isGenericIndexType(constraintType)) {
60962
60960
  forEachType(constraintType, addMemberForKeyType);
60963
60961
  }
60964
- const result = noIndexSignatures ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
60962
+ const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
60965
60963
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
60966
60964
  return constraintType;
60967
60965
  }
@@ -61014,19 +61012,15 @@ function createTypeChecker(host) {
61014
61012
  origin
61015
61013
  );
61016
61014
  }
61017
- function isPossiblyReducibleByInstantiation(type) {
61018
- const uniqueFilled = getUniqueLiteralFilledInstantiation(type);
61019
- return getReducedType(uniqueFilled) !== uniqueFilled;
61020
- }
61021
- function shouldDeferIndexType(type) {
61022
- return !!(type.flags & 595853312 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 1002700800 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
61015
+ function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
61016
+ return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
61023
61017
  }
61024
- function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
61018
+ function getIndexType(type, indexFlags = defaultIndexFlags) {
61025
61019
  type = getReducedType(type);
61026
- return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type, stringsOnly) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, stringsOnly, noIndexSignatures))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, stringsOnly, noIndexSignatures))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
61020
+ return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
61027
61021
  type,
61028
- (noIndexSignatures ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (stringsOnly ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
61029
- stringsOnly === keyofStringsOnly && !noIndexSignatures
61022
+ (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
61023
+ indexFlags === defaultIndexFlags
61030
61024
  );
61031
61025
  }
61032
61026
  function getExtractStringType(type) {
@@ -61151,19 +61145,8 @@ function createTypeChecker(host) {
61151
61145
  )
61152
61146
  );
61153
61147
  }
61154
- function getNoInferType(symbol, type) {
61155
- if (!isGenericType(type)) {
61156
- return type;
61157
- }
61158
- const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
61159
- let result = intrinsicWrapperTypes.get(id);
61160
- if (!result) {
61161
- intrinsicWrapperTypes.set(id, result = createNoInferType(symbol, type));
61162
- }
61163
- return result;
61164
- }
61165
61148
  function applyStringMapping(symbol, str) {
61166
- switch (stringMappingTypeKinds.get(symbol.escapedName)) {
61149
+ switch (intrinsicTypeKinds.get(symbol.escapedName)) {
61167
61150
  case 0 /* Uppercase */:
61168
61151
  return str.toUpperCase();
61169
61152
  case 1 /* Lowercase */:
@@ -61176,7 +61159,7 @@ function createTypeChecker(host) {
61176
61159
  return str;
61177
61160
  }
61178
61161
  function applyTemplateStringMapping(symbol, texts, types) {
61179
- switch (stringMappingTypeKinds.get(symbol.escapedName)) {
61162
+ switch (intrinsicTypeKinds.get(symbol.escapedName)) {
61180
61163
  case 0 /* Uppercase */:
61181
61164
  return [texts.map((t) => t.toUpperCase()), types.map((t) => getStringMappingType(symbol, t))];
61182
61165
  case 1 /* Lowercase */:
@@ -61190,9 +61173,9 @@ function createTypeChecker(host) {
61190
61173
  }
61191
61174
  function getStringMappingTypeForGenericType(symbol, type) {
61192
61175
  const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
61193
- let result = intrinsicWrapperTypes.get(id);
61176
+ let result = stringMappingTypes.get(id);
61194
61177
  if (!result) {
61195
- intrinsicWrapperTypes.set(id, result = createStringMappingType(symbol, type));
61178
+ stringMappingTypes.set(id, result = createStringMappingType(symbol, type));
61196
61179
  }
61197
61180
  return result;
61198
61181
  }
@@ -61201,11 +61184,6 @@ function createTypeChecker(host) {
61201
61184
  result.type = type;
61202
61185
  return result;
61203
61186
  }
61204
- function createNoInferType(symbol, type) {
61205
- const result = createTypeWithSymbol(536870912 /* NoInfer */, symbol);
61206
- result.type = type;
61207
- return result;
61208
- }
61209
61187
  function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
61210
61188
  const type = createType(8388608 /* IndexedAccess */);
61211
61189
  type.objectType = objectType;
@@ -61228,7 +61206,7 @@ function createTypeChecker(host) {
61228
61206
  if (type.flags & 2097152 /* Intersection */) {
61229
61207
  return some(type.types, isJSLiteralType);
61230
61208
  }
61231
- if (type.flags & 1002700800 /* Instantiable */) {
61209
+ if (type.flags & 465829888 /* Instantiable */) {
61232
61210
  const constraint = getResolvedBaseConstraint(type);
61233
61211
  return constraint !== type && isJSLiteralType(constraint);
61234
61212
  }
@@ -61480,7 +61458,7 @@ function createTypeChecker(host) {
61480
61458
  }
61481
61459
  return type.objectFlags & 12582912 /* IsGenericType */;
61482
61460
  }
61483
- return (type.flags & 595853312 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (595853312 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
61461
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
61484
61462
  }
61485
61463
  function getSimplifiedType(type, writing) {
61486
61464
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -61509,7 +61487,7 @@ function createTypeChecker(host) {
61509
61487
  if (distributedOverIndex) {
61510
61488
  return type[cache] = distributedOverIndex;
61511
61489
  }
61512
- if (!(indexType.flags & 1002700800 /* Instantiable */)) {
61490
+ if (!(indexType.flags & 465829888 /* Instantiable */)) {
61513
61491
  const distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
61514
61492
  if (distributedOverObject) {
61515
61493
  return type[cache] = distributedOverObject;
@@ -61582,12 +61560,13 @@ function createTypeChecker(host) {
61582
61560
  if (objectType === wildcardType || indexType === wildcardType) {
61583
61561
  return wildcardType;
61584
61562
  }
61563
+ objectType = getReducedType(objectType);
61585
61564
  if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
61586
61565
  indexType = stringType;
61587
61566
  }
61588
61567
  if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
61589
61568
  accessFlags |= 1 /* IncludeUndefined */;
61590
- if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
61569
+ if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
61591
61570
  if (objectType.flags & 3 /* AnyOrUnknown */) {
61592
61571
  return objectType;
61593
61572
  }
@@ -62560,7 +62539,7 @@ function createTypeChecker(host) {
62560
62539
  const mappedTypeVariable = instantiateType(typeVariable, mapper);
62561
62540
  if (typeVariable !== mappedTypeVariable) {
62562
62541
  return mapTypeWithAlias(getReducedType(mappedTypeVariable), (t) => {
62563
- if (t.flags & (3 /* AnyOrUnknown */ | 595853312 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
62542
+ if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
62564
62543
  if (!type.declaration.nameType) {
62565
62544
  let constraint;
62566
62545
  if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
@@ -62725,9 +62704,6 @@ function createTypeChecker(host) {
62725
62704
  if (flags & 268435456 /* StringMapping */) {
62726
62705
  return getStringMappingType(type.symbol, instantiateType(type.type, mapper));
62727
62706
  }
62728
- if (flags & 536870912 /* NoInfer */) {
62729
- return getNoInferType(type.symbol, instantiateType(type.type, mapper));
62730
- }
62731
62707
  if (flags & 8388608 /* IndexedAccess */) {
62732
62708
  const newAliasSymbol = aliasSymbol || type.aliasSymbol;
62733
62709
  const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
@@ -62776,9 +62752,6 @@ function createTypeChecker(host) {
62776
62752
  }
62777
62753
  return type;
62778
62754
  }
62779
- function getUniqueLiteralFilledInstantiation(type) {
62780
- return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
62781
- }
62782
62755
  function getPermissiveInstantiation(type) {
62783
62756
  return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
62784
62757
  }
@@ -62877,7 +62850,7 @@ function createTypeChecker(host) {
62877
62850
  return isTypeRelatedTo(source, target, assignableRelation);
62878
62851
  }
62879
62852
  function isTypeDerivedFrom(source, target) {
62880
- return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 595853312 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
62853
+ return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
62881
62854
  }
62882
62855
  function isTypeComparableTo(source, target) {
62883
62856
  return isTypeRelatedTo(source, target, comparableRelation);
@@ -63490,7 +63463,12 @@ function createTypeChecker(host) {
63490
63463
  const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
63491
63464
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
63492
63465
  for (let i = 0; i < paramCount; i++) {
63493
- const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
63466
+ const sourceType = i === restIndex ? getRestTypeAtPosition(
63467
+ source,
63468
+ i,
63469
+ /*readonly*/
63470
+ true
63471
+ ) : tryGetTypeAtPosition(source, i);
63494
63472
  const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
63495
63473
  if (sourceType && targetType) {
63496
63474
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
@@ -63740,7 +63718,7 @@ function createTypeChecker(host) {
63740
63718
  return !!(related & 1 /* Succeeded */);
63741
63719
  }
63742
63720
  }
63743
- if (source.flags & 1006370816 /* StructuredOrInstantiable */ || target.flags & 1006370816 /* StructuredOrInstantiable */) {
63721
+ if (source.flags & 469499904 /* StructuredOrInstantiable */ || target.flags & 469499904 /* StructuredOrInstantiable */) {
63744
63722
  return checkTypeRelatedTo(
63745
63723
  source,
63746
63724
  target,
@@ -63756,7 +63734,7 @@ function createTypeChecker(host) {
63756
63734
  }
63757
63735
  function getNormalizedType(type, writing) {
63758
63736
  while (true) {
63759
- const t = isFreshLiteralType(type) ? type.regularType : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type.flags & 536870912 /* NoInfer */ ? type.type : type;
63737
+ const t = isFreshLiteralType(type) ? type.regularType : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
63760
63738
  if (t === type)
63761
63739
  return t;
63762
63740
  type = t;
@@ -64114,7 +64092,7 @@ function createTypeChecker(host) {
64114
64092
  }
64115
64093
  if (relation === comparableRelation && !(target2.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors2 ? reportError : void 0))
64116
64094
  return -1 /* True */;
64117
- if (source2.flags & 1006370816 /* StructuredOrInstantiable */ || target2.flags & 1006370816 /* StructuredOrInstantiable */) {
64095
+ if (source2.flags & 469499904 /* StructuredOrInstantiable */ || target2.flags & 469499904 /* StructuredOrInstantiable */) {
64118
64096
  const isPerformingExcessPropertyChecks = !(intersectionState & 2 /* Target */) && (isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */);
64119
64097
  if (isPerformingExcessPropertyChecks) {
64120
64098
  if (hasExcessProperties(source2, target2, reportErrors2)) {
@@ -64153,7 +64131,7 @@ function createTypeChecker(host) {
64153
64131
  return 0 /* False */;
64154
64132
  }
64155
64133
  traceUnionsOrIntersectionsTooLarge(source2, target2);
64156
- const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags & 1006370816 /* StructuredOrInstantiable */);
64134
+ const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags & 469499904 /* StructuredOrInstantiable */);
64157
64135
  const result2 = skipCaching ? unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) : recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags);
64158
64136
  if (result2) {
64159
64137
  return result2;
@@ -64341,7 +64319,7 @@ function createTypeChecker(host) {
64341
64319
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
64342
64320
  }
64343
64321
  if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) {
64344
- const constraints = sameMap(source2.types, (t) => t.flags & 1002700800 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
64322
+ const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
64345
64323
  if (constraints !== source2.types) {
64346
64324
  source2 = getIntersectionType(constraints);
64347
64325
  if (source2.flags & 131072 /* Never */) {
@@ -64892,7 +64870,7 @@ function createTypeChecker(host) {
64892
64870
  if (result2 = unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState)) {
64893
64871
  return result2;
64894
64872
  }
64895
- if (!(sourceFlags & 1002700800 /* Instantiable */ || sourceFlags & 524288 /* Object */ && targetFlags & 1048576 /* Union */ || sourceFlags & 2097152 /* Intersection */ && targetFlags & (524288 /* Object */ | 1048576 /* Union */ | 1002700800 /* Instantiable */))) {
64873
+ if (!(sourceFlags & 465829888 /* Instantiable */ || sourceFlags & 524288 /* Object */ && targetFlags & 1048576 /* Union */ || sourceFlags & 2097152 /* Intersection */ && targetFlags & (524288 /* Object */ | 1048576 /* Union */ | 465829888 /* Instantiable */))) {
64896
64874
  return 0 /* False */;
64897
64875
  }
64898
64876
  }
@@ -64961,7 +64939,7 @@ function createTypeChecker(host) {
64961
64939
  } else {
64962
64940
  const constraint = getSimplifiedTypeOrConstraint(targetType);
64963
64941
  if (constraint) {
64964
- if (isRelatedTo(source2, getIndexType(constraint, target2.stringsOnly), 2 /* Target */, reportErrors2) === -1 /* True */) {
64942
+ if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
64965
64943
  return -1 /* True */;
64966
64944
  }
64967
64945
  } else if (isGenericMappedType(targetType)) {
@@ -65042,13 +65020,7 @@ function createTypeChecker(host) {
65042
65020
  }
65043
65021
  if (!isGenericMappedType(source2)) {
65044
65022
  const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
65045
- const sourceKeys = getIndexType(
65046
- source2,
65047
- /*stringsOnly*/
65048
- void 0,
65049
- /*noIndexSignatures*/
65050
- true
65051
- );
65023
+ const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
65052
65024
  const includeOptional = modifiers & 4 /* IncludeOptional */;
65053
65025
  const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
65054
65026
  if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
@@ -66083,7 +66055,7 @@ function createTypeChecker(host) {
66083
66055
  if (type.flags & 3145728 /* UnionOrIntersection */) {
66084
66056
  return !!forEach(type.types, typeCouldHaveTopLevelSingletonTypes);
66085
66057
  }
66086
- if (type.flags & 1002700800 /* Instantiable */) {
66058
+ if (type.flags & 465829888 /* Instantiable */) {
66087
66059
  const constraint = getConstraintOfType(type);
66088
66060
  if (constraint && constraint !== type) {
66089
66061
  return typeCouldHaveTopLevelSingletonTypes(constraint);
@@ -67132,7 +67104,7 @@ function createTypeChecker(host) {
67132
67104
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
67133
67105
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
67134
67106
  }
67135
- const result = !!(type.flags & 1002700800 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || forEach(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
67107
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || forEach(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
67136
67108
  if (type.flags & 3899393 /* ObjectFlagsType */) {
67137
67109
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
67138
67110
  }
@@ -67414,7 +67386,7 @@ function createTypeChecker(host) {
67414
67386
  let expandingFlags = 0 /* None */;
67415
67387
  inferFromTypes(originalSource, originalTarget);
67416
67388
  function inferFromTypes(source, target) {
67417
- if (!couldContainTypeVariables(target) || source.flags & 536870912 /* NoInfer */) {
67389
+ if (!couldContainTypeVariables(target)) {
67418
67390
  return;
67419
67391
  }
67420
67392
  if (source === wildcardType) {
@@ -67513,7 +67485,7 @@ function createTypeChecker(host) {
67513
67485
  /*writing*/
67514
67486
  false
67515
67487
  );
67516
- if (indexType.flags & 1002700800 /* Instantiable */) {
67488
+ if (indexType.flags & 465829888 /* Instantiable */) {
67517
67489
  const simplified2 = distributeIndexOverObjectType(
67518
67490
  getSimplifiedType(
67519
67491
  target.objectType,
@@ -67560,7 +67532,7 @@ function createTypeChecker(host) {
67560
67532
  inferToTemplateLiteralType(source, target);
67561
67533
  } else {
67562
67534
  source = getReducedType(source);
67563
- if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 1002700800 /* Instantiable */))) {
67535
+ if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) {
67564
67536
  const apparentSource = getApparentType(source);
67565
67537
  if (apparentSource !== source && allowComplexConstraintInference && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
67566
67538
  allowComplexConstraintInference = false;
@@ -68312,7 +68284,7 @@ function createTypeChecker(host) {
68312
68284
  const map2 = /* @__PURE__ */ new Map();
68313
68285
  let count = 0;
68314
68286
  for (const type of types) {
68315
- if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 595853312 /* InstantiableNonPrimitive */)) {
68287
+ if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
68316
68288
  const discriminant = getTypeOfPropertyOfType(type, name);
68317
68289
  if (discriminant) {
68318
68290
  if (!isLiteralType(discriminant)) {
@@ -68338,11 +68310,11 @@ function createTypeChecker(host) {
68338
68310
  }
68339
68311
  function getKeyPropertyName(unionType) {
68340
68312
  const types = unionType.types;
68341
- if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ | 595853312 /* InstantiableNonPrimitive */))) < 10) {
68313
+ if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */))) < 10) {
68342
68314
  return void 0;
68343
68315
  }
68344
68316
  if (unionType.keyPropertyName === void 0) {
68345
- const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ | 595853312 /* InstantiableNonPrimitive */) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : void 0) : void 0);
68317
+ const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : void 0) : void 0);
68346
68318
  const mapByKeyProperty = keyPropertyName && mapTypesByKeyProperty(types, keyPropertyName);
68347
68319
  unionType.keyPropertyName = mapByKeyProperty ? keyPropertyName : "";
68348
68320
  unionType.constituentMap = mapByKeyProperty;
@@ -68420,7 +68392,7 @@ function createTypeChecker(host) {
68420
68392
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
68421
68393
  }
68422
68394
  function getTypeFacts(type) {
68423
- if (type.flags & (2097152 /* Intersection */ | 1002700800 /* Instantiable */)) {
68395
+ if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
68424
68396
  type = getBaseConstraintOfType(type) || unknownType;
68425
68397
  }
68426
68398
  const flags = type.flags;
@@ -69965,7 +69937,7 @@ function createTypeChecker(host) {
69965
69937
  const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
69966
69938
  const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
69967
69939
  const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
69968
- return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 1002700800 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
69940
+ return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
69969
69941
  });
69970
69942
  return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
69971
69943
  }
@@ -70145,10 +70117,10 @@ function createTypeChecker(host) {
70145
70117
  return parent2.kind === 209 /* PropertyAccessExpression */ || parent2.kind === 164 /* QualifiedName */ || parent2.kind === 211 /* CallExpression */ && parent2.expression === node || parent2.kind === 210 /* ElementAccessExpression */ && parent2.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent2.argumentExpression)));
70146
70118
  }
70147
70119
  function isGenericTypeWithUnionConstraint(type) {
70148
- return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 1002700800 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
70120
+ return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
70149
70121
  }
70150
70122
  function isGenericTypeWithoutNullableConstraint(type) {
70151
- return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 1002700800 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
70123
+ return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
70152
70124
  }
70153
70125
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
70154
70126
  const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 64 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
@@ -71456,7 +71428,7 @@ function createTypeChecker(host) {
71456
71428
  }
71457
71429
  }
71458
71430
  function instantiateContextualType(contextualType, node, contextFlags) {
71459
- if (contextualType && maybeTypeOfKind(contextualType, 1002700800 /* Instantiable */)) {
71431
+ if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* Instantiable */)) {
71460
71432
  const inferenceContext = getInferenceContext(node);
71461
71433
  if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
71462
71434
  return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
@@ -71469,7 +71441,7 @@ function createTypeChecker(host) {
71469
71441
  return contextualType;
71470
71442
  }
71471
71443
  function instantiateInstantiableTypes(type, mapper) {
71472
- if (type.flags & 1002700800 /* Instantiable */) {
71444
+ if (type.flags & 465829888 /* Instantiable */) {
71473
71445
  return instantiateType(type, mapper);
71474
71446
  }
71475
71447
  if (type.flags & 1048576 /* Union */) {
@@ -72243,7 +72215,7 @@ function createTypeChecker(host) {
72243
72215
  }
72244
72216
  function isValidSpreadType(type) {
72245
72217
  const t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType));
72246
- return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ | 595853312 /* InstantiableNonPrimitive */) || t.flags & 3145728 /* UnionOrIntersection */ && every(t.types, isValidSpreadType));
72218
+ return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) || t.flags & 3145728 /* UnionOrIntersection */ && every(t.types, isValidSpreadType));
72247
72219
  }
72248
72220
  function checkJsxSelfClosingElementDeferred(node) {
72249
72221
  checkJsxOpeningLikeElementOrOpeningFragment(node);
@@ -75797,7 +75769,7 @@ function createTypeChecker(host) {
75797
75769
  result3.node = node;
75798
75770
  return result3;
75799
75771
  }
75800
- } else if (type2.flags & 595853312 /* InstantiableNonPrimitive */) {
75772
+ } else if (type2.flags & 58982400 /* InstantiableNonPrimitive */) {
75801
75773
  const constraint = getBaseConstraintOfType(type2);
75802
75774
  if (constraint) {
75803
75775
  const instantiated = getInstantiatedTypePart(constraint);
@@ -75981,12 +75953,12 @@ function createTypeChecker(host) {
75981
75953
  }
75982
75954
  return void 0;
75983
75955
  }
75984
- function getRestTypeAtPosition(source, pos) {
75956
+ function getRestTypeAtPosition(source, pos, readonly = false) {
75985
75957
  const parameterCount = getParameterCount(source);
75986
75958
  const minArgumentCount = getMinArgumentCount(source);
75987
75959
  const restType = getEffectiveRestType(source);
75988
75960
  if (restType && pos >= parameterCount - 1) {
75989
- return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
75961
+ return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
75990
75962
  }
75991
75963
  const types = [];
75992
75964
  const flags = [];
@@ -76004,13 +75976,7 @@ function createTypeChecker(host) {
76004
75976
  names.push(name);
76005
75977
  }
76006
75978
  }
76007
- return createTupleType(
76008
- types,
76009
- flags,
76010
- /*readonly*/
76011
- false,
76012
- length(names) === length(types) ? names : void 0
76013
- );
75979
+ return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
76014
75980
  }
76015
75981
  function getParameterCount(signature) {
76016
75982
  const length2 = signature.parameters.length;
@@ -78070,7 +78036,7 @@ function createTypeChecker(host) {
78070
78036
  ) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
78071
78037
  }
78072
78038
  function isTemplateLiteralContextualType(type) {
78073
- return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 595853312 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
78039
+ return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
78074
78040
  }
78075
78041
  function getContextNode2(node) {
78076
78042
  if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
@@ -78183,7 +78149,7 @@ function createTypeChecker(host) {
78183
78149
  const types = contextualType.types;
78184
78150
  return some(types, (t) => isLiteralOfContextualType(candidateType, t));
78185
78151
  }
78186
- if (contextualType.flags & 595853312 /* InstantiableNonPrimitive */) {
78152
+ if (contextualType.flags & 58982400 /* InstantiableNonPrimitive */) {
78187
78153
  const constraint = getBaseConstraintOfType(contextualType) || unknownType;
78188
78154
  return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) || maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) || maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) || maybeTypeOfKind(constraint, 4096 /* ESSymbol */) && maybeTypeOfKind(candidateType, 8192 /* UniqueESSymbol */) || isLiteralOfContextualType(candidateType, constraint);
78189
78155
  }
@@ -79288,11 +79254,7 @@ function createTypeChecker(host) {
79288
79254
  }
79289
79255
  const objectType = type.objectType;
79290
79256
  const indexType = type.indexType;
79291
- if (isTypeAssignableTo(indexType, getIndexType(
79292
- objectType,
79293
- /*stringsOnly*/
79294
- false
79295
- ))) {
79257
+ if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
79296
79258
  if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
79297
79259
  error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
79298
79260
  }
@@ -81241,7 +81203,7 @@ function createTypeChecker(host) {
81241
81203
  );
81242
81204
  }
81243
81205
  }
81244
- if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 595853312 /* InstantiableNonPrimitive */)) {
81206
+ if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
81245
81207
  error(node.expression, 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));
81246
81208
  }
81247
81209
  checkSourceElement(node.statement);
@@ -82918,7 +82880,7 @@ function createTypeChecker(host) {
82918
82880
  checkExportsOnMergedDeclarations(node);
82919
82881
  checkTypeParameters(node.typeParameters);
82920
82882
  if (node.type.kind === 140 /* IntrinsicKeyword */) {
82921
- if (!stringMappingTypeKinds.has(node.name.escapedText) && node.name.escapedText !== "NoInfer" || length(node.typeParameters) !== 1) {
82883
+ if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
82922
82884
  error(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
82923
82885
  }
82924
82886
  } else {
@@ -86112,7 +86074,8 @@ function createTypeChecker(host) {
86112
86074
  return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
86113
86075
  }
86114
86076
  if (!(node.parent.kind === 261 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 256 /* Abstract */))) {
86115
- return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
86077
+ const message = node.kind === 170 /* PropertyDeclaration */ ? Diagnostics.Abstract_properties_can_only_appear_within_an_abstract_class : Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class;
86078
+ return grammarErrorOnNode(modifier, message);
86116
86079
  }
86117
86080
  if (flags & 32 /* Static */) {
86118
86081
  return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
@@ -133538,6 +133501,11 @@ function canBeConvertedToAsync(node) {
133538
133501
  }
133539
133502
 
133540
133503
  // src/services/transpile.ts
133504
+ var optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
133505
+ "isolatedModules",
133506
+ "preserveValueImports",
133507
+ "importsNotUsedAsValues"
133508
+ ]);
133541
133509
  function transpileModule(input, transpileOptions) {
133542
133510
  const diagnostics = [];
133543
133511
  const options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
@@ -133548,6 +133516,9 @@ function transpileModule(input, transpileOptions) {
133548
133516
  }
133549
133517
  }
133550
133518
  for (const option of transpileOptionValueCompilerOptions) {
133519
+ if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
133520
+ continue;
133521
+ }
133551
133522
  options[option.name] = option.transpileOptionValue;
133552
133523
  }
133553
133524
  options.suppressOutputPathCheck = true;
@@ -168103,6 +168074,7 @@ __export(ts_exports3, {
168103
168074
  ImportKind: () => ImportKind,
168104
168075
  ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
168105
168076
  IndentStyle: () => IndentStyle,
168077
+ IndexFlags: () => IndexFlags,
168106
168078
  IndexKind: () => IndexKind,
168107
168079
  InferenceFlags: () => InferenceFlags,
168108
168080
  InferencePriority: () => InferencePriority,
@@ -182061,6 +182033,7 @@ start(initializeNodeSystem(), require("os").platform());
182061
182033
  ImportKind,
182062
182034
  ImportsNotUsedAsValues,
182063
182035
  IndentStyle,
182036
+ IndexFlags,
182064
182037
  IndexKind,
182065
182038
  InferenceFlags,
182066
182039
  InferencePriority,