typescript 6.0.0-dev.20251207 → 6.0.0-dev.20251209

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 = "6.0";
21
- var version = `${versionMajorMinor}.0-dev.20251207`;
21
+ var version = `${versionMajorMinor}.0-dev.20251209`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -46585,7 +46585,7 @@ function createTypeChecker(host) {
46585
46585
  if (!node) {
46586
46586
  return void 0;
46587
46587
  }
46588
- if (contextFlags & 4 /* Completions */) {
46588
+ if (contextFlags & 4 /* IgnoreNodeInferences */) {
46589
46589
  return runWithInferenceBlockedFromSourceNode(node, () => getContextualType(node, contextFlags));
46590
46590
  }
46591
46591
  return getContextualType(node, contextFlags);
@@ -73462,7 +73462,7 @@ function createTypeChecker(host) {
73462
73462
  ), getNameFromImportAttribute(node));
73463
73463
  }
73464
73464
  function getContextualJsxElementAttributesType(node, contextFlags) {
73465
- if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
73465
+ if (isJsxOpeningElement(node) && contextFlags !== 4 /* IgnoreNodeInferences */) {
73466
73466
  const index = findContextualNode(
73467
73467
  node.parent,
73468
73468
  /*includeCaches*/
package/lib/typescript.js CHANGED
@@ -2286,7 +2286,7 @@ module.exports = __toCommonJS(typescript_exports);
2286
2286
 
2287
2287
  // src/compiler/corePublic.ts
2288
2288
  var versionMajorMinor = "6.0";
2289
- var version = `${versionMajorMinor}.0-dev.20251207`;
2289
+ var version = `${versionMajorMinor}.0-dev.20251209`;
2290
2290
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2291
2291
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2292
2292
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6169,7 +6169,7 @@ var ContextFlags = /* @__PURE__ */ ((ContextFlags3) => {
6169
6169
  ContextFlags3[ContextFlags3["None"] = 0] = "None";
6170
6170
  ContextFlags3[ContextFlags3["Signature"] = 1] = "Signature";
6171
6171
  ContextFlags3[ContextFlags3["NoConstraints"] = 2] = "NoConstraints";
6172
- ContextFlags3[ContextFlags3["Completions"] = 4] = "Completions";
6172
+ ContextFlags3[ContextFlags3["IgnoreNodeInferences"] = 4] = "IgnoreNodeInferences";
6173
6173
  ContextFlags3[ContextFlags3["SkipBindingPatterns"] = 8] = "SkipBindingPatterns";
6174
6174
  return ContextFlags3;
6175
6175
  })(ContextFlags || {});
@@ -51213,7 +51213,7 @@ function createTypeChecker(host) {
51213
51213
  if (!node) {
51214
51214
  return void 0;
51215
51215
  }
51216
- if (contextFlags & 4 /* Completions */) {
51216
+ if (contextFlags & 4 /* IgnoreNodeInferences */) {
51217
51217
  return runWithInferenceBlockedFromSourceNode(node, () => getContextualType2(node, contextFlags));
51218
51218
  }
51219
51219
  return getContextualType2(node, contextFlags);
@@ -78090,7 +78090,7 @@ function createTypeChecker(host) {
78090
78090
  ), getNameFromImportAttribute(node));
78091
78091
  }
78092
78092
  function getContextualJsxElementAttributesType(node, contextFlags) {
78093
- if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
78093
+ if (isJsxOpeningElement(node) && contextFlags !== 4 /* IgnoreNodeInferences */) {
78094
78094
  const index = findContextualNode(
78095
78095
  node.parent,
78096
78096
  /*includeCaches*/
@@ -168924,7 +168924,7 @@ function getContextualType(previousToken, position, sourceFile, checker) {
168924
168924
  return argInfo ? checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? (
168925
168925
  // completion at `x ===/**/` should be for the right side
168926
168926
  checker.getTypeAtLocation(parent2.left)
168927
- ) : checker.getContextualType(previousToken, 4 /* Completions */) || checker.getContextualType(previousToken);
168927
+ ) : checker.getContextualType(previousToken, 4 /* IgnoreNodeInferences */) || checker.getContextualType(previousToken);
168928
168928
  }
168929
168929
  }
168930
168930
  function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) {
@@ -169429,7 +169429,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
169429
169429
  const jsxContainer = tryGetContainingJsxElement(contextToken);
169430
169430
  const attrsType = jsxContainer && typeChecker.getContextualType(jsxContainer.attributes);
169431
169431
  if (!attrsType) return 0 /* Continue */;
169432
- const completionsType = jsxContainer && typeChecker.getContextualType(jsxContainer.attributes, 4 /* Completions */);
169432
+ const completionsType = jsxContainer && typeChecker.getContextualType(jsxContainer.attributes, 4 /* IgnoreNodeInferences */);
169433
169433
  symbols = concatenate(symbols, filterJsxAttributes(getPropertiesForObjectExpression(attrsType, completionsType, jsxContainer.attributes, typeChecker), jsxContainer.attributes.properties));
169434
169434
  setSortTextToOptionalMember();
169435
169435
  completionKind = 3 /* MemberLike */;
@@ -169856,7 +169856,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
169856
169856
  }
169857
169857
  return 0 /* Continue */;
169858
169858
  }
169859
- const completionsType = typeChecker.getContextualType(objectLikeContainer, 4 /* Completions */);
169859
+ const completionsType = typeChecker.getContextualType(objectLikeContainer, 4 /* IgnoreNodeInferences */);
169860
169860
  const hasStringIndexType = (completionsType || instantiatedType).getStringIndexType();
169861
169861
  const hasNumberIndextype = (completionsType || instantiatedType).getNumberIndexType();
169862
169862
  isNewIdentifierLocation = !!hasStringIndexType || !!hasNumberIndextype;
@@ -171153,7 +171153,15 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
171153
171153
  if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) {
171154
171154
  return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent);
171155
171155
  }
171156
- return fromContextualType() || fromContextualType(0 /* None */);
171156
+ if (findAncestor(parent2.parent, isCallLikeExpression)) {
171157
+ const uniques2 = /* @__PURE__ */ new Set();
171158
+ const stringLiteralTypes = concatenate(
171159
+ getStringLiteralTypes(typeChecker.getContextualType(node, 0 /* None */), uniques2),
171160
+ getStringLiteralTypes(typeChecker.getContextualType(node, 4 /* IgnoreNodeInferences */), uniques2)
171161
+ );
171162
+ return toStringLiteralCompletionsFromTypes(stringLiteralTypes);
171163
+ }
171164
+ return fromContextualType(0 /* None */);
171157
171165
  case 213 /* ElementAccessExpression */: {
171158
171166
  const { expression, argumentExpression } = parent2;
171159
171167
  if (node === skipParentheses(argumentExpression)) {
@@ -171249,14 +171257,13 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
171249
171257
  return void 0;
171250
171258
  }
171251
171259
  }
171252
- function fromContextualType(contextFlags = 4 /* Completions */) {
171253
- const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
171254
- if (!types.length) {
171255
- return;
171256
- }
171257
- return { kind: 2 /* Types */, types, isNewIdentifier: false };
171260
+ function fromContextualType(contextFlags = 4 /* IgnoreNodeInferences */) {
171261
+ return toStringLiteralCompletionsFromTypes(getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags)));
171258
171262
  }
171259
171263
  }
171264
+ function toStringLiteralCompletionsFromTypes(types) {
171265
+ return types.length ? { kind: 2 /* Types */, types, isNewIdentifier: false } : void 0;
171266
+ }
171260
171267
  function walkUpParentheses(node) {
171261
171268
  switch (node.kind) {
171262
171269
  case 197 /* ParenthesizedType */:
@@ -171299,7 +171306,7 @@ function stringLiteralCompletionsFromProperties(type) {
171299
171306
  function stringLiteralCompletionsForObjectLiteral(checker, objectLiteralExpression) {
171300
171307
  const contextualType = checker.getContextualType(objectLiteralExpression);
171301
171308
  if (!contextualType) return void 0;
171302
- const completionsType = checker.getContextualType(objectLiteralExpression, 4 /* Completions */);
171309
+ const completionsType = checker.getContextualType(objectLiteralExpression, 4 /* IgnoreNodeInferences */);
171303
171310
  const symbols = getPropertiesForObjectExpression(
171304
171311
  contextualType,
171305
171312
  completionsType,
@@ -174594,13 +174601,29 @@ function getDefinitionFromObjectLiteralElement(typeChecker, node) {
174594
174601
  if (element) {
174595
174602
  const contextualType = element && typeChecker.getContextualType(element.parent);
174596
174603
  if (contextualType) {
174597
- return flatMap(getPropertySymbolsFromContextualType(
174604
+ let properties = getPropertySymbolsFromContextualType(
174598
174605
  element,
174599
174606
  typeChecker,
174600
174607
  contextualType,
174601
174608
  /*unionSymbolOk*/
174602
174609
  false
174603
- ), (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node));
174610
+ );
174611
+ if (some(properties, (p) => !!(p.valueDeclaration && isObjectLiteralExpression(p.valueDeclaration.parent) && isObjectLiteralElementLike(p.valueDeclaration) && p.valueDeclaration.name === node))) {
174612
+ const withoutNodeInferencesType = typeChecker.getContextualType(element.parent, 4 /* IgnoreNodeInferences */);
174613
+ if (withoutNodeInferencesType) {
174614
+ const withoutNodeInferencesProperties = getPropertySymbolsFromContextualType(
174615
+ element,
174616
+ typeChecker,
174617
+ withoutNodeInferencesType,
174618
+ /*unionSymbolOk*/
174619
+ false
174620
+ );
174621
+ if (withoutNodeInferencesProperties.length) {
174622
+ properties = withoutNodeInferencesProperties;
174623
+ }
174624
+ }
174625
+ }
174626
+ return flatMap(properties, (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node));
174604
174627
  }
174605
174628
  }
174606
174629
  return 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": "6.0.0-dev.20251207",
5
+ "version": "6.0.0-dev.20251209",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "20.1.0",
116
116
  "npm": "8.19.4"
117
117
  },
118
- "gitHead": "38d95c8001300f525fd601dd0ce6d0ff5f12baee"
118
+ "gitHead": "ab142be459f50e7cf1327b6ab1031074cf7d8e5e"
119
119
  }