@typescript-deploys/pr-build 5.0.0-pr-52866-6 → 5.0.0-pr-49107-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-insiders.20230220`;
26
+ var version = `${versionMajorMinor}.0-insiders.20230221`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -15744,9 +15744,6 @@ function getClassLikeDeclarationOfSymbol(symbol) {
15744
15744
  function getObjectFlags(type) {
15745
15745
  return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
15746
15746
  }
15747
- function typeHasCallOrConstructSignatures(type, checker) {
15748
- return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
15749
- }
15750
15747
  function isUMDExportSymbol(symbol) {
15751
15748
  return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
15752
15749
  }
@@ -42989,7 +42986,8 @@ function createTypeChecker(host) {
42989
42986
  isPropertyAccessible,
42990
42987
  getTypeOnlyAliasDeclaration,
42991
42988
  getMemberOverrideModifierStatus,
42992
- isTypeParameterPossiblyReferenced
42989
+ isTypeParameterPossiblyReferenced,
42990
+ typeHasCallOrConstructSignatures
42993
42991
  };
42994
42992
  function runWithoutResolvedSignatureCaching(node, fn) {
42995
42993
  const containingCall = findAncestor(node, isCallLikeExpression);
@@ -50496,7 +50494,7 @@ function createTypeChecker(host) {
50496
50494
  }
50497
50495
  function findResolutionCycleStartIndex(target, propertyName) {
50498
50496
  for (let i = resolutionTargets.length - 1; i >= 0; i--) {
50499
- if (hasType2(resolutionTargets[i], resolutionPropertyNames[i])) {
50497
+ if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
50500
50498
  return -1;
50501
50499
  }
50502
50500
  if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
@@ -50505,7 +50503,7 @@ function createTypeChecker(host) {
50505
50503
  }
50506
50504
  return -1;
50507
50505
  }
50508
- function hasType2(target, propertyName) {
50506
+ function resolutionTargetHasProperty(target, propertyName) {
50509
50507
  switch (propertyName) {
50510
50508
  case 0 /* Type */:
50511
50509
  return !!getSymbolLinks(target).type;
@@ -53542,6 +53540,20 @@ function createTypeChecker(host) {
53542
53540
  return t.flags & 1048576 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : void 0;
53543
53541
  }
53544
53542
  if (t.flags & 4194304 /* Index */) {
53543
+ if (t.type.flags & 8388608 /* IndexedAccess */) {
53544
+ const indexedAccess = t.type;
53545
+ if (!isGenericObjectType(indexedAccess.objectType)) {
53546
+ const baseIndexType = getBaseConstraint(indexedAccess.indexType);
53547
+ const indexedAccessType = baseIndexType && getIndexedAccessTypeOrUndefined(indexedAccess.objectType, baseIndexType);
53548
+ const mappedIndexTypeOfIndexedAccess = indexedAccessType && mapType(indexedAccessType, getIndexType);
53549
+ const narrowed = mappedIndexTypeOfIndexedAccess && filterType(keyofConstraintType, (t2) => {
53550
+ return !(getIntersectionType([t2, mappedIndexTypeOfIndexedAccess]).flags & 131072 /* Never */);
53551
+ });
53552
+ if (narrowed) {
53553
+ return narrowed;
53554
+ }
53555
+ }
53556
+ }
53545
53557
  return keyofConstraintType;
53546
53558
  }
53547
53559
  if (t.flags & 134217728 /* TemplateLiteral */) {
@@ -56913,7 +56925,7 @@ function createTypeChecker(host) {
56913
56925
  }
56914
56926
  function getActualTypeVariable(type) {
56915
56927
  if (type.flags & 33554432 /* Substitution */) {
56916
- return type.baseType;
56928
+ return getActualTypeVariable(type.baseType);
56917
56929
  }
56918
56930
  if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
56919
56931
  return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
@@ -59406,7 +59418,7 @@ function createTypeChecker(host) {
59406
59418
  return 0 /* False */;
59407
59419
  }
59408
59420
  }
59409
- const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
59421
+ const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
59410
59422
  const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
59411
59423
  if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
59412
59424
  if (reportErrors2) {
@@ -62004,7 +62016,7 @@ function createTypeChecker(host) {
62004
62016
  }
62005
62017
  function isObjectTypeWithInferableIndex(type) {
62006
62018
  const objectFlags = getObjectFlags(type);
62007
- return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures2(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
62019
+ return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
62008
62020
  }
62009
62021
  function createSymbolWithType(source, type) {
62010
62022
  const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
@@ -66706,20 +66718,17 @@ function createTypeChecker(host) {
66706
66718
  contextualType
66707
66719
  );
66708
66720
  }
66709
- function getDiscriminatedApparentType(node, type) {
66710
- const apparentType = mapType(
66711
- type,
66712
- getApparentType,
66713
- /*noReductions*/
66714
- true
66715
- );
66716
- return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
66717
- }
66718
66721
  function getApparentTypeOfContextualType(node, contextFlags) {
66719
66722
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType(node, contextFlags);
66720
66723
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
66721
66724
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
66722
- return getDiscriminatedApparentType(node, instantiatedType);
66725
+ const apparentType = mapType(
66726
+ instantiatedType,
66727
+ getApparentType,
66728
+ /*noReductions*/
66729
+ true
66730
+ );
66731
+ return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
66723
66732
  }
66724
66733
  }
66725
66734
  function instantiateContextualType(contextualType, node, contextFlags) {
@@ -69124,8 +69133,7 @@ function createTypeChecker(host) {
69124
69133
  const isFromBindingPattern = !skipBindingPatterns && getContextualType(node, 8 /* SkipBindingPatterns */) !== contextualType;
69125
69134
  if (!isFromBindingPattern) {
69126
69135
  const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
69127
- const argumentApparentType = outerContext && isCallOrNewExpression(node.parent) && getDiscriminatedApparentType(node, contextualType);
69128
- const instantiatedType = instantiateType(argumentApparentType && argumentApparentType !== unknownType ? argumentApparentType : contextualType, outerMapper);
69136
+ const instantiatedType = instantiateType(contextualType, outerMapper);
69129
69137
  const contextualSignature = getSingleCallSignature(instantiatedType);
69130
69138
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
69131
69139
  inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
@@ -72453,7 +72461,7 @@ function createTypeChecker(host) {
72453
72461
  if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
72454
72462
  error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
72455
72463
  }
72456
- if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
72464
+ if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
72457
72465
  error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
72458
72466
  }
72459
72467
  return booleanType;
@@ -80124,8 +80132,8 @@ function createTypeChecker(host) {
80124
80132
  }
80125
80133
  return getNamedMembers(propsByName);
80126
80134
  }
80127
- function typeHasCallOrConstructSignatures2(type) {
80128
- return typeHasCallOrConstructSignatures(type, checker);
80135
+ function typeHasCallOrConstructSignatures(type) {
80136
+ return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
80129
80137
  }
80130
80138
  function getRootSymbols(symbol) {
80131
80139
  const roots = getImmediateRootSymbols(symbol);
package/lib/tsserver.js CHANGED
@@ -2233,7 +2233,6 @@ __export(server_exports, {
2233
2233
  typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
2234
2234
  typeAliasNamePart: () => typeAliasNamePart,
2235
2235
  typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
2236
- typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
2237
2236
  typeKeywords: () => typeKeywords,
2238
2237
  typeParameterNamePart: () => typeParameterNamePart,
2239
2238
  typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
@@ -2288,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
2288
2287
 
2289
2288
  // src/compiler/corePublic.ts
2290
2289
  var versionMajorMinor = "5.0";
2291
- var version = `${versionMajorMinor}.0-insiders.20230220`;
2290
+ var version = `${versionMajorMinor}.0-insiders.20230221`;
2292
2291
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2293
2292
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2294
2293
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -19751,9 +19750,6 @@ function getClassLikeDeclarationOfSymbol(symbol) {
19751
19750
  function getObjectFlags(type) {
19752
19751
  return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
19753
19752
  }
19754
- function typeHasCallOrConstructSignatures(type, checker) {
19755
- return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
19756
- }
19757
19753
  function forSomeAncestorDirectory(directory, callback) {
19758
19754
  return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
19759
19755
  }
@@ -47596,7 +47592,8 @@ function createTypeChecker(host) {
47596
47592
  isPropertyAccessible,
47597
47593
  getTypeOnlyAliasDeclaration,
47598
47594
  getMemberOverrideModifierStatus,
47599
- isTypeParameterPossiblyReferenced
47595
+ isTypeParameterPossiblyReferenced,
47596
+ typeHasCallOrConstructSignatures
47600
47597
  };
47601
47598
  function runWithoutResolvedSignatureCaching(node, fn) {
47602
47599
  const containingCall = findAncestor(node, isCallLikeExpression);
@@ -55103,7 +55100,7 @@ function createTypeChecker(host) {
55103
55100
  }
55104
55101
  function findResolutionCycleStartIndex(target, propertyName) {
55105
55102
  for (let i = resolutionTargets.length - 1; i >= 0; i--) {
55106
- if (hasType2(resolutionTargets[i], resolutionPropertyNames[i])) {
55103
+ if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
55107
55104
  return -1;
55108
55105
  }
55109
55106
  if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
@@ -55112,7 +55109,7 @@ function createTypeChecker(host) {
55112
55109
  }
55113
55110
  return -1;
55114
55111
  }
55115
- function hasType2(target, propertyName) {
55112
+ function resolutionTargetHasProperty(target, propertyName) {
55116
55113
  switch (propertyName) {
55117
55114
  case 0 /* Type */:
55118
55115
  return !!getSymbolLinks(target).type;
@@ -58149,6 +58146,20 @@ function createTypeChecker(host) {
58149
58146
  return t.flags & 1048576 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : void 0;
58150
58147
  }
58151
58148
  if (t.flags & 4194304 /* Index */) {
58149
+ if (t.type.flags & 8388608 /* IndexedAccess */) {
58150
+ const indexedAccess = t.type;
58151
+ if (!isGenericObjectType(indexedAccess.objectType)) {
58152
+ const baseIndexType = getBaseConstraint(indexedAccess.indexType);
58153
+ const indexedAccessType = baseIndexType && getIndexedAccessTypeOrUndefined(indexedAccess.objectType, baseIndexType);
58154
+ const mappedIndexTypeOfIndexedAccess = indexedAccessType && mapType(indexedAccessType, getIndexType);
58155
+ const narrowed = mappedIndexTypeOfIndexedAccess && filterType(keyofConstraintType, (t2) => {
58156
+ return !(getIntersectionType([t2, mappedIndexTypeOfIndexedAccess]).flags & 131072 /* Never */);
58157
+ });
58158
+ if (narrowed) {
58159
+ return narrowed;
58160
+ }
58161
+ }
58162
+ }
58152
58163
  return keyofConstraintType;
58153
58164
  }
58154
58165
  if (t.flags & 134217728 /* TemplateLiteral */) {
@@ -61520,7 +61531,7 @@ function createTypeChecker(host) {
61520
61531
  }
61521
61532
  function getActualTypeVariable(type) {
61522
61533
  if (type.flags & 33554432 /* Substitution */) {
61523
- return type.baseType;
61534
+ return getActualTypeVariable(type.baseType);
61524
61535
  }
61525
61536
  if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
61526
61537
  return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
@@ -64013,7 +64024,7 @@ function createTypeChecker(host) {
64013
64024
  return 0 /* False */;
64014
64025
  }
64015
64026
  }
64016
- const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
64027
+ const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
64017
64028
  const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
64018
64029
  if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
64019
64030
  if (reportErrors2) {
@@ -66611,7 +66622,7 @@ function createTypeChecker(host) {
66611
66622
  }
66612
66623
  function isObjectTypeWithInferableIndex(type) {
66613
66624
  const objectFlags = getObjectFlags(type);
66614
- return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures2(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
66625
+ return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
66615
66626
  }
66616
66627
  function createSymbolWithType(source, type) {
66617
66628
  const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
@@ -71313,20 +71324,17 @@ function createTypeChecker(host) {
71313
71324
  contextualType
71314
71325
  );
71315
71326
  }
71316
- function getDiscriminatedApparentType(node, type) {
71317
- const apparentType = mapType(
71318
- type,
71319
- getApparentType,
71320
- /*noReductions*/
71321
- true
71322
- );
71323
- return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
71324
- }
71325
71327
  function getApparentTypeOfContextualType(node, contextFlags) {
71326
71328
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType2(node, contextFlags);
71327
71329
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
71328
71330
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
71329
- return getDiscriminatedApparentType(node, instantiatedType);
71331
+ const apparentType = mapType(
71332
+ instantiatedType,
71333
+ getApparentType,
71334
+ /*noReductions*/
71335
+ true
71336
+ );
71337
+ return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
71330
71338
  }
71331
71339
  }
71332
71340
  function instantiateContextualType(contextualType, node, contextFlags) {
@@ -73731,8 +73739,7 @@ function createTypeChecker(host) {
73731
73739
  const isFromBindingPattern = !skipBindingPatterns && getContextualType2(node, 8 /* SkipBindingPatterns */) !== contextualType;
73732
73740
  if (!isFromBindingPattern) {
73733
73741
  const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
73734
- const argumentApparentType = outerContext && isCallOrNewExpression(node.parent) && getDiscriminatedApparentType(node, contextualType);
73735
- const instantiatedType = instantiateType(argumentApparentType && argumentApparentType !== unknownType ? argumentApparentType : contextualType, outerMapper);
73742
+ const instantiatedType = instantiateType(contextualType, outerMapper);
73736
73743
  const contextualSignature = getSingleCallSignature(instantiatedType);
73737
73744
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
73738
73745
  inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
@@ -77060,7 +77067,7 @@ function createTypeChecker(host) {
77060
77067
  if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
77061
77068
  error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
77062
77069
  }
77063
- if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
77070
+ if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
77064
77071
  error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
77065
77072
  }
77066
77073
  return booleanType;
@@ -84731,8 +84738,8 @@ function createTypeChecker(host) {
84731
84738
  }
84732
84739
  return getNamedMembers(propsByName);
84733
84740
  }
84734
- function typeHasCallOrConstructSignatures2(type) {
84735
- return typeHasCallOrConstructSignatures(type, checker);
84741
+ function typeHasCallOrConstructSignatures(type) {
84742
+ return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
84736
84743
  }
84737
84744
  function getRootSymbols(symbol) {
84738
84745
  const roots = getImmediateRootSymbols(symbol);
@@ -129597,7 +129604,7 @@ function needsParentheses(expression) {
129597
129604
  return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
129598
129605
  }
129599
129606
  function getContextualTypeFromParent(node, checker, contextFlags) {
129600
- const { parent: parent2 } = node;
129607
+ const parent2 = walkUpParenthesizedExpressions(node.parent);
129601
129608
  switch (parent2.kind) {
129602
129609
  case 211 /* NewExpression */:
129603
129610
  return checker.getContextualType(parent2, contextFlags);
@@ -129606,7 +129613,7 @@ function getContextualTypeFromParent(node, checker, contextFlags) {
129606
129613
  return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
129607
129614
  }
129608
129615
  case 292 /* CaseClause */:
129609
- return parent2.expression === node ? getSwitchedType(parent2, checker) : void 0;
129616
+ return getSwitchedType(parent2, checker);
129610
129617
  default:
129611
129618
  return checker.getContextualType(node, contextFlags);
129612
129619
  }
@@ -130166,8 +130173,8 @@ function newCaseClauseTracker(checker, clauses) {
130166
130173
  const existingBigInts = /* @__PURE__ */ new Set();
130167
130174
  for (const clause of clauses) {
130168
130175
  if (!isDefaultClause(clause)) {
130169
- if (isLiteralExpression(clause.expression)) {
130170
- const expression = clause.expression;
130176
+ const expression = skipParentheses(clause.expression);
130177
+ if (isLiteralExpression(expression)) {
130171
130178
  switch (expression.kind) {
130172
130179
  case 14 /* NoSubstitutionTemplateLiteral */:
130173
130180
  case 10 /* StringLiteral */:
@@ -151386,7 +151393,7 @@ function getPropertiesForObjectExpression(contextualType, completionsType, obj,
151386
151393
  function getApparentProperties(type, node, checker) {
151387
151394
  if (!type.isUnion())
151388
151395
  return type.getApparentProperties();
151389
- return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
151396
+ return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
151390
151397
  }
151391
151398
  function containsNonPublicProperties(props) {
151392
151399
  return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
@@ -151931,7 +151938,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
151931
151938
  case 280 /* ExternalModuleReference */:
151932
151939
  return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
151933
151940
  case 292 /* CaseClause */:
151934
- const tracker = newCaseClauseTracker(typeChecker, node.parent.parent.clauses);
151941
+ const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
151935
151942
  const literals = fromContextualType().types.filter((literal) => !tracker.hasValue(literal.value));
151936
151943
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
151937
151944
  default:
@@ -158546,12 +158553,7 @@ function filterImport(i, moduleSpecifier, keep) {
158546
158553
  return defaultImport || namedBindings ? factory.createImportDeclaration(
158547
158554
  /*modifiers*/
158548
158555
  void 0,
158549
- factory.createImportClause(
158550
- /*isTypeOnly*/
158551
- false,
158552
- defaultImport,
158553
- namedBindings
158554
- ),
158556
+ factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings),
158555
158557
  moduleSpecifier,
158556
158558
  /*assertClause*/
158557
158559
  void 0
@@ -169839,7 +169841,6 @@ __export(ts_exports3, {
169839
169841
  typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
169840
169842
  typeAliasNamePart: () => typeAliasNamePart,
169841
169843
  typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
169842
- typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
169843
169844
  typeKeywords: () => typeKeywords,
169844
169845
  typeParameterNamePart: () => typeParameterNamePart,
169845
169846
  typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
@@ -183789,7 +183790,6 @@ start(initializeNodeSystem(), require("os").platform());
183789
183790
  typeAcquisitionDeclarations,
183790
183791
  typeAliasNamePart,
183791
183792
  typeDirectiveIsEqualTo,
183792
- typeHasCallOrConstructSignatures,
183793
183793
  typeKeywords,
183794
183794
  typeParameterNamePart,
183795
183795
  typeReferenceResolutionNameAndModeGetter,
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.0";
38
- version = `${versionMajorMinor}.0-insiders.20230220`;
38
+ version = `${versionMajorMinor}.0-insiders.20230221`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -17490,9 +17490,6 @@ ${lanes.join("\n")}
17490
17490
  function getObjectFlags(type) {
17491
17491
  return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
17492
17492
  }
17493
- function typeHasCallOrConstructSignatures(type, checker) {
17494
- return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
17495
- }
17496
17493
  function forSomeAncestorDirectory(directory, callback) {
17497
17494
  return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
17498
17495
  }
@@ -45404,7 +45401,8 @@ ${lanes.join("\n")}
45404
45401
  isPropertyAccessible,
45405
45402
  getTypeOnlyAliasDeclaration,
45406
45403
  getMemberOverrideModifierStatus,
45407
- isTypeParameterPossiblyReferenced
45404
+ isTypeParameterPossiblyReferenced,
45405
+ typeHasCallOrConstructSignatures
45408
45406
  };
45409
45407
  function runWithoutResolvedSignatureCaching(node, fn) {
45410
45408
  const containingCall = findAncestor(node, isCallLikeExpression);
@@ -52911,7 +52909,7 @@ ${lanes.join("\n")}
52911
52909
  }
52912
52910
  function findResolutionCycleStartIndex(target, propertyName) {
52913
52911
  for (let i = resolutionTargets.length - 1; i >= 0; i--) {
52914
- if (hasType2(resolutionTargets[i], resolutionPropertyNames[i])) {
52912
+ if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
52915
52913
  return -1;
52916
52914
  }
52917
52915
  if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
@@ -52920,7 +52918,7 @@ ${lanes.join("\n")}
52920
52918
  }
52921
52919
  return -1;
52922
52920
  }
52923
- function hasType2(target, propertyName) {
52921
+ function resolutionTargetHasProperty(target, propertyName) {
52924
52922
  switch (propertyName) {
52925
52923
  case 0 /* Type */:
52926
52924
  return !!getSymbolLinks(target).type;
@@ -55957,6 +55955,20 @@ ${lanes.join("\n")}
55957
55955
  return t.flags & 1048576 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : void 0;
55958
55956
  }
55959
55957
  if (t.flags & 4194304 /* Index */) {
55958
+ if (t.type.flags & 8388608 /* IndexedAccess */) {
55959
+ const indexedAccess = t.type;
55960
+ if (!isGenericObjectType(indexedAccess.objectType)) {
55961
+ const baseIndexType = getBaseConstraint(indexedAccess.indexType);
55962
+ const indexedAccessType = baseIndexType && getIndexedAccessTypeOrUndefined(indexedAccess.objectType, baseIndexType);
55963
+ const mappedIndexTypeOfIndexedAccess = indexedAccessType && mapType(indexedAccessType, getIndexType);
55964
+ const narrowed = mappedIndexTypeOfIndexedAccess && filterType(keyofConstraintType, (t2) => {
55965
+ return !(getIntersectionType([t2, mappedIndexTypeOfIndexedAccess]).flags & 131072 /* Never */);
55966
+ });
55967
+ if (narrowed) {
55968
+ return narrowed;
55969
+ }
55970
+ }
55971
+ }
55960
55972
  return keyofConstraintType;
55961
55973
  }
55962
55974
  if (t.flags & 134217728 /* TemplateLiteral */) {
@@ -59328,7 +59340,7 @@ ${lanes.join("\n")}
59328
59340
  }
59329
59341
  function getActualTypeVariable(type) {
59330
59342
  if (type.flags & 33554432 /* Substitution */) {
59331
- return type.baseType;
59343
+ return getActualTypeVariable(type.baseType);
59332
59344
  }
59333
59345
  if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
59334
59346
  return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
@@ -61821,7 +61833,7 @@ ${lanes.join("\n")}
61821
61833
  return 0 /* False */;
61822
61834
  }
61823
61835
  }
61824
- const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
61836
+ const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
61825
61837
  const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
61826
61838
  if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
61827
61839
  if (reportErrors2) {
@@ -64419,7 +64431,7 @@ ${lanes.join("\n")}
64419
64431
  }
64420
64432
  function isObjectTypeWithInferableIndex(type) {
64421
64433
  const objectFlags = getObjectFlags(type);
64422
- return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures2(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
64434
+ return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
64423
64435
  }
64424
64436
  function createSymbolWithType(source, type) {
64425
64437
  const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
@@ -69121,20 +69133,17 @@ ${lanes.join("\n")}
69121
69133
  contextualType
69122
69134
  );
69123
69135
  }
69124
- function getDiscriminatedApparentType(node, type) {
69125
- const apparentType = mapType(
69126
- type,
69127
- getApparentType,
69128
- /*noReductions*/
69129
- true
69130
- );
69131
- return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
69132
- }
69133
69136
  function getApparentTypeOfContextualType(node, contextFlags) {
69134
69137
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType2(node, contextFlags);
69135
69138
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
69136
69139
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
69137
- return getDiscriminatedApparentType(node, instantiatedType);
69140
+ const apparentType = mapType(
69141
+ instantiatedType,
69142
+ getApparentType,
69143
+ /*noReductions*/
69144
+ true
69145
+ );
69146
+ return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
69138
69147
  }
69139
69148
  }
69140
69149
  function instantiateContextualType(contextualType, node, contextFlags) {
@@ -71539,8 +71548,7 @@ ${lanes.join("\n")}
71539
71548
  const isFromBindingPattern = !skipBindingPatterns && getContextualType2(node, 8 /* SkipBindingPatterns */) !== contextualType;
71540
71549
  if (!isFromBindingPattern) {
71541
71550
  const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
71542
- const argumentApparentType = outerContext && isCallOrNewExpression(node.parent) && getDiscriminatedApparentType(node, contextualType);
71543
- const instantiatedType = instantiateType(argumentApparentType && argumentApparentType !== unknownType ? argumentApparentType : contextualType, outerMapper);
71551
+ const instantiatedType = instantiateType(contextualType, outerMapper);
71544
71552
  const contextualSignature = getSingleCallSignature(instantiatedType);
71545
71553
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
71546
71554
  inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
@@ -74868,7 +74876,7 @@ ${lanes.join("\n")}
74868
74876
  if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
74869
74877
  error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
74870
74878
  }
74871
- if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
74879
+ if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
74872
74880
  error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
74873
74881
  }
74874
74882
  return booleanType;
@@ -82539,8 +82547,8 @@ ${lanes.join("\n")}
82539
82547
  }
82540
82548
  return getNamedMembers(propsByName);
82541
82549
  }
82542
- function typeHasCallOrConstructSignatures2(type) {
82543
- return typeHasCallOrConstructSignatures(type, checker);
82550
+ function typeHasCallOrConstructSignatures(type) {
82551
+ return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
82544
82552
  }
82545
82553
  function getRootSymbols(symbol) {
82546
82554
  const roots = getImmediateRootSymbols(symbol);
@@ -85096,7 +85104,6 @@ ${lanes.join("\n")}
85096
85104
  "src/compiler/checker.ts"() {
85097
85105
  "use strict";
85098
85106
  init_ts2();
85099
- init_ts2();
85100
85107
  init_ts_moduleSpecifiers();
85101
85108
  init_ts_performance();
85102
85109
  ambientModuleSymbolRegex = /^".+"$/;
@@ -127895,7 +127902,7 @@ ${lanes.join("\n")}
127895
127902
  return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
127896
127903
  }
127897
127904
  function getContextualTypeFromParent(node, checker, contextFlags) {
127898
- const { parent: parent2 } = node;
127905
+ const parent2 = walkUpParenthesizedExpressions(node.parent);
127899
127906
  switch (parent2.kind) {
127900
127907
  case 211 /* NewExpression */:
127901
127908
  return checker.getContextualType(parent2, contextFlags);
@@ -127904,7 +127911,7 @@ ${lanes.join("\n")}
127904
127911
  return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
127905
127912
  }
127906
127913
  case 292 /* CaseClause */:
127907
- return parent2.expression === node ? getSwitchedType(parent2, checker) : void 0;
127914
+ return getSwitchedType(parent2, checker);
127908
127915
  default:
127909
127916
  return checker.getContextualType(node, contextFlags);
127910
127917
  }
@@ -128457,8 +128464,8 @@ ${lanes.join("\n")}
128457
128464
  const existingBigInts = /* @__PURE__ */ new Set();
128458
128465
  for (const clause of clauses) {
128459
128466
  if (!isDefaultClause(clause)) {
128460
- if (isLiteralExpression(clause.expression)) {
128461
- const expression = clause.expression;
128467
+ const expression = skipParentheses(clause.expression);
128468
+ if (isLiteralExpression(expression)) {
128462
128469
  switch (expression.kind) {
128463
128470
  case 14 /* NoSubstitutionTemplateLiteral */:
128464
128471
  case 10 /* StringLiteral */:
@@ -150417,7 +150424,7 @@ ${lanes.join("\n")}
150417
150424
  function getApparentProperties(type, node, checker) {
150418
150425
  if (!type.isUnion())
150419
150426
  return type.getApparentProperties();
150420
- return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
150427
+ return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
150421
150428
  }
150422
150429
  function containsNonPublicProperties(props) {
150423
150430
  return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
@@ -151027,7 +151034,7 @@ ${lanes.join("\n")}
151027
151034
  case 280 /* ExternalModuleReference */:
151028
151035
  return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
151029
151036
  case 292 /* CaseClause */:
151030
- const tracker = newCaseClauseTracker(typeChecker, node.parent.parent.clauses);
151037
+ const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
151031
151038
  const literals = fromContextualType().types.filter((literal) => !tracker.hasValue(literal.value));
151032
151039
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
151033
151040
  default:
@@ -157765,12 +157772,7 @@ ${lanes.join("\n")}
157765
157772
  return defaultImport || namedBindings ? factory.createImportDeclaration(
157766
157773
  /*modifiers*/
157767
157774
  void 0,
157768
- factory.createImportClause(
157769
- /*isTypeOnly*/
157770
- false,
157771
- defaultImport,
157772
- namedBindings
157773
- ),
157775
+ factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings),
157774
157776
  moduleSpecifier,
157775
157777
  /*assertClause*/
157776
157778
  void 0
@@ -180425,7 +180427,6 @@ ${e.message}`;
180425
180427
  typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
180426
180428
  typeAliasNamePart: () => typeAliasNamePart,
180427
180429
  typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
180428
- typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
180429
180430
  typeKeywords: () => typeKeywords,
180430
180431
  typeParameterNamePart: () => typeParameterNamePart,
180431
180432
  typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
@@ -182785,7 +182786,6 @@ ${e.message}`;
182785
182786
  typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
182786
182787
  typeAliasNamePart: () => typeAliasNamePart,
182787
182788
  typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
182788
- typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
182789
182789
  typeKeywords: () => typeKeywords,
182790
182790
  typeParameterNamePart: () => typeParameterNamePart,
182791
182791
  typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
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.0";
38
- version = `${versionMajorMinor}.0-insiders.20230220`;
38
+ version = `${versionMajorMinor}.0-insiders.20230221`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -17490,9 +17490,6 @@ ${lanes.join("\n")}
17490
17490
  function getObjectFlags(type) {
17491
17491
  return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
17492
17492
  }
17493
- function typeHasCallOrConstructSignatures(type, checker) {
17494
- return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
17495
- }
17496
17493
  function forSomeAncestorDirectory(directory, callback) {
17497
17494
  return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
17498
17495
  }
@@ -45404,7 +45401,8 @@ ${lanes.join("\n")}
45404
45401
  isPropertyAccessible,
45405
45402
  getTypeOnlyAliasDeclaration,
45406
45403
  getMemberOverrideModifierStatus,
45407
- isTypeParameterPossiblyReferenced
45404
+ isTypeParameterPossiblyReferenced,
45405
+ typeHasCallOrConstructSignatures
45408
45406
  };
45409
45407
  function runWithoutResolvedSignatureCaching(node, fn) {
45410
45408
  const containingCall = findAncestor(node, isCallLikeExpression);
@@ -52911,7 +52909,7 @@ ${lanes.join("\n")}
52911
52909
  }
52912
52910
  function findResolutionCycleStartIndex(target, propertyName) {
52913
52911
  for (let i = resolutionTargets.length - 1; i >= 0; i--) {
52914
- if (hasType2(resolutionTargets[i], resolutionPropertyNames[i])) {
52912
+ if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
52915
52913
  return -1;
52916
52914
  }
52917
52915
  if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
@@ -52920,7 +52918,7 @@ ${lanes.join("\n")}
52920
52918
  }
52921
52919
  return -1;
52922
52920
  }
52923
- function hasType2(target, propertyName) {
52921
+ function resolutionTargetHasProperty(target, propertyName) {
52924
52922
  switch (propertyName) {
52925
52923
  case 0 /* Type */:
52926
52924
  return !!getSymbolLinks(target).type;
@@ -55957,6 +55955,20 @@ ${lanes.join("\n")}
55957
55955
  return t.flags & 1048576 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : void 0;
55958
55956
  }
55959
55957
  if (t.flags & 4194304 /* Index */) {
55958
+ if (t.type.flags & 8388608 /* IndexedAccess */) {
55959
+ const indexedAccess = t.type;
55960
+ if (!isGenericObjectType(indexedAccess.objectType)) {
55961
+ const baseIndexType = getBaseConstraint(indexedAccess.indexType);
55962
+ const indexedAccessType = baseIndexType && getIndexedAccessTypeOrUndefined(indexedAccess.objectType, baseIndexType);
55963
+ const mappedIndexTypeOfIndexedAccess = indexedAccessType && mapType(indexedAccessType, getIndexType);
55964
+ const narrowed = mappedIndexTypeOfIndexedAccess && filterType(keyofConstraintType, (t2) => {
55965
+ return !(getIntersectionType([t2, mappedIndexTypeOfIndexedAccess]).flags & 131072 /* Never */);
55966
+ });
55967
+ if (narrowed) {
55968
+ return narrowed;
55969
+ }
55970
+ }
55971
+ }
55960
55972
  return keyofConstraintType;
55961
55973
  }
55962
55974
  if (t.flags & 134217728 /* TemplateLiteral */) {
@@ -59328,7 +59340,7 @@ ${lanes.join("\n")}
59328
59340
  }
59329
59341
  function getActualTypeVariable(type) {
59330
59342
  if (type.flags & 33554432 /* Substitution */) {
59331
- return type.baseType;
59343
+ return getActualTypeVariable(type.baseType);
59332
59344
  }
59333
59345
  if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
59334
59346
  return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
@@ -61821,7 +61833,7 @@ ${lanes.join("\n")}
61821
61833
  return 0 /* False */;
61822
61834
  }
61823
61835
  }
61824
- const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
61836
+ const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
61825
61837
  const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
61826
61838
  if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
61827
61839
  if (reportErrors2) {
@@ -64419,7 +64431,7 @@ ${lanes.join("\n")}
64419
64431
  }
64420
64432
  function isObjectTypeWithInferableIndex(type) {
64421
64433
  const objectFlags = getObjectFlags(type);
64422
- return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures2(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
64434
+ return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
64423
64435
  }
64424
64436
  function createSymbolWithType(source, type) {
64425
64437
  const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
@@ -69121,20 +69133,17 @@ ${lanes.join("\n")}
69121
69133
  contextualType
69122
69134
  );
69123
69135
  }
69124
- function getDiscriminatedApparentType(node, type) {
69125
- const apparentType = mapType(
69126
- type,
69127
- getApparentType,
69128
- /*noReductions*/
69129
- true
69130
- );
69131
- return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
69132
- }
69133
69136
  function getApparentTypeOfContextualType(node, contextFlags) {
69134
69137
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType2(node, contextFlags);
69135
69138
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
69136
69139
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
69137
- return getDiscriminatedApparentType(node, instantiatedType);
69140
+ const apparentType = mapType(
69141
+ instantiatedType,
69142
+ getApparentType,
69143
+ /*noReductions*/
69144
+ true
69145
+ );
69146
+ return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
69138
69147
  }
69139
69148
  }
69140
69149
  function instantiateContextualType(contextualType, node, contextFlags) {
@@ -71539,8 +71548,7 @@ ${lanes.join("\n")}
71539
71548
  const isFromBindingPattern = !skipBindingPatterns && getContextualType2(node, 8 /* SkipBindingPatterns */) !== contextualType;
71540
71549
  if (!isFromBindingPattern) {
71541
71550
  const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
71542
- const argumentApparentType = outerContext && isCallOrNewExpression(node.parent) && getDiscriminatedApparentType(node, contextualType);
71543
- const instantiatedType = instantiateType(argumentApparentType && argumentApparentType !== unknownType ? argumentApparentType : contextualType, outerMapper);
71551
+ const instantiatedType = instantiateType(contextualType, outerMapper);
71544
71552
  const contextualSignature = getSingleCallSignature(instantiatedType);
71545
71553
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
71546
71554
  inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
@@ -74868,7 +74876,7 @@ ${lanes.join("\n")}
74868
74876
  if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
74869
74877
  error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
74870
74878
  }
74871
- if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
74879
+ if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
74872
74880
  error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
74873
74881
  }
74874
74882
  return booleanType;
@@ -82539,8 +82547,8 @@ ${lanes.join("\n")}
82539
82547
  }
82540
82548
  return getNamedMembers(propsByName);
82541
82549
  }
82542
- function typeHasCallOrConstructSignatures2(type) {
82543
- return typeHasCallOrConstructSignatures(type, checker);
82550
+ function typeHasCallOrConstructSignatures(type) {
82551
+ return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
82544
82552
  }
82545
82553
  function getRootSymbols(symbol) {
82546
82554
  const roots = getImmediateRootSymbols(symbol);
@@ -85096,7 +85104,6 @@ ${lanes.join("\n")}
85096
85104
  "src/compiler/checker.ts"() {
85097
85105
  "use strict";
85098
85106
  init_ts2();
85099
- init_ts2();
85100
85107
  init_ts_moduleSpecifiers();
85101
85108
  init_ts_performance();
85102
85109
  ambientModuleSymbolRegex = /^".+"$/;
@@ -127909,7 +127916,7 @@ ${lanes.join("\n")}
127909
127916
  return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
127910
127917
  }
127911
127918
  function getContextualTypeFromParent(node, checker, contextFlags) {
127912
- const { parent: parent2 } = node;
127919
+ const parent2 = walkUpParenthesizedExpressions(node.parent);
127913
127920
  switch (parent2.kind) {
127914
127921
  case 211 /* NewExpression */:
127915
127922
  return checker.getContextualType(parent2, contextFlags);
@@ -127918,7 +127925,7 @@ ${lanes.join("\n")}
127918
127925
  return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
127919
127926
  }
127920
127927
  case 292 /* CaseClause */:
127921
- return parent2.expression === node ? getSwitchedType(parent2, checker) : void 0;
127928
+ return getSwitchedType(parent2, checker);
127922
127929
  default:
127923
127930
  return checker.getContextualType(node, contextFlags);
127924
127931
  }
@@ -128471,8 +128478,8 @@ ${lanes.join("\n")}
128471
128478
  const existingBigInts = /* @__PURE__ */ new Set();
128472
128479
  for (const clause of clauses) {
128473
128480
  if (!isDefaultClause(clause)) {
128474
- if (isLiteralExpression(clause.expression)) {
128475
- const expression = clause.expression;
128481
+ const expression = skipParentheses(clause.expression);
128482
+ if (isLiteralExpression(expression)) {
128476
128483
  switch (expression.kind) {
128477
128484
  case 14 /* NoSubstitutionTemplateLiteral */:
128478
128485
  case 10 /* StringLiteral */:
@@ -150431,7 +150438,7 @@ ${lanes.join("\n")}
150431
150438
  function getApparentProperties(type, node, checker) {
150432
150439
  if (!type.isUnion())
150433
150440
  return type.getApparentProperties();
150434
- return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
150441
+ return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
150435
150442
  }
150436
150443
  function containsNonPublicProperties(props) {
150437
150444
  return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
@@ -151041,7 +151048,7 @@ ${lanes.join("\n")}
151041
151048
  case 280 /* ExternalModuleReference */:
151042
151049
  return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
151043
151050
  case 292 /* CaseClause */:
151044
- const tracker = newCaseClauseTracker(typeChecker, node.parent.parent.clauses);
151051
+ const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
151045
151052
  const literals = fromContextualType().types.filter((literal) => !tracker.hasValue(literal.value));
151046
151053
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
151047
151054
  default:
@@ -157779,12 +157786,7 @@ ${lanes.join("\n")}
157779
157786
  return defaultImport || namedBindings ? factory.createImportDeclaration(
157780
157787
  /*modifiers*/
157781
157788
  void 0,
157782
- factory.createImportClause(
157783
- /*isTypeOnly*/
157784
- false,
157785
- defaultImport,
157786
- namedBindings
157787
- ),
157789
+ factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings),
157788
157790
  moduleSpecifier,
157789
157791
  /*assertClause*/
157790
157792
  void 0
@@ -169606,7 +169608,6 @@ ${options.prefix}` : "\n" : options.prefix
169606
169608
  typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
169607
169609
  typeAliasNamePart: () => typeAliasNamePart,
169608
169610
  typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
169609
- typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
169610
169611
  typeKeywords: () => typeKeywords,
169611
169612
  typeParameterNamePart: () => typeParameterNamePart,
169612
169613
  typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.0";
57
- var version = `${versionMajorMinor}.0-insiders.20230220`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230221`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.0.0-pr-52866-6",
5
+ "version": "5.0.0-pr-49107-5",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [