@typescript-deploys/pr-build 5.2.0-pr-54788-8 → 5.2.0-pr-52493-8

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-insiders.20230626`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230627`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7746,6 +7746,7 @@ var Diagnostics = {
7746
7746
  Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
7747
7747
  Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
7748
7748
  Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
7749
+ Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
7749
7750
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
7750
7751
  Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
7751
7752
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -13286,8 +13287,8 @@ function isInExpressionContext(node) {
13286
13287
  return forStatement.initializer === node && forStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node;
13287
13288
  case 249 /* ForInStatement */:
13288
13289
  case 250 /* ForOfStatement */:
13289
- const forInStatement = parent;
13290
- return forInStatement.initializer === node && forInStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInStatement.expression === node;
13290
+ const forInOrOfStatement = parent;
13291
+ return forInOrOfStatement.initializer === node && forInOrOfStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInOrOfStatement.expression === node;
13291
13292
  case 216 /* TypeAssertionExpression */:
13292
13293
  case 234 /* AsExpression */:
13293
13294
  return node === parent.expression;
@@ -13948,20 +13949,23 @@ function getTypeParameterFromJsDoc(node) {
13948
13949
  const { typeParameters } = node.parent.parent.parent;
13949
13950
  return typeParameters && find(typeParameters, (p) => p.name.escapedText === name);
13950
13951
  }
13951
- function getAssignmentTargetKind(node) {
13952
+ function getAssignmentTarget(node) {
13952
13953
  let parent = node.parent;
13953
13954
  while (true) {
13954
13955
  switch (parent.kind) {
13955
13956
  case 226 /* BinaryExpression */:
13956
- const binaryOperator = parent.operatorToken.kind;
13957
- return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */;
13957
+ const binaryExpression = parent;
13958
+ const binaryOperator = binaryExpression.operatorToken.kind;
13959
+ return isAssignmentOperator(binaryOperator) && binaryExpression.left === node ? binaryExpression : void 0;
13958
13960
  case 224 /* PrefixUnaryExpression */:
13959
13961
  case 225 /* PostfixUnaryExpression */:
13960
- const unaryOperator = parent.operator;
13961
- return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
13962
+ const unaryExpression = parent;
13963
+ const unaryOperator = unaryExpression.operator;
13964
+ return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? unaryExpression : void 0;
13962
13965
  case 249 /* ForInStatement */:
13963
13966
  case 250 /* ForOfStatement */:
13964
- return parent.initializer === node ? 1 /* Definite */ : 0 /* None */;
13967
+ const forInOrOfStatement = parent;
13968
+ return forInOrOfStatement.initializer === node ? forInOrOfStatement : void 0;
13965
13969
  case 217 /* ParenthesizedExpression */:
13966
13970
  case 209 /* ArrayLiteralExpression */:
13967
13971
  case 230 /* SpreadElement */:
@@ -13973,24 +13977,53 @@ function getAssignmentTargetKind(node) {
13973
13977
  break;
13974
13978
  case 304 /* ShorthandPropertyAssignment */:
13975
13979
  if (parent.name !== node) {
13976
- return 0 /* None */;
13980
+ return void 0;
13977
13981
  }
13978
13982
  node = parent.parent;
13979
13983
  break;
13980
13984
  case 303 /* PropertyAssignment */:
13981
13985
  if (parent.name === node) {
13982
- return 0 /* None */;
13986
+ return void 0;
13983
13987
  }
13984
13988
  node = parent.parent;
13985
13989
  break;
13986
13990
  default:
13987
- return 0 /* None */;
13991
+ return void 0;
13988
13992
  }
13989
13993
  parent = node.parent;
13990
13994
  }
13991
13995
  }
13996
+ function getAssignmentTargetKind(node) {
13997
+ const target = getAssignmentTarget(node);
13998
+ if (!target) {
13999
+ return 0 /* None */;
14000
+ }
14001
+ switch (target.kind) {
14002
+ case 226 /* BinaryExpression */:
14003
+ const binaryOperator = target.operatorToken.kind;
14004
+ return binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */;
14005
+ case 224 /* PrefixUnaryExpression */:
14006
+ case 225 /* PostfixUnaryExpression */:
14007
+ return 2 /* Compound */;
14008
+ case 249 /* ForInStatement */:
14009
+ case 250 /* ForOfStatement */:
14010
+ return 1 /* Definite */;
14011
+ }
14012
+ }
13992
14013
  function isAssignmentTarget(node) {
13993
- return getAssignmentTargetKind(node) !== 0 /* None */;
14014
+ return !!getAssignmentTarget(node);
14015
+ }
14016
+ function isCompoundLikeAssignment(assignment) {
14017
+ const right = skipParentheses(assignment.right);
14018
+ return right.kind === 226 /* BinaryExpression */ && isShiftOperatorOrHigher(right.operatorToken.kind);
14019
+ }
14020
+ function isInCompoundLikeAssignment(node) {
14021
+ const target = getAssignmentTarget(node);
14022
+ return !!target && isAssignmentExpression(
14023
+ target,
14024
+ /*excludeCompoundAssignment*/
14025
+ true
14026
+ ) && isCompoundLikeAssignment(target);
13994
14027
  }
13995
14028
  function isNodeWithPossibleHoistedDeclaration(node) {
13996
14029
  switch (node.kind) {
@@ -46167,7 +46200,6 @@ function createTypeChecker(host) {
46167
46200
  const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
46168
46201
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
46169
46202
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
46170
- const moduleKind2 = getEmitModuleKind(compilerOptions);
46171
46203
  const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
46172
46204
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
46173
46205
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
@@ -46200,7 +46232,7 @@ function createTypeChecker(host) {
46200
46232
  moduleReference
46201
46233
  );
46202
46234
  }
46203
- if (100 /* Node16 */ <= moduleKind2 && moduleKind2 <= 199 /* NodeNext */) {
46235
+ if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
46204
46236
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
46205
46237
  const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
46206
46238
  const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
@@ -46324,7 +46356,7 @@ function createTypeChecker(host) {
46324
46356
  return void 0;
46325
46357
  function getSuggestedImportSource(tsExtension) {
46326
46358
  const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
46327
- if (emitModuleKindIsNonNodeESM(moduleKind2) || mode === 99 /* ESNext */) {
46359
+ if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
46328
46360
  const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
46329
46361
  const ext = tsExtension === ".mts" /* Mts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".mts" : ".mjs" : tsExtension === ".cts" /* Cts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".cts" : ".cjs" : preferTs ? ".ts" : ".js";
46330
46362
  return importSourceWithoutExtension + ext;
@@ -65171,10 +65203,11 @@ function createTypeChecker(host) {
65171
65203
  const assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
65172
65204
  return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
65173
65205
  }
65174
- if (declaredType.flags & 1048576 /* Union */) {
65175
- return getAssignmentReducedType(declaredType, getInitialOrAssignedType(flow));
65206
+ const t = isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(declaredType) : declaredType;
65207
+ if (t.flags & 1048576 /* Union */) {
65208
+ return getAssignmentReducedType(t, getInitialOrAssignedType(flow));
65176
65209
  }
65177
- return declaredType;
65210
+ return t;
65178
65211
  }
65179
65212
  if (containsMatchingReference(reference, node)) {
65180
65213
  if (!isReachableFlowNode(flow)) {
@@ -66303,7 +66336,7 @@ function createTypeChecker(host) {
66303
66336
  const isAlias = localOrExportSymbol.flags & 2097152 /* Alias */;
66304
66337
  if (localOrExportSymbol.flags & 3 /* Variable */) {
66305
66338
  if (assignmentKind === 1 /* Definite */) {
66306
- return type;
66339
+ return isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(type) : type;
66307
66340
  }
66308
66341
  } else if (isAlias) {
66309
66342
  declaration = getDeclarationOfAliasSymbol(symbol);
@@ -66630,17 +66663,14 @@ function createTypeChecker(host) {
66630
66663
  }
66631
66664
  }
66632
66665
  function getTypeForThisExpressionFromJSDoc(node) {
66633
- const jsdocType = getJSDocType(node);
66634
- if (jsdocType && jsdocType.kind === 324 /* JSDocFunctionType */) {
66635
- const jsDocFunctionType = jsdocType;
66636
- if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) {
66637
- return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
66638
- }
66639
- }
66640
66666
  const thisTag = getJSDocThisTag(node);
66641
66667
  if (thisTag && thisTag.typeExpression) {
66642
66668
  return getTypeFromTypeNode(thisTag.typeExpression);
66643
66669
  }
66670
+ const signature = getSignatureOfTypeTag(node);
66671
+ if (signature) {
66672
+ return getThisTypeOfSignature(signature);
66673
+ }
66644
66674
  }
66645
66675
  function isInConstructorArgumentInitializer(node, constructorDecl) {
66646
66676
  return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl);
@@ -115085,9 +115115,9 @@ function getConfigFileParsingDiagnostics(configFileParseResult) {
115085
115115
  return configFileParseResult.options.configFile ? [...configFileParseResult.options.configFile.parseDiagnostics, ...configFileParseResult.errors] : configFileParseResult.errors;
115086
115116
  }
115087
115117
  function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
115088
- switch (getEmitModuleKind(options)) {
115089
- case 100 /* Node16 */:
115090
- case 199 /* NodeNext */:
115118
+ switch (getEmitModuleResolutionKind(options)) {
115119
+ case 3 /* Node16 */:
115120
+ case 99 /* NodeNext */:
115091
115121
  return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
115092
115122
  default:
115093
115123
  return void 0;
package/lib/tsserver.js CHANGED
@@ -1414,6 +1414,7 @@ __export(server_exports, {
1414
1414
  isImportTypeNode: () => isImportTypeNode,
1415
1415
  isImportableFile: () => isImportableFile,
1416
1416
  isInComment: () => isInComment,
1417
+ isInCompoundLikeAssignment: () => isInCompoundLikeAssignment,
1417
1418
  isInExpressionContext: () => isInExpressionContext,
1418
1419
  isInJSDoc: () => isInJSDoc,
1419
1420
  isInJSFile: () => isInJSFile,
@@ -1706,6 +1707,7 @@ __export(server_exports, {
1706
1707
  isSetAccessor: () => isSetAccessor,
1707
1708
  isSetAccessorDeclaration: () => isSetAccessorDeclaration,
1708
1709
  isShebangTrivia: () => isShebangTrivia,
1710
+ isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
1709
1711
  isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
1710
1712
  isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
1711
1713
  isSignedNumericLiteral: () => isSignedNumericLiteral,
@@ -2327,7 +2329,7 @@ module.exports = __toCommonJS(server_exports);
2327
2329
 
2328
2330
  // src/compiler/corePublic.ts
2329
2331
  var versionMajorMinor = "5.2";
2330
- var version = `${versionMajorMinor}.0-insiders.20230626`;
2332
+ var version = `${versionMajorMinor}.0-insiders.20230627`;
2331
2333
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2332
2334
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2333
2335
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -11267,6 +11269,7 @@ var Diagnostics = {
11267
11269
  Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
11268
11270
  Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
11269
11271
  Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
11272
+ Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
11270
11273
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
11271
11274
  Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
11272
11275
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -17124,8 +17127,8 @@ function isInExpressionContext(node) {
17124
17127
  return forStatement.initializer === node && forStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node;
17125
17128
  case 249 /* ForInStatement */:
17126
17129
  case 250 /* ForOfStatement */:
17127
- const forInStatement = parent2;
17128
- return forInStatement.initializer === node && forInStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInStatement.expression === node;
17130
+ const forInOrOfStatement = parent2;
17131
+ return forInOrOfStatement.initializer === node && forInOrOfStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInOrOfStatement.expression === node;
17129
17132
  case 216 /* TypeAssertionExpression */:
17130
17133
  case 234 /* AsExpression */:
17131
17134
  return node === parent2.expression;
@@ -17821,20 +17824,23 @@ var AssignmentKind = /* @__PURE__ */ ((AssignmentKind2) => {
17821
17824
  AssignmentKind2[AssignmentKind2["Compound"] = 2] = "Compound";
17822
17825
  return AssignmentKind2;
17823
17826
  })(AssignmentKind || {});
17824
- function getAssignmentTargetKind(node) {
17827
+ function getAssignmentTarget(node) {
17825
17828
  let parent2 = node.parent;
17826
17829
  while (true) {
17827
17830
  switch (parent2.kind) {
17828
17831
  case 226 /* BinaryExpression */:
17829
- const binaryOperator = parent2.operatorToken.kind;
17830
- return isAssignmentOperator(binaryOperator) && parent2.left === node ? binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */;
17832
+ const binaryExpression = parent2;
17833
+ const binaryOperator = binaryExpression.operatorToken.kind;
17834
+ return isAssignmentOperator(binaryOperator) && binaryExpression.left === node ? binaryExpression : void 0;
17831
17835
  case 224 /* PrefixUnaryExpression */:
17832
17836
  case 225 /* PostfixUnaryExpression */:
17833
- const unaryOperator = parent2.operator;
17834
- return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
17837
+ const unaryExpression = parent2;
17838
+ const unaryOperator = unaryExpression.operator;
17839
+ return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? unaryExpression : void 0;
17835
17840
  case 249 /* ForInStatement */:
17836
17841
  case 250 /* ForOfStatement */:
17837
- return parent2.initializer === node ? 1 /* Definite */ : 0 /* None */;
17842
+ const forInOrOfStatement = parent2;
17843
+ return forInOrOfStatement.initializer === node ? forInOrOfStatement : void 0;
17838
17844
  case 217 /* ParenthesizedExpression */:
17839
17845
  case 209 /* ArrayLiteralExpression */:
17840
17846
  case 230 /* SpreadElement */:
@@ -17846,24 +17852,53 @@ function getAssignmentTargetKind(node) {
17846
17852
  break;
17847
17853
  case 304 /* ShorthandPropertyAssignment */:
17848
17854
  if (parent2.name !== node) {
17849
- return 0 /* None */;
17855
+ return void 0;
17850
17856
  }
17851
17857
  node = parent2.parent;
17852
17858
  break;
17853
17859
  case 303 /* PropertyAssignment */:
17854
17860
  if (parent2.name === node) {
17855
- return 0 /* None */;
17861
+ return void 0;
17856
17862
  }
17857
17863
  node = parent2.parent;
17858
17864
  break;
17859
17865
  default:
17860
- return 0 /* None */;
17866
+ return void 0;
17861
17867
  }
17862
17868
  parent2 = node.parent;
17863
17869
  }
17864
17870
  }
17871
+ function getAssignmentTargetKind(node) {
17872
+ const target = getAssignmentTarget(node);
17873
+ if (!target) {
17874
+ return 0 /* None */;
17875
+ }
17876
+ switch (target.kind) {
17877
+ case 226 /* BinaryExpression */:
17878
+ const binaryOperator = target.operatorToken.kind;
17879
+ return binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */;
17880
+ case 224 /* PrefixUnaryExpression */:
17881
+ case 225 /* PostfixUnaryExpression */:
17882
+ return 2 /* Compound */;
17883
+ case 249 /* ForInStatement */:
17884
+ case 250 /* ForOfStatement */:
17885
+ return 1 /* Definite */;
17886
+ }
17887
+ }
17865
17888
  function isAssignmentTarget(node) {
17866
- return getAssignmentTargetKind(node) !== 0 /* None */;
17889
+ return !!getAssignmentTarget(node);
17890
+ }
17891
+ function isCompoundLikeAssignment(assignment) {
17892
+ const right = skipParentheses(assignment.right);
17893
+ return right.kind === 226 /* BinaryExpression */ && isShiftOperatorOrHigher(right.operatorToken.kind);
17894
+ }
17895
+ function isInCompoundLikeAssignment(node) {
17896
+ const target = getAssignmentTarget(node);
17897
+ return !!target && isAssignmentExpression(
17898
+ target,
17899
+ /*excludeCompoundAssignment*/
17900
+ true
17901
+ ) && isCompoundLikeAssignment(target);
17867
17902
  }
17868
17903
  function isNodeWithPossibleHoistedDeclaration(node) {
17869
17904
  switch (node.kind) {
@@ -50843,7 +50878,6 @@ function createTypeChecker(host) {
50843
50878
  const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
50844
50879
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
50845
50880
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
50846
- const moduleKind2 = getEmitModuleKind(compilerOptions);
50847
50881
  const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
50848
50882
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
50849
50883
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
@@ -50876,7 +50910,7 @@ function createTypeChecker(host) {
50876
50910
  moduleReference
50877
50911
  );
50878
50912
  }
50879
- if (100 /* Node16 */ <= moduleKind2 && moduleKind2 <= 199 /* NodeNext */) {
50913
+ if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
50880
50914
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
50881
50915
  const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
50882
50916
  const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
@@ -51000,7 +51034,7 @@ function createTypeChecker(host) {
51000
51034
  return void 0;
51001
51035
  function getSuggestedImportSource(tsExtension) {
51002
51036
  const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
51003
- if (emitModuleKindIsNonNodeESM(moduleKind2) || mode === 99 /* ESNext */) {
51037
+ if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
51004
51038
  const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
51005
51039
  const ext = tsExtension === ".mts" /* Mts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".mts" : ".mjs" : tsExtension === ".cts" /* Cts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".cts" : ".cjs" : preferTs ? ".ts" : ".js";
51006
51040
  return importSourceWithoutExtension + ext;
@@ -69847,10 +69881,11 @@ function createTypeChecker(host) {
69847
69881
  const assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
69848
69882
  return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
69849
69883
  }
69850
- if (declaredType.flags & 1048576 /* Union */) {
69851
- return getAssignmentReducedType(declaredType, getInitialOrAssignedType(flow));
69884
+ const t = isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(declaredType) : declaredType;
69885
+ if (t.flags & 1048576 /* Union */) {
69886
+ return getAssignmentReducedType(t, getInitialOrAssignedType(flow));
69852
69887
  }
69853
- return declaredType;
69888
+ return t;
69854
69889
  }
69855
69890
  if (containsMatchingReference(reference, node)) {
69856
69891
  if (!isReachableFlowNode(flow)) {
@@ -70979,7 +71014,7 @@ function createTypeChecker(host) {
70979
71014
  const isAlias = localOrExportSymbol.flags & 2097152 /* Alias */;
70980
71015
  if (localOrExportSymbol.flags & 3 /* Variable */) {
70981
71016
  if (assignmentKind === 1 /* Definite */) {
70982
- return type;
71017
+ return isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(type) : type;
70983
71018
  }
70984
71019
  } else if (isAlias) {
70985
71020
  declaration = getDeclarationOfAliasSymbol(symbol);
@@ -71306,17 +71341,14 @@ function createTypeChecker(host) {
71306
71341
  }
71307
71342
  }
71308
71343
  function getTypeForThisExpressionFromJSDoc(node) {
71309
- const jsdocType = getJSDocType(node);
71310
- if (jsdocType && jsdocType.kind === 324 /* JSDocFunctionType */) {
71311
- const jsDocFunctionType = jsdocType;
71312
- if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) {
71313
- return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
71314
- }
71315
- }
71316
71344
  const thisTag = getJSDocThisTag(node);
71317
71345
  if (thisTag && thisTag.typeExpression) {
71318
71346
  return getTypeFromTypeNode(thisTag.typeExpression);
71319
71347
  }
71348
+ const signature = getSignatureOfTypeTag(node);
71349
+ if (signature) {
71350
+ return getThisTypeOfSignature(signature);
71351
+ }
71320
71352
  }
71321
71353
  function isInConstructorArgumentInitializer(node, constructorDecl) {
71322
71354
  return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl);
@@ -119997,9 +120029,9 @@ function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, optio
119997
120029
  return typeof result === "object" ? result.impliedNodeFormat : result;
119998
120030
  }
119999
120031
  function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
120000
- switch (getEmitModuleKind(options)) {
120001
- case 100 /* Node16 */:
120002
- case 199 /* NodeNext */:
120032
+ switch (getEmitModuleResolutionKind(options)) {
120033
+ case 3 /* Node16 */:
120034
+ case 99 /* NodeNext */:
120003
120035
  return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
120004
120036
  default:
120005
120037
  return void 0;
@@ -138043,7 +138075,10 @@ function getReplacementExpression(reference, replacement) {
138043
138075
  if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
138044
138076
  return factory.createParenthesizedExpression(replacement);
138045
138077
  }
138046
- if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
138078
+ if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression(parent2))) {
138079
+ return factory.createParenthesizedExpression(replacement);
138080
+ }
138081
+ if (isPropertyAccessExpression(parent2) && (isNumericLiteral(replacement) || isObjectLiteralExpression(replacement))) {
138047
138082
  return factory.createParenthesizedExpression(replacement);
138048
138083
  }
138049
138084
  return replacement;
@@ -156661,6 +156696,7 @@ var CompletionSource = /* @__PURE__ */ ((CompletionSource2) => {
156661
156696
  CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
156662
156697
  CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
156663
156698
  CompletionSource2["SwitchCases"] = "SwitchCases/";
156699
+ CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
156664
156700
  return CompletionSource2;
156665
156701
  })(CompletionSource || {});
156666
156702
  var SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
@@ -157539,6 +157575,7 @@ function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
157539
157575
  return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
157540
157576
  }
157541
157577
  function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
157578
+ var _a, _b;
157542
157579
  let insertText;
157543
157580
  let filterText;
157544
157581
  let replacementSpan = getReplacementSpanForContextToken(replacementToken);
@@ -157597,6 +157634,12 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
157597
157634
  if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
157598
157635
  hasAction = true;
157599
157636
  }
157637
+ if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */) {
157638
+ if (isMethodDeclaration(contextToken.parent.parent) || isGetAccessorDeclaration(contextToken.parent.parent) || isSetAccessorDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, isPropertyAssignment)) == null ? void 0 : _b.getLastToken(sourceFile)) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
157639
+ source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
157640
+ hasAction = true;
157641
+ }
157642
+ }
157600
157643
  if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
157601
157644
  let importAdder;
157602
157645
  const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
@@ -158327,7 +158370,7 @@ function getSymbolCompletionFromEntryId(program, log, sourceFile, position, entr
158327
158370
  return firstDefined(symbols, (symbol, index) => {
158328
158371
  const origin = symbolToOriginInfoMap[index];
158329
158372
  const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
158330
- return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
158373
+ return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
158331
158374
  }) || { type: "none" };
158332
158375
  }
158333
158376
  function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
@@ -158472,6 +158515,21 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
158472
158515
  Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
158473
158516
  return { codeActions: [codeAction2], sourceDisplay: void 0 };
158474
158517
  }
158518
+ if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
158519
+ const changes = ts_textChanges_exports.ChangeTracker.with(
158520
+ { host, formatContext, preferences },
158521
+ (tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
158522
+ );
158523
+ if (changes) {
158524
+ return {
158525
+ sourceDisplay: void 0,
158526
+ codeActions: [{
158527
+ changes,
158528
+ description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
158529
+ }]
158530
+ };
158531
+ }
158532
+ }
158475
158533
  if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
158476
158534
  return { codeActions: void 0, sourceDisplay: void 0 };
158477
158535
  }
@@ -159378,7 +159436,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
159378
159436
  }
159379
159437
  function tryGetObjectLikeCompletionSymbols() {
159380
159438
  const symbolsStartIndex = symbols.length;
159381
- const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
159439
+ const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile);
159382
159440
  if (!objectLikeContainer)
159383
159441
  return 0 /* Continue */;
159384
159442
  completionKind = 0 /* ObjectPropertyDeclaration */;
@@ -159864,7 +159922,8 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
159864
159922
  return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
159865
159923
  }
159866
159924
  }
159867
- function tryGetObjectLikeCompletionContainer(contextToken) {
159925
+ function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile) {
159926
+ var _a;
159868
159927
  if (contextToken) {
159869
159928
  const { parent: parent2 } = contextToken;
159870
159929
  switch (contextToken.kind) {
@@ -159879,7 +159938,29 @@ function tryGetObjectLikeCompletionContainer(contextToken) {
159879
159938
  case 134 /* AsyncKeyword */:
159880
159939
  return tryCast(parent2.parent, isObjectLiteralExpression);
159881
159940
  case 80 /* Identifier */:
159882
- return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
159941
+ if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) {
159942
+ return contextToken.parent.parent;
159943
+ } else {
159944
+ if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line)) {
159945
+ return contextToken.parent.parent;
159946
+ }
159947
+ const ancestorNode2 = findAncestor(parent2, isPropertyAssignment);
159948
+ if ((ancestorNode2 == null ? void 0 : ancestorNode2.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
159949
+ return ancestorNode2.parent;
159950
+ }
159951
+ }
159952
+ break;
159953
+ default:
159954
+ if (((_a = parent2.parent) == null ? void 0 : _a.parent) && (isMethodDeclaration(parent2.parent) || isGetAccessorDeclaration(parent2.parent) || isSetAccessorDeclaration(parent2.parent)) && isObjectLiteralExpression(parent2.parent.parent)) {
159955
+ return parent2.parent.parent;
159956
+ }
159957
+ if (isSpreadAssignment(parent2) && isObjectLiteralExpression(parent2.parent)) {
159958
+ return parent2.parent;
159959
+ }
159960
+ const ancestorNode = findAncestor(parent2, isPropertyAssignment);
159961
+ if (contextToken.kind !== 59 /* ColonToken */ && (ancestorNode == null ? void 0 : ancestorNode.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
159962
+ return ancestorNode.parent;
159963
+ }
159883
159964
  }
159884
159965
  }
159885
159966
  return void 0;
@@ -172944,6 +173025,7 @@ __export(ts_exports2, {
172944
173025
  isImportTypeNode: () => isImportTypeNode,
172945
173026
  isImportableFile: () => isImportableFile,
172946
173027
  isInComment: () => isInComment,
173028
+ isInCompoundLikeAssignment: () => isInCompoundLikeAssignment,
172947
173029
  isInExpressionContext: () => isInExpressionContext,
172948
173030
  isInJSDoc: () => isInJSDoc,
172949
173031
  isInJSFile: () => isInJSFile,
@@ -173236,6 +173318,7 @@ __export(ts_exports2, {
173236
173318
  isSetAccessor: () => isSetAccessor,
173237
173319
  isSetAccessorDeclaration: () => isSetAccessorDeclaration,
173238
173320
  isShebangTrivia: () => isShebangTrivia,
173321
+ isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
173239
173322
  isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
173240
173323
  isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
173241
173324
  isSignedNumericLiteral: () => isSignedNumericLiteral,
@@ -187457,6 +187540,7 @@ start(initializeNodeSystem(), require("os").platform());
187457
187540
  isImportTypeNode,
187458
187541
  isImportableFile,
187459
187542
  isInComment,
187543
+ isInCompoundLikeAssignment,
187460
187544
  isInExpressionContext,
187461
187545
  isInJSDoc,
187462
187546
  isInJSFile,
@@ -187749,6 +187833,7 @@ start(initializeNodeSystem(), require("os").platform());
187749
187833
  isSetAccessor,
187750
187834
  isSetAccessorDeclaration,
187751
187835
  isShebangTrivia,
187836
+ isShiftOperatorOrHigher,
187752
187837
  isShorthandAmbientModuleSymbol,
187753
187838
  isShorthandPropertyAssignment,
187754
187839
  isSignedNumericLiteral,
@@ -9191,7 +9191,7 @@ declare namespace ts {
9191
9191
  /**
9192
9192
  * Controls the format the file is detected as - this can be derived from only the path
9193
9193
  * and files on disk, but needs to be done with a module resolution cache in scope to be performant.
9194
- * This is usually `undefined` for compilations that do not have `module` values of `node16` or `nodenext`.
9194
+ * This is usually `undefined` for compilations that do not have `moduleResolution` values of `node16` or `nodenext`.
9195
9195
  */
9196
9196
  impliedNodeFormat?: ResolutionMode;
9197
9197
  /**
@@ -9504,7 +9504,7 @@ declare namespace ts {
9504
9504
  * Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
9505
9505
  * one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
9506
9506
  * Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
9507
- * `module` is `node16`+.
9507
+ * `moduleResolution` is `node16`+.
9508
9508
  * @param file The file the import or import-like reference is contained within
9509
9509
  * @param usage The module reference string
9510
9510
  * @returns The final resolution mode of the import