@typescript-deploys/pr-build 5.3.0-pr-55991-37 → 5.3.0-pr-56004-10

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.3";
21
- var version = `${versionMajorMinor}.0-insiders.20231005`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231006`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -48476,6 +48476,28 @@ function createTypeChecker(host) {
48476
48476
  const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context);
48477
48477
  context.enclosingDeclaration = saveEnclosingDeclaration;
48478
48478
  context.approximateLength += symbolName(propertySymbol).length + 1;
48479
+ if (propertySymbol.flags & 98304 /* Accessor */) {
48480
+ const writeType = getWriteTypeOfSymbol(propertySymbol);
48481
+ if (propertyType !== writeType) {
48482
+ const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
48483
+ const getterSignature = getSignatureFromDeclaration(getterDeclaration);
48484
+ typeElements.push(
48485
+ setCommentRange(
48486
+ signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
48487
+ getterDeclaration
48488
+ )
48489
+ );
48490
+ const setterDeclaration = getDeclarationOfKind(propertySymbol, 178 /* SetAccessor */);
48491
+ const setterSignature = getSignatureFromDeclaration(setterDeclaration);
48492
+ typeElements.push(
48493
+ setCommentRange(
48494
+ signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
48495
+ setterDeclaration
48496
+ )
48497
+ );
48498
+ return;
48499
+ }
48500
+ }
48479
48501
  const optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0;
48480
48502
  if (propertySymbol.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(propertyType).length && !isReadonlySymbol(propertySymbol)) {
48481
48503
  const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */);
@@ -48513,9 +48535,9 @@ function createTypeChecker(host) {
48513
48535
  typeElements.push(preserveCommentsOn(propertySignature));
48514
48536
  function preserveCommentsOn(node) {
48515
48537
  var _a2;
48516
- if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
48517
- const d = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d2) => d2.kind === 355 /* JSDocPropertyTag */);
48518
- const commentText = getTextOfJSDocComment(d.comment);
48538
+ const jsdocPropertyTag = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 355 /* JSDocPropertyTag */);
48539
+ if (jsdocPropertyTag) {
48540
+ const commentText = getTextOfJSDocComment(jsdocPropertyTag.comment);
48519
48541
  if (commentText) {
48520
48542
  setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
48521
48543
  }
@@ -50822,7 +50844,15 @@ function createTypeChecker(host) {
50822
50844
  const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
50823
50845
  return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class
50824
50846
  !!(length(filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) && !length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
50825
- !getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), (p) => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), (p) => some(p.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && every(getPropertiesOfType(typeToSerialize), (p) => isIdentifierText(symbolName(p), languageVersion));
50847
+ !getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), (p) => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), (p) => some(p.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && every(getPropertiesOfType(typeToSerialize), (p) => {
50848
+ if (!isIdentifierText(symbolName(p), languageVersion)) {
50849
+ return false;
50850
+ }
50851
+ if (!(p.flags & 98304 /* Accessor */)) {
50852
+ return true;
50853
+ }
50854
+ return getNonMissingTypeOfSymbol(p) === getWriteTypeOfSymbol(p);
50855
+ });
50826
50856
  }
50827
50857
  function makeSerializePropertySymbol(createProperty2, methodKind, useAccessors) {
50828
50858
  return function serializePropertySymbol(p, isStatic2, baseType) {
@@ -54025,7 +54055,12 @@ function createTypeChecker(host) {
54025
54055
  const checkType = type.checkType;
54026
54056
  const constraint = getLowerBoundOfKeyType(checkType);
54027
54057
  if (constraint !== checkType) {
54028
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
54058
+ return getConditionalTypeInstantiation(
54059
+ type,
54060
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
54061
+ /*forConstraint*/
54062
+ false
54063
+ );
54029
54064
  }
54030
54065
  }
54031
54066
  return type;
@@ -54377,7 +54412,12 @@ function createTypeChecker(host) {
54377
54412
  );
54378
54413
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
54379
54414
  if (constraint && constraint !== type.checkType) {
54380
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
54415
+ const instantiated = getConditionalTypeInstantiation(
54416
+ type,
54417
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
54418
+ /*forConstraint*/
54419
+ true
54420
+ );
54381
54421
  if (!(instantiated.flags & 131072 /* Never */)) {
54382
54422
  type.resolvedConstraintOfDistributive = instantiated;
54383
54423
  return instantiated;
@@ -57940,7 +57980,7 @@ function createTypeChecker(host) {
57940
57980
  function isDeferredType(type, checkTuples) {
57941
57981
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
57942
57982
  }
57943
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
57983
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
57944
57984
  let result;
57945
57985
  let extraTypes;
57946
57986
  let tailCount = 0;
@@ -57986,7 +58026,7 @@ function createTypeChecker(host) {
57986
58026
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
57987
58027
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
57988
58028
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
57989
- if (checkType.flags & 1 /* Any */) {
58029
+ if (checkType.flags & 1 /* Any */ || forConstraint && areTypesComparable(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) {
57990
58030
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
57991
58031
  }
57992
58032
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -58096,7 +58136,9 @@ function createTypeChecker(host) {
58096
58136
  links.resolvedType = getConditionalType(
58097
58137
  root,
58098
58138
  /*mapper*/
58099
- void 0
58139
+ void 0,
58140
+ /*forConstraint*/
58141
+ false
58100
58142
  );
58101
58143
  if (outerTypeParameters) {
58102
58144
  root.instantiations = /* @__PURE__ */ new Map();
@@ -58950,17 +58992,17 @@ function createTypeChecker(host) {
58950
58992
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
58951
58993
  return result;
58952
58994
  }
58953
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
58995
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
58954
58996
  const root = type.root;
58955
58997
  if (root.outerTypeParameters) {
58956
58998
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
58957
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
58999
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
58958
59000
  let result = root.instantiations.get(id);
58959
59001
  if (!result) {
58960
59002
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
58961
59003
  const checkType = root.checkType;
58962
59004
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
58963
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
59005
+ result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
58964
59006
  root.instantiations.set(id, result);
58965
59007
  }
58966
59008
  return result;
@@ -59048,7 +59090,14 @@ function createTypeChecker(host) {
59048
59090
  );
59049
59091
  }
59050
59092
  if (flags & 16777216 /* Conditional */) {
59051
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
59093
+ return getConditionalTypeInstantiation(
59094
+ type,
59095
+ combineTypeMappers(type.mapper, mapper),
59096
+ /*forConstraint*/
59097
+ false,
59098
+ aliasSymbol,
59099
+ aliasTypeArguments
59100
+ );
59052
59101
  }
59053
59102
  if (flags & 33554432 /* Substitution */) {
59054
59103
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -61589,13 +61638,6 @@ function createTypeChecker(host) {
61589
61638
  return result2;
61590
61639
  }
61591
61640
  }
61592
- } else {
61593
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
61594
- if (distributiveConstraint) {
61595
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
61596
- return result2;
61597
- }
61598
- }
61599
61641
  }
61600
61642
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
61601
61643
  if (defaultConstraint) {
@@ -61603,6 +61645,13 @@ function createTypeChecker(host) {
61603
61645
  return result2;
61604
61646
  }
61605
61647
  }
61648
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
61649
+ if (distributiveConstraint) {
61650
+ resetErrorInfo(saveErrorInfo);
61651
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
61652
+ return result2;
61653
+ }
61654
+ }
61606
61655
  } else {
61607
61656
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
61608
61657
  return -1 /* True */;
@@ -65710,7 +65759,16 @@ function createTypeChecker(host) {
65710
65759
  } else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
65711
65760
  type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
65712
65761
  } else if (expr.kind === 112 /* TrueKeyword */) {
65713
- type = narrowTypeBySwitchOnTrue(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
65762
+ const clause = flow.switchStatement.caseBlock.clauses.find((_, index) => index === flow.clauseStart);
65763
+ const clauseExpression = clause && clause.kind === 296 /* CaseClause */ ? clause.expression : void 0;
65764
+ if (clauseExpression) {
65765
+ type = narrowType(
65766
+ type,
65767
+ clauseExpression,
65768
+ /*assumeTrue*/
65769
+ true
65770
+ );
65771
+ }
65714
65772
  } else {
65715
65773
  if (strictNullChecks) {
65716
65774
  if (optionalChainContainsReference(expr, reference)) {
@@ -66256,30 +66314,6 @@ function createTypeChecker(host) {
66256
66314
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
66257
66315
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
66258
66316
  }
66259
- function narrowTypeBySwitchOnTrue(type, switchStatement, clauseStart, clauseEnd) {
66260
- const clauses = switchStatement.caseBlock.clauses.slice(clauseStart, clauseEnd);
66261
- const clausesType = narrowTypeForTrueClauses(type, clauses);
66262
- const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 297 /* DefaultClause */);
66263
- const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
66264
- if (hasDefaultClause) {
66265
- const clausesBefore = switchStatement.caseBlock.clauses.slice(0, clauseStart);
66266
- const clausesAfter = switchStatement.caseBlock.clauses.slice(clauseEnd);
66267
- const before = narrowTypeForTrueClauses(type, clausesBefore);
66268
- const after = narrowTypeForTrueClauses(type, clausesAfter);
66269
- const other = getUnionType([before, after]);
66270
- const typeNotOther = filterType(type, (t) => !isTypeSubsetOf(t, other));
66271
- return getUnionType([clausesType, typeNotOther]);
66272
- }
66273
- return clausesType;
66274
- }
66275
- function narrowTypeForTrueClauses(type, clauses) {
66276
- return getUnionType(map(clauses, (clause) => clause.kind === 296 /* CaseClause */ ? narrowType(
66277
- type,
66278
- clause.expression,
66279
- /*assumeTrue*/
66280
- true
66281
- ) : neverType));
66282
- }
66283
66317
  function isMatchingConstructorReference(expr) {
66284
66318
  return (isPropertyAccessExpression(expr) && idText(expr.name) === "constructor" || isElementAccessExpression(expr) && isStringLiteralLike(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression);
66285
66319
  }
package/lib/tsserver.js CHANGED
@@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(server_exports);
2328
2328
 
2329
2329
  // src/compiler/corePublic.ts
2330
2330
  var versionMajorMinor = "5.3";
2331
- var version = `${versionMajorMinor}.0-insiders.20231005`;
2331
+ var version = `${versionMajorMinor}.0-insiders.20231006`;
2332
2332
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2333
2333
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2334
2334
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -53188,6 +53188,28 @@ function createTypeChecker(host) {
53188
53188
  const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context);
53189
53189
  context.enclosingDeclaration = saveEnclosingDeclaration;
53190
53190
  context.approximateLength += symbolName(propertySymbol).length + 1;
53191
+ if (propertySymbol.flags & 98304 /* Accessor */) {
53192
+ const writeType = getWriteTypeOfSymbol(propertySymbol);
53193
+ if (propertyType !== writeType) {
53194
+ const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
53195
+ const getterSignature = getSignatureFromDeclaration(getterDeclaration);
53196
+ typeElements.push(
53197
+ setCommentRange(
53198
+ signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
53199
+ getterDeclaration
53200
+ )
53201
+ );
53202
+ const setterDeclaration = getDeclarationOfKind(propertySymbol, 178 /* SetAccessor */);
53203
+ const setterSignature = getSignatureFromDeclaration(setterDeclaration);
53204
+ typeElements.push(
53205
+ setCommentRange(
53206
+ signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
53207
+ setterDeclaration
53208
+ )
53209
+ );
53210
+ return;
53211
+ }
53212
+ }
53191
53213
  const optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0;
53192
53214
  if (propertySymbol.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(propertyType).length && !isReadonlySymbol(propertySymbol)) {
53193
53215
  const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */);
@@ -53225,9 +53247,9 @@ function createTypeChecker(host) {
53225
53247
  typeElements.push(preserveCommentsOn(propertySignature));
53226
53248
  function preserveCommentsOn(node) {
53227
53249
  var _a2;
53228
- if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
53229
- const d = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d2) => d2.kind === 355 /* JSDocPropertyTag */);
53230
- const commentText = getTextOfJSDocComment(d.comment);
53250
+ const jsdocPropertyTag = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 355 /* JSDocPropertyTag */);
53251
+ if (jsdocPropertyTag) {
53252
+ const commentText = getTextOfJSDocComment(jsdocPropertyTag.comment);
53231
53253
  if (commentText) {
53232
53254
  setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
53233
53255
  }
@@ -55534,7 +55556,15 @@ function createTypeChecker(host) {
55534
55556
  const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
55535
55557
  return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class
55536
55558
  !!(length(filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) && !length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
55537
- !getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), (p) => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), (p) => some(p.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && every(getPropertiesOfType(typeToSerialize), (p) => isIdentifierText(symbolName(p), languageVersion));
55559
+ !getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), (p) => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), (p) => some(p.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && every(getPropertiesOfType(typeToSerialize), (p) => {
55560
+ if (!isIdentifierText(symbolName(p), languageVersion)) {
55561
+ return false;
55562
+ }
55563
+ if (!(p.flags & 98304 /* Accessor */)) {
55564
+ return true;
55565
+ }
55566
+ return getNonMissingTypeOfSymbol(p) === getWriteTypeOfSymbol(p);
55567
+ });
55538
55568
  }
55539
55569
  function makeSerializePropertySymbol(createProperty2, methodKind, useAccessors) {
55540
55570
  return function serializePropertySymbol(p, isStatic2, baseType) {
@@ -58737,7 +58767,12 @@ function createTypeChecker(host) {
58737
58767
  const checkType = type.checkType;
58738
58768
  const constraint = getLowerBoundOfKeyType(checkType);
58739
58769
  if (constraint !== checkType) {
58740
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
58770
+ return getConditionalTypeInstantiation(
58771
+ type,
58772
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
58773
+ /*forConstraint*/
58774
+ false
58775
+ );
58741
58776
  }
58742
58777
  }
58743
58778
  return type;
@@ -59089,7 +59124,12 @@ function createTypeChecker(host) {
59089
59124
  );
59090
59125
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
59091
59126
  if (constraint && constraint !== type.checkType) {
59092
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
59127
+ const instantiated = getConditionalTypeInstantiation(
59128
+ type,
59129
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
59130
+ /*forConstraint*/
59131
+ true
59132
+ );
59093
59133
  if (!(instantiated.flags & 131072 /* Never */)) {
59094
59134
  type.resolvedConstraintOfDistributive = instantiated;
59095
59135
  return instantiated;
@@ -62652,7 +62692,7 @@ function createTypeChecker(host) {
62652
62692
  function isDeferredType(type, checkTuples) {
62653
62693
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
62654
62694
  }
62655
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
62695
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
62656
62696
  let result;
62657
62697
  let extraTypes;
62658
62698
  let tailCount = 0;
@@ -62698,7 +62738,7 @@ function createTypeChecker(host) {
62698
62738
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
62699
62739
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
62700
62740
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
62701
- if (checkType.flags & 1 /* Any */) {
62741
+ if (checkType.flags & 1 /* Any */ || forConstraint && areTypesComparable(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) {
62702
62742
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
62703
62743
  }
62704
62744
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -62808,7 +62848,9 @@ function createTypeChecker(host) {
62808
62848
  links.resolvedType = getConditionalType(
62809
62849
  root,
62810
62850
  /*mapper*/
62811
- void 0
62851
+ void 0,
62852
+ /*forConstraint*/
62853
+ false
62812
62854
  );
62813
62855
  if (outerTypeParameters) {
62814
62856
  root.instantiations = /* @__PURE__ */ new Map();
@@ -63662,17 +63704,17 @@ function createTypeChecker(host) {
63662
63704
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
63663
63705
  return result;
63664
63706
  }
63665
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
63707
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
63666
63708
  const root = type.root;
63667
63709
  if (root.outerTypeParameters) {
63668
63710
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
63669
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
63711
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
63670
63712
  let result = root.instantiations.get(id);
63671
63713
  if (!result) {
63672
63714
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
63673
63715
  const checkType = root.checkType;
63674
63716
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
63675
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
63717
+ result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
63676
63718
  root.instantiations.set(id, result);
63677
63719
  }
63678
63720
  return result;
@@ -63760,7 +63802,14 @@ function createTypeChecker(host) {
63760
63802
  );
63761
63803
  }
63762
63804
  if (flags & 16777216 /* Conditional */) {
63763
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
63805
+ return getConditionalTypeInstantiation(
63806
+ type,
63807
+ combineTypeMappers(type.mapper, mapper),
63808
+ /*forConstraint*/
63809
+ false,
63810
+ aliasSymbol,
63811
+ aliasTypeArguments
63812
+ );
63764
63813
  }
63765
63814
  if (flags & 33554432 /* Substitution */) {
63766
63815
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -66301,13 +66350,6 @@ function createTypeChecker(host) {
66301
66350
  return result2;
66302
66351
  }
66303
66352
  }
66304
- } else {
66305
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
66306
- if (distributiveConstraint) {
66307
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
66308
- return result2;
66309
- }
66310
- }
66311
66353
  }
66312
66354
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
66313
66355
  if (defaultConstraint) {
@@ -66315,6 +66357,13 @@ function createTypeChecker(host) {
66315
66357
  return result2;
66316
66358
  }
66317
66359
  }
66360
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
66361
+ if (distributiveConstraint) {
66362
+ resetErrorInfo(saveErrorInfo);
66363
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
66364
+ return result2;
66365
+ }
66366
+ }
66318
66367
  } else {
66319
66368
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
66320
66369
  return -1 /* True */;
@@ -70422,7 +70471,16 @@ function createTypeChecker(host) {
70422
70471
  } else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
70423
70472
  type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
70424
70473
  } else if (expr.kind === 112 /* TrueKeyword */) {
70425
- type = narrowTypeBySwitchOnTrue(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
70474
+ const clause = flow.switchStatement.caseBlock.clauses.find((_, index) => index === flow.clauseStart);
70475
+ const clauseExpression = clause && clause.kind === 296 /* CaseClause */ ? clause.expression : void 0;
70476
+ if (clauseExpression) {
70477
+ type = narrowType(
70478
+ type,
70479
+ clauseExpression,
70480
+ /*assumeTrue*/
70481
+ true
70482
+ );
70483
+ }
70426
70484
  } else {
70427
70485
  if (strictNullChecks) {
70428
70486
  if (optionalChainContainsReference(expr, reference)) {
@@ -70968,30 +71026,6 @@ function createTypeChecker(host) {
70968
71026
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
70969
71027
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
70970
71028
  }
70971
- function narrowTypeBySwitchOnTrue(type, switchStatement, clauseStart, clauseEnd) {
70972
- const clauses = switchStatement.caseBlock.clauses.slice(clauseStart, clauseEnd);
70973
- const clausesType = narrowTypeForTrueClauses(type, clauses);
70974
- const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 297 /* DefaultClause */);
70975
- const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
70976
- if (hasDefaultClause) {
70977
- const clausesBefore = switchStatement.caseBlock.clauses.slice(0, clauseStart);
70978
- const clausesAfter = switchStatement.caseBlock.clauses.slice(clauseEnd);
70979
- const before = narrowTypeForTrueClauses(type, clausesBefore);
70980
- const after = narrowTypeForTrueClauses(type, clausesAfter);
70981
- const other = getUnionType([before, after]);
70982
- const typeNotOther = filterType(type, (t) => !isTypeSubsetOf(t, other));
70983
- return getUnionType([clausesType, typeNotOther]);
70984
- }
70985
- return clausesType;
70986
- }
70987
- function narrowTypeForTrueClauses(type, clauses) {
70988
- return getUnionType(map(clauses, (clause) => clause.kind === 296 /* CaseClause */ ? narrowType(
70989
- type,
70990
- clause.expression,
70991
- /*assumeTrue*/
70992
- true
70993
- ) : neverType));
70994
- }
70995
71029
  function isMatchingConstructorReference(expr) {
70996
71030
  return (isPropertyAccessExpression(expr) && idText(expr.name) === "constructor" || isElementAccessExpression(expr) && isStringLiteralLike(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression);
70997
71031
  }
@@ -157250,7 +157284,7 @@ function completionInfoFromData(sourceFile, host, program, compilerOptions, log,
157250
157284
  );
157251
157285
  if (keywordFilters !== 0 /* None */) {
157252
157286
  for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
157253
- if (isTypeOnlyLocation && isTypeKeyword(stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
157287
+ if (isTypeOnlyLocation && isTypeKeyword(stringToToken(keywordEntry.name)) || !isTypeOnlyLocation && isContextualKeywordInAutoImportableExpressionSpace(keywordEntry.name) || !uniqueNames.has(keywordEntry.name)) {
157254
157288
  uniqueNames.add(keywordEntry.name);
157255
157289
  insertSorted(
157256
157290
  entries,
@@ -160439,6 +160473,9 @@ function toUpperCharCode(charCode) {
160439
160473
  }
160440
160474
  return charCode;
160441
160475
  }
160476
+ function isContextualKeywordInAutoImportableExpressionSpace(keyword) {
160477
+ return keyword === "abstract" || keyword === "async" || keyword === "await" || keyword === "declare" || keyword === "module" || keyword === "namespace" || keyword === "type";
160478
+ }
160442
160479
 
160443
160480
  // src/services/_namespaces/ts.Completions.StringCompletions.ts
160444
160481
  var ts_Completions_StringCompletions_exports = {};
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.3";
38
- version = `${versionMajorMinor}.0-insiders.20231005`;
38
+ version = `${versionMajorMinor}.0-insiders.20231006`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -50955,6 +50955,28 @@ ${lanes.join("\n")}
50955
50955
  const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context);
50956
50956
  context.enclosingDeclaration = saveEnclosingDeclaration;
50957
50957
  context.approximateLength += symbolName(propertySymbol).length + 1;
50958
+ if (propertySymbol.flags & 98304 /* Accessor */) {
50959
+ const writeType = getWriteTypeOfSymbol(propertySymbol);
50960
+ if (propertyType !== writeType) {
50961
+ const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
50962
+ const getterSignature = getSignatureFromDeclaration(getterDeclaration);
50963
+ typeElements.push(
50964
+ setCommentRange(
50965
+ signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
50966
+ getterDeclaration
50967
+ )
50968
+ );
50969
+ const setterDeclaration = getDeclarationOfKind(propertySymbol, 178 /* SetAccessor */);
50970
+ const setterSignature = getSignatureFromDeclaration(setterDeclaration);
50971
+ typeElements.push(
50972
+ setCommentRange(
50973
+ signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
50974
+ setterDeclaration
50975
+ )
50976
+ );
50977
+ return;
50978
+ }
50979
+ }
50958
50980
  const optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0;
50959
50981
  if (propertySymbol.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(propertyType).length && !isReadonlySymbol(propertySymbol)) {
50960
50982
  const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */);
@@ -50992,9 +51014,9 @@ ${lanes.join("\n")}
50992
51014
  typeElements.push(preserveCommentsOn(propertySignature));
50993
51015
  function preserveCommentsOn(node) {
50994
51016
  var _a2;
50995
- if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
50996
- const d = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d2) => d2.kind === 355 /* JSDocPropertyTag */);
50997
- const commentText = getTextOfJSDocComment(d.comment);
51017
+ const jsdocPropertyTag = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 355 /* JSDocPropertyTag */);
51018
+ if (jsdocPropertyTag) {
51019
+ const commentText = getTextOfJSDocComment(jsdocPropertyTag.comment);
50998
51020
  if (commentText) {
50999
51021
  setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
51000
51022
  }
@@ -53301,7 +53323,15 @@ ${lanes.join("\n")}
53301
53323
  const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
53302
53324
  return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class
53303
53325
  !!(length(filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) && !length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
53304
- !getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), (p) => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), (p) => some(p.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && every(getPropertiesOfType(typeToSerialize), (p) => isIdentifierText(symbolName(p), languageVersion));
53326
+ !getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), (p) => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), (p) => some(p.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && every(getPropertiesOfType(typeToSerialize), (p) => {
53327
+ if (!isIdentifierText(symbolName(p), languageVersion)) {
53328
+ return false;
53329
+ }
53330
+ if (!(p.flags & 98304 /* Accessor */)) {
53331
+ return true;
53332
+ }
53333
+ return getNonMissingTypeOfSymbol(p) === getWriteTypeOfSymbol(p);
53334
+ });
53305
53335
  }
53306
53336
  function makeSerializePropertySymbol(createProperty2, methodKind, useAccessors) {
53307
53337
  return function serializePropertySymbol(p, isStatic2, baseType) {
@@ -56504,7 +56534,12 @@ ${lanes.join("\n")}
56504
56534
  const checkType = type.checkType;
56505
56535
  const constraint = getLowerBoundOfKeyType(checkType);
56506
56536
  if (constraint !== checkType) {
56507
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
56537
+ return getConditionalTypeInstantiation(
56538
+ type,
56539
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
56540
+ /*forConstraint*/
56541
+ false
56542
+ );
56508
56543
  }
56509
56544
  }
56510
56545
  return type;
@@ -56856,7 +56891,12 @@ ${lanes.join("\n")}
56856
56891
  );
56857
56892
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
56858
56893
  if (constraint && constraint !== type.checkType) {
56859
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
56894
+ const instantiated = getConditionalTypeInstantiation(
56895
+ type,
56896
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
56897
+ /*forConstraint*/
56898
+ true
56899
+ );
56860
56900
  if (!(instantiated.flags & 131072 /* Never */)) {
56861
56901
  type.resolvedConstraintOfDistributive = instantiated;
56862
56902
  return instantiated;
@@ -60419,7 +60459,7 @@ ${lanes.join("\n")}
60419
60459
  function isDeferredType(type, checkTuples) {
60420
60460
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
60421
60461
  }
60422
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
60462
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
60423
60463
  let result;
60424
60464
  let extraTypes;
60425
60465
  let tailCount = 0;
@@ -60465,7 +60505,7 @@ ${lanes.join("\n")}
60465
60505
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
60466
60506
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
60467
60507
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
60468
- if (checkType.flags & 1 /* Any */) {
60508
+ if (checkType.flags & 1 /* Any */ || forConstraint && areTypesComparable(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) {
60469
60509
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
60470
60510
  }
60471
60511
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -60575,7 +60615,9 @@ ${lanes.join("\n")}
60575
60615
  links.resolvedType = getConditionalType(
60576
60616
  root,
60577
60617
  /*mapper*/
60578
- void 0
60618
+ void 0,
60619
+ /*forConstraint*/
60620
+ false
60579
60621
  );
60580
60622
  if (outerTypeParameters) {
60581
60623
  root.instantiations = /* @__PURE__ */ new Map();
@@ -61429,17 +61471,17 @@ ${lanes.join("\n")}
61429
61471
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
61430
61472
  return result;
61431
61473
  }
61432
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
61474
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
61433
61475
  const root = type.root;
61434
61476
  if (root.outerTypeParameters) {
61435
61477
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
61436
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
61478
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
61437
61479
  let result = root.instantiations.get(id);
61438
61480
  if (!result) {
61439
61481
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
61440
61482
  const checkType = root.checkType;
61441
61483
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
61442
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
61484
+ result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
61443
61485
  root.instantiations.set(id, result);
61444
61486
  }
61445
61487
  return result;
@@ -61527,7 +61569,14 @@ ${lanes.join("\n")}
61527
61569
  );
61528
61570
  }
61529
61571
  if (flags & 16777216 /* Conditional */) {
61530
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
61572
+ return getConditionalTypeInstantiation(
61573
+ type,
61574
+ combineTypeMappers(type.mapper, mapper),
61575
+ /*forConstraint*/
61576
+ false,
61577
+ aliasSymbol,
61578
+ aliasTypeArguments
61579
+ );
61531
61580
  }
61532
61581
  if (flags & 33554432 /* Substitution */) {
61533
61582
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -64068,13 +64117,6 @@ ${lanes.join("\n")}
64068
64117
  return result2;
64069
64118
  }
64070
64119
  }
64071
- } else {
64072
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
64073
- if (distributiveConstraint) {
64074
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
64075
- return result2;
64076
- }
64077
- }
64078
64120
  }
64079
64121
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
64080
64122
  if (defaultConstraint) {
@@ -64082,6 +64124,13 @@ ${lanes.join("\n")}
64082
64124
  return result2;
64083
64125
  }
64084
64126
  }
64127
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
64128
+ if (distributiveConstraint) {
64129
+ resetErrorInfo(saveErrorInfo);
64130
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
64131
+ return result2;
64132
+ }
64133
+ }
64085
64134
  } else {
64086
64135
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
64087
64136
  return -1 /* True */;
@@ -68189,7 +68238,16 @@ ${lanes.join("\n")}
68189
68238
  } else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
68190
68239
  type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
68191
68240
  } else if (expr.kind === 112 /* TrueKeyword */) {
68192
- type = narrowTypeBySwitchOnTrue(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
68241
+ const clause = flow.switchStatement.caseBlock.clauses.find((_, index) => index === flow.clauseStart);
68242
+ const clauseExpression = clause && clause.kind === 296 /* CaseClause */ ? clause.expression : void 0;
68243
+ if (clauseExpression) {
68244
+ type = narrowType(
68245
+ type,
68246
+ clauseExpression,
68247
+ /*assumeTrue*/
68248
+ true
68249
+ );
68250
+ }
68193
68251
  } else {
68194
68252
  if (strictNullChecks) {
68195
68253
  if (optionalChainContainsReference(expr, reference)) {
@@ -68735,30 +68793,6 @@ ${lanes.join("\n")}
68735
68793
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
68736
68794
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
68737
68795
  }
68738
- function narrowTypeBySwitchOnTrue(type, switchStatement, clauseStart, clauseEnd) {
68739
- const clauses = switchStatement.caseBlock.clauses.slice(clauseStart, clauseEnd);
68740
- const clausesType = narrowTypeForTrueClauses(type, clauses);
68741
- const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 297 /* DefaultClause */);
68742
- const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
68743
- if (hasDefaultClause) {
68744
- const clausesBefore = switchStatement.caseBlock.clauses.slice(0, clauseStart);
68745
- const clausesAfter = switchStatement.caseBlock.clauses.slice(clauseEnd);
68746
- const before = narrowTypeForTrueClauses(type, clausesBefore);
68747
- const after = narrowTypeForTrueClauses(type, clausesAfter);
68748
- const other = getUnionType([before, after]);
68749
- const typeNotOther = filterType(type, (t) => !isTypeSubsetOf(t, other));
68750
- return getUnionType([clausesType, typeNotOther]);
68751
- }
68752
- return clausesType;
68753
- }
68754
- function narrowTypeForTrueClauses(type, clauses) {
68755
- return getUnionType(map(clauses, (clause) => clause.kind === 296 /* CaseClause */ ? narrowType(
68756
- type,
68757
- clause.expression,
68758
- /*assumeTrue*/
68759
- true
68760
- ) : neverType));
68761
- }
68762
68796
  function isMatchingConstructorReference(expr) {
68763
68797
  return (isPropertyAccessExpression(expr) && idText(expr.name) === "constructor" || isElementAccessExpression(expr) && isStringLiteralLike(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression);
68764
68798
  }
@@ -156474,7 +156508,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
156474
156508
  );
156475
156509
  if (keywordFilters !== 0 /* None */) {
156476
156510
  for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
156477
- if (isTypeOnlyLocation && isTypeKeyword(stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
156511
+ if (isTypeOnlyLocation && isTypeKeyword(stringToToken(keywordEntry.name)) || !isTypeOnlyLocation && isContextualKeywordInAutoImportableExpressionSpace(keywordEntry.name) || !uniqueNames.has(keywordEntry.name)) {
156478
156512
  uniqueNames.add(keywordEntry.name);
156479
156513
  insertSorted(
156480
156514
  entries,
@@ -159641,6 +159675,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
159641
159675
  }
159642
159676
  return charCode;
159643
159677
  }
159678
+ function isContextualKeywordInAutoImportableExpressionSpace(keyword) {
159679
+ return keyword === "abstract" || keyword === "async" || keyword === "await" || keyword === "declare" || keyword === "module" || keyword === "namespace" || keyword === "type";
159680
+ }
159644
159681
  var moduleSpecifierResolutionLimit, moduleSpecifierResolutionCacheAttemptLimit, SortText, CompletionSource, SymbolOriginInfoKind, CompletionKind, _keywordCompletions, allKeywordsCompletions;
159645
159682
  var init_completions = __esm({
159646
159683
  "src/services/completions.ts"() {
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.3";
57
- var version = `${versionMajorMinor}.0-insiders.20231005`;
57
+ var version = `${versionMajorMinor}.0-insiders.20231006`;
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.3.0-pr-55991-37",
5
+ "version": "5.3.0-pr-56004-10",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "2c2be073b2b807b0d45edd413fb922128c517411"
117
+ "gitHead": "833be10fdbb871b107e14d5b092c9b17a912b60f"
118
118
  }