@typescript-deploys/pr-build 5.1.0-pr-53907-15 → 5.1.0-pr-54205-7

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.1";
21
- var version = `${versionMajorMinor}.0-insiders.20230505`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230510`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -10916,7 +10916,6 @@ function isLeftHandSideExpressionKind(kind) {
10916
10916
  case 283 /* JsxElement */:
10917
10917
  case 284 /* JsxSelfClosingElement */:
10918
10918
  case 287 /* JsxFragment */:
10919
- case 294 /* JsxNamespacedName */:
10920
10919
  case 214 /* TaggedTemplateExpression */:
10921
10920
  case 208 /* ArrayLiteralExpression */:
10922
10921
  case 216 /* ParenthesizedExpression */:
@@ -11430,7 +11429,39 @@ function projectReferenceIsEqualTo(oldRef, newRef) {
11430
11429
  return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
11431
11430
  }
11432
11431
  function moduleResolutionIsEqualTo(oldResolution, newResolution) {
11433
- return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
11432
+ return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.node10Result === newResolution.node10Result;
11433
+ }
11434
+ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
11435
+ var _a, _b;
11436
+ const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
11437
+ const result = node10Result ? chainDiagnosticMessages(
11438
+ /*details*/
11439
+ void 0,
11440
+ Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings,
11441
+ node10Result,
11442
+ node10Result.indexOf(nodeModulesPathPart + "@types/") > -1 ? `@types/${mangleScopedPackageName(packageName)}` : packageName
11443
+ ) : host.typesPackageExists(packageName) ? chainDiagnosticMessages(
11444
+ /*details*/
11445
+ void 0,
11446
+ Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1,
11447
+ packageName,
11448
+ mangleScopedPackageName(packageName)
11449
+ ) : host.packageBundlesTypes(packageName) ? chainDiagnosticMessages(
11450
+ /*details*/
11451
+ void 0,
11452
+ Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1,
11453
+ packageName,
11454
+ moduleReference
11455
+ ) : chainDiagnosticMessages(
11456
+ /*details*/
11457
+ void 0,
11458
+ Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,
11459
+ moduleReference,
11460
+ mangleScopedPackageName(packageName)
11461
+ );
11462
+ if (result)
11463
+ result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
11464
+ return result;
11434
11465
  }
11435
11466
  function packageIdIsEqual(a, b) {
11436
11467
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
@@ -12282,6 +12313,8 @@ function tryGetTextOfPropertyName(name) {
12282
12313
  if (isStringOrNumericLiteralLike(name.expression))
12283
12314
  return escapeLeadingUnderscores(name.expression.text);
12284
12315
  return void 0;
12316
+ case 294 /* JsxNamespacedName */:
12317
+ return getEscapedTextOfJsxNamespacedName(name);
12285
12318
  default:
12286
12319
  return Debug.assertNever(name);
12287
12320
  }
@@ -14163,6 +14196,8 @@ function getPropertyNameForPropertyNameNode(name) {
14163
14196
  return nameExpression.operand.text;
14164
14197
  }
14165
14198
  return void 0;
14199
+ case 294 /* JsxNamespacedName */:
14200
+ return getEscapedTextOfJsxNamespacedName(name);
14166
14201
  default:
14167
14202
  return Debug.assertNever(name);
14168
14203
  }
@@ -14179,10 +14214,10 @@ function isPropertyNameLiteral(node) {
14179
14214
  }
14180
14215
  }
14181
14216
  function getTextOfIdentifierOrLiteral(node) {
14182
- return isMemberName(node) ? idText(node) : node.text;
14217
+ return isMemberName(node) ? idText(node) : isJsxNamespacedName(node) ? getTextOfJsxNamespacedName(node) : node.text;
14183
14218
  }
14184
14219
  function getEscapedTextOfIdentifierOrLiteral(node) {
14185
- return isMemberName(node) ? node.escapedText : escapeLeadingUnderscores(node.text);
14220
+ return isMemberName(node) ? node.escapedText : isJsxNamespacedName(node) ? getEscapedTextOfJsxNamespacedName(node) : escapeLeadingUnderscores(node.text);
14186
14221
  }
14187
14222
  function getSymbolNameForPrivateIdentifier(containingClassSymbol, description) {
14188
14223
  return `__#${getSymbolId(containingClassSymbol)}@${description}`;
