typescript 5.0.0-dev.20230210 → 5.0.0-dev.20230211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-dev.20230210`;
26
+ var version = `${versionMajorMinor}.0-dev.20230211`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -43295,6 +43295,7 @@ function createTypeChecker(host) {
43295
43295
  let flowTypeCache;
43296
43296
  const contextualTypeNodes = [];
43297
43297
  const contextualTypes = [];
43298
+ const contextualIsCache = [];
43298
43299
  let contextualTypeCount = 0;
43299
43300
  const inferenceContextNodes = [];
43300
43301
  const inferenceContexts = [];
@@ -58256,7 +58257,12 @@ function createTypeChecker(host) {
58256
58257
  }
58257
58258
  }
58258
58259
  function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
58259
- pushContextualType(next, sourcePropType);
58260
+ pushContextualType(
58261
+ next,
58262
+ sourcePropType,
58263
+ /*isCache*/
58264
+ false
58265
+ );
58260
58266
  const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
58261
58267
  popContextualType();
58262
58268
  return result;
@@ -58564,7 +58570,12 @@ function createTypeChecker(host) {
58564
58570
  if (isTupleLikeType(source)) {
58565
58571
  return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
58566
58572
  }
58567
- pushContextualType(node, target);
58573
+ pushContextualType(
58574
+ node,
58575
+ target,
58576
+ /*isCache*/
58577
+ false
58578
+ );
58568
58579
  const tupleizedType = checkArrayLiteral(
58569
58580
  node,
58570
58581
  1 /* Contextual */,
@@ -66613,11 +66624,13 @@ function createTypeChecker(host) {
66613
66624
  if (node.flags & 33554432 /* InWithStatement */) {
66614
66625
  return void 0;
66615
66626
  }
66616
- const index = findContextualNode(node);
66627
+ const index = findContextualNode(
66628
+ node,
66629
+ /*includeCaches*/
66630
+ !contextFlags
66631
+ );
66617
66632
  if (index >= 0) {
66618
- const cached = contextualTypes[index];
66619
- if (cached || !contextFlags)
66620
- return cached;
66633
+ return contextualTypes[index];
66621
66634
  }
66622
66635
  const { parent } = node;
66623
66636
  switch (parent.kind) {
@@ -66688,17 +66701,30 @@ function createTypeChecker(host) {
66688
66701
  }
66689
66702
  return void 0;
66690
66703
  }
66691
- function pushContextualType(node, type) {
66704
+ function pushCachedContextualType(node) {
66705
+ pushContextualType(
66706
+ node,
66707
+ getContextualType(
66708
+ node,
66709
+ /*contextFlags*/
66710
+ void 0
66711
+ ),
66712
+ /*isCache*/
66713
+ true
66714
+ );
66715
+ }
66716
+ function pushContextualType(node, type, isCache) {
66692
66717
  contextualTypeNodes[contextualTypeCount] = node;
66693
66718
  contextualTypes[contextualTypeCount] = type;
66719
+ contextualIsCache[contextualTypeCount] = isCache;
66694
66720
  contextualTypeCount++;
66695
66721
  }
66696
66722
  function popContextualType() {
66697
66723
  contextualTypeCount--;
66698
66724
  }
66699
- function findContextualNode(node) {
66725
+ function findContextualNode(node, includeCaches) {
66700
66726
  for (let i = contextualTypeCount - 1; i >= 0; i--) {
66701
- if (node === contextualTypeNodes[i]) {
66727
+ if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
66702
66728
  return i;
66703
66729
  }
66704
66730
  }
@@ -66721,7 +66747,11 @@ function createTypeChecker(host) {
66721
66747
  }
66722
66748
  function getContextualJsxElementAttributesType(node, contextFlags) {
66723
66749
  if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
66724
- const index = findContextualNode(node.parent);
66750
+ const index = findContextualNode(
66751
+ node.parent,
66752
+ /*includeCaches*/
66753
+ !contextFlags
66754
+ );
66725
66755
  if (index >= 0) {
66726
66756
  return contextualTypes[index];
66727
66757
  }
@@ -66992,11 +67022,7 @@ function createTypeChecker(host) {
66992
67022
  const elementCount = elements.length;
66993
67023
  const elementTypes = [];
66994
67024
  const elementFlags = [];
66995
- pushContextualType(node, getContextualType(
66996
- node,
66997
- /*contextFlags*/
66998
- void 0
66999
- ));
67025
+ pushCachedContextualType(node);
67000
67026
  const inDestructuringPattern = isAssignmentTarget(node);
67001
67027
  const inConstContext = isConstContext(node);
67002
67028
  const contextualType = getApparentTypeOfContextualType(
@@ -67159,11 +67185,7 @@ function createTypeChecker(host) {
67159
67185
  let propertiesTable = createSymbolTable();
67160
67186
  let propertiesArray = [];
67161
67187
  let spread = emptyObjectType;
67162
- pushContextualType(node, getContextualType(
67163
- node,
67164
- /*contextFlags*/
67165
- void 0
67166
- ));
67188
+ pushCachedContextualType(node);
67167
67189
  const contextualType = getApparentTypeOfContextualType(
67168
67190
  node,
67169
67191
  /*contextFlags*/
@@ -73174,14 +73196,19 @@ function createTypeChecker(host) {
73174
73196
  return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
73175
73197
  }
73176
73198
  function getContextNode(node) {
73177
- if (node.kind === 289 /* JsxAttributes */ && !isJsxSelfClosingElement(node.parent)) {
73199
+ if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
73178
73200
  return node.parent.parent;
73179
73201
  }
73180
73202
  return node;
73181
73203
  }
73182
73204
  function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
73183
73205
  const contextNode = getContextNode(node);
73184
- pushContextualType(contextNode, contextualType);
73206
+ pushContextualType(
73207
+ contextNode,
73208
+ contextualType,
73209
+ /*isCache*/
73210
+ false
73211
+ );
73185
73212
  pushInferenceContext(contextNode, inferenceContext);
73186
73213
  const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
73187
73214
  if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
@@ -73522,7 +73549,12 @@ function createTypeChecker(host) {
73522
73549
  if (links.contextFreeType) {
73523
73550
  return links.contextFreeType;
73524
73551
  }
73525
- pushContextualType(node, anyType);
73552
+ pushContextualType(
73553
+ node,
73554
+ anyType,
73555
+ /*isCache*/
73556
+ false
73557
+ );
73526
73558
  const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
73527
73559
  popContextualType();
73528
73560
  return type;
package/lib/tsserver.js CHANGED
@@ -2287,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
2287
2287
 
2288
2288
  // src/compiler/corePublic.ts
2289
2289
  var versionMajorMinor = "5.0";
2290
- var version = `${versionMajorMinor}.0-dev.20230210`;
2290
+ var version = `${versionMajorMinor}.0-dev.20230211`;
2291
2291
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2292
2292
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2293
2293
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -47871,6 +47871,7 @@ function createTypeChecker(host) {
47871
47871
  let flowTypeCache;
47872
47872
  const contextualTypeNodes = [];
47873
47873
  const contextualTypes = [];
47874
+ const contextualIsCache = [];
47874
47875
  let contextualTypeCount = 0;
47875
47876
  const inferenceContextNodes = [];
47876
47877
  const inferenceContexts = [];
@@ -62832,7 +62833,12 @@ function createTypeChecker(host) {
62832
62833
  }
62833
62834
  }
62834
62835
  function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
62835
- pushContextualType(next, sourcePropType);
62836
+ pushContextualType(
62837
+ next,
62838
+ sourcePropType,
62839
+ /*isCache*/
62840
+ false
62841
+ );
62836
62842
  const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
62837
62843
  popContextualType();
62838
62844
  return result;
@@ -63140,7 +63146,12 @@ function createTypeChecker(host) {
63140
63146
  if (isTupleLikeType(source)) {
63141
63147
  return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
63142
63148
  }
63143
- pushContextualType(node, target);
63149
+ pushContextualType(
63150
+ node,
63151
+ target,
63152
+ /*isCache*/
63153
+ false
63154
+ );
63144
63155
  const tupleizedType = checkArrayLiteral(
63145
63156
  node,
63146
63157
  1 /* Contextual */,
@@ -71189,11 +71200,13 @@ function createTypeChecker(host) {
71189
71200
  if (node.flags & 33554432 /* InWithStatement */) {
71190
71201
  return void 0;
71191
71202
  }
71192
- const index = findContextualNode(node);
71203
+ const index = findContextualNode(
71204
+ node,
71205
+ /*includeCaches*/
71206
+ !contextFlags
71207
+ );
71193
71208
  if (index >= 0) {
71194
- const cached = contextualTypes[index];
71195
- if (cached || !contextFlags)
71196
- return cached;
71209
+ return contextualTypes[index];
71197
71210
  }
71198
71211
  const { parent: parent2 } = node;
71199
71212
  switch (parent2.kind) {
@@ -71264,17 +71277,30 @@ function createTypeChecker(host) {
71264
71277
  }
71265
71278
  return void 0;
71266
71279
  }
71267
- function pushContextualType(node, type) {
71280
+ function pushCachedContextualType(node) {
71281
+ pushContextualType(
71282
+ node,
71283
+ getContextualType2(
71284
+ node,
71285
+ /*contextFlags*/
71286
+ void 0
71287
+ ),
71288
+ /*isCache*/
71289
+ true
71290
+ );
71291
+ }
71292
+ function pushContextualType(node, type, isCache) {
71268
71293
  contextualTypeNodes[contextualTypeCount] = node;
71269
71294
  contextualTypes[contextualTypeCount] = type;
71295
+ contextualIsCache[contextualTypeCount] = isCache;
71270
71296
  contextualTypeCount++;
71271
71297
  }
71272
71298
  function popContextualType() {
71273
71299
  contextualTypeCount--;
71274
71300
  }
71275
- function findContextualNode(node) {
71301
+ function findContextualNode(node, includeCaches) {
71276
71302
  for (let i = contextualTypeCount - 1; i >= 0; i--) {
71277
- if (node === contextualTypeNodes[i]) {
71303
+ if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
71278
71304
  return i;
71279
71305
  }
71280
71306
  }
@@ -71297,7 +71323,11 @@ function createTypeChecker(host) {
71297
71323
  }
71298
71324
  function getContextualJsxElementAttributesType(node, contextFlags) {
71299
71325
  if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
71300
- const index = findContextualNode(node.parent);
71326
+ const index = findContextualNode(
71327
+ node.parent,
71328
+ /*includeCaches*/
71329
+ !contextFlags
71330
+ );
71301
71331
  if (index >= 0) {
71302
71332
  return contextualTypes[index];
71303
71333
  }
@@ -71568,11 +71598,7 @@ function createTypeChecker(host) {
71568
71598
  const elementCount = elements.length;
71569
71599
  const elementTypes = [];
71570
71600
  const elementFlags = [];
71571
- pushContextualType(node, getContextualType2(
71572
- node,
71573
- /*contextFlags*/
71574
- void 0
71575
- ));
71601
+ pushCachedContextualType(node);
71576
71602
  const inDestructuringPattern = isAssignmentTarget(node);
71577
71603
  const inConstContext = isConstContext(node);
71578
71604
  const contextualType = getApparentTypeOfContextualType(
@@ -71735,11 +71761,7 @@ function createTypeChecker(host) {
71735
71761
  let propertiesTable = createSymbolTable();
71736
71762
  let propertiesArray = [];
71737
71763
  let spread = emptyObjectType;
71738
- pushContextualType(node, getContextualType2(
71739
- node,
71740
- /*contextFlags*/
71741
- void 0
71742
- ));
71764
+ pushCachedContextualType(node);
71743
71765
  const contextualType = getApparentTypeOfContextualType(
71744
71766
  node,
71745
71767
  /*contextFlags*/
@@ -77750,14 +77772,19 @@ function createTypeChecker(host) {
77750
77772
  return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
77751
77773
  }
77752
77774
  function getContextNode2(node) {
77753
- if (node.kind === 289 /* JsxAttributes */ && !isJsxSelfClosingElement(node.parent)) {
77775
+ if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
77754
77776
  return node.parent.parent;
77755
77777
  }
77756
77778
  return node;
77757
77779
  }
77758
77780
  function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
77759
77781
  const contextNode = getContextNode2(node);
77760
- pushContextualType(contextNode, contextualType);
77782
+ pushContextualType(
77783
+ contextNode,
77784
+ contextualType,
77785
+ /*isCache*/
77786
+ false
77787
+ );
77761
77788
  pushInferenceContext(contextNode, inferenceContext);
77762
77789
  const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
77763
77790
  if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
@@ -78098,7 +78125,12 @@ function createTypeChecker(host) {
78098
78125
  if (links.contextFreeType) {
78099
78126
  return links.contextFreeType;
78100
78127
  }
78101
- pushContextualType(node, anyType);
78128
+ pushContextualType(
78129
+ node,
78130
+ anyType,
78131
+ /*isCache*/
78132
+ false
78133
+ );
78102
78134
  const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
78103
78135
  popContextualType();
78104
78136
  return type;
@@ -141231,6 +141263,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
141231
141263
  sourceFile,
141232
141264
  symbol,
141233
141265
  symbolName2,
141266
+ moduleSymbol,
141234
141267
  /*isJsxTagName*/
141235
141268
  false,
141236
141269
  program,
@@ -141242,7 +141275,6 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
141242
141275
  const fix = getImportFixForSymbol(
141243
141276
  sourceFile,
141244
141277
  Debug.checkDefined(exportInfo),
141245
- moduleSymbol,
141246
141278
  program,
141247
141279
  /*position*/
141248
141280
  void 0,
@@ -141420,13 +141452,19 @@ function createImportSpecifierResolver(importingFile, program, host, preferences
141420
141452
  return result && { ...result, computedWithoutCacheCount };
141421
141453
  }
141422
141454
  }
141423
- function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
141455
+ function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
141424
141456
  const compilerOptions = program.getCompilerOptions();
141425
- const exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, isJsxTagName, program, host, preferences, cancellationToken);
141426
- Debug.assertIsDefined(exportInfos);
141457
+ let exportInfos;
141458
+ if (exportMapKey) {
141459
+ exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
141460
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified exportMapKey");
141461
+ } else {
141462
+ exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, symbolName2, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, moduleSymbol, isJsxTagName, program, host, preferences, cancellationToken);
141463
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified symbol / moduleSymbol");
141464
+ }
141427
141465
  const useRequire = shouldUseRequire(sourceFile, program);
141428
141466
  const isValidTypeOnlyUseSite = isValidTypeOnlyAliasUseSite(getTokenAtPosition(sourceFile, position));
141429
- const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
141467
+ const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
141430
141468
  return {
141431
141469
  moduleSpecifier: fix.moduleSpecifier,
141432
141470
  codeAction: codeFixActionToCodeAction(codeActionForFix(
@@ -141448,23 +141486,22 @@ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, ho
141448
141486
  const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
141449
141487
  return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences));
141450
141488
  }
141451
- function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
141452
- Debug.assert(exportInfos.some((info) => info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol), "Some exportInfo should match the specified moduleSymbol");
141489
+ function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
141453
141490
  const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
141454
141491
  return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
141455
141492
  }
141456
141493
  function codeFixActionToCodeAction({ description: description2, changes, commands }) {
141457
141494
  return { description: description2, changes, commands };
141458
141495
  }
141459
- function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, preferCapitalized, program, host, preferences, cancellationToken) {
141496
+ function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) {
141460
141497
  const getChecker = createGetChecker(program, host);
141461
141498
  return getExportInfoMap(importingFile, host, program, preferences, cancellationToken).search(importingFile.path, preferCapitalized, (name) => name === symbolName2, (info) => {
141462
- if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) {
141499
+ if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol && info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol)) {
141463
141500
  return info;
141464
141501
  }
141465
141502
  });
141466
141503
  }
141467
- function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
141504
+ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) {
141468
141505
  var _a2, _b;
141469
141506
  const compilerOptions = program.getCompilerOptions();
141470
141507
  const mainProgramInfo = getInfoWithChecker(
@@ -141486,7 +141523,7 @@ function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
141486
141523
  if (defaultInfo && skipAlias(defaultInfo.symbol, checker) === symbol) {
141487
141524
  return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
141488
141525
  }
141489
- const named = checker.tryGetMemberInModuleExportsAndProperties(symbol.name, moduleSymbol);
141526
+ const named = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
141490
141527
  if (named && skipAlias(named, checker) === symbol) {
141491
141528
  return { symbol: named, moduleSymbol, moduleFileName: void 0, exportKind: 0 /* Named */, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
141492
141529
  }
@@ -149145,6 +149182,7 @@ function originToCompletionEntryData(origin) {
149145
149182
  if (originIsResolvedExport(origin)) {
149146
149183
  const resolvedData = {
149147
149184
  exportName: origin.exportName,
149185
+ exportMapKey: origin.exportMapKey,
149148
149186
  moduleSpecifier: origin.moduleSpecifier,
149149
149187
  ambientModuleName,
149150
149188
  fileName: origin.fileName,
@@ -149168,6 +149206,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
149168
149206
  const resolvedOrigin = {
149169
149207
  kind: 32 /* ResolvedExport */,
149170
149208
  exportName: data.exportName,
149209
+ exportMapKey: data.exportMapKey,
149171
149210
  moduleSpecifier: data.moduleSpecifier,
149172
149211
  symbolName: completionName,
149173
149212
  fileName: data.fileName,
@@ -149546,6 +149585,7 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
149546
149585
  const { moduleSpecifier, codeAction } = ts_codefix_exports.getImportCompletionAction(
149547
149586
  targetSymbol,
149548
149587
  moduleSymbol,
149588
+ data == null ? void 0 : data.exportMapKey,
149549
149589
  sourceFile,
149550
149590
  name,
149551
149591
  isJsxOpeningTagName,
@@ -150244,16 +150284,16 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
150244
150284
  if (detailsEntryId && !some(info, (i) => detailsEntryId.source === stripQuotes(i.moduleSymbol.name))) {
150245
150285
  return;
150246
150286
  }
150247
- const firstImportableExportInfo = find(info, isImportableExportInfo);
150248
- if (!firstImportableExportInfo) {
150287
+ info = filter(info, isImportableExportInfo);
150288
+ if (!info.length) {
150249
150289
  return;
150250
150290
  }
150251
150291
  const result = context.tryResolve(info, isFromAmbientModule) || {};
150252
150292
  if (result === "failed")
150253
150293
  return;
150254
- let exportInfo2 = firstImportableExportInfo, moduleSpecifier;
150294
+ let exportInfo2 = info[0], moduleSpecifier;
150255
150295
  if (result !== "skipped") {
150256
- ({ exportInfo: exportInfo2 = firstImportableExportInfo, moduleSpecifier } = result);
150296
+ ({ exportInfo: exportInfo2 = info[0], moduleSpecifier } = result);
150257
150297
  }
150258
150298
  const isDefaultExport = exportInfo2.exportKind === 1 /* Default */;
150259
150299
  const symbol = isDefaultExport && getLocalSymbolForExportDefault(exportInfo2.symbol) || exportInfo2.symbol;
@@ -10590,6 +10590,7 @@ declare namespace ts {
10590
10590
  * in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default.
10591
10591
  */
10592
10592
  exportName: string;
10593
+ exportMapKey?: string;
10593
10594
  moduleSpecifier?: string;
10594
10595
  /** The file name declaring the export's module symbol, if it was an external module */
10595
10596
  fileName?: string;
@@ -10599,7 +10600,6 @@ declare namespace ts {
10599
10600
  isPackageJsonImport?: true;
10600
10601
  }
10601
10602
  interface CompletionEntryDataUnresolved extends CompletionEntryDataAutoImport {
10602
- /** The key in the `ExportMapCache` where the completion entry's `SymbolExportInfo[]` is found */
10603
10603
  exportMapKey: string;
10604
10604
  }
10605
10605
  interface CompletionEntryDataResolved extends CompletionEntryDataAutoImport {
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.0";
38
- version = `${versionMajorMinor}.0-dev.20230210`;
38
+ version = `${versionMajorMinor}.0-dev.20230211`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -45681,6 +45681,7 @@ ${lanes.join("\n")}
45681
45681
  let flowTypeCache;
45682
45682
  const contextualTypeNodes = [];
45683
45683
  const contextualTypes = [];
45684
+ const contextualIsCache = [];
45684
45685
  let contextualTypeCount = 0;
45685
45686
  const inferenceContextNodes = [];
45686
45687
  const inferenceContexts = [];
@@ -60642,7 +60643,12 @@ ${lanes.join("\n")}
60642
60643
  }
60643
60644
  }
60644
60645
  function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
60645
- pushContextualType(next, sourcePropType);
60646
+ pushContextualType(
60647
+ next,
60648
+ sourcePropType,
60649
+ /*isCache*/
60650
+ false
60651
+ );
60646
60652
  const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
60647
60653
  popContextualType();
60648
60654
  return result;
@@ -60950,7 +60956,12 @@ ${lanes.join("\n")}
60950
60956
  if (isTupleLikeType(source)) {
60951
60957
  return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
60952
60958
  }
60953
- pushContextualType(node, target);
60959
+ pushContextualType(
60960
+ node,
60961
+ target,
60962
+ /*isCache*/
60963
+ false
60964
+ );
60954
60965
  const tupleizedType = checkArrayLiteral(
60955
60966
  node,
60956
60967
  1 /* Contextual */,
@@ -68999,11 +69010,13 @@ ${lanes.join("\n")}
68999
69010
  if (node.flags & 33554432 /* InWithStatement */) {
69000
69011
  return void 0;
69001
69012
  }
69002
- const index = findContextualNode(node);
69013
+ const index = findContextualNode(
69014
+ node,
69015
+ /*includeCaches*/
69016
+ !contextFlags
69017
+ );
69003
69018
  if (index >= 0) {
69004
- const cached = contextualTypes[index];
69005
- if (cached || !contextFlags)
69006
- return cached;
69019
+ return contextualTypes[index];
69007
69020
  }
69008
69021
  const { parent: parent2 } = node;
69009
69022
  switch (parent2.kind) {
@@ -69074,17 +69087,30 @@ ${lanes.join("\n")}
69074
69087
  }
69075
69088
  return void 0;
69076
69089
  }
69077
- function pushContextualType(node, type) {
69090
+ function pushCachedContextualType(node) {
69091
+ pushContextualType(
69092
+ node,
69093
+ getContextualType2(
69094
+ node,
69095
+ /*contextFlags*/
69096
+ void 0
69097
+ ),
69098
+ /*isCache*/
69099
+ true
69100
+ );
69101
+ }
69102
+ function pushContextualType(node, type, isCache) {
69078
69103
  contextualTypeNodes[contextualTypeCount] = node;
69079
69104
  contextualTypes[contextualTypeCount] = type;
69105
+ contextualIsCache[contextualTypeCount] = isCache;
69080
69106
  contextualTypeCount++;
69081
69107
  }
69082
69108
  function popContextualType() {
69083
69109
  contextualTypeCount--;
69084
69110
  }
69085
- function findContextualNode(node) {
69111
+ function findContextualNode(node, includeCaches) {
69086
69112
  for (let i = contextualTypeCount - 1; i >= 0; i--) {
69087
- if (node === contextualTypeNodes[i]) {
69113
+ if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
69088
69114
  return i;
69089
69115
  }
69090
69116
  }
@@ -69107,7 +69133,11 @@ ${lanes.join("\n")}
69107
69133
  }
69108
69134
  function getContextualJsxElementAttributesType(node, contextFlags) {
69109
69135
  if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
69110
- const index = findContextualNode(node.parent);
69136
+ const index = findContextualNode(
69137
+ node.parent,
69138
+ /*includeCaches*/
69139
+ !contextFlags
69140
+ );
69111
69141
  if (index >= 0) {
69112
69142
  return contextualTypes[index];
69113
69143
  }
@@ -69378,11 +69408,7 @@ ${lanes.join("\n")}
69378
69408
  const elementCount = elements.length;
69379
69409
  const elementTypes = [];
69380
69410
  const elementFlags = [];
69381
- pushContextualType(node, getContextualType2(
69382
- node,
69383
- /*contextFlags*/
69384
- void 0
69385
- ));
69411
+ pushCachedContextualType(node);
69386
69412
  const inDestructuringPattern = isAssignmentTarget(node);
69387
69413
  const inConstContext = isConstContext(node);
69388
69414
  const contextualType = getApparentTypeOfContextualType(
@@ -69545,11 +69571,7 @@ ${lanes.join("\n")}
69545
69571
  let propertiesTable = createSymbolTable();
69546
69572
  let propertiesArray = [];
69547
69573
  let spread = emptyObjectType;
69548
- pushContextualType(node, getContextualType2(
69549
- node,
69550
- /*contextFlags*/
69551
- void 0
69552
- ));
69574
+ pushCachedContextualType(node);
69553
69575
  const contextualType = getApparentTypeOfContextualType(
69554
69576
  node,
69555
69577
  /*contextFlags*/
@@ -75560,14 +75582,19 @@ ${lanes.join("\n")}
75560
75582
  return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
75561
75583
  }
75562
75584
  function getContextNode2(node) {
75563
- if (node.kind === 289 /* JsxAttributes */ && !isJsxSelfClosingElement(node.parent)) {
75585
+ if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
75564
75586
  return node.parent.parent;
75565
75587
  }
75566
75588
  return node;
75567
75589
  }
75568
75590
  function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
75569
75591
  const contextNode = getContextNode2(node);
75570
- pushContextualType(contextNode, contextualType);
75592
+ pushContextualType(
75593
+ contextNode,
75594
+ contextualType,
75595
+ /*isCache*/
75596
+ false
75597
+ );
75571
75598
  pushInferenceContext(contextNode, inferenceContext);
75572
75599
  const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
75573
75600
  if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
@@ -75908,7 +75935,12 @@ ${lanes.join("\n")}
75908
75935
  if (links.contextFreeType) {
75909
75936
  return links.contextFreeType;
75910
75937
  }
75911
- pushContextualType(node, anyType);
75938
+ pushContextualType(
75939
+ node,
75940
+ anyType,
75941
+ /*isCache*/
75942
+ false
75943
+ );
75912
75944
  const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
75913
75945
  popContextualType();
75914
75946
  return type;
@@ -139784,6 +139816,7 @@ ${lanes.join("\n")}
139784
139816
  sourceFile,
139785
139817
  symbol,
139786
139818
  symbolName2,
139819
+ moduleSymbol,
139787
139820
  /*isJsxTagName*/
139788
139821
  false,
139789
139822
  program,
@@ -139795,7 +139828,6 @@ ${lanes.join("\n")}
139795
139828
  const fix = getImportFixForSymbol(
139796
139829
  sourceFile,
139797
139830
  Debug.checkDefined(exportInfo),
139798
- moduleSymbol,
139799
139831
  program,
139800
139832
  /*position*/
139801
139833
  void 0,
@@ -139973,13 +140005,19 @@ ${lanes.join("\n")}
139973
140005
  return result && { ...result, computedWithoutCacheCount };
139974
140006
  }
139975
140007
  }
139976
- function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
140008
+ function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
139977
140009
  const compilerOptions = program.getCompilerOptions();
139978
- const exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, isJsxTagName, program, host, preferences, cancellationToken);
139979
- Debug.assertIsDefined(exportInfos);
140010
+ let exportInfos;
140011
+ if (exportMapKey) {
140012
+ exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
140013
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified exportMapKey");
140014
+ } else {
140015
+ exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, symbolName2, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, moduleSymbol, isJsxTagName, program, host, preferences, cancellationToken);
140016
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified symbol / moduleSymbol");
140017
+ }
139980
140018
  const useRequire = shouldUseRequire(sourceFile, program);
139981
140019
  const isValidTypeOnlyUseSite = isValidTypeOnlyAliasUseSite(getTokenAtPosition(sourceFile, position));
139982
- const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
140020
+ const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
139983
140021
  return {
139984
140022
  moduleSpecifier: fix.moduleSpecifier,
139985
140023
  codeAction: codeFixActionToCodeAction(codeActionForFix(
@@ -140001,23 +140039,22 @@ ${lanes.join("\n")}
140001
140039
  const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
140002
140040
  return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences));
140003
140041
  }
140004
- function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
140005
- Debug.assert(exportInfos.some((info) => info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol), "Some exportInfo should match the specified moduleSymbol");
140042
+ function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
140006
140043
  const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
140007
140044
  return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
140008
140045
  }
140009
140046
  function codeFixActionToCodeAction({ description: description2, changes, commands }) {
140010
140047
  return { description: description2, changes, commands };
140011
140048
  }
140012
- function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, preferCapitalized, program, host, preferences, cancellationToken) {
140049
+ function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) {
140013
140050
  const getChecker = createGetChecker(program, host);
140014
140051
  return getExportInfoMap(importingFile, host, program, preferences, cancellationToken).search(importingFile.path, preferCapitalized, (name) => name === symbolName2, (info) => {
140015
- if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) {
140052
+ if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol && info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol)) {
140016
140053
  return info;
140017
140054
  }
140018
140055
  });
140019
140056
  }
140020
- function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
140057
+ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) {
140021
140058
  var _a2, _b;
140022
140059
  const compilerOptions = program.getCompilerOptions();
140023
140060
  const mainProgramInfo = getInfoWithChecker(
@@ -140039,7 +140076,7 @@ ${lanes.join("\n")}
140039
140076
  if (defaultInfo && skipAlias(defaultInfo.symbol, checker) === symbol) {
140040
140077
  return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
140041
140078
  }
140042
- const named = checker.tryGetMemberInModuleExportsAndProperties(symbol.name, moduleSymbol);
140079
+ const named = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
140043
140080
  if (named && skipAlias(named, checker) === symbol) {
140044
140081
  return { symbol: named, moduleSymbol, moduleFileName: void 0, exportKind: 0 /* Named */, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
140045
140082
  }
@@ -148200,6 +148237,7 @@ ${lanes.join("\n")}
148200
148237
  if (originIsResolvedExport(origin)) {
148201
148238
  const resolvedData = {
148202
148239
  exportName: origin.exportName,
148240
+ exportMapKey: origin.exportMapKey,
148203
148241
  moduleSpecifier: origin.moduleSpecifier,
148204
148242
  ambientModuleName,
148205
148243
  fileName: origin.fileName,
@@ -148223,6 +148261,7 @@ ${lanes.join("\n")}
148223
148261
  const resolvedOrigin = {
148224
148262
  kind: 32 /* ResolvedExport */,
148225
148263
  exportName: data.exportName,
148264
+ exportMapKey: data.exportMapKey,
148226
148265
  moduleSpecifier: data.moduleSpecifier,
148227
148266
  symbolName: completionName,
148228
148267
  fileName: data.fileName,
@@ -148601,6 +148640,7 @@ ${lanes.join("\n")}
148601
148640
  const { moduleSpecifier, codeAction } = ts_codefix_exports.getImportCompletionAction(
148602
148641
  targetSymbol,
148603
148642
  moduleSymbol,
148643
+ data == null ? void 0 : data.exportMapKey,
148604
148644
  sourceFile,
148605
148645
  name,
148606
148646
  isJsxOpeningTagName,
@@ -149290,16 +149330,16 @@ ${lanes.join("\n")}
149290
149330
  if (detailsEntryId && !some(info, (i) => detailsEntryId.source === stripQuotes(i.moduleSymbol.name))) {
149291
149331
  return;
149292
149332
  }
149293
- const firstImportableExportInfo = find(info, isImportableExportInfo);
149294
- if (!firstImportableExportInfo) {
149333
+ info = filter(info, isImportableExportInfo);
149334
+ if (!info.length) {
149295
149335
  return;
149296
149336
  }
149297
149337
  const result = context.tryResolve(info, isFromAmbientModule) || {};
149298
149338
  if (result === "failed")
149299
149339
  return;
149300
- let exportInfo2 = firstImportableExportInfo, moduleSpecifier;
149340
+ let exportInfo2 = info[0], moduleSpecifier;
149301
149341
  if (result !== "skipped") {
149302
- ({ exportInfo: exportInfo2 = firstImportableExportInfo, moduleSpecifier } = result);
149342
+ ({ exportInfo: exportInfo2 = info[0], moduleSpecifier } = result);
149303
149343
  }
149304
149344
  const isDefaultExport = exportInfo2.exportKind === 1 /* Default */;
149305
149345
  const symbol = isDefaultExport && getLocalSymbolForExportDefault(exportInfo2.symbol) || exportInfo2.symbol;
@@ -6688,6 +6688,7 @@ declare namespace ts {
6688
6688
  * in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default.
6689
6689
  */
6690
6690
  exportName: string;
6691
+ exportMapKey?: string;
6691
6692
  moduleSpecifier?: string;
6692
6693
  /** The file name declaring the export's module symbol, if it was an external module */
6693
6694
  fileName?: string;
@@ -6697,7 +6698,6 @@ declare namespace ts {
6697
6698
  isPackageJsonImport?: true;
6698
6699
  }
6699
6700
  interface CompletionEntryDataUnresolved extends CompletionEntryDataAutoImport {
6700
- /** The key in the `ExportMapCache` where the completion entry's `SymbolExportInfo[]` is found */
6701
6701
  exportMapKey: string;
6702
6702
  }
6703
6703
  interface CompletionEntryDataResolved extends CompletionEntryDataAutoImport {
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.0";
38
- version = `${versionMajorMinor}.0-dev.20230210`;
38
+ version = `${versionMajorMinor}.0-dev.20230211`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -45681,6 +45681,7 @@ ${lanes.join("\n")}
45681
45681
  let flowTypeCache;
45682
45682
  const contextualTypeNodes = [];
45683
45683
  const contextualTypes = [];
45684
+ const contextualIsCache = [];
45684
45685
  let contextualTypeCount = 0;
45685
45686
  const inferenceContextNodes = [];
45686
45687
  const inferenceContexts = [];
@@ -60642,7 +60643,12 @@ ${lanes.join("\n")}
60642
60643
  }
60643
60644
  }
60644
60645
  function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
60645
- pushContextualType(next, sourcePropType);
60646
+ pushContextualType(
60647
+ next,
60648
+ sourcePropType,
60649
+ /*isCache*/
60650
+ false
60651
+ );
60646
60652
  const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
60647
60653
  popContextualType();
60648
60654
  return result;
@@ -60950,7 +60956,12 @@ ${lanes.join("\n")}
60950
60956
  if (isTupleLikeType(source)) {
60951
60957
  return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
60952
60958
  }
60953
- pushContextualType(node, target);
60959
+ pushContextualType(
60960
+ node,
60961
+ target,
60962
+ /*isCache*/
60963
+ false
60964
+ );
60954
60965
  const tupleizedType = checkArrayLiteral(
60955
60966
  node,
60956
60967
  1 /* Contextual */,
@@ -68999,11 +69010,13 @@ ${lanes.join("\n")}
68999
69010
  if (node.flags & 33554432 /* InWithStatement */) {
69000
69011
  return void 0;
69001
69012
  }
69002
- const index = findContextualNode(node);
69013
+ const index = findContextualNode(
69014
+ node,
69015
+ /*includeCaches*/
69016
+ !contextFlags
69017
+ );
69003
69018
  if (index >= 0) {
69004
- const cached = contextualTypes[index];
69005
- if (cached || !contextFlags)
69006
- return cached;
69019
+ return contextualTypes[index];
69007
69020
  }
69008
69021
  const { parent: parent2 } = node;
69009
69022
  switch (parent2.kind) {
@@ -69074,17 +69087,30 @@ ${lanes.join("\n")}
69074
69087
  }
69075
69088
  return void 0;
69076
69089
  }
69077
- function pushContextualType(node, type) {
69090
+ function pushCachedContextualType(node) {
69091
+ pushContextualType(
69092
+ node,
69093
+ getContextualType2(
69094
+ node,
69095
+ /*contextFlags*/
69096
+ void 0
69097
+ ),
69098
+ /*isCache*/
69099
+ true
69100
+ );
69101
+ }
69102
+ function pushContextualType(node, type, isCache) {
69078
69103
  contextualTypeNodes[contextualTypeCount] = node;
69079
69104
  contextualTypes[contextualTypeCount] = type;
69105
+ contextualIsCache[contextualTypeCount] = isCache;
69080
69106
  contextualTypeCount++;
69081
69107
  }
69082
69108
  function popContextualType() {
69083
69109
  contextualTypeCount--;
69084
69110
  }
69085
- function findContextualNode(node) {
69111
+ function findContextualNode(node, includeCaches) {
69086
69112
  for (let i = contextualTypeCount - 1; i >= 0; i--) {
69087
- if (node === contextualTypeNodes[i]) {
69113
+ if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
69088
69114
  return i;
69089
69115
  }
69090
69116
  }
@@ -69107,7 +69133,11 @@ ${lanes.join("\n")}
69107
69133
  }
69108
69134
  function getContextualJsxElementAttributesType(node, contextFlags) {
69109
69135
  if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
69110
- const index = findContextualNode(node.parent);
69136
+ const index = findContextualNode(
69137
+ node.parent,
69138
+ /*includeCaches*/
69139
+ !contextFlags
69140
+ );
69111
69141
  if (index >= 0) {
69112
69142
  return contextualTypes[index];
69113
69143
  }
@@ -69378,11 +69408,7 @@ ${lanes.join("\n")}
69378
69408
  const elementCount = elements.length;
69379
69409
  const elementTypes = [];
69380
69410
  const elementFlags = [];
69381
- pushContextualType(node, getContextualType2(
69382
- node,
69383
- /*contextFlags*/
69384
- void 0
69385
- ));
69411
+ pushCachedContextualType(node);
69386
69412
  const inDestructuringPattern = isAssignmentTarget(node);
69387
69413
  const inConstContext = isConstContext(node);
69388
69414
  const contextualType = getApparentTypeOfContextualType(
@@ -69545,11 +69571,7 @@ ${lanes.join("\n")}
69545
69571
  let propertiesTable = createSymbolTable();
69546
69572
  let propertiesArray = [];
69547
69573
  let spread = emptyObjectType;
69548
- pushContextualType(node, getContextualType2(
69549
- node,
69550
- /*contextFlags*/
69551
- void 0
69552
- ));
69574
+ pushCachedContextualType(node);
69553
69575
  const contextualType = getApparentTypeOfContextualType(
69554
69576
  node,
69555
69577
  /*contextFlags*/
@@ -75560,14 +75582,19 @@ ${lanes.join("\n")}
75560
75582
  return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
75561
75583
  }
75562
75584
  function getContextNode2(node) {
75563
- if (node.kind === 289 /* JsxAttributes */ && !isJsxSelfClosingElement(node.parent)) {
75585
+ if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
75564
75586
  return node.parent.parent;
75565
75587
  }
75566
75588
  return node;
75567
75589
  }
75568
75590
  function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
75569
75591
  const contextNode = getContextNode2(node);
75570
- pushContextualType(contextNode, contextualType);
75592
+ pushContextualType(
75593
+ contextNode,
75594
+ contextualType,
75595
+ /*isCache*/
75596
+ false
75597
+ );
75571
75598
  pushInferenceContext(contextNode, inferenceContext);
75572
75599
  const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
75573
75600
  if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
@@ -75908,7 +75935,12 @@ ${lanes.join("\n")}
75908
75935
  if (links.contextFreeType) {
75909
75936
  return links.contextFreeType;
75910
75937
  }
75911
- pushContextualType(node, anyType);
75938
+ pushContextualType(
75939
+ node,
75940
+ anyType,
75941
+ /*isCache*/
75942
+ false
75943
+ );
75912
75944
  const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
75913
75945
  popContextualType();
75914
75946
  return type;
@@ -139798,6 +139830,7 @@ ${lanes.join("\n")}
139798
139830
  sourceFile,
139799
139831
  symbol,
139800
139832
  symbolName2,
139833
+ moduleSymbol,
139801
139834
  /*isJsxTagName*/
139802
139835
  false,
139803
139836
  program,
@@ -139809,7 +139842,6 @@ ${lanes.join("\n")}
139809
139842
  const fix = getImportFixForSymbol(
139810
139843
  sourceFile,
139811
139844
  Debug.checkDefined(exportInfo),
139812
- moduleSymbol,
139813
139845
  program,
139814
139846
  /*position*/
139815
139847
  void 0,
@@ -139987,13 +140019,19 @@ ${lanes.join("\n")}
139987
140019
  return result && { ...result, computedWithoutCacheCount };
139988
140020
  }
139989
140021
  }
139990
- function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
140022
+ function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
139991
140023
  const compilerOptions = program.getCompilerOptions();
139992
- const exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, isJsxTagName, program, host, preferences, cancellationToken);
139993
- Debug.assertIsDefined(exportInfos);
140024
+ let exportInfos;
140025
+ if (exportMapKey) {
140026
+ exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
140027
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified exportMapKey");
140028
+ } else {
140029
+ exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, symbolName2, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, moduleSymbol, isJsxTagName, program, host, preferences, cancellationToken);
140030
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified symbol / moduleSymbol");
140031
+ }
139994
140032
  const useRequire = shouldUseRequire(sourceFile, program);
139995
140033
  const isValidTypeOnlyUseSite = isValidTypeOnlyAliasUseSite(getTokenAtPosition(sourceFile, position));
139996
- const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
140034
+ const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
139997
140035
  return {
139998
140036
  moduleSpecifier: fix.moduleSpecifier,
139999
140037
  codeAction: codeFixActionToCodeAction(codeActionForFix(
@@ -140015,23 +140053,22 @@ ${lanes.join("\n")}
140015
140053
  const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
140016
140054
  return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences));
140017
140055
  }
140018
- function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
140019
- Debug.assert(exportInfos.some((info) => info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol), "Some exportInfo should match the specified moduleSymbol");
140056
+ function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
140020
140057
  const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
140021
140058
  return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
140022
140059
  }
140023
140060
  function codeFixActionToCodeAction({ description: description2, changes, commands }) {
140024
140061
  return { description: description2, changes, commands };
140025
140062
  }
140026
- function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, preferCapitalized, program, host, preferences, cancellationToken) {
140063
+ function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) {
140027
140064
  const getChecker = createGetChecker(program, host);
140028
140065
  return getExportInfoMap(importingFile, host, program, preferences, cancellationToken).search(importingFile.path, preferCapitalized, (name) => name === symbolName2, (info) => {
140029
- if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) {
140066
+ if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol && info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol)) {
140030
140067
  return info;
140031
140068
  }
140032
140069
  });
140033
140070
  }
140034
- function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
140071
+ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) {
140035
140072
  var _a2, _b;
140036
140073
  const compilerOptions = program.getCompilerOptions();
140037
140074
  const mainProgramInfo = getInfoWithChecker(
@@ -140053,7 +140090,7 @@ ${lanes.join("\n")}
140053
140090
  if (defaultInfo && skipAlias(defaultInfo.symbol, checker) === symbol) {
140054
140091
  return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
140055
140092
  }
140056
- const named = checker.tryGetMemberInModuleExportsAndProperties(symbol.name, moduleSymbol);
140093
+ const named = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
140057
140094
  if (named && skipAlias(named, checker) === symbol) {
140058
140095
  return { symbol: named, moduleSymbol, moduleFileName: void 0, exportKind: 0 /* Named */, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
140059
140096
  }
@@ -148214,6 +148251,7 @@ ${lanes.join("\n")}
148214
148251
  if (originIsResolvedExport(origin)) {
148215
148252
  const resolvedData = {
148216
148253
  exportName: origin.exportName,
148254
+ exportMapKey: origin.exportMapKey,
148217
148255
  moduleSpecifier: origin.moduleSpecifier,
148218
148256
  ambientModuleName,
148219
148257
  fileName: origin.fileName,
@@ -148237,6 +148275,7 @@ ${lanes.join("\n")}
148237
148275
  const resolvedOrigin = {
148238
148276
  kind: 32 /* ResolvedExport */,
148239
148277
  exportName: data.exportName,
148278
+ exportMapKey: data.exportMapKey,
148240
148279
  moduleSpecifier: data.moduleSpecifier,
148241
148280
  symbolName: completionName,
148242
148281
  fileName: data.fileName,
@@ -148615,6 +148654,7 @@ ${lanes.join("\n")}
148615
148654
  const { moduleSpecifier, codeAction } = ts_codefix_exports.getImportCompletionAction(
148616
148655
  targetSymbol,
148617
148656
  moduleSymbol,
148657
+ data == null ? void 0 : data.exportMapKey,
148618
148658
  sourceFile,
148619
148659
  name,
148620
148660
  isJsxOpeningTagName,
@@ -149304,16 +149344,16 @@ ${lanes.join("\n")}
149304
149344
  if (detailsEntryId && !some(info, (i) => detailsEntryId.source === stripQuotes(i.moduleSymbol.name))) {
149305
149345
  return;
149306
149346
  }
149307
- const firstImportableExportInfo = find(info, isImportableExportInfo);
149308
- if (!firstImportableExportInfo) {
149347
+ info = filter(info, isImportableExportInfo);
149348
+ if (!info.length) {
149309
149349
  return;
149310
149350
  }
149311
149351
  const result = context.tryResolve(info, isFromAmbientModule) || {};
149312
149352
  if (result === "failed")
149313
149353
  return;
149314
- let exportInfo2 = firstImportableExportInfo, moduleSpecifier;
149354
+ let exportInfo2 = info[0], moduleSpecifier;
149315
149355
  if (result !== "skipped") {
149316
- ({ exportInfo: exportInfo2 = firstImportableExportInfo, moduleSpecifier } = result);
149356
+ ({ exportInfo: exportInfo2 = info[0], moduleSpecifier } = result);
149317
149357
  }
149318
149358
  const isDefaultExport = exportInfo2.exportKind === 1 /* Default */;
149319
149359
  const symbol = isDefaultExport && getLocalSymbolForExportDefault(exportInfo2.symbol) || exportInfo2.symbol;
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.0";
57
- var version = `${versionMajorMinor}.0-dev.20230210`;
57
+ var version = `${versionMajorMinor}.0-dev.20230211`;
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.0.0-dev.20230210",
5
+ "version": "5.0.0-dev.20230211",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [