@typescript-deploys/pr-build 5.5.0-pr-57951-3 → 5.5.0-pr-57973-2

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.
@@ -60,6 +60,8 @@ interface Array<T> {
60
60
  * @param end If not specified, length of the this object is used as its default value.
61
61
  */
62
62
  copyWithin(target: number, start: number, end?: number): this;
63
+
64
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
63
65
  }
64
66
 
65
67
  interface ArrayConstructor {
@@ -360,6 +362,8 @@ interface ReadonlyArray<T> {
360
362
  * predicate. If it is not provided, undefined is used instead.
361
363
  */
362
364
  findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number;
365
+
366
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
363
367
  }
364
368
 
365
369
  interface RegExp {
@@ -555,3 +559,39 @@ interface StringConstructor {
555
559
  */
556
560
  raw(template: { raw: readonly string[] | ArrayLike<string>; }, ...substitutions: any[]): string;
557
561
  }
562
+
563
+ interface Int8Array {
564
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
565
+ }
566
+
567
+ interface Uint8Array {
568
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
569
+ }
570
+
571
+ interface Uint8ClampedArray {
572
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
573
+ }
574
+
575
+ interface Int16Array {
576
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
577
+ }
578
+
579
+ interface Uint16Array {
580
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
581
+ }
582
+
583
+ interface Int32Array {
584
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
585
+ }
586
+
587
+ interface Uint32Array {
588
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
589
+ }
590
+
591
+ interface Float32Array {
592
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
593
+ }
594
+
595
+ interface Float64Array {
596
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
597
+ }
@@ -369,7 +369,7 @@ interface BigInt64Array {
369
369
  subarray(begin?: number, end?: number): BigInt64Array;
370
370
 
371
371
  /** Converts the array to a string by using the current locale. */
372
- toLocaleString(): string;
372
+ toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
373
373
 
374
374
  /** Returns a string representation of the array. */
375
375
  toString(): string;
@@ -641,7 +641,7 @@ interface BigUint64Array {
641
641
  subarray(begin?: number, end?: number): BigUint64Array;
642
642
 
643
643
  /** Converts the array to a string by using the current locale. */
644
- toLocaleString(): string;
644
+ toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
645
645
 
646
646
  /** Returns a string representation of the array. */
647
647
  toString(): string;
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.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240326`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240327`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3699,6 +3699,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
3699
3699
  ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
3700
3700
  ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
3701
3701
  ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
3702
+ ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
3702
3703
  ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
3703
3704
  ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
3704
3705
  ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
@@ -17697,6 +17698,91 @@ function isSyntacticallyString(expr) {
17697
17698
  }
17698
17699
  return false;
17699
17700
  }
17701
+ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameExpression }) {
17702
+ function evaluate(expr, location) {
17703
+ switch (expr.kind) {
17704
+ case 224 /* PrefixUnaryExpression */:
17705
+ const value = evaluate(expr.operand, location);
17706
+ if (typeof value === "number") {
17707
+ switch (expr.operator) {
17708
+ case 40 /* PlusToken */:
17709
+ return value;
17710
+ case 41 /* MinusToken */:
17711
+ return -value;
17712
+ case 55 /* TildeToken */:
17713
+ return ~value;
17714
+ }
17715
+ }
17716
+ break;
17717
+ case 226 /* BinaryExpression */:
17718
+ const left = evaluate(expr.left, location);
17719
+ const right = evaluate(expr.right, location);
17720
+ if (typeof left === "number" && typeof right === "number") {
17721
+ switch (expr.operatorToken.kind) {
17722
+ case 52 /* BarToken */:
17723
+ return left | right;
17724
+ case 51 /* AmpersandToken */:
17725
+ return left & right;
17726
+ case 49 /* GreaterThanGreaterThanToken */:
17727
+ return left >> right;
17728
+ case 50 /* GreaterThanGreaterThanGreaterThanToken */:
17729
+ return left >>> right;
17730
+ case 48 /* LessThanLessThanToken */:
17731
+ return left << right;
17732
+ case 53 /* CaretToken */:
17733
+ return left ^ right;
17734
+ case 42 /* AsteriskToken */:
17735
+ return left * right;
17736
+ case 44 /* SlashToken */:
17737
+ return left / right;
17738
+ case 40 /* PlusToken */:
17739
+ return left + right;
17740
+ case 41 /* MinusToken */:
17741
+ return left - right;
17742
+ case 45 /* PercentToken */:
17743
+ return left % right;
17744
+ case 43 /* AsteriskAsteriskToken */:
17745
+ return left ** right;
17746
+ }
17747
+ } else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
17748
+ return "" + left + right;
17749
+ }
17750
+ break;
17751
+ case 11 /* StringLiteral */:
17752
+ case 15 /* NoSubstitutionTemplateLiteral */:
17753
+ return expr.text;
17754
+ case 228 /* TemplateExpression */:
17755
+ return evaluateTemplateExpression(expr, location);
17756
+ case 9 /* NumericLiteral */:
17757
+ return +expr.text;
17758
+ case 217 /* ParenthesizedExpression */:
17759
+ return evaluate(expr.expression, location);
17760
+ case 80 /* Identifier */:
17761
+ return evaluateEntityNameExpression(expr, location);
17762
+ case 211 /* PropertyAccessExpression */:
17763
+ if (isEntityNameExpression(expr)) {
17764
+ return evaluateEntityNameExpression(expr, location);
17765
+ }
17766
+ break;
17767
+ case 212 /* ElementAccessExpression */:
17768
+ return evaluateElementAccessExpression(expr, location);
17769
+ }
17770
+ return void 0;
17771
+ }
17772
+ function evaluateTemplateExpression(expr, location) {
17773
+ let result = expr.head.text;
17774
+ for (const span of expr.templateSpans) {
17775
+ const value = evaluate(span.expression, location);
17776
+ if (value === void 0) {
17777
+ return void 0;
17778
+ }
17779
+ result += value;
17780
+ result += span.literal.text;
17781
+ }
17782
+ return result;
17783
+ }
17784
+ return evaluate;
17785
+ }
17700
17786
 
17701
17787
  // src/compiler/factory/baseNodeFactory.ts
17702
17788
  function createBaseNodeFactory() {
@@ -42596,8 +42682,10 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
42596
42682
  if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
42597
42683
  return maybeNonRelative;
42598
42684
  }
42599
- const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
42600
- const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
42685
+ let nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
42686
+ let nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
42687
+ nearestTargetPackageJson && (nearestTargetPackageJson = toPath(nearestTargetPackageJson, projectDirectory, getCanonicalFileName));
42688
+ nearestSourcePackageJson && (nearestSourcePackageJson = toPath(nearestSourcePackageJson, projectDirectory, getCanonicalFileName));
42601
42689
  if (nearestSourcePackageJson !== nearestTargetPackageJson) {
42602
42690
  return maybeNonRelative;
42603
42691
  }
@@ -43370,6 +43458,10 @@ function createTypeChecker(host) {
43370
43458
  var checkBinaryExpression = createCheckBinaryExpression();
43371
43459
  var emitResolver = createResolver();
43372
43460
  var nodeBuilder = createNodeBuilder();
43461
+ var evaluate = createEvaluator({
43462
+ evaluateElementAccessExpression,
43463
+ evaluateEntityNameExpression
43464
+ });
43373
43465
  var globals = createSymbolTable();
43374
43466
  var undefinedSymbol = createSymbol(4 /* Property */, "undefined");
43375
43467
  undefinedSymbol.declarations = [];
@@ -48540,7 +48632,7 @@ function createTypeChecker(host) {
48540
48632
  }
48541
48633
  const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
48542
48634
  if (some(abstractSignatures)) {
48543
- const types = map(abstractSignatures, getOrCreateTypeFromSignature);
48635
+ const types = map(abstractSignatures, (s) => getOrCreateTypeFromSignature(s));
48544
48636
  const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
48545
48637
  // the logic in `createTypeNodesFromResolvedType`.
48546
48638
  (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
@@ -49855,7 +49947,7 @@ function createTypeChecker(host) {
49855
49947
  const type = getDeclaredTypeOfSymbol(sym);
49856
49948
  const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
49857
49949
  name.symbol = sym;
49858
- return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
49950
+ return { introducesError, node: setTextRange(setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */), node) };
49859
49951
  }
49860
49952
  }
49861
49953
  return { introducesError, node };
@@ -49865,7 +49957,6 @@ function createTypeChecker(host) {
49865
49957
  cancellationToken.throwIfCancellationRequested();
49866
49958
  }
49867
49959
  let hadError = false;
49868
- const file = getSourceFileOfNode(existing);
49869
49960
  const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
49870
49961
  if (hadError) {
49871
49962
  return void 0;
@@ -50016,8 +50107,17 @@ function createTypeChecker(host) {
50016
50107
  return result;
50017
50108
  }
50018
50109
  }
50019
- if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
50020
- setEmitFlags(node, 1 /* SingleLine */);
50110
+ if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
50111
+ const visited = visitEachChild(
50112
+ node,
50113
+ visitExistingNodeTreeSymbols,
50114
+ /*context*/
50115
+ void 0
50116
+ );
50117
+ const clone = setTextRange(visited === node ? factory.cloneNode(node) : visited, node);
50118
+ const flags = getEmitFlags(clone);
50119
+ setEmitFlags(clone, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
50120
+ return clone;
50021
50121
  }
50022
50122
  return visitEachChild(
50023
50123
  node,
@@ -55978,6 +56078,12 @@ function createTypeChecker(host) {
55978
56078
  isInJSFile(signature.declaration)
55979
56079
  );
55980
56080
  }
56081
+ function getImplementationSignature(signature) {
56082
+ return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
56083
+ }
56084
+ function createImplementationSignature(signature) {
56085
+ return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
56086
+ }
55981
56087
  function getBaseSignature(signature) {
55982
56088
  const typeParameters = signature.typeParameters;
55983
56089
  if (typeParameters) {
@@ -56000,12 +56106,22 @@ function createTypeChecker(host) {
56000
56106
  }
56001
56107
  return signature;
56002
56108
  }
56003
- function getOrCreateTypeFromSignature(signature) {
56109
+ function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
56004
56110
  var _a;
56005
56111
  if (!signature.isolatedSignatureType) {
56006
56112
  const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
56007
56113
  const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
56008
- const type = createObjectType(16 /* Anonymous */);
56114
+ const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
56115
+ if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
56116
+ type.symbol.declarations = [signature.declaration];
56117
+ type.symbol.valueDeclaration = signature.declaration;
56118
+ }
56119
+ outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
56120
+ signature.declaration,
56121
+ /*includeThisTypes*/
56122
+ true
56123
+ ));
56124
+ type.outerTypeParameters = outerTypeParameters;
56009
56125
  type.members = emptySymbols;
56010
56126
  type.properties = emptyArray;
56011
56127
  type.callSignatures = !isConstructor ? [signature] : emptyArray;
@@ -59411,7 +59527,7 @@ function createTypeChecker(host) {
59411
59527
  const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
59412
59528
  const links = getNodeLinks(declaration);
59413
59529
  const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
59414
- let typeParameters = links.outerTypeParameters;
59530
+ let typeParameters = type.objectFlags & 134217728 /* SingleSignatureType */ ? type.outerTypeParameters : links.outerTypeParameters;
59415
59531
  if (!typeParameters) {
59416
59532
  let outerTypeParameters = getOuterTypeParameters(
59417
59533
  declaration,
@@ -59591,6 +59707,9 @@ function createTypeChecker(host) {
59591
59707
  if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
59592
59708
  result.node = type.node;
59593
59709
  }
59710
+ if (type.objectFlags & 134217728 /* SingleSignatureType */) {
59711
+ result.outerTypeParameters = type.outerTypeParameters;
59712
+ }
59594
59713
  result.target = type;
59595
59714
  result.mapper = mapper;
59596
59715
  result.aliasSymbol = aliasSymbol || type.aliasSymbol;
@@ -64222,7 +64341,7 @@ function createTypeChecker(host) {
64222
64341
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
64223
64342
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
64224
64343
  }
64225
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
64344
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
64226
64345
  if (type.flags & 3899393 /* ObjectFlagsType */) {
64227
64346
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
64228
64347
  }
@@ -64506,6 +64625,9 @@ function createTypeChecker(host) {
64506
64625
  pos = p;
64507
64626
  }
64508
64627
  }
64628
+ function isTupleOfSelf(typeParameter, type) {
64629
+ return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
64630
+ }
64509
64631
  function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
64510
64632
  let bivariant = false;
64511
64633
  let propagationType;
@@ -64591,6 +64713,9 @@ function createTypeChecker(host) {
64591
64713
  inference.priority = priority;
64592
64714
  }
64593
64715
  if (priority === inference.priority) {
64716
+ if (isTupleOfSelf(inference.typeParameter, candidate)) {
64717
+ return;
64718
+ }
64594
64719
  if (contravariant && !bivariant) {
64595
64720
  if (!contains(inference.contraCandidates, candidate)) {
64596
64721
  inference.contraCandidates = append(inference.contraCandidates, candidate);
@@ -71529,7 +71654,7 @@ function createTypeChecker(host) {
71529
71654
  argument = skipParentheses(argument);
71530
71655
  return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
71531
71656
  }
71532
- function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
71657
+ function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
71533
71658
  const errorOutputContainer = { errors: void 0, skipLogging: true };
71534
71659
  if (isJsxOpeningLikeElement(node)) {
71535
71660
  if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
@@ -71563,7 +71688,8 @@ function createTypeChecker(host) {
71563
71688
  void 0,
71564
71689
  checkMode
71565
71690
  );
71566
- const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
71691
+ const regularArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
71692
+ const checkArgType = inferenceContext ? instantiateType(regularArgType, inferenceContext.nonFixingMapper) : regularArgType;
71567
71693
  const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
71568
71694
  if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
71569
71695
  Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
@@ -71975,7 +72101,9 @@ function createTypeChecker(host) {
71975
72101
  0 /* Normal */,
71976
72102
  /*reportErrors*/
71977
72103
  true,
71978
- () => chain
72104
+ () => chain,
72105
+ /*inferenceContext*/
72106
+ void 0
71979
72107
  );
71980
72108
  if (diags) {
71981
72109
  for (const d of diags) {
@@ -72011,7 +72139,9 @@ function createTypeChecker(host) {
72011
72139
  0 /* Normal */,
72012
72140
  /*reportErrors*/
72013
72141
  true,
72014
- chain2
72142
+ chain2,
72143
+ /*inferenceContext*/
72144
+ void 0
72015
72145
  );
72016
72146
  if (diags2) {
72017
72147
  if (diags2.length <= min2) {
@@ -72102,6 +72232,8 @@ function createTypeChecker(host) {
72102
72232
  /*reportErrors*/
72103
72233
  false,
72104
72234
  /*containingMessageChain*/
72235
+ void 0,
72236
+ /*inferenceContext*/
72105
72237
  void 0
72106
72238
  )) {
72107
72239
  candidatesForArgumentError = [candidate];
@@ -72110,13 +72242,16 @@ function createTypeChecker(host) {
72110
72242
  return candidate;
72111
72243
  }
72112
72244
  for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
72113
- const candidate = candidates2[candidateIndex];
72245
+ let candidate = candidates2[candidateIndex];
72114
72246
  if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
72115
72247
  continue;
72116
72248
  }
72117
72249
  let checkCandidate;
72118
72250
  let inferenceContext;
72119
72251
  if (candidate.typeParameters) {
72252
+ if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
72253
+ candidate = getImplementationSignature(candidate);
72254
+ }
72120
72255
  let typeArgumentTypes;
72121
72256
  if (some(typeArguments)) {
72122
72257
  typeArgumentTypes = checkTypeArguments(
@@ -72136,7 +72271,7 @@ function createTypeChecker(host) {
72136
72271
  /*flags*/
72137
72272
  isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
72138
72273
  );
72139
- typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
72274
+ typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext), inferenceContext.nonFixingMapper);
72140
72275
  argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
72141
72276
  }
72142
72277
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
@@ -72156,7 +72291,8 @@ function createTypeChecker(host) {
72156
72291
  /*reportErrors*/
72157
72292
  false,
72158
72293
  /*containingMessageChain*/
72159
- void 0
72294
+ void 0,
72295
+ inferenceContext
72160
72296
  )) {
72161
72297
  (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
72162
72298
  continue;
@@ -72164,7 +72300,7 @@ function createTypeChecker(host) {
72164
72300
  if (argCheckMode) {
72165
72301
  argCheckMode = 0 /* Normal */;
72166
72302
  if (inferenceContext) {
72167
- const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
72303
+ const typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext), inferenceContext.mapper);
72168
72304
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
72169
72305
  if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
72170
72306
  candidateForArgumentArityError = checkCandidate;
@@ -72180,7 +72316,8 @@ function createTypeChecker(host) {
72180
72316
  /*reportErrors*/
72181
72317
  false,
72182
72318
  /*containingMessageChain*/
72183
- void 0
72319
+ void 0,
72320
+ inferenceContext
72184
72321
  )) {
72185
72322
  (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
72186
72323
  continue;
@@ -75720,7 +75857,7 @@ function createTypeChecker(host) {
75720
75857
  ) || unknownType, isTemplateLiteralContextualType)) {
75721
75858
  return getTemplateLiteralType(texts, types);
75722
75859
  }
75723
- const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
75860
+ const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluate(node);
75724
75861
  return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
75725
75862
  }
75726
75863
  function isTemplateLiteralContextualType(type) {
@@ -75934,7 +76071,7 @@ function createTypeChecker(host) {
75934
76071
  }
75935
76072
  }
75936
76073
  }
75937
- return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
76074
+ return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, (c) => c && map(c.inferences, (i) => i.typeParameter)).slice());
75938
76075
  }
75939
76076
  }
75940
76077
  }
@@ -76109,7 +76246,8 @@ function createTypeChecker(host) {
76109
76246
  if (getIsolatedModules(compilerOptions)) {
76110
76247
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
76111
76248
  const constEnumDeclaration = type.symbol.valueDeclaration;
76112
- if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
76249
+ const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
76250
+ if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node) && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
76113
76251
  error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
76114
76252
  }
76115
76253
  }
@@ -80696,122 +80834,53 @@ function createTypeChecker(host) {
80696
80834
  }
80697
80835
  return false;
80698
80836
  }
80699
- function evaluate(expr, location) {
80700
- switch (expr.kind) {
80701
- case 224 /* PrefixUnaryExpression */:
80702
- const value = evaluate(expr.operand, location);
80703
- if (typeof value === "number") {
80704
- switch (expr.operator) {
80705
- case 40 /* PlusToken */:
80706
- return value;
80707
- case 41 /* MinusToken */:
80708
- return -value;
80709
- case 55 /* TildeToken */:
80710
- return ~value;
80711
- }
80712
- }
80713
- break;
80714
- case 226 /* BinaryExpression */:
80715
- const left = evaluate(expr.left, location);
80716
- const right = evaluate(expr.right, location);
80717
- if (typeof left === "number" && typeof right === "number") {
80718
- switch (expr.operatorToken.kind) {
80719
- case 52 /* BarToken */:
80720
- return left | right;
80721
- case 51 /* AmpersandToken */:
80722
- return left & right;
80723
- case 49 /* GreaterThanGreaterThanToken */:
80724
- return left >> right;
80725
- case 50 /* GreaterThanGreaterThanGreaterThanToken */:
80726
- return left >>> right;
80727
- case 48 /* LessThanLessThanToken */:
80728
- return left << right;
80729
- case 53 /* CaretToken */:
80730
- return left ^ right;
80731
- case 42 /* AsteriskToken */:
80732
- return left * right;
80733
- case 44 /* SlashToken */:
80734
- return left / right;
80735
- case 40 /* PlusToken */:
80736
- return left + right;
80737
- case 41 /* MinusToken */:
80738
- return left - right;
80739
- case 45 /* PercentToken */:
80740
- return left % right;
80741
- case 43 /* AsteriskAsteriskToken */:
80742
- return left ** right;
80743
- }
80744
- } else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
80745
- return "" + left + right;
80746
- }
80747
- break;
80748
- case 11 /* StringLiteral */:
80749
- case 15 /* NoSubstitutionTemplateLiteral */:
80750
- return expr.text;
80751
- case 228 /* TemplateExpression */:
80752
- return evaluateTemplateExpression(expr, location);
80753
- case 9 /* NumericLiteral */:
80754
- checkGrammarNumericLiteral(expr);
80755
- return +expr.text;
80756
- case 217 /* ParenthesizedExpression */:
80757
- return evaluate(expr.expression, location);
80758
- case 80 /* Identifier */: {
80759
- const identifier = expr;
80760
- if (isInfinityOrNaNString(identifier.escapedText) && resolveEntityName(
80761
- identifier,
80762
- 111551 /* Value */,
80763
- /*ignoreErrors*/
80764
- true
80765
- ) === getGlobalSymbol(
80766
- identifier.escapedText,
80767
- 111551 /* Value */,
80768
- /*diagnostic*/
80769
- void 0
80770
- )) {
80771
- return +identifier.escapedText;
80772
- }
80837
+ function evaluateEntityNameExpression(expr, location) {
80838
+ const symbol = resolveEntityName(
80839
+ expr,
80840
+ 111551 /* Value */,
80841
+ /*ignoreErrors*/
80842
+ true
80843
+ );
80844
+ if (!symbol)
80845
+ return void 0;
80846
+ if (expr.kind === 80 /* Identifier */) {
80847
+ const identifier = expr;
80848
+ if (isInfinityOrNaNString(identifier.escapedText) && symbol === getGlobalSymbol(
80849
+ identifier.escapedText,
80850
+ 111551 /* Value */,
80851
+ /*diagnostic*/
80852
+ void 0
80853
+ )) {
80854
+ return +identifier.escapedText;
80773
80855
  }
80774
- case 211 /* PropertyAccessExpression */:
80775
- if (isEntityNameExpression(expr)) {
80776
- const symbol = resolveEntityName(
80777
- expr,
80778
- 111551 /* Value */,
80779
- /*ignoreErrors*/
80780
- true
80781
- );
80782
- if (symbol) {
80783
- if (symbol.flags & 8 /* EnumMember */) {
80784
- return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
80785
- }
80786
- if (isConstantVariable(symbol)) {
80787
- const declaration = symbol.valueDeclaration;
80788
- if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
80789
- return evaluate(declaration.initializer, declaration);
80790
- }
80791
- }
80792
- }
80793
- }
80794
- break;
80795
- case 212 /* ElementAccessExpression */:
80796
- const root = expr.expression;
80797
- if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) {
80798
- const rootSymbol = resolveEntityName(
80799
- root,
80800
- 111551 /* Value */,
80801
- /*ignoreErrors*/
80802
- true
80803
- );
80804
- if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
80805
- const name = escapeLeadingUnderscores(expr.argumentExpression.text);
80806
- const member = rootSymbol.exports.get(name);
80807
- if (member) {
80808
- return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
80809
- }
80810
- }
80856
+ }
80857
+ if (symbol.flags & 8 /* EnumMember */) {
80858
+ return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
80859
+ }
80860
+ if (isConstantVariable(symbol)) {
80861
+ const declaration = symbol.valueDeclaration;
80862
+ if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
80863
+ return evaluate(declaration.initializer, declaration);
80864
+ }
80865
+ }
80866
+ }
80867
+ function evaluateElementAccessExpression(expr, location) {
80868
+ const root = expr.expression;
80869
+ if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) {
80870
+ const rootSymbol = resolveEntityName(
80871
+ root,
80872
+ 111551 /* Value */,
80873
+ /*ignoreErrors*/
80874
+ true
80875
+ );
80876
+ if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
80877
+ const name = escapeLeadingUnderscores(expr.argumentExpression.text);
80878
+ const member = rootSymbol.exports.get(name);
80879
+ if (member) {
80880
+ return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
80811
80881
  }
80812
- break;
80882
+ }
80813
80883
  }
80814
- return void 0;
80815
80884
  }
80816
80885
  function evaluateEnumMember(expr, symbol, location) {
80817
80886
  const declaration = symbol.valueDeclaration;
@@ -80825,18 +80894,6 @@ function createTypeChecker(host) {
80825
80894
  }
80826
80895
  return getEnumMemberValue(declaration);
80827
80896
  }
80828
- function evaluateTemplateExpression(expr, location) {
80829
- let result = expr.head.text;
80830
- for (const span of expr.templateSpans) {
80831
- const value = evaluate(span.expression, location);
80832
- if (value === void 0) {
80833
- return void 0;
80834
- }
80835
- result += value;
80836
- result += span.literal.text;
80837
- }
80838
- return result;
80839
- }
80840
80897
  function checkEnumDeclaration(node) {
80841
80898
  addLazyDiagnostic(() => checkEnumDeclarationWorker(node));
80842
80899
  }
@@ -117018,6 +117075,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117018
117075
  getResolvedProjectReferenceByPath,
117019
117076
  forEachResolvedProjectReference: forEachResolvedProjectReference2,
117020
117077
  isSourceOfProjectReferenceRedirect,
117078
+ getRedirectReferenceForResolutionFromSourceOfProject,
117021
117079
  emitBuildInfo,
117022
117080
  fileExists,
117023
117081
  readFile,