@@ -15413,6 +15448,8 @@ function tryGetPropertyAccessOrIdentifierToString(expr) {
15413
15448
  }
15414
15449
  } else if (isIdentifier(expr)) {
15415
15450
  return unescapeLeadingUnderscores(expr.escapedText);
15451
+ } else if (isJsxNamespacedName(expr)) {
15452
+ return getTextOfJsxNamespacedName(expr);
15416
15453
  }
15417
15454
  return void 0;
15418
15455
  }
@@ -29582,7 +29619,11 @@ var Parser;
29582
29619
  }
29583
29620
  function parseJsxElementName() {
29584
29621
  const pos = getNodePos();
29585
- let expression = parseJsxTagName();
29622
+ const initialExpression = parseJsxTagName();
29623
+ if (isJsxNamespacedName(initialExpression)) {
29624
+ return initialExpression;
29625
+ }
29626
+ let expression = initialExpression;
29586
29627
  while (parseOptional(25 /* DotToken */)) {
29587
29628
  expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
29588
29629
  /*allowIdentifierNames*/
@@ -37524,8 +37565,6 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
37524
37565
  const diagnosticState = {
37525
37566
  ...state,
37526
37567
  features: state.features & ~8 /* Exports */,
37527
- failedLookupLocations: [],
37528
- affectingLocations: [],
37529
37568
  reportDiagnostic: noop
37530
37569
  };
37531
37570
  const diagnosticResult = tryResolve(extensions & (1 /* TypeScript */ | 4 /* Declaration */), diagnosticState);
@@ -42378,7 +42417,10 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
42378
42417
  const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
42379
42418
  if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths.paths), mainFileRelative))) {
42380
42419
  const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
42381
- if (removeFileExtension(mainExportFile) === removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
42420
+ const canonicalModuleFileToTry = getCanonicalFileName(moduleFileToTry);
42421
+ if (removeFileExtension(mainExportFile) === removeFileExtension(canonicalModuleFileToTry)) {
42422
+ return { packageRootPath, moduleFileToTry };
42423
+ } else if (packageJsonContent.type !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") {
42382
42424
  return { packageRootPath, moduleFileToTry };
42383
42425
  }
42384
42426
  }
@@ -42644,18 +42686,6 @@ function isInstantiatedModule(node, preserveConstEnums) {
42644
42686
  return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
42645
42687
  }
42646
42688
  function createTypeChecker(host) {
42647
- var getPackagesMap = memoize(() => {
42648
- var map2 = /* @__PURE__ */ new Map();
42649
- host.getSourceFiles().forEach((sf) => {
42650
- if (!sf.resolvedModules)
42651
- return;
42652
- sf.resolvedModules.forEach(({ resolvedModule }) => {
42653
- if (resolvedModule == null ? void 0 : resolvedModule.packageId)
42654
- map2.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map2.get(resolvedModule.packageId.name));
42655
- });
42656
- });
42657
- return map2;
42658
- });
42659
42689
  var deferredDiagnosticsCallbacks = [];
42660
42690
  var addLazyDiagnostic = (arg) => {
42661
42691
  deferredDiagnosticsCallbacks.push(arg);
@@ -44438,7 +44468,7 @@ function createTypeChecker(host) {
44438
44468
  if (!result) {
44439
44469
  if (nameNotFoundMessage) {
44440
44470
  addLazyDiagnostic(() => {
44441
- if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
44471
+ if (!errorLocation || errorLocation.parent.kind !== 330 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
44442
44472
  !checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
44443
44473
  let suggestion;
44444
44474
  let suggestedLib;
@@ -45991,35 +46021,9 @@ function createTypeChecker(host) {
45991
46021
  }
45992
46022
  }
45993
46023
  function errorOnImplicitAnyModule(isError, errorNode, sourceFile, mode, { packageId, resolvedFileName }, moduleReference) {
45994
- var _a, _b;
45995
46024
  let errorInfo;
45996
46025
  if (!isExternalModuleNameRelative(moduleReference) && packageId) {
45997
- const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
45998
- errorInfo = node10Result ? chainDiagnosticMessages(
45999
- /*details*/
46000
- void 0,
46001
- Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings,
46002
- node10Result,
46003
- node10Result.indexOf(nodeModulesPathPart + "@types/") > -1 ? `@types/${mangleScopedPackageName(packageId.name)}` : packageId.name
46004
- ) : typesPackageExists(packageId.name) ? chainDiagnosticMessages(
46005
- /*details*/
46006
- void 0,
46007
- Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1,
46008
- packageId.name,
46009
- mangleScopedPackageName(packageId.name)
46010
- ) : packageBundlesTypes(packageId.name) ? chainDiagnosticMessages(
46011
- /*details*/
46012
- void 0,
46013
- Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1,
46014
- packageId.name,
46015
- moduleReference
46016
- ) : chainDiagnosticMessages(
46017
- /*details*/
46018
- void 0,
46019
- Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,
46020
- moduleReference,
46021
- mangleScopedPackageName(packageId.name)
46022
- );
46026
+ errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
46023
46027
  }
46024
46028
  errorOrSuggestion(isError, errorNode, chainDiagnosticMessages(
46025
46029
  errorInfo,
@@ -46028,12 +46032,6 @@ function createTypeChecker(host) {
46028
46032
  resolvedFileName
46029
46033
  ));
46030
46034
  }
46031
- function typesPackageExists(packageName) {
46032
- return getPackagesMap().has(getTypesPackageName(packageName));
46033
- }
46034
- function packageBundlesTypes(packageName) {
46035
- return !!getPackagesMap().get(packageName);
46036
- }
46037
46035
  function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) {
46038
46036
  if (moduleSymbol == null ? void 0 : moduleSymbol.exports) {
46039
46037
  const exportEquals = resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias);
@@ -56544,7 +56542,20 @@ function createTypeChecker(host) {
56544
56542
  if (isPrivateIdentifier(name)) {
56545
56543
  return neverType;
56546
56544
  }
56547
- return isIdentifier(name) ? getStringLiteralType(unescapeLeadingUnderscores(name.escapedText)) : getRegularTypeOfLiteralType(isComputedPropertyName(name) ? checkComputedPropertyName(name) : checkExpression(name));
56545
+ if (isNumericLiteral(name)) {
56546
+ return getRegularTypeOfLiteralType(checkExpression(name));
56547
+ }
56548
+ if (isComputedPropertyName(name)) {
56549
+ return getRegularTypeOfLiteralType(checkComputedPropertyName(name));
56550
+ }
56551
+ const propertyName = getPropertyNameForPropertyNameNode(name);
56552
+ if (propertyName !== void 0) {
56553
+ return getStringLiteralType(unescapeLeadingUnderscores(propertyName));
56554
+ }
56555
+ if (isExpression(name)) {
56556
+ return getRegularTypeOfLiteralType(checkExpression(name));
56557
+ }
56558
+ return neverType;
56548
56559
  }
56549
56560
  function getLiteralTypeFromProperty(prop, include, includeNonPublic) {
56550
56561
  if (includeNonPublic || !(getDeclarationModifierFlagsFromSymbol(prop) & 24 /* NonPublicAccessibilityModifier */)) {
@@ -57192,7 +57203,7 @@ function createTypeChecker(host) {
57192
57203
  }
57193
57204
  function maybeCloneTypeParameter(p) {
57194
57205
  const constraint = getConstraintOfTypeParameter(p);
57195
- return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
57206
+ return constraint && couldContainTypeVariables(constraint) ? cloneTypeParameter(p) : p;
57196
57207
  }
57197
57208
  function isSimpleTupleType(node) {
57198
57209
  return isTupleTypeNode(node) && length(node.elements) > 0 && !some(node.elements, (e) => isOptionalTypeNode(e) || isRestTypeNode(e) || isNamedTupleMember(e) && !!(e.questionToken || e.dotDotDotToken));
@@ -66992,7 +67003,6 @@ function createTypeChecker(host) {
66992
67003
  case 9 /* NumericLiteral */:
66993
67004
  case 10 /* BigIntLiteral */:
66994
67005
  case 15 /* NoSubstitutionTemplateLiteral */:
66995
- case 227 /* TemplateExpression */:
66996
67006
  case 112 /* TrueKeyword */:
66997
67007
  case 97 /* FalseKeyword */:
66998
67008
  case 106 /* NullKeyword */:
@@ -67648,7 +67658,7 @@ function createTypeChecker(host) {
67648
67658
  }
67649
67659
  return links.immediateTarget;
67650
67660
  }
67651
- function checkObjectLiteral(node, checkMode) {
67661
+ function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
67652
67662
  var _a;
67653
67663
  const inDestructuringPattern = isAssignmentTarget(node);
67654
67664
  checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
@@ -67731,7 +67741,7 @@ function createTypeChecker(host) {
67731
67741
  prop.links.target = member;
67732
67742
  member = prop;
67733
67743
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
67734
- if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
67744
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
67735
67745
  const inferenceContext = getInferenceContext(node);
67736
67746
  Debug.assert(inferenceContext);
67737
67747
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -67749,7 +67759,7 @@ function createTypeChecker(host) {
67749
67759
  hasComputedNumberProperty = false;
67750
67760
  hasComputedSymbolProperty = false;
67751
67761
  }
67752
- const type = getReducedType(checkExpression(memberDecl.expression));
67762
+ const type = getReducedType(checkExpression(memberDecl.expression, checkMode & 2 /* Inferential */));
67753
67763
  if (isValidSpreadType(type)) {
67754
67764
  const mergedType = tryMergeUnionOfObjectTypeAndEmptyObject(type, inConstContext);
67755
67765
  if (allPropertiesTable) {
@@ -67890,7 +67900,7 @@ function createTypeChecker(host) {
67890
67900
  function checkJsxAttribute(node, checkMode) {
67891
67901
  return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
67892
67902
  }
67893
- function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
67903
+ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
67894
67904
  const attributes = openingLikeElement.attributes;
67895
67905
  const contextualType = getContextualType(attributes, 0 /* None */);
67896
67906
  const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
@@ -67925,7 +67935,7 @@ function createTypeChecker(host) {
67925
67935
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
67926
67936
  }
67927
67937
  }
67928
- if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
67938
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
67929
67939
  const inferenceContext = getInferenceContext(attributes);
67930
67940
  Debug.assert(inferenceContext);
67931
67941
  const inferenceNode = attributeDecl.initializer.expression;
@@ -67944,7 +67954,7 @@ function createTypeChecker(host) {
67944
67954
  );
67945
67955
  attributesTable = createSymbolTable();
67946
67956
  }
67947
- const exprType = getReducedType(checkExpressionCached(attributeDecl.expression, checkMode));
67957
+ const exprType = getReducedType(checkExpression(attributeDecl.expression, checkMode & 2 /* Inferential */));
67948
67958
  if (isTypeAny(exprType)) {
67949
67959
  hasSpreadAnyType = true;
67950
67960
  }
@@ -69675,7 +69685,7 @@ function createTypeChecker(host) {
69675
69685
  if (getJsxNamespaceContainerForImplicitImport(node)) {
69676
69686
  return true;
69677
69687
  }
69678
- const tagType = isJsxOpeningElement(node) || isJsxSelfClosingElement(node) && !isJsxIntrinsicTagName(node.tagName) ? checkExpression(node.tagName) : void 0;
69688
+ const tagType = (isJsxOpeningElement(node) || isJsxSelfClosingElement(node)) && !(isJsxIntrinsicTagName(node.tagName) || isJsxNamespacedName(node.tagName)) ? checkExpression(node.tagName) : void 0;
69679
69689
  if (!tagType) {
69680
69690
  return true;
69681
69691
  }
@@ -73790,15 +73800,11 @@ function createTypeChecker(host) {
73790
73800
  texts.push(span.literal.text);
73791
73801
  types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
73792
73802
  }
73793
- if (isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(
73803
+ return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(
73794
73804
  node,
73795
73805
  /*contextFlags*/
73796
73806
  void 0
73797
- ) || unknownType, isTemplateLiteralContextualType)) {
73798
- return getTemplateLiteralType(texts, types);
73799
- }
73800
- const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
73801
- return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
73807
+ ) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
73802
73808
  }
73803
73809
  function isTemplateLiteralContextualType(type) {
73804
73810
  return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
@@ -78776,11 +78782,11 @@ function createTypeChecker(host) {
78776
78782
  );
78777
78783
  if (symbol) {
78778
78784
  if (symbol.flags & 8 /* EnumMember */) {
78779
- return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
78785
+ return evaluateEnumMember(expr, symbol, location);
78780
78786
  }
78781
78787
  if (isConstVariable(symbol)) {
78782
78788
  const declaration = symbol.valueDeclaration;
78783
- if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
78789
+ if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
78784
78790
  return evaluate(declaration.initializer, declaration);
78785
78791
  }
78786
78792
  }
@@ -78800,7 +78806,7 @@ function createTypeChecker(host) {
78800
78806
  const name = escapeLeadingUnderscores(expr.argumentExpression.text);
78801
78807
  const member = rootSymbol.exports.get(name);
78802
78808
  if (member) {
78803
- return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
78809
+ return evaluateEnumMember(expr, member, location);
78804
78810
  }
78805
78811
  }
78806
78812
  }
@@ -80261,7 +80267,7 @@ function createTypeChecker(host) {
80261
80267
  name,
80262
80268
  meaning,
80263
80269
  /*ignoreErrors*/
80264
- false,
80270
+ true,
80265
80271
  /*dontResolveAlias*/
80266
80272
  true,
80267
80273
  getHostSignatureFromJSDoc(name)
@@ -80272,7 +80278,7 @@ function createTypeChecker(host) {
80272
80278
  return resolveJSDocMemberName(
80273
80279
  name,
80274
80280
  /*ignoreErrors*/
80275
- false,
80281
+ true,
80276
80282
  getSymbolOfDeclaration(container)
80277
80283
  );
80278
80284
  }
@@ -108397,6 +108403,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108397
108403
  return emitJsxSpreadAttribute(node);
108398
108404
  case 293 /* JsxExpression */:
108399
108405
  return emitJsxExpression(node);
108406
+ case 294 /* JsxNamespacedName */:
108407
+ return emitJsxNamespacedName(node);
108400
108408
  case 295 /* CaseClause */:
108401
108409
  return emitCaseClause(node);
108402
108410
  case 296 /* DefaultClause */:
@@ -108592,8 +108600,6 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108592
108600
  return emitJsxSelfClosingElement(node);
108593
108601
  case 287 /* JsxFragment */:
108594
108602
  return emitJsxFragment(node);
108595
- case 294 /* JsxNamespacedName */:
108596
- return emitJsxNamespacedName(node);
108597
108603
  case 357 /* SyntaxList */:
108598
108604
  return Debug.fail("SyntaxList should not be printed");
108599
108605
  case 358 /* NotEmittedStatement */:
@@ -111425,6 +111431,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111425
111431
  if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
111426
111432
  return idText(node);
111427
111433
  }
111434
+ } else if (isJsxNamespacedName(node)) {
111435
+ if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
111436
+ return getTextOfJsxNamespacedName(node);
111437
+ }
111428
111438
  } else {
111429
111439
  Debug.assertNode(node, isLiteralExpression);
111430
111440
  if (!canUseSourceFile) {
@@ -111436,7 +111446,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111436
111446
  function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
111437
111447
  if (node.kind === 11 /* StringLiteral */ && node.textSourceNode) {
111438
111448
  const textSourceNode = node.textSourceNode;
111439
- if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) {
111449
+ if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode) || isJsxNamespacedName(textSourceNode)) {
111440
111450
  const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode);
111441
111451
  return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
111442
111452
  } else {
@@ -113648,6 +113658,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113648
113658
  let automaticTypeDirectiveResolutions;
113649
113659
  let resolvedLibReferences;
113650
113660
  let resolvedLibProcessing;
113661
+ let packageMap;
113651
113662
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
113652
113663
  let currentNodeModulesDepth = 0;
113653
113664
  const modulesWithElidedImports = /* @__PURE__ */ new Map();
@@ -113952,6 +113963,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113952
113963
  redirectTargetsMap,
113953
113964
  usesUriStyleNodeCoreModules,
113954
113965
  resolvedLibReferences,
113966
+ getCurrentPackagesMap: () => packageMap,
113967
+ typesPackageExists,
113968
+ packageBundlesTypes,
113955
113969
  isEmittedFile,
113956
113970
  getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
113957
113971
  getProjectReferences,
@@ -113992,6 +114006,26 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113992
114006
  measure("Program", "beforeProgram", "afterProgram");
113993
114007
  (_p = tracing) == null ? void 0 : _p.pop();
113994
114008
  return program;
114009
+ function getPackagesMap() {
114010
+ if (packageMap)
114011
+ return packageMap;
114012
+ packageMap = /* @__PURE__ */ new Map();
114013
+ files.forEach((sf) => {
114014
+ if (!sf.resolvedModules)
114015
+ return;
114016
+ sf.resolvedModules.forEach(({ resolvedModule }) => {
114017
+ if (resolvedModule == null ? void 0 : resolvedModule.packageId)
114018
+ packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
114019
+ });
114020
+ });
114021
+ return packageMap;
114022
+ }
114023
+ function typesPackageExists(packageName) {
114024
+ return getPackagesMap().has(getTypesPackageName(packageName));
114025
+ }
114026
+ function packageBundlesTypes(packageName) {
114027
+ return !!getPackagesMap().get(packageName);
114028
+ }
113995
114029
  function addResolutionDiagnostics(resolution) {
113996
114030
  var _a2;
113997
114031
  if (!((_a2 = resolution.resolutionDiagnostics) == null ? void 0 : _a2.length))
@@ -114480,6 +114514,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114480
114514
  redirectTargetsMap = oldProgram.redirectTargetsMap;
114481
114515
  usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
114482
114516
  resolvedLibReferences = oldProgram.resolvedLibReferences;
114517
+ packageMap = oldProgram.getCurrentPackagesMap();
114483
114518
  return 2 /* Completely */;
114484
114519
  }
114485
114520
  function getEmitHost(writeFileCallback) {
@@ -117335,7 +117370,10 @@ function createBuilderProgramState(newProgram, oldState) {
117335
117370
  return;
117336
117371
  const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
117337
117372
  if (diagnostics) {
117338
- state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
117373
+ state.semanticDiagnosticsPerFile.set(
117374
+ sourceFilePath,
117375
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
117376
+ );
117339
117377
  if (!state.semanticDiagnosticsFromOldState) {
117340
117378
  state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
117341
117379
  }
@@ -117406,6 +117444,33 @@ function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature)
117406
117444
  isString(oldEmitSignature) ? [oldEmitSignature] : oldEmitSignature[0]
117407
117445
  );
117408
117446
  }
117447
+ function repopulateDiagnostics(diagnostics, newProgram) {
117448
+ if (!diagnostics.length)
117449
+ return diagnostics;
117450
+ return sameMap(diagnostics, (diag2) => {
117451
+ if (isString(diag2.messageText))
117452
+ return diag2;
117453
+ const repopulatedChain = convertOrRepopulateDiagnosticMessageChain(diag2.messageText, diag2.file, newProgram, (chain) => {
117454
+ var _a;
117455
+ return (_a = chain.repopulateInfo) == null ? void 0 : _a.call(chain);
117456
+ });
117457
+ return repopulatedChain === diag2.messageText ? diag2 : { ...diag2, messageText: repopulatedChain };
117458
+ });
117459
+ }
117460
+ function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
117461
+ const info = repopulateInfo(chain);
117462
+ if (info) {
117463
+ return {
117464
+ ...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
117465
+ next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
117466
+ };
117467
+ }
117468
+ const next = convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo);
117469
+ return next === chain.next ? chain : { ...chain, next };
117470
+ }
117471
+ function convertOrRepopulateDiagnosticMessageChainArray(array, sourceFile, newProgram, repopulateInfo) {
117472
+ return sameMap(array, (chain) => convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo));
117473
+ }
117409
117474
  function convertToDiagnostics(diagnostics, newProgram) {
117410
117475
  if (!diagnostics.length)
117411
117476
  return emptyArray;
@@ -117427,9 +117492,11 @@ function convertToDiagnostics(diagnostics, newProgram) {
117427
117492
  }
117428
117493
  function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) {
117429
117494
  const { file } = diagnostic;
117495
+ const sourceFile = file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0;
117430
117496
  return {
117431
117497
  ...diagnostic,
117432
- file: file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0
117498
+ file: sourceFile,
117499
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertOrRepopulateDiagnosticMessageChain(diagnostic.messageText, sourceFile, newProgram, (chain) => chain.info)
117433
117500
  };
117434
117501
  }
117435
117502
  function releaseCache(state) {
@@ -117971,9 +118038,35 @@ function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBui
117971
118038
  const { file } = diagnostic;
117972
118039
  return {
117973
118040
  ...diagnostic,
117974
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0
118041
+ file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
118042
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
117975
118043
  };
117976
118044
  }
118045
+ function convertToReusableDiagnosticMessageChain(chain) {
118046
+ if (chain.repopulateInfo) {
118047
+ return {
118048
+ info: chain.repopulateInfo(),
118049
+ next: convertToReusableDiagnosticMessageChainArray(chain.next)
118050
+ };
118051
+ }
118052
+ const next = convertToReusableDiagnosticMessageChainArray(chain.next);
118053
+ return next === chain.next ? chain : { ...chain, next };
118054
+ }
118055
+ function convertToReusableDiagnosticMessageChainArray(array) {
118056
+ if (!array)
118057
+ return array;
118058
+ return forEach(array, (chain, index) => {
118059
+ const reusable = convertToReusableDiagnosticMessageChain(chain);
118060
+ if (chain === reusable)
118061
+ return void 0;
118062
+ const result = index > 0 ? array.slice(0, index - 1) : [];
118063
+ result.push(reusable);
118064
+ for (let i = index + 1; i < array.length; i++) {
118065
+ result.push(convertToReusableDiagnosticMessageChain(array[i]));
118066
+ }
118067
+ return result;
118068
+ }) || array;
118069
+ }
117977
118070
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
117978
118071
  let host;
117979
118072
  let newProgram;
@@ -119060,45 +119153,51 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119060
119153
  }
119061
119154
  (resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
119062
119155
  }
119156
+ function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
119157
+ const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119158
+ const toWatch = getDirectoryToWatchFailedLookupLocation(
119159
+ failedLookupLocation,
119160
+ failedLookupLocationPath,
119161
+ rootDir,
119162
+ rootPath,
119163
+ rootPathComponents,
119164
+ getCurrentDirectory
119165
+ );
119166
+ if (toWatch) {
119167
+ const { dir, dirPath, nonRecursive } = toWatch;
119168
+ if (dirPath === rootPath) {
119169
+ Debug.assert(nonRecursive);
119170
+ setAtRoot = true;
119171
+ } else {
119172
+ setDirectoryWatcher(dir, dirPath, nonRecursive);
119173
+ }
119174
+ }
119175
+ return setAtRoot;
119176
+ }
119063
119177
  function watchFailedLookupLocationOfResolution(resolution) {
119064
119178
  Debug.assert(!!resolution.refCount);
119065
- const { failedLookupLocations, affectingLocations } = resolution;
119066
- if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length))
119179
+ const { failedLookupLocations, affectingLocations, node10Result } = resolution;
119180
+ if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !node10Result)
119067
119181
  return;
119068
- if (failedLookupLocations == null ? void 0 : failedLookupLocations.length)
119182
+ if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || node10Result)
119069
119183
  resolutionsWithFailedLookups.add(resolution);
119070
119184
  let setAtRoot = false;
119071
119185
  if (failedLookupLocations) {
119072
119186
  for (const failedLookupLocation of failedLookupLocations) {
119073
- const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119074
- const toWatch = getDirectoryToWatchFailedLookupLocation(
119075
- failedLookupLocation,
119076
- failedLookupLocationPath,
119077
- rootDir,
119078
- rootPath,
119079
- rootPathComponents,
119080
- getCurrentDirectory
119081
- );
119082
- if (toWatch) {
119083
- const { dir, dirPath, nonRecursive } = toWatch;
119084
- if (dirPath === rootPath) {
119085
- Debug.assert(nonRecursive);
119086
- setAtRoot = true;
119087
- } else {
119088
- setDirectoryWatcher(dir, dirPath, nonRecursive);
119089
- }
119090
- }
119091
- }
119092
- if (setAtRoot) {
119093
- setDirectoryWatcher(
119094
- rootDir,
119095
- rootPath,
119096
- /*nonRecursive*/
119097
- true
119098
- );
119187
+ setAtRoot = watchFailedLookupLocation(failedLookupLocation, setAtRoot);
119099
119188
  }
119100
119189
  }
119101
- watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length));
119190
+ if (node10Result)
119191
+ setAtRoot = watchFailedLookupLocation(node10Result, setAtRoot);
119192
+ if (setAtRoot) {
119193
+ setDirectoryWatcher(
119194
+ rootDir,
119195
+ rootPath,
119196
+ /*nonRecursive*/
119197
+ true
119198
+ );
119199
+ }
119200
+ watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !node10Result);
119102
119201
  }
