typescript 5.1.0-dev.20230313 → 5.1.0-dev.20230315

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/README.md CHANGED
@@ -17,13 +17,13 @@ Find others who are using TypeScript at [our community page](https://www.typescr
17
17
  For the latest stable version:
18
18
 
19
19
  ```bash
20
- npm install -g typescript
20
+ npm install -D typescript
21
21
  ```
22
22
 
23
23
  For our nightly builds:
24
24
 
25
25
  ```bash
26
- npm install -g typescript@next
26
+ npm install -D typescript@next
27
27
  ```
28
28
 
29
29
  ## Contribute
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.1";
26
- var version = `${versionMajorMinor}.0-dev.20230313`;
26
+ var version = `${versionMajorMinor}.0-dev.20230315`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -5935,6 +5935,7 @@ var Diagnostics = {
5935
5935
  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'."),
5936
5936
  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."),
5937
5937
  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."),
5938
+ 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."),
5938
5939
  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."),
5939
5940
  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."),
5940
5941
  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."),
@@ -42681,6 +42682,7 @@ function createTypeChecker(host) {
42681
42682
  var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
42682
42683
  var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
42683
42684
  var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
42685
+ var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
42684
42686
  var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
42685
42687
  var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
42686
42688
  var checkBinaryExpression = createCheckBinaryExpression();
@@ -53949,6 +53951,13 @@ function createTypeChecker(host) {
53949
53951
  function isConflictingPrivateProperty(prop) {
53950
53952
  return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
53951
53953
  }
53954
+ function isGenericReducibleType(type) {
53955
+ return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
53956
+ }
53957
+ function isReducibleIntersection(type) {
53958
+ const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
53959
+ return getReducedType(uniqueFilled) !== uniqueFilled;
53960
+ }
53952
53961
  function elaborateNeverIntersection(errorInfo, type) {
53953
53962
  if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
53954
53963
  const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
@@ -56318,10 +56327,10 @@ function createTypeChecker(host) {
56318
56327
  }
56319
56328
  return links.resolvedType;
56320
56329
  }
56321
- function createIndexType(type, stringsOnly) {
56330
+ function createIndexType(type, indexFlags) {
56322
56331
  const result = createType(4194304 /* Index */);
56323
56332
  result.type = type;
56324
- result.stringsOnly = stringsOnly;
56333
+ result.indexFlags = indexFlags;
56325
56334
  return result;
56326
56335
  }
56327
56336
  function createOriginIndexType(type) {
@@ -56329,31 +56338,23 @@ function createTypeChecker(host) {
56329
56338
  result.type = type;
56330
56339
  return result;
56331
56340
  }
56332
- function getIndexTypeForGenericType(type, stringsOnly) {
56333
- return stringsOnly ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(
56334
- type,
56335
- /*stringsOnly*/
56336
- true
56337
- )) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
56338
- type,
56339
- /*stringsOnly*/
56340
- false
56341
- ));
56341
+ function getIndexTypeForGenericType(type, indexFlags) {
56342
+ return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */));
56342
56343
  }
56343
- function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) {
56344
+ function getIndexTypeForMappedType(type, indexFlags) {
56344
56345
  const typeParameter = getTypeParameterFromMappedType(type);
56345
56346
  const constraintType = getConstraintTypeFromMappedType(type);
56346
56347
  const nameType = getNameTypeFromMappedType(type.target || type);
56347
- if (!nameType && !noIndexSignatures) {
56348
+ if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
56348
56349
  return constraintType;
56349
56350
  }
56350
56351
  const keyTypes = [];
56351
56352
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
56352
56353
  if (!isGenericIndexType(constraintType)) {
56353
56354
  const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
56354
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, stringsOnly, addMemberForKeyType);
56355
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
56355
56356
  } else {
56356
- return getIndexTypeForGenericType(type, stringsOnly);
56357
+ return getIndexTypeForGenericType(type, indexFlags);
56357
56358
  }
56358
56359
  } else {
56359
56360
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
@@ -56361,7 +56362,7 @@ function createTypeChecker(host) {
56361
56362
  if (isGenericIndexType(constraintType)) {
56362
56363
  forEachType(constraintType, addMemberForKeyType);
56363
56364
  }
56364
- const result = noIndexSignatures ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
56365
+ const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
56365
56366
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
56366
56367
  return constraintType;
56367
56368
  }
@@ -56414,19 +56415,15 @@ function createTypeChecker(host) {
56414
56415
  origin
56415
56416
  );
56416
56417
  }
56417
- function isPossiblyReducibleByInstantiation(type) {
56418
- const uniqueFilled = getUniqueLiteralFilledInstantiation(type);
56419
- return getReducedType(uniqueFilled) !== uniqueFilled;
56418
+ function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
56419
+ 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));
56420
56420
  }
