typescript 5.2.0-dev.20230613 → 5.2.0-dev.20230615

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.2";
21
- var version = `${versionMajorMinor}.0-dev.20230613`;
21
+ var version = `${versionMajorMinor}.0-dev.20230615`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -42962,13 +42962,24 @@ function createTypeChecker(host) {
42962
42962
  getTypeOfPropertyOfContextualType,
42963
42963
  getFullyQualifiedName,
42964
42964
  getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
42965
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
42966
- call,
42967
- candidatesOutArray,
42968
- /*argumentCount*/
42969
- void 0,
42970
- 32 /* IsForStringLiteralArgumentCompletions */
42971
- )),
42965
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
42966
+ if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
42967
+ return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
42968
+ call,
42969
+ candidatesOutArray,
42970
+ /*argumentCount*/
42971
+ void 0,
42972
+ checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
42973
+ ));
42974
+ }
42975
+ return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
42976
+ call,
42977
+ candidatesOutArray,
42978
+ /*argumentCount*/
42979
+ void 0,
42980
+ checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
42981
+ ));
42982
+ },
42972
42983
  getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
42973
42984
  getExpandedParameters,
42974
42985
  hasEffectiveRestParameter,
@@ -50795,9 +50806,15 @@ function createTypeChecker(host) {
50795
50806
  const prop = getPropertyOfType(type, name);
50796
50807
  return prop ? getTypeOfSymbol(prop) : void 0;
50797
50808
  }
50798
- function getTypeOfPropertyOrIndexSignature(type, name) {
50809
+ function getTypeOfPropertyOrIndexSignature(type, name, addOptionalityToIndex) {
50799
50810
  var _a;
50800
- return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) || unknownType;
50811
+ let propType;
50812
+ return getTypeOfPropertyOfType(type, name) || (propType = (_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) && addOptionality(
50813
+ propType,
50814
+ /*isProperty*/
50815
+ true,
50816
+ addOptionalityToIndex
50817
+ ) || unknownType;
50801
50818
  }
50802
50819
  function isTypeAny(type) {
50803
50820
  return type && (type.flags & 1 /* Any */) !== 0;
@@ -61799,7 +61816,12 @@ function createTypeChecker(host) {
61799
61816
  let matched = false;
61800
61817
  for (let i = 0; i < types.length; i++) {
61801
61818
  if (include[i]) {
61802
- const targetType = getTypeOfPropertyOfType(types[i], propertyName);
61819
+ const targetType = getTypeOfPropertyOrIndexSignature(
61820
+ types[i],
61821
+ propertyName,
61822
+ /*addOptionalityToIndex*/
61823
+ true
61824
+ );
61803
61825
  if (targetType && related(getDiscriminatingType(), targetType)) {
61804
61826
  matched = true;
61805
61827
  } else {
@@ -63730,7 +63752,7 @@ function createTypeChecker(host) {
63730
63752
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
63731
63753
  if (constraint) {
63732
63754
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
63733
- if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
63755
+ if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
63734
63756
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
63735
63757
  }
63736
63758
  }
@@ -65197,7 +65219,12 @@ function createTypeChecker(host) {
65197
65219
  propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
65198
65220
  const narrowedPropType = narrowType2(propType);
65199
65221
  return filterType(type, (t) => {
65200
- const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
65222
+ const discriminantType = getTypeOfPropertyOrIndexSignature(
65223
+ t,
65224
+ propName,
65225
+ /*addOptionalityToIndex*/
65226
+ false
65227
+ );
65201
65228
  return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
65202
65229
  });
65203
65230
  }
@@ -69645,7 +69672,7 @@ function createTypeChecker(host) {
69645
69672
  }
69646
69673
  for (let i = 0; i < argCount; i++) {
69647
69674
  const arg = args[i];
69648
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
69675
+ if (arg.kind !== 231 /* OmittedExpression */) {
69649
69676
  const paramType = getTypeAtPosition(signature, i);
69650
69677
  if (couldContainTypeVariables(paramType)) {
69651
69678
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -70258,7 +70285,6 @@ function createTypeChecker(host) {
70258
70285
  const args = getEffectiveCallArguments(node);
70259
70286
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
70260
70287
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
70261
- argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70262
70288
  let candidatesForArgumentError;
70263
70289
  let candidateForArgumentArityError;
70264
70290
  let candidateForTypeArgumentError;
@@ -70482,7 +70508,7 @@ function createTypeChecker(host) {
70482
70508
  continue;
70483
70509
  }
70484
70510
  if (argCheckMode) {
70485
- argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70511
+ argCheckMode = 0 /* Normal */;
70486
70512
  if (inferenceContext) {
70487
70513
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
70488
70514
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -74335,7 +74361,7 @@ function createTypeChecker(host) {
74335
74361
  return nullWideningType;
74336
74362
  case 15 /* NoSubstitutionTemplateLiteral */:
74337
74363
  case 11 /* StringLiteral */:
74338
- return hasSkipDirectInferenceFlag(node) ? anyType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
74364
+ return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
74339
74365
  case 9 /* NumericLiteral */:
74340
74366
  checkGrammarNumericLiteral(node);
74341
74367
  return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
package/lib/tsserver.js CHANGED
@@ -2305,7 +2305,7 @@ module.exports = __toCommonJS(server_exports);
2305
2305
 
2306
2306
  // src/compiler/corePublic.ts
2307
2307
  var versionMajorMinor = "5.2";
2308
- var version = `${versionMajorMinor}.0-dev.20230613`;
2308
+ var version = `${versionMajorMinor}.0-dev.20230615`;
2309
2309
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2310
2310
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2311
2311
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -47603,13 +47603,24 @@ function createTypeChecker(host) {
47603
47603
  getTypeOfPropertyOfContextualType,
47604
47604
  getFullyQualifiedName,
47605
47605
  getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
47606
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
47607
- call,
47608
- candidatesOutArray,
47609
- /*argumentCount*/
47610
- void 0,
47611
- 32 /* IsForStringLiteralArgumentCompletions */
47612
- )),
47606
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
47607
+ if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
47608
+ return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
47609
+ call,
47610
+ candidatesOutArray,
47611
+ /*argumentCount*/
47612
+ void 0,
47613
+ checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
47614
+ ));
47615
+ }
47616
+ return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
47617
+ call,
47618
+ candidatesOutArray,
47619
+ /*argumentCount*/
47620
+ void 0,
47621
+ checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
47622
+ ));
47623
+ },
47613
47624
  getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
47614
47625
  getExpandedParameters,
47615
47626
  hasEffectiveRestParameter,
@@ -55436,9 +55447,15 @@ function createTypeChecker(host) {
55436
55447
  const prop = getPropertyOfType(type, name);
55437
55448
  return prop ? getTypeOfSymbol(prop) : void 0;
55438
55449
  }
55439
- function getTypeOfPropertyOrIndexSignature(type, name) {
55450
+ function getTypeOfPropertyOrIndexSignature(type, name, addOptionalityToIndex) {
55440
55451
  var _a;
55441
- return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) || unknownType;
55452
+ let propType;
55453
+ return getTypeOfPropertyOfType(type, name) || (propType = (_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) && addOptionality(
55454
+ propType,
55455
+ /*isProperty*/
55456
+ true,
55457
+ addOptionalityToIndex
55458
+ ) || unknownType;
55442
55459
  }
55443
55460
  function isTypeAny(type) {
55444
55461
  return type && (type.flags & 1 /* Any */) !== 0;
@@ -66440,7 +66457,12 @@ function createTypeChecker(host) {
66440
66457
  let matched = false;
66441
66458
  for (let i = 0; i < types.length; i++) {
66442
66459
  if (include[i]) {
66443
- const targetType = getTypeOfPropertyOfType(types[i], propertyName);
66460
+ const targetType = getTypeOfPropertyOrIndexSignature(
66461
+ types[i],
66462
+ propertyName,
66463
+ /*addOptionalityToIndex*/
66464
+ true
66465
+ );
66444
66466
  if (targetType && related(getDiscriminatingType(), targetType)) {
66445
66467
  matched = true;
66446
66468
  } else {
@@ -68371,7 +68393,7 @@ function createTypeChecker(host) {
68371
68393
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
68372
68394
  if (constraint) {
68373
68395
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
68374
- if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
68396
+ if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
68375
68397
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
68376
68398
  }
68377
68399
  }
@@ -69838,7 +69860,12 @@ function createTypeChecker(host) {
69838
69860
  propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
69839
69861
  const narrowedPropType = narrowType2(propType);
69840
69862
  return filterType(type, (t) => {
69841
- const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
69863
+ const discriminantType = getTypeOfPropertyOrIndexSignature(
69864
+ t,
69865
+ propName,
69866
+ /*addOptionalityToIndex*/
69867
+ false
69868
+ );
69842
69869
  return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
69843
69870
  });
69844
69871
  }
@@ -74286,7 +74313,7 @@ function createTypeChecker(host) {
74286
74313
  }
74287
74314
  for (let i = 0; i < argCount; i++) {
74288
74315
  const arg = args[i];
74289
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
74316
+ if (arg.kind !== 231 /* OmittedExpression */) {
74290
74317
  const paramType = getTypeAtPosition(signature, i);
74291
74318
  if (couldContainTypeVariables(paramType)) {
74292
74319
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -74899,7 +74926,6 @@ function createTypeChecker(host) {
74899
74926
  const args = getEffectiveCallArguments(node);
74900
74927
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
74901
74928
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
74902
- argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
74903
74929
  let candidatesForArgumentError;
74904
74930
  let candidateForArgumentArityError;
74905
74931
  let candidateForTypeArgumentError;
@@ -75123,7 +75149,7 @@ function createTypeChecker(host) {
75123
75149
  continue;
75124
75150
  }
75125
75151
  if (argCheckMode) {
75126
- argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
75152
+ argCheckMode = 0 /* Normal */;
75127
75153
  if (inferenceContext) {
75128
75154
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
75129
75155
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -78976,7 +79002,7 @@ function createTypeChecker(host) {
78976
79002
  return nullWideningType;
78977
79003
  case 15 /* NoSubstitutionTemplateLiteral */:
78978
79004
  case 11 /* StringLiteral */:
78979
- return hasSkipDirectInferenceFlag(node) ? anyType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
79005
+ return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
78980
79006
  case 9 /* NumericLiteral */:
78981
79007
  checkGrammarNumericLiteral(node);
78982
79008
  return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
@@ -159116,7 +159142,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
159116
159142
  case 290 /* JsxAttribute */:
159117
159143
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
159118
159144
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
159119
- return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
159145
+ return argumentInfo && (getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker, 0 /* Normal */)) || fromContextualType(0 /* None */);
159120
159146
  }
159121
159147
  case 271 /* ImportDeclaration */:
159122
159148
  case 277 /* ExportDeclaration */:
@@ -159185,12 +159211,12 @@ function walkUpParentheses(node) {
159185
159211
  function getAlreadyUsedTypesInStringLiteralUnion(union, current) {
159186
159212
  return mapDefined(union.types, (type) => type !== current && isLiteralTypeNode(type) && isStringLiteral(type.literal) ? type.literal.text : void 0);
159187
159213
  }
159188
- function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) {
159214
+ function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) {
159189
159215
  let isNewIdentifier = false;
159190
159216
  const uniques = /* @__PURE__ */ new Map();
159191
159217
  const candidates = [];
159192
159218
  const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg;
159193
- checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates);
159219
+ checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates, checkMode);
159194
159220
  const types = flatMap(candidates, (candidate) => {
159195
159221
  if (!signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length)
159196
159222
  return;
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.2";
38
- version = `${versionMajorMinor}.0-dev.20230613`;
38
+ version = `${versionMajorMinor}.0-dev.20230615`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -45392,13 +45392,24 @@ ${lanes.join("\n")}
45392
45392
  getTypeOfPropertyOfContextualType,
45393
45393
  getFullyQualifiedName,
45394
45394
  getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
45395
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
45396
- call,
45397
- candidatesOutArray,
45398
- /*argumentCount*/
45399
- void 0,
45400
- 32 /* IsForStringLiteralArgumentCompletions */
45401
- )),
45395
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
45396
+ if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
45397
+ return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
45398
+ call,
45399
+ candidatesOutArray,
45400
+ /*argumentCount*/
45401
+ void 0,
45402
+ checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
45403
+ ));
45404
+ }
45405
+ return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
45406
+ call,
45407
+ candidatesOutArray,
45408
+ /*argumentCount*/
45409
+ void 0,
45410
+ checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
45411
+ ));
45412
+ },
45402
45413
  getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
45403
45414
  getExpandedParameters,
45404
45415
  hasEffectiveRestParameter,
@@ -53225,9 +53236,15 @@ ${lanes.join("\n")}
53225
53236
  const prop = getPropertyOfType(type, name);
53226
53237
  return prop ? getTypeOfSymbol(prop) : void 0;
53227
53238
  }
53228
- function getTypeOfPropertyOrIndexSignature(type, name) {
53239
+ function getTypeOfPropertyOrIndexSignature(type, name, addOptionalityToIndex) {
53229
53240
  var _a;
53230
- return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) || unknownType;
53241
+ let propType;
53242
+ return getTypeOfPropertyOfType(type, name) || (propType = (_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) && addOptionality(
53243
+ propType,
53244
+ /*isProperty*/
53245
+ true,
53246
+ addOptionalityToIndex
53247
+ ) || unknownType;
53231
53248
  }
53232
53249
  function isTypeAny(type) {
53233
53250
  return type && (type.flags & 1 /* Any */) !== 0;
@@ -64229,7 +64246,12 @@ ${lanes.join("\n")}
64229
64246
  let matched = false;
64230
64247
  for (let i = 0; i < types.length; i++) {
64231
64248
  if (include[i]) {
64232
- const targetType = getTypeOfPropertyOfType(types[i], propertyName);
64249
+ const targetType = getTypeOfPropertyOrIndexSignature(
64250
+ types[i],
64251
+ propertyName,
64252
+ /*addOptionalityToIndex*/
64253
+ true
64254
+ );
64233
64255
  if (targetType && related(getDiscriminatingType(), targetType)) {
64234
64256
  matched = true;
64235
64257
  } else {
@@ -66160,7 +66182,7 @@ ${lanes.join("\n")}
66160
66182
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
66161
66183
  if (constraint) {
66162
66184
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
66163
- if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
66185
+ if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
66164
66186
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
66165
66187
  }
66166
66188
  }
@@ -67627,7 +67649,12 @@ ${lanes.join("\n")}
67627
67649
  propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
67628
67650
  const narrowedPropType = narrowType2(propType);
67629
67651
  return filterType(type, (t) => {
67630
- const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
67652
+ const discriminantType = getTypeOfPropertyOrIndexSignature(
67653
+ t,
67654
+ propName,
67655
+ /*addOptionalityToIndex*/
67656
+ false
67657
+ );
67631
67658
  return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
67632
67659
  });
67633
67660
  }
@@ -72075,7 +72102,7 @@ ${lanes.join("\n")}
72075
72102
  }
72076
72103
  for (let i = 0; i < argCount; i++) {
72077
72104
  const arg = args[i];
72078
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
72105
+ if (arg.kind !== 231 /* OmittedExpression */) {
72079
72106
  const paramType = getTypeAtPosition(signature, i);
72080
72107
  if (couldContainTypeVariables(paramType)) {
72081
72108
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -72688,7 +72715,6 @@ ${lanes.join("\n")}
72688
72715
  const args = getEffectiveCallArguments(node);
72689
72716
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
72690
72717
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
72691
- argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
72692
72718
  let candidatesForArgumentError;
72693
72719
  let candidateForArgumentArityError;
72694
72720
  let candidateForTypeArgumentError;
@@ -72912,7 +72938,7 @@ ${lanes.join("\n")}
72912
72938
  continue;
72913
72939
  }
72914
72940
  if (argCheckMode) {
72915
- argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
72941
+ argCheckMode = 0 /* Normal */;
72916
72942
  if (inferenceContext) {
72917
72943
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
72918
72944
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -76765,7 +76791,7 @@ ${lanes.join("\n")}
76765
76791
  return nullWideningType;
76766
76792
  case 15 /* NoSubstitutionTemplateLiteral */:
76767
76793
  case 11 /* StringLiteral */:
76768
- return hasSkipDirectInferenceFlag(node) ? anyType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
76794
+ return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
76769
76795
  case 9 /* NumericLiteral */:
76770
76796
  checkGrammarNumericLiteral(node);
76771
76797
  return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
@@ -158399,7 +158425,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158399
158425
  case 290 /* JsxAttribute */:
158400
158426
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
158401
158427
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
158402
- return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
158428
+ return argumentInfo && (getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker, 0 /* Normal */)) || fromContextualType(0 /* None */);
158403
158429
  }
158404
158430
  case 271 /* ImportDeclaration */:
158405
158431
  case 277 /* ExportDeclaration */:
@@ -158468,12 +158494,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158468
158494
  function getAlreadyUsedTypesInStringLiteralUnion(union, current) {
158469
158495
  return mapDefined(union.types, (type) => type !== current && isLiteralTypeNode(type) && isStringLiteral(type.literal) ? type.literal.text : void 0);
158470
158496
  }
158471
- function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) {
158497
+ function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) {
158472
158498
  let isNewIdentifier = false;
158473
158499
  const uniques = /* @__PURE__ */ new Map();
158474
158500
  const candidates = [];
158475
158501
  const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg;
158476
- checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates);
158502
+ checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates, checkMode);
158477
158503
  const types = flatMap(candidates, (candidate) => {
158478
158504
  if (!signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length)
158479
158505
  return;
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.2";
38
- version = `${versionMajorMinor}.0-dev.20230613`;
38
+ version = `${versionMajorMinor}.0-dev.20230615`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -45392,13 +45392,24 @@ ${lanes.join("\n")}
45392
45392
  getTypeOfPropertyOfContextualType,
45393
45393
  getFullyQualifiedName,
45394
45394
  getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
45395
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
45396
- call,
45397
- candidatesOutArray,
45398
- /*argumentCount*/
45399
- void 0,
45400
- 32 /* IsForStringLiteralArgumentCompletions */
45401
- )),
45395
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
45396
+ if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
45397
+ return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
45398
+ call,
45399
+ candidatesOutArray,
45400
+ /*argumentCount*/
45401
+ void 0,
45402
+ checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
45403
+ ));
45404
+ }
45405
+ return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
45406
+ call,
45407
+ candidatesOutArray,
45408
+ /*argumentCount*/
45409
+ void 0,
45410
+ checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
45411
+ ));
45412
+ },
45402
45413
  getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
45403
45414
  getExpandedParameters,
45404
45415
  hasEffectiveRestParameter,
@@ -53225,9 +53236,15 @@ ${lanes.join("\n")}
53225
53236
  const prop = getPropertyOfType(type, name);
53226
53237
  return prop ? getTypeOfSymbol(prop) : void 0;
53227
53238
  }
53228
- function getTypeOfPropertyOrIndexSignature(type, name) {
53239
+ function getTypeOfPropertyOrIndexSignature(type, name, addOptionalityToIndex) {
53229
53240
  var _a;
53230
- return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) || unknownType;
53241
+ let propType;
53242
+ return getTypeOfPropertyOfType(type, name) || (propType = (_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) && addOptionality(
53243
+ propType,
53244
+ /*isProperty*/
53245
+ true,
53246
+ addOptionalityToIndex
53247
+ ) || unknownType;
53231
53248
  }
53232
53249
  function isTypeAny(type) {
53233
53250
  return type && (type.flags & 1 /* Any */) !== 0;
@@ -64229,7 +64246,12 @@ ${lanes.join("\n")}
64229
64246
  let matched = false;
64230
64247
  for (let i = 0; i < types.length; i++) {
64231
64248
  if (include[i]) {
64232
- const targetType = getTypeOfPropertyOfType(types[i], propertyName);
64249
+ const targetType = getTypeOfPropertyOrIndexSignature(
64250
+ types[i],
64251
+ propertyName,
64252
+ /*addOptionalityToIndex*/
64253
+ true
64254
+ );
64233
64255
  if (targetType && related(getDiscriminatingType(), targetType)) {
64234
64256
  matched = true;
64235
64257
  } else {
@@ -66160,7 +66182,7 @@ ${lanes.join("\n")}
66160
66182
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
66161
66183
  if (constraint) {
66162
66184
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
66163
- if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
66185
+ if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
66164
66186
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
66165
66187
  }
66166
66188
  }
@@ -67627,7 +67649,12 @@ ${lanes.join("\n")}
67627
67649
  propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
67628
67650
  const narrowedPropType = narrowType2(propType);
67629
67651
  return filterType(type, (t) => {
67630
- const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
67652
+ const discriminantType = getTypeOfPropertyOrIndexSignature(
67653
+ t,
67654
+ propName,
67655
+ /*addOptionalityToIndex*/
67656
+ false
67657
+ );
67631
67658
  return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
67632
67659
  });
67633
67660
  }
@@ -72075,7 +72102,7 @@ ${lanes.join("\n")}
72075
72102
  }
72076
72103
  for (let i = 0; i < argCount; i++) {
72077
72104
  const arg = args[i];
72078
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
72105
+ if (arg.kind !== 231 /* OmittedExpression */) {
72079
72106
  const paramType = getTypeAtPosition(signature, i);
72080
72107
  if (couldContainTypeVariables(paramType)) {
72081
72108
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -72688,7 +72715,6 @@ ${lanes.join("\n")}
72688
72715
  const args = getEffectiveCallArguments(node);
72689
72716
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
72690
72717
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
72691
- argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
72692
72718
  let candidatesForArgumentError;
72693
72719
  let candidateForArgumentArityError;
72694
72720
  let candidateForTypeArgumentError;
@@ -72912,7 +72938,7 @@ ${lanes.join("\n")}
72912
72938
  continue;
72913
72939
  }
72914
72940
  if (argCheckMode) {
72915
- argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
72941
+ argCheckMode = 0 /* Normal */;
72916
72942
  if (inferenceContext) {
72917
72943
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
72918
72944
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -76765,7 +76791,7 @@ ${lanes.join("\n")}
76765
76791
  return nullWideningType;
76766
76792
  case 15 /* NoSubstitutionTemplateLiteral */:
76767
76793
  case 11 /* StringLiteral */:
76768
- return hasSkipDirectInferenceFlag(node) ? anyType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
76794
+ return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
76769
76795
  case 9 /* NumericLiteral */:
76770
76796
  checkGrammarNumericLiteral(node);
76771
76797
  return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
@@ -158414,7 +158440,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158414
158440
  case 290 /* JsxAttribute */:
158415
158441
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
158416
158442
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
158417
- return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
158443
+ return argumentInfo && (getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker, 0 /* Normal */)) || fromContextualType(0 /* None */);
158418
158444
  }
158419
158445
  case 271 /* ImportDeclaration */:
158420
158446
  case 277 /* ExportDeclaration */:
@@ -158483,12 +158509,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158483
158509
  function getAlreadyUsedTypesInStringLiteralUnion(union, current) {
158484
158510
  return mapDefined(union.types, (type) => type !== current && isLiteralTypeNode(type) && isStringLiteral(type.literal) ? type.literal.text : void 0);
158485
158511
  }
158486
- function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) {
158512
+ function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) {
158487
158513
  let isNewIdentifier = false;
158488
158514
  const uniques = /* @__PURE__ */ new Map();
158489
158515
  const candidates = [];
158490
158516
  const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg;
158491
- checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates);
158517
+ checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates, checkMode);
158492
158518
  const types = flatMap(candidates, (candidate) => {
158493
158519
  if (!signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length)
158494
158520
  return;
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.2";
57
- var version = `${versionMajorMinor}.0-dev.20230613`;
57
+ var version = `${versionMajorMinor}.0-dev.20230615`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.2.0-dev.20230613",
5
+ "version": "5.2.0-dev.20230615",
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": "2a37eb2e471e01e510849f0dc108b3699ab869db"
117
+ "gitHead": "972299ae347bd29cfb3be2de1a7f2ee24e0781cd"
118
118
  }