119103
119202
  function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
119104
119203
  Debug.assert(!!resolution.refCount);
@@ -119192,6 +119291,26 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119192
119291
  directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
119193
119292
  }
119194
119293
  }
119294
+ function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
119295
+ const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119296
+ const toWatch = getDirectoryToWatchFailedLookupLocation(
119297
+ failedLookupLocation,
119298
+ failedLookupLocationPath,
119299
+ rootDir,
119300
+ rootPath,
119301
+ rootPathComponents,
119302
+ getCurrentDirectory
119303
+ );
119304
+ if (toWatch) {
119305
+ const { dirPath } = toWatch;
119306
+ if (dirPath === rootPath) {
119307
+ removeAtRoot = true;
119308
+ } else {
119309
+ removeDirectoryWatcher(dirPath);
119310
+ }
119311
+ }
119312
+ return removeAtRoot;
119313
+ }
119195
119314
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
119196
119315
  Debug.checkDefined(resolution.files).delete(filePath);
119197
119316
  resolution.refCount--;
@@ -119205,31 +119324,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119205
119324
  if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size)
119206
119325
  resolvedFileToResolution.delete(key);
119207
119326
  }
119208
- const { failedLookupLocations, affectingLocations } = resolution;
119327
+ const { failedLookupLocations, affectingLocations, node10Result } = resolution;
119209
119328
  if (resolutionsWithFailedLookups.delete(resolution)) {
119210
119329
  let removeAtRoot = false;
119211
- for (const failedLookupLocation of failedLookupLocations) {
119212
- const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119213
- const toWatch = getDirectoryToWatchFailedLookupLocation(
119214
- failedLookupLocation,
119215
- failedLookupLocationPath,
119216
- rootDir,
119217
- rootPath,
119218
- rootPathComponents,
119219
- getCurrentDirectory
119220
- );
119221
- if (toWatch) {
119222
- const { dirPath } = toWatch;
119223
- if (dirPath === rootPath) {
119224
- removeAtRoot = true;
119225
- } else {
119226
- removeDirectoryWatcher(dirPath);
119227
- }
119330
+ if (failedLookupLocations) {
119331
+ for (const failedLookupLocation of failedLookupLocations) {
119332
+ removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
119228
119333
  }
119229
119334
  }
119230
- if (removeAtRoot) {
119335
+ if (node10Result)
119336
+ removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot);
119337
+ if (removeAtRoot)
119231
119338
  removeDirectoryWatcher(rootPath);
119232
- }
119233
119339
  } else if (affectingLocations == null ? void 0 : affectingLocations.length) {
119234
119340
  resolutionsWithOnlyAffectingLocations.delete(resolution);
119235
119341
  }
@@ -119383,7 +119489,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119383
119489
  return true;
119384
119490
  if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
119385
119491
  return false;
119386
- return (_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
119492
+ return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.node10Result && isInvalidatedFailedLookup(resolutionHost.toPath(resolution.node10Result));
119387
119493
  }
119388
119494
  function isInvalidatedFailedLookup(locationPath) {
119389
119495
  return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);