56421
- function shouldDeferIndexType(type) {
56422
- return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
56423
- }
56424
- function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
56421
+ function getIndexType(type, indexFlags = defaultIndexFlags) {
56425
56422
  type = getReducedType(type);
56426
- 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(
56423
+ 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(
56427
56424
  type,
56428
- (noIndexSignatures ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (stringsOnly ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
56429
- stringsOnly === keyofStringsOnly && !noIndexSignatures
56425
+ (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
56426
+ indexFlags === defaultIndexFlags
56430
56427
  );
56431
56428
  }
56432
56429
  function getExtractStringType(type) {
@@ -56966,12 +56963,13 @@ function createTypeChecker(host) {
56966
56963
  if (objectType === wildcardType || indexType === wildcardType) {
56967
56964
  return wildcardType;
56968
56965
  }
56966
+ objectType = getReducedType(objectType);
56969
56967
  if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
56970
56968
  indexType = stringType;
56971
56969
  }
56972
56970
  if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
56973
56971
  accessFlags |= 1 /* IncludeUndefined */;
56974
- if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
56972
+ 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))) {
56975
56973
  if (objectType.flags & 3 /* AnyOrUnknown */) {
56976
56974
  return objectType;
56977
56975
  }
@@ -58157,9 +58155,6 @@ function createTypeChecker(host) {
58157
58155
  }
58158
58156
  return type;
58159
58157
  }
58160
- function getUniqueLiteralFilledInstantiation(type) {
58161
- return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
58162
- }
58163
58158
  function getPermissiveInstantiation(type) {
58164
58159
  return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
58165
58160
  }
@@ -60342,7 +60337,7 @@ function createTypeChecker(host) {
60342
60337
  } else {
60343
60338
  const constraint = getSimplifiedTypeOrConstraint(targetType);
60344
60339
  if (constraint) {
60345
- if (isRelatedTo(source2, getIndexType(constraint, target2.stringsOnly), 2 /* Target */, reportErrors2) === -1 /* True */) {
60340
+ if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
60346
60341
  return -1 /* True */;
60347
60342
  }
60348
60343
  } else if (isGenericMappedType(targetType)) {
@@ -60423,13 +60418,7 @@ function createTypeChecker(host) {
60423
60418
  }
60424
60419
  if (!isGenericMappedType(source2)) {
60425
60420
  const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
60426
- const sourceKeys = getIndexType(
60427
- source2,
60428
- /*stringsOnly*/
60429
- void 0,
60430
- /*noIndexSignatures*/
60431
- true
60432
- );
60421
+ const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
60433
60422
  const includeOptional = modifiers & 4 /* IncludeOptional */;
60434
60423
  const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
60435
60424
  if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
@@ -74669,11 +74658,7 @@ function createTypeChecker(host) {
74669
74658
  }
74670
74659
  const objectType = type.objectType;
74671
74660
  const indexType = type.indexType;
74672
- if (isTypeAssignableTo(indexType, getIndexType(
74673
- objectType,
74674
- /*stringsOnly*/
74675
- false
74676
- ))) {
74661
+ if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
74677
74662
  if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
74678
74663
  error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
74679
74664
  }
@@ -81493,7 +81478,8 @@ function createTypeChecker(host) {
81493
81478
  return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
81494
81479
  }
81495
81480
  if (!(node.parent.kind === 261 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 256 /* Abstract */))) {
81496
- return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
81481
+ 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;
81482
+ return grammarErrorOnNode(modifier, message);
81497
81483
  }
81498
81484
  if (flags & 32 /* Static */) {
81499
81485
  return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
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-dev.20230313`;
2288
+ var version = `${versionMajorMinor}.0-dev.20230315`;
2288
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2289
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2290
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6747,6 +6748,13 @@ var AccessFlags = /* @__PURE__ */ ((AccessFlags2) => {
6747
6748
  AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent";
6748
6749
  return AccessFlags2;
6749
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 || {});
6750
6758
  var JsxReferenceKind = /* @__PURE__ */ ((JsxReferenceKind2) => {
6751
6759
  JsxReferenceKind2[JsxReferenceKind2["Component"] = 0] = "Component";
6752
6760
  JsxReferenceKind2[JsxReferenceKind2["Function"] = 1] = "Function";
@@ -9389,6 +9397,7 @@ var Diagnostics = {
9389
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'."),
9390
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."),
9391
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."),
9392
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."),
9393
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."),
9394
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."),
@@ -47270,6 +47279,7 @@ function createTypeChecker(host) {
47270
47279
  var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
47271
47280
  var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
47272
47281
  var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
47282
+ var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
47273
47283
  var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
47274
47284
  var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
47275
47285
  var checkBinaryExpression = createCheckBinaryExpression();
@@ -58538,6 +58548,13 @@ function createTypeChecker(host) {
58538
58548
  function isConflictingPrivateProperty(prop) {
58539
58549
  return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
58540
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
+ }
58541
58558
  function elaborateNeverIntersection(errorInfo, type) {
58542
58559
  if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
58543
58560
  const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
@@ -60907,10 +60924,10 @@ function createTypeChecker(host) {
60907
60924
  }
60908
60925
  return links.resolvedType;
60909
60926
  }
60910
- function createIndexType(type, stringsOnly) {
60927
+ function createIndexType(type, indexFlags) {
60911
60928
  const result = createType(4194304 /* Index */);
60912
60929
  result.type = type;
60913
- result.stringsOnly = stringsOnly;
60930
+ result.indexFlags = indexFlags;
60914
60931
  return result;
60915
60932
  }
60916
60933
  function createOriginIndexType(type) {
@@ -60918,31 +60935,23 @@ function createTypeChecker(host) {
60918
60935
  result.type = type;
60919
60936
  return result;
60920
60937
  }
60921
- function getIndexTypeForGenericType(type, stringsOnly) {
60922
- return stringsOnly ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(
60923
- type,
60924
- /*stringsOnly*/
60925
- true
60926
- )) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
60927
- type,
60928
- /*stringsOnly*/
60929
- false
60930
- ));
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 */));
60931
60940
  }
60932
- function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) {
60941
+ function getIndexTypeForMappedType(type, indexFlags) {
60933
60942
  const typeParameter = getTypeParameterFromMappedType(type);
60934
60943
  const constraintType = getConstraintTypeFromMappedType(type);
60935
60944
  const nameType = getNameTypeFromMappedType(type.target || type);
60936
- if (!nameType && !noIndexSignatures) {
60945
+ if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
60937
60946
  return constraintType;
60938
60947
  }
60939
60948
  const keyTypes = [];
60940
60949
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
60941
60950
  if (!isGenericIndexType(constraintType)) {
60942
60951
  const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
60943
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, stringsOnly, addMemberForKeyType);
60952
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
60944
60953
  } else {
60945
- return getIndexTypeForGenericType(type, stringsOnly);
60954
+ return getIndexTypeForGenericType(type, indexFlags);
60946
60955
  }
60947
60956
  } else {
60948
60957
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
@@ -60950,7 +60959,7 @@ function createTypeChecker(host) {
60950
60959
  if (isGenericIndexType(constraintType)) {
60951
60960
  forEachType(constraintType, addMemberForKeyType);
60952
60961
  }
60953
- 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);
60954
60963
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
60955
60964
  return constraintType;
60956
60965
  }
@@ -61003,19 +61012,15 @@ function createTypeChecker(host) {
61003
61012
  origin
61004
61013
  );
61005
61014
  }
61006
- function isPossiblyReducibleByInstantiation(type) {
61007
- const uniqueFilled = getUniqueLiteralFilledInstantiation(type);
61008
- return getReducedType(uniqueFilled) !== uniqueFilled;
61009
- }
61010
- function shouldDeferIndexType(type) {
61011
- return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* 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));
61012
61017
  }
61013
- function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
61018
+ function getIndexType(type, indexFlags = defaultIndexFlags) {
61014
61019
  type = getReducedType(type);
61015
- 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(
61016
61021
  type,
61017
- (noIndexSignatures ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (stringsOnly ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
61018
- stringsOnly === keyofStringsOnly && !noIndexSignatures
61022
+ (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
61023
+ indexFlags === defaultIndexFlags
61019
61024
  );
61020
61025
  }
61021
61026
  function getExtractStringType(type) {
@@ -61555,12 +61560,13 @@ function createTypeChecker(host) {
61555
61560
  if (objectType === wildcardType || indexType === wildcardType) {
61556
61561
  return wildcardType;
61557
61562
  }
61563
+ objectType = getReducedType(objectType);
61558
61564
  if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
61559
61565
  indexType = stringType;
61560
61566
  }
61561
61567
  if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
61562
61568
  accessFlags |= 1 /* IncludeUndefined */;
61563
- 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))) {
61564
61570
  if (objectType.flags & 3 /* AnyOrUnknown */) {
61565
61571
  return objectType;
61566
61572
  }
@@ -62746,9 +62752,6 @@ function createTypeChecker(host) {
62746
62752
  }
62747
62753
  return type;
62748
62754
  }
62749
- function getUniqueLiteralFilledInstantiation(type) {
62750
- return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
62751
- }
62752
62755
  function getPermissiveInstantiation(type) {
62753
62756
  return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
62754
62757
  }
@@ -64931,7 +64934,7 @@ function createTypeChecker(host) {
64931
64934
  } else {
64932
64935
  const constraint = getSimplifiedTypeOrConstraint(targetType);
64933
64936
  if (constraint) {
64934
- if (isRelatedTo(source2, getIndexType(constraint, target2.stringsOnly), 2 /* Target */, reportErrors2) === -1 /* True */) {
64937
+ if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
64935
64938
  return -1 /* True */;
64936
64939
  }
64937
64940
  } else if (isGenericMappedType(targetType)) {
@@ -65012,13 +65015,7 @@ function createTypeChecker(host) {
65012
65015
  }
65013
65016
  if (!isGenericMappedType(source2)) {
65014
65017
  const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
65015
- const sourceKeys = getIndexType(
65016
- source2,
65017
- /*stringsOnly*/
65018
- void 0,
65019
- /*noIndexSignatures*/
65020
- true
65021
- );
65018
+ const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
65022
65019
  const includeOptional = modifiers & 4 /* IncludeOptional */;
65023
65020
  const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
65024
65021
  if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
@@ -79258,11 +79255,7 @@ function createTypeChecker(host) {
79258
79255
  }
79259
79256
  const objectType = type.objectType;
79260
79257
  const indexType = type.indexType;
79261
- if (isTypeAssignableTo(indexType, getIndexType(
79262
- objectType,
79263
- /*stringsOnly*/
79264
- false
79265
- ))) {
79258
+ if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
79266
79259
  if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
79267
79260
  error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
79268
79261
  }
@@ -86082,7 +86075,8 @@ function createTypeChecker(host) {
86082
86075
  return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
86083
86076
  }
86084
86077
  if (!(node.parent.kind === 261 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 256 /* Abstract */))) {
86085
- return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
86078
+ 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;
86079
+ return grammarErrorOnNode(modifier, message);
86086
86080
  }
86087
86081
  if (flags & 32 /* Static */) {
86088
86082
  return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
@@ -133508,6 +133502,11 @@ function canBeConvertedToAsync(node) {
133508
133502
  }
133509
133503
 
133510
133504
  // src/services/transpile.ts
133505
+ var optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
133506
+ "isolatedModules",
133507
+ "preserveValueImports",
133508
+ "importsNotUsedAsValues"
133509
+ ]);
133511
133510
  function transpileModule(input, transpileOptions) {
133512
133511
  const diagnostics = [];
133513
133512
  const options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
@@ -133518,6 +133517,9 @@ function transpileModule(input, transpileOptions) {
133518
133517
  }
133519
133518
  }
133520
133519
  for (const option of transpileOptionValueCompilerOptions) {
133520
+ if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
133521
+ continue;
133522
+ }
133521
133523
  options[option.name] = option.transpileOptionValue;
133522
133524
  }
133523
133525
  options.suppressOutputPathCheck = true;
@@ -168073,6 +168075,7 @@ __export(ts_exports3, {
168073
168075
  ImportKind: () => ImportKind,
168074
168076
  ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
168075
168077
  IndentStyle: () => IndentStyle,
168078
+ IndexFlags: () => IndexFlags,
168076
168079
  IndexKind: () => IndexKind,
168077
168080
  InferenceFlags: () => InferenceFlags,
168078
168081
  InferencePriority: () => InferencePriority,
@@ -182031,6 +182034,7 @@ start(initializeNodeSystem(), require("os").platform());
182031
182034
  ImportKind,
182032
182035
  ImportsNotUsedAsValues,
182033
182036
  IndentStyle,
182037
+ IndexFlags,
182034
182038
  IndexKind,
182035
182039
  InferenceFlags,
182036
182040
  InferencePriority,
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = `${versionMajorMinor}.0-dev.20230313`;
38
+ version = `${versionMajorMinor}.0-dev.20230315`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -3545,7 +3545,7 @@ ${lanes.join("\n")}
3545
3545
  const name = DiagnosticCategory[d.category];
3546
3546
  return lowerCase ? name.toLowerCase() : name;
3547
3547
  }
3548
- var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas;
3548
+ var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, IndexFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas;
3549
3549
  var init_types = __esm({
3550
3550
  "src/compiler/types.ts"() {
3551
3551
  "use strict";
@@ -4556,6 +4556,13 @@ ${lanes.join("\n")}
4556
4556
  AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent";
4557
4557
  return AccessFlags2;
4558
4558
  })(AccessFlags || {});
4559
+ IndexFlags = /* @__PURE__ */ ((IndexFlags2) => {
4560
+ IndexFlags2[IndexFlags2["None"] = 0] = "None";
4561
+ IndexFlags2[IndexFlags2["StringsOnly"] = 1] = "StringsOnly";
4562
+ IndexFlags2[IndexFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
4563
+ IndexFlags2[IndexFlags2["NoReducibleCheck"] = 4] = "NoReducibleCheck";
4564
+ return IndexFlags2;
4565
+ })(IndexFlags || {});
4559
4566
  JsxReferenceKind = /* @__PURE__ */ ((JsxReferenceKind2) => {
4560
4567
  JsxReferenceKind2[JsxReferenceKind2["Component"] = 0] = "Component";
4561
4568
  JsxReferenceKind2[JsxReferenceKind2["Function"] = 1] = "Function";
@@ -7215,6 +7222,7 @@ ${lanes.join("\n")}
7215
7222
  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'."),
7216
7223
  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."),
7217
7224
  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."),
7225
+ 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."),
7218
7226
  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."),
7219
7227
  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."),
7220
7228
  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."),
@@ -45082,6 +45090,7 @@ ${lanes.join("\n")}
45082
45090
  var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
45083
45091
  var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
45084
45092
  var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
45093
+ var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
45085
45094
  var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
45086
45095
  var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
45087
45096
  var checkBinaryExpression = createCheckBinaryExpression();
@@ -56350,6 +56359,13 @@ ${lanes.join("\n")}
56350
56359
  function isConflictingPrivateProperty(prop) {
56351
56360
  return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
56352
56361
  }
56362
+ function isGenericReducibleType(type) {
56363
+ return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
56364
+ }
56365
+ function isReducibleIntersection(type) {
56366
+ const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
56367
+ return getReducedType(uniqueFilled) !== uniqueFilled;
56368
+ }
56353
56369
  function elaborateNeverIntersection(errorInfo, type) {
56354
56370
  if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
56355
56371
  const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
@@ -58719,10 +58735,10 @@ ${lanes.join("\n")}
58719
58735
  }
58720
58736
  return links.resolvedType;
58721
58737
  }
58722
- function createIndexType(type, stringsOnly) {
58738
+ function createIndexType(type, indexFlags) {
58723
58739
  const result = createType(4194304 /* Index */);
58724
58740
  result.type = type;
58725
- result.stringsOnly = stringsOnly;
58741
+ result.indexFlags = indexFlags;
58726
58742
  return result;
58727
58743
  }
58728
58744
  function createOriginIndexType(type) {
@@ -58730,31 +58746,23 @@ ${lanes.join("\n")}
58730
58746
  result.type = type;
58731
58747
  return result;
58732
58748
  }
58733
- function getIndexTypeForGenericType(type, stringsOnly) {
58734
- return stringsOnly ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(
58735
- type,
58736
- /*stringsOnly*/
58737
- true
58738
- )) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
58739
- type,
58740
- /*stringsOnly*/
58741
- false
58742
- ));
58749
+ function getIndexTypeForGenericType(type, indexFlags) {
58750
+ return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */));
58743
58751
  }
58744
- function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) {
58752
+ function getIndexTypeForMappedType(type, indexFlags) {
58745
58753
  const typeParameter = getTypeParameterFromMappedType(type);
58746
58754
  const constraintType = getConstraintTypeFromMappedType(type);
58747
58755
  const nameType = getNameTypeFromMappedType(type.target || type);
58748
- if (!nameType && !noIndexSignatures) {
58756
+ if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
58749
58757
  return constraintType;
58750
58758
  }
58751
58759
  const keyTypes = [];
58752
58760
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
58753
58761
  if (!isGenericIndexType(constraintType)) {
58754
58762
  const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
58755
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, stringsOnly, addMemberForKeyType);
58763
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
58756
58764
  } else {
58757
- return getIndexTypeForGenericType(type, stringsOnly);
58765
+ return getIndexTypeForGenericType(type, indexFlags);
58758
58766
  }
58759
58767
  } else {
58760
58768
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
@@ -58762,7 +58770,7 @@ ${lanes.join("\n")}
58762
58770
  if (isGenericIndexType(constraintType)) {
58763
58771
  forEachType(constraintType, addMemberForKeyType);
58764
58772
  }
58765
- const result = noIndexSignatures ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
58773
+ const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
58766
58774
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
58767
58775
  return constraintType;
58768
58776
  }
@@ -58815,19 +58823,15 @@ ${lanes.join("\n")}
58815
58823
  origin
58816
58824
  );
58817
58825
  }
58818
- function isPossiblyReducibleByInstantiation(type) {
58819
- const uniqueFilled = getUniqueLiteralFilledInstantiation(type);
58820
- return getReducedType(uniqueFilled) !== uniqueFilled;
58821
- }
58822
- function shouldDeferIndexType(type) {
58823
- return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
58826
+ function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
58827
+ 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));
58824
58828
  }
58825
- function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
58829
+ function getIndexType(type, indexFlags = defaultIndexFlags) {
58826
58830
  type = getReducedType(type);
58827
- 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(
58831
+ 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(
58828
58832
  type,
58829
- (noIndexSignatures ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (stringsOnly ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
58830
- stringsOnly === keyofStringsOnly && !noIndexSignatures
58833
+ (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
58834
+ indexFlags === defaultIndexFlags
58831
58835
  );
58832
58836
  }
58833
58837
  function getExtractStringType(type) {
@@ -59367,12 +59371,13 @@ ${lanes.join("\n")}
59367
59371
  if (objectType === wildcardType || indexType === wildcardType) {
59368
59372
  return wildcardType;
59369
59373
  }
59374
+ objectType = getReducedType(objectType);
59370
59375
  if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
59371
59376
  indexType = stringType;
59372
59377
  }
59373
59378
  if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
59374
59379
  accessFlags |= 1 /* IncludeUndefined */;
59375
- if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
59380
+ 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))) {
59376
59381
  if (objectType.flags & 3 /* AnyOrUnknown */) {
59377
59382
  return objectType;
59378
59383
  }
@@ -60558,9 +60563,6 @@ ${lanes.join("\n")}
60558
60563
  }
60559
60564
  return type;
60560
60565
  }
60561
- function getUniqueLiteralFilledInstantiation(type) {
60562
- return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
60563
- }
60564
60566
  function getPermissiveInstantiation(type) {
60565
60567
  return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
60566
60568
  }
@@ -62743,7 +62745,7 @@ ${lanes.join("\n")}
62743
62745
  } else {
62744
62746
  const constraint = getSimplifiedTypeOrConstraint(targetType);
62745
62747
  if (constraint) {
62746
- if (isRelatedTo(source2, getIndexType(constraint, target2.stringsOnly), 2 /* Target */, reportErrors2) === -1 /* True */) {
62748
+ if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
62747
62749
  return -1 /* True */;
62748
62750
  }
62749
62751
  } else if (isGenericMappedType(targetType)) {
@@ -62824,13 +62826,7 @@ ${lanes.join("\n")}
62824
62826
  }
62825
62827
  if (!isGenericMappedType(source2)) {
62826
62828
  const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
62827
- const sourceKeys = getIndexType(
62828
- source2,
62829
- /*stringsOnly*/
62830
- void 0,
62831
- /*noIndexSignatures*/
62832
- true
62833
- );
62829
+ const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
62834
62830
  const includeOptional = modifiers & 4 /* IncludeOptional */;
62835
62831
  const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
62836
62832
  if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
@@ -77070,11 +77066,7 @@ ${lanes.join("\n")}
77070
77066
  }
77071
77067
  const objectType = type.objectType;
77072
77068
  const indexType = type.indexType;
77073
- if (isTypeAssignableTo(indexType, getIndexType(
77074
- objectType,
77075
- /*stringsOnly*/
77076
- false
77077
- ))) {
77069
+ if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
77078
77070
  if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
77079
77071
  error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
77080
77072
  }
@@ -83894,7 +83886,8 @@ ${lanes.join("\n")}
83894
83886
  return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
83895
83887
  }
83896
83888
  if (!(node.parent.kind === 261 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 256 /* Abstract */))) {
83897
- return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
83889
+ 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;
83890
+ return grammarErrorOnNode(modifier, message);
83898
83891
  }
83899
83892
  if (flags & 32 /* Static */) {
83900
83893
  return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
@@ -131928,6 +131921,9 @@ ${lanes.join("\n")}
131928
131921
  }
131929
131922
  }
131930
131923
  for (const option of transpileOptionValueCompilerOptions) {
131924
+ if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
131925
+ continue;
131926
+ }
131931
131927
  options[option.name] = option.transpileOptionValue;
131932
131928
  }
131933
131929
  options.suppressOutputPathCheck = true;
@@ -132031,11 +132027,16 @@ ${lanes.join("\n")}
132031
132027
  }
132032
132028
  return options;
132033
132029
  }
132034
- var commandLineOptionsStringToEnum;
132030
+ var optionsRedundantWithVerbatimModuleSyntax, commandLineOptionsStringToEnum;
132035
132031
  var init_transpile = __esm({
132036
132032
  "src/services/transpile.ts"() {
132037
132033
  "use strict";
132038
132034
  init_ts4();
132035
+ optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
132036
+ "isolatedModules",
132037
+ "preserveValueImports",
132038
+ "importsNotUsedAsValues"
132039
+ ]);
132039
132040
  }
132040
132041
  });
132041
132042
 
@@ -178683,6 +178684,7 @@ ${e.message}`;
178683
178684
  ImportKind: () => ImportKind,
178684
178685
  ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
178685
178686
  IndentStyle: () => IndentStyle,
178687
+ IndexFlags: () => IndexFlags,
178686
178688
  IndexKind: () => IndexKind,
178687
178689
  InferenceFlags: () => InferenceFlags,
178688
178690
  InferencePriority: () => InferencePriority,
@@ -181039,6 +181041,7 @@ ${e.message}`;
181039
181041
  ImportKind: () => ImportKind,
181040
181042
  ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
181041
181043
  IndentStyle: () => IndentStyle,
181044
+ IndexFlags: () => IndexFlags,
181042
181045
  IndexKind: () => IndexKind,
181043
181046
  InferenceFlags: () => InferenceFlags,
181044
181047
  InferencePriority: () => InferencePriority,
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = `${versionMajorMinor}.0-dev.20230313`;
38
+ version = `${versionMajorMinor}.0-dev.20230315`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -3545,7 +3545,7 @@ ${lanes.join("\n")}
3545
3545
  const name = DiagnosticCategory[d.category];
3546
3546
  return lowerCase ? name.toLowerCase() : name;
3547
3547
  }
3548
- var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas;
3548
+ var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, IndexFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas;
3549
3549
  var init_types = __esm({
3550
3550
  "src/compiler/types.ts"() {
3551
3551
  "use strict";
@@ -4556,6 +4556,13 @@ ${lanes.join("\n")}
4556
4556
  AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent";
4557
4557
  return AccessFlags2;
4558
4558
  })(AccessFlags || {});
4559
+ IndexFlags = /* @__PURE__ */ ((IndexFlags2) => {
4560
+ IndexFlags2[IndexFlags2["None"] = 0] = "None";
4561
+ IndexFlags2[IndexFlags2["StringsOnly"] = 1] = "StringsOnly";
4562
+ IndexFlags2[IndexFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
4563
+ IndexFlags2[IndexFlags2["NoReducibleCheck"] = 4] = "NoReducibleCheck";
4564
+ return IndexFlags2;
4565
+ })(IndexFlags || {});
4559
4566
  JsxReferenceKind = /* @__PURE__ */ ((JsxReferenceKind2) => {
4560
4567
  JsxReferenceKind2[JsxReferenceKind2["Component"] = 0] = "Component";
4561
4568
  JsxReferenceKind2[JsxReferenceKind2["Function"] = 1] = "Function";
@@ -7215,6 +7222,7 @@ ${lanes.join("\n")}
7215
7222
  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'."),
7216
7223
  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."),
7217
7224
  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."),
7225
+ 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."),
7218
7226
  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."),
7219
7227
  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."),
7220
7228
  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."),
@@ -45082,6 +45090,7 @@ ${lanes.join("\n")}
45082
45090
  var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
45083
45091
  var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
45084
45092
  var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
45093
+ var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
45085
45094
  var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
45086
45095
  var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
45087
45096
  var checkBinaryExpression = createCheckBinaryExpression();
@@ -56350,6 +56359,13 @@ ${lanes.join("\n")}
56350
56359
  function isConflictingPrivateProperty(prop) {
56351
56360
  return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
56352
56361
  }
56362
+ function isGenericReducibleType(type) {
56363
+ return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
56364
+ }
56365
+ function isReducibleIntersection(type) {
56366
+ const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
56367
+ return getReducedType(uniqueFilled) !== uniqueFilled;
56368
+ }
56353
56369
  function elaborateNeverIntersection(errorInfo, type) {
56354
56370
  if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
56355
56371
  const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
@@ -58719,10 +58735,10 @@ ${lanes.join("\n")}
58719
58735
  }
58720
58736
  return links.resolvedType;
58721
58737
  }
58722
- function createIndexType(type, stringsOnly) {
58738
+ function createIndexType(type, indexFlags) {
58723
58739
  const result = createType(4194304 /* Index */);
58724
58740
  result.type = type;
58725
- result.stringsOnly = stringsOnly;
58741
+ result.indexFlags = indexFlags;
58726
58742
  return result;
58727
58743
  }
58728
58744
  function createOriginIndexType(type) {
@@ -58730,31 +58746,23 @@ ${lanes.join("\n")}
58730
58746
  result.type = type;
58731
58747
  return result;
58732
58748
  }
58733
- function getIndexTypeForGenericType(type, stringsOnly) {
58734
- return stringsOnly ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(
58735
- type,
58736
- /*stringsOnly*/
58737
- true
58738
- )) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
58739
- type,
58740
- /*stringsOnly*/
58741
- false
58742
- ));
58749
+ function getIndexTypeForGenericType(type, indexFlags) {
58750
+ return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */));
58743
58751
  }
58744
- function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) {
58752
+ function getIndexTypeForMappedType(type, indexFlags) {
58745
58753
  const typeParameter = getTypeParameterFromMappedType(type);
58746
58754
  const constraintType = getConstraintTypeFromMappedType(type);
58747
58755
  const nameType = getNameTypeFromMappedType(type.target || type);
58748
- if (!nameType && !noIndexSignatures) {
58756
+ if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
58749
58757
  return constraintType;
58750
58758
  }
58751
58759
  const keyTypes = [];
58752
58760
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
58753
58761
  if (!isGenericIndexType(constraintType)) {
58754
58762
  const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
58755
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, stringsOnly, addMemberForKeyType);
58763
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
58756
58764
  } else {
58757
- return getIndexTypeForGenericType(type, stringsOnly);
58765
+ return getIndexTypeForGenericType(type, indexFlags);
58758
58766
  }
58759
58767
  } else {
58760
58768
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
@@ -58762,7 +58770,7 @@ ${lanes.join("\n")}
58762
58770
  if (isGenericIndexType(constraintType)) {
58763
58771
  forEachType(constraintType, addMemberForKeyType);
58764
58772
  }
58765
- const result = noIndexSignatures ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
58773
+ const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
58766
58774
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
58767
58775
  return constraintType;
58768
58776
  }
@@ -58815,19 +58823,15 @@ ${lanes.join("\n")}
58815
58823
  origin
58816
58824
  );
58817
58825
  }
58818
- function isPossiblyReducibleByInstantiation(type) {
58819
- const uniqueFilled = getUniqueLiteralFilledInstantiation(type);
58820
- return getReducedType(uniqueFilled) !== uniqueFilled;
58821
- }
58822
- function shouldDeferIndexType(type) {
58823
- return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
58826
+ function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
58827
+ 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));
58824
58828
  }
58825
- function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
58829
+ function getIndexType(type, indexFlags = defaultIndexFlags) {
58826
58830
  type = getReducedType(type);
58827
- 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(
58831
+ 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(
58828
58832
  type,
58829
- (noIndexSignatures ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (stringsOnly ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
58830
- stringsOnly === keyofStringsOnly && !noIndexSignatures
58833
+ (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
58834
+ indexFlags === defaultIndexFlags
58831
58835
  );
58832
58836
  }
58833
58837
  function getExtractStringType(type) {
@@ -59367,12 +59371,13 @@ ${lanes.join("\n")}
59367
59371
  if (objectType === wildcardType || indexType === wildcardType) {
59368
59372
  return wildcardType;
59369
59373
  }
59374
+ objectType = getReducedType(objectType);
59370
59375
  if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
59371
59376
  indexType = stringType;
59372
59377
  }
59373
59378
  if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
59374
59379
  accessFlags |= 1 /* IncludeUndefined */;
59375
- if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
59380
+ 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))) {
59376
59381
  if (objectType.flags & 3 /* AnyOrUnknown */) {
59377
59382
  return objectType;
59378
59383
  }
@@ -60558,9 +60563,6 @@ ${lanes.join("\n")}
60558
60563
  }
60559
60564
  return type;
60560
60565
  }
60561
- function getUniqueLiteralFilledInstantiation(type) {
60562
- return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
60563
- }
60564
60566
  function getPermissiveInstantiation(type) {
60565
60567
  return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
60566
60568
  }
@@ -62743,7 +62745,7 @@ ${lanes.join("\n")}
62743
62745
  } else {
62744
62746
  const constraint = getSimplifiedTypeOrConstraint(targetType);
62745
62747
  if (constraint) {
62746
- if (isRelatedTo(source2, getIndexType(constraint, target2.stringsOnly), 2 /* Target */, reportErrors2) === -1 /* True */) {
62748
+ if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
62747
62749
  return -1 /* True */;
62748
62750
  }
62749
62751
  } else if (isGenericMappedType(targetType)) {
@@ -62824,13 +62826,7 @@ ${lanes.join("\n")}
62824
62826
  }
62825
62827
  if (!isGenericMappedType(source2)) {
62826
62828
  const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
62827
- const sourceKeys = getIndexType(
62828
- source2,
62829
- /*stringsOnly*/
62830
- void 0,
62831
- /*noIndexSignatures*/
62832
- true
62833
- );
62829
+ const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
62834
62830
  const includeOptional = modifiers & 4 /* IncludeOptional */;
62835
62831
  const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
62836
62832
  if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
@@ -77070,11 +77066,7 @@ ${lanes.join("\n")}
77070
77066
  }
77071
77067
  const objectType = type.objectType;
77072
77068
  const indexType = type.indexType;
77073
- if (isTypeAssignableTo(indexType, getIndexType(
77074
- objectType,
77075
- /*stringsOnly*/
77076
- false
77077
- ))) {
77069
+ if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
77078
77070
  if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
77079
77071
  error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
77080
77072
  }
@@ -83894,7 +83886,8 @@ ${lanes.join("\n")}
83894
83886
  return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
83895
83887
  }
83896
83888
  if (!(node.parent.kind === 261 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 256 /* Abstract */))) {
83897
- return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
83889
+ 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;
83890
+ return grammarErrorOnNode(modifier, message);
83898
83891
  }
83899
83892
  if (flags & 32 /* Static */) {
83900
83893
  return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
@@ -131942,6 +131935,9 @@ ${lanes.join("\n")}
131942
131935
  }
131943
131936
  }
131944
131937
  for (const option of transpileOptionValueCompilerOptions) {
131938
+ if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
131939
+ continue;
131940
+ }
131945
131941
  options[option.name] = option.transpileOptionValue;
131946
131942
  }
131947
131943
  options.suppressOutputPathCheck = true;
@@ -132045,11 +132041,16 @@ ${lanes.join("\n")}
132045
132041
  }
132046
132042
  return options;
132047
132043
  }
132048
- var commandLineOptionsStringToEnum;
132044
+ var optionsRedundantWithVerbatimModuleSyntax, commandLineOptionsStringToEnum;
132049
132045
  var init_transpile = __esm({
132050
132046
  "src/services/transpile.ts"() {
132051
132047
  "use strict";
132052
132048
  init_ts4();
132049
+ optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
132050
+ "isolatedModules",
132051
+ "preserveValueImports",
132052
+ "importsNotUsedAsValues"
132053
+ ]);
132053
132054
  }
132054
132055
  });
132055
132056
 
@@ -167851,6 +167852,7 @@ ${options.prefix}` : "\n" : options.prefix
167851
167852
  ImportKind: () => ImportKind,
167852
167853
  ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
167853
167854
  IndentStyle: () => IndentStyle,
167855
+ IndexFlags: () => IndexFlags,
167854
167856
  IndexKind: () => IndexKind,
167855
167857
  InferenceFlags: () => InferenceFlags,
167856
167858
  InferencePriority: () => InferencePriority,
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-dev.20230313`;
57
+ var version = `${versionMajorMinor}.0-dev.20230315`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -5291,6 +5291,7 @@ var Diagnostics = {
5291
5291
  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'."),
5292
5292
  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."),
5293
5293
  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."),
5294
+ 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."),
5294
5295
  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."),
5295
5296
  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."),
5296
5297
  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."),
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.1.0-dev.20230313",
5
+ "version": "5.1.0-dev.20230315",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -78,7 +78,8 @@
78
78
  "ms": "^2.1.3",
79
79
  "node-fetch": "^3.2.10",
80
80
  "source-map-support": "^0.5.21",
81
- "typescript": "5.0.0-dev.20230112",
81
+ "tslib": "^2.5.0",
82
+ "typescript": "5.0.1-rc",
82
83
  "which": "^2.0.2"
83
84
  },
84
85
  "overrides": {
@@ -112,5 +113,5 @@
112
113
  "node": "14.21.1",
113
114
  "npm": "8.19.3"
114
115
  },
115
- "gitHead": "ac60ca7f786addfadd32d71fe7ad41d5b1405422"
116
+ "gitHead": "9ccf47fec5c1c87061956ac6e1446677654a4d4b"
116
117
  }