@typescript-deploys/pr-build 5.4.0-pr-56281-22 → 5.4.0-pr-55774-21

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/tsserver.js CHANGED
@@ -2330,7 +2330,7 @@ module.exports = __toCommonJS(server_exports);
2330
2330
 
2331
2331
  // src/compiler/corePublic.ts
2332
2332
  var versionMajorMinor = "5.4";
2333
- var version = `${versionMajorMinor}.0-insiders.20231104`;
2333
+ var version = `${versionMajorMinor}.0-insiders.20231108`;
2334
2334
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2335
2335
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2336
2336
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6402,6 +6402,7 @@ var TypeFormatFlags = /* @__PURE__ */ ((TypeFormatFlags2) => {
6402
6402
  TypeFormatFlags2[TypeFormatFlags2["None"] = 0] = "None";
6403
6403
  TypeFormatFlags2[TypeFormatFlags2["NoTruncation"] = 1] = "NoTruncation";
6404
6404
  TypeFormatFlags2[TypeFormatFlags2["WriteArrayAsGenericType"] = 2] = "WriteArrayAsGenericType";
6405
+ TypeFormatFlags2[TypeFormatFlags2["GenerateNamesForShadowedTypeParams"] = 4] = "GenerateNamesForShadowedTypeParams";
6405
6406
  TypeFormatFlags2[TypeFormatFlags2["UseStructuralFallback"] = 8] = "UseStructuralFallback";
6406
6407
  TypeFormatFlags2[TypeFormatFlags2["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature";
6407
6408
  TypeFormatFlags2[TypeFormatFlags2["UseFullyQualifiedType"] = 64] = "UseFullyQualifiedType";
@@ -6421,7 +6422,7 @@ var TypeFormatFlags = /* @__PURE__ */ ((TypeFormatFlags2) => {
6421
6422
  TypeFormatFlags2[TypeFormatFlags2["InElementType"] = 2097152] = "InElementType";
6422
6423
  TypeFormatFlags2[TypeFormatFlags2["InFirstTypeArgument"] = 4194304] = "InFirstTypeArgument";
6423
6424
  TypeFormatFlags2[TypeFormatFlags2["InTypeAlias"] = 8388608] = "InTypeAlias";
6424
- TypeFormatFlags2[TypeFormatFlags2["NodeBuilderFlagsMask"] = 848330091] = "NodeBuilderFlagsMask";
6425
+ TypeFormatFlags2[TypeFormatFlags2["NodeBuilderFlagsMask"] = 848330095] = "NodeBuilderFlagsMask";
6425
6426
  return TypeFormatFlags2;
6426
6427
  })(TypeFormatFlags || {});
6427
6428
  var SymbolFormatFlags = /* @__PURE__ */ ((SymbolFormatFlags2) => {
@@ -6586,6 +6587,7 @@ var InternalSymbolName = /* @__PURE__ */ ((InternalSymbolName2) => {
6586
6587
  InternalSymbolName2["ExportEquals"] = "export=";
6587
6588
  InternalSymbolName2["Default"] = "default";
6588
6589
  InternalSymbolName2["This"] = "this";
6590
+ InternalSymbolName2["InstantiationExpression"] = "__instantiationExpression";
6589
6591
  return InternalSymbolName2;
6590
6592
  })(InternalSymbolName || {});
6591
6593
  var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags2) => {
@@ -52403,7 +52405,7 @@ function createTypeChecker(host) {
52403
52405
  return symbol && !!symbol.valueDeclaration && isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration);
52404
52406
  }
52405
52407
  function toNodeBuilderFlags(flags = 0 /* None */) {
52406
- return flags & 848330091 /* NodeBuilderFlagsMask */;
52408
+ return flags & 848330095 /* NodeBuilderFlagsMask */;
52407
52409
  }
52408
52410
  function isClassInstanceSide(type) {
52409
52411
  return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 524288 /* Object */) && !!(getObjectFlags(type) & 16777216 /* IsClassInstanceClone */));
@@ -52652,7 +52654,7 @@ function createTypeChecker(host) {
52652
52654
  }
52653
52655
  return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
52654
52656
  }
52655
- if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
52657
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */) {
52656
52658
  const name2 = typeParameterToName(type, context);
52657
52659
  context.approximateLength += idText(name2).length;
52658
52660
  return factory.createTypeReferenceNode(
@@ -52863,6 +52865,21 @@ function createTypeChecker(host) {
52863
52865
  const typeId = type2.id;
52864
52866
  const symbol = type2.symbol;
52865
52867
  if (symbol) {
52868
+ const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
52869
+ if (isInstantiationExpressionType) {
52870
+ const instantiationExpressionType = type2;
52871
+ const existing = instantiationExpressionType.node;
52872
+ if (isTypeQueryNode(existing) && getTypeFromTypeNode(existing) === type2) {
52873
+ const typeNode = serializeExistingTypeNode(context, existing);
52874
+ if (typeNode) {
52875
+ return typeNode;
52876
+ }
52877
+ }
52878
+ if ((_a2 = context.visitedTypes) == null ? void 0 : _a2.has(typeId)) {
52879
+ return createElidedInformationPlaceholder(context);
52880
+ }
52881
+ return visitAndTransformType(type2, createTypeNodeFromObjectType);
52882
+ }
52866
52883
  const isInstanceType = isClassInstanceSide(type2) ? 788968 /* Type */ : 111551 /* Value */;
52867
52884
  if (isJSConstructor(symbol.valueDeclaration)) {
52868
52885
  return symbolToTypeNode(symbol, context, isInstanceType);
@@ -52874,7 +52891,7 @@ function createTypeChecker(host) {
52874
52891
  false
52875
52892
  ).accessibility !== 0 /* Accessible */)) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol()) {
52876
52893
  return symbolToTypeNode(symbol, context, isInstanceType);
52877
- } else if ((_a2 = context.visitedTypes) == null ? void 0 : _a2.has(typeId)) {
52894
+ } else if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
52878
52895
  const typeAlias = getTypeAliasForTypeLiteral(type2);
52879
52896
  if (typeAlias) {
52880
52897
  return symbolToTypeNode(typeAlias, context, 788968 /* Type */);
@@ -52885,20 +52902,6 @@ function createTypeChecker(host) {
52885
52902
  return visitAndTransformType(type2, createTypeNodeFromObjectType);
52886
52903
  }
52887
52904
  } else {
52888
- const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
52889
- if (isInstantiationExpressionType) {
52890
- const instantiationExpressionType = type2;
52891
- if (isTypeQueryNode(instantiationExpressionType.node)) {
52892
- const typeNode = serializeExistingTypeNode(context, instantiationExpressionType.node);
52893
- if (typeNode) {
52894
- return typeNode;
52895
- }
52896
- }
52897
- if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
52898
- return createElidedInformationPlaceholder(context);
52899
- }
52900
- return visitAndTransformType(type2, createTypeNodeFromObjectType);
52901
- }
52902
52905
  return createTypeNodeFromObjectType(type2);
52903
52906
  }
52904
52907
  function shouldWriteTypeOfFunctionSymbol() {
@@ -53452,36 +53455,65 @@ function createTypeChecker(host) {
53452
53455
  true
53453
53456
  )[0];
53454
53457
  let cleanup;
53455
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
53456
- const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
53457
- Debug.assertOptionalNode(existingFakeScope, isBlock);
53458
- const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
53459
- let newLocals;
53460
- for (const param of expandedParams) {
53461
- if (!locals.has(param.escapedName)) {
53462
- newLocals = append(newLocals, param.escapedName);
53463
- locals.set(param.escapedName, param);
53464
- }
53465
- }
53466
- if (newLocals) {
53467
- let removeNewLocals2 = function() {
53458
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && (some(expandedParams) || some(signature.typeParameters))) {
53459
+ let pushFakeScope2 = function(kind2, addAll) {
53460
+ Debug.assert(context.enclosingDeclaration);
53461
+ let existingFakeScope;
53462
+ if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind2) {
53463
+ existingFakeScope = context.enclosingDeclaration;
53464
+ } else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind2) {
53465
+ existingFakeScope = context.enclosingDeclaration.parent;
53466
+ }
53467
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
53468
+ const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
53469
+ let newLocals;
53470
+ addAll((name, symbol) => {
53471
+ if (!locals.has(name)) {
53472
+ newLocals = append(newLocals, name);
53473
+ locals.set(name, symbol);
53474
+ }
53475
+ });
53476
+ if (!newLocals)
53477
+ return;
53478
+ const oldCleanup = cleanup;
53479
+ function undo() {
53468
53480
  forEach(newLocals, (s) => locals.delete(s));
53469
- };
53470
- var removeNewLocals = removeNewLocals2;
53481
+ oldCleanup == null ? void 0 : oldCleanup();
53482
+ }
53471
53483
  if (existingFakeScope) {
53472
- cleanup = removeNewLocals2;
53484
+ cleanup = undo;
53473
53485
  } else {
53474
53486
  const fakeScope = parseNodeFactory.createBlock(emptyArray);
53475
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
53487
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind2;
53476
53488
  fakeScope.locals = locals;
53477
53489
  const saveEnclosingDeclaration = context.enclosingDeclaration;
53478
53490
  setParent(fakeScope, saveEnclosingDeclaration);
53479
53491
  context.enclosingDeclaration = fakeScope;
53480
53492
  cleanup = () => {
53481
53493
  context.enclosingDeclaration = saveEnclosingDeclaration;
53482
- removeNewLocals2();
53494
+ undo();
53483
53495
  };
53484
53496
  }
53497
+ };
53498
+ var pushFakeScope = pushFakeScope2;
53499
+ pushFakeScope2(
53500
+ "params",
53501
+ (add) => {
53502
+ for (const param of expandedParams) {
53503
+ add(param.escapedName, param);
53504
+ }
53505
+ }
53506
+ );
53507
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
53508
+ pushFakeScope2(
53509
+ "typeParams",
53510
+ (add) => {
53511
+ for (const typeParam of signature.typeParameters ?? emptyArray) {
53512
+ const typeParamName = typeParameterToName(typeParam, context).escapedText;
53513
+ add(typeParamName, typeParam.symbol);
53514
+ }
53515
+ }
53516
+ );
53485
53517
  }
53486
53518
  }
53487
53519
  const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
@@ -54026,7 +54058,7 @@ function createTypeChecker(host) {
54026
54058
  return identifier;
54027
54059
  }
54028
54060
  }
54029
- function typeParameterShadowsNameInScope(escapedName, context, type) {
54061
+ function typeParameterShadowsOtherTypeParameterInScope(escapedName, context, type) {
54030
54062
  const result = resolveName(
54031
54063
  context.enclosingDeclaration,
54032
54064
  escapedName,
@@ -54037,11 +54069,8 @@ function createTypeChecker(host) {
54037
54069
  /*isUse*/
54038
54070
  false
54039
54071
  );
54040
- if (result) {
54041
- if (result.flags & 262144 /* TypeParameter */ && result === type.symbol) {
54042
- return false;
54043
- }
54044
- return true;
54072
+ if (result && result.flags & 262144 /* TypeParameter */) {
54073
+ return result !== type.symbol;
54045
54074
  }
54046
54075
  return false;
54047
54076
  }
@@ -54067,7 +54096,7 @@ function createTypeChecker(host) {
54067
54096
  const rawtext = result.escapedText;
54068
54097
  let i = ((_a = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a.get(rawtext)) || 0;
54069
54098
  let text = rawtext;
54070
- while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsNameInScope(text, context, type)) {
54099
+ while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
54071
54100
  i++;
54072
54101
  text = `${rawtext}_${i}`;
54073
54102
  }
@@ -54078,7 +54107,7 @@ function createTypeChecker(host) {
54078
54107
  }
54079
54108
  (context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = /* @__PURE__ */ new Map())).set(rawtext, i);
54080
54109
  (context.typeParameterNames || (context.typeParameterNames = /* @__PURE__ */ new Map())).set(getTypeId(type), result);
54081
- (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(rawtext);
54110
+ (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(text);
54082
54111
  }
54083
54112
  return result;
54084
54113
  }
@@ -54223,7 +54252,10 @@ function createTypeChecker(host) {
54223
54252
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
54224
54253
  }
54225
54254
  function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
54226
- return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
54255
+ while (getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration) {
54256
+ enclosingDeclaration = enclosingDeclaration.parent;
54257
+ }
54258
+ return enclosingDeclaration;
54227
54259
  }
54228
54260
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
54229
54261
  if (!isErrorType(type) && enclosingDeclaration) {
@@ -54303,7 +54335,7 @@ function createTypeChecker(host) {
54303
54335
  }
54304
54336
  if (isIdentifier(node)) {
54305
54337
  const type = getDeclaredTypeOfSymbol(sym);
54306
- const name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : factory.cloneNode(node);
54338
+ const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
54307
54339
  name.symbol = sym;
54308
54340
  return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
54309
54341
  }
@@ -58920,7 +58952,13 @@ function createTypeChecker(host) {
58920
58952
  const templateModifiers = getMappedTypeModifiers(type);
58921
58953
  const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
58922
58954
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
58923
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, include, keyofStringsOnly, addMemberForKeyType);
58955
+ if (isTupleType(modifiersType)) {
58956
+ forEachType(getUnionType(getElementTypes(modifiersType).map((_, i) => getStringLiteralType("" + i))), addMemberForKeyType);
58957
+ } else if (isArrayType(modifiersType)) {
58958
+ addMemberForKeyType(numberType);
58959
+ } else {
58960
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, include, keyofStringsOnly, addMemberForKeyType);
58961
+ }
58924
58962
  } else {
58925
58963
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
58926
58964
  }
@@ -59716,69 +59754,22 @@ function createTypeChecker(host) {
59716
59754
  }
59717
59755
  return emptyArray;
59718
59756
  }
59719
- function getSignaturesOfType(typeIn, kind) {
59720
- const reducedType = getReducedApparentType(typeIn);
59721
- function carveoutResult() {
59722
- var _a;
59723
- if (kind === 0 /* Call */ && reducedType.flags & 1048576 /* Union */) {
59724
- let memberName;
59725
- if (everyType(reducedType, (t) => {
59726
- var _a2;
59727
- return !!((_a2 = t.symbol) == null ? void 0 : _a2.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
59728
- })) {
59729
- if (reducedType.arrayFallbackSignatures) {
59730
- return reducedType.arrayFallbackSignatures;
59731
- }
59732
- const numTypes = reducedType.types.length;
59733
- const numSigs = (_a = reducedType.types[0].symbol.declarations) == null ? void 0 : _a.length;
59734
- Debug.assert(numSigs);
59735
- const returnTypes = new Array(numSigs).fill(
59736
- /*value*/
59737
- void 0
59738
- ).map((_, isig) => {
59739
- const rtset = /* @__PURE__ */ new Set();
59740
- new Array(numTypes).fill(
59741
- /*value*/
59742
- void 0
59743
- ).forEach((_2, itype) => {
59744
- const callSignatures = reducedType.types[itype].callSignatures ?? getSignaturesOfStructuredType(reducedType.types[itype], 0 /* Call */);
59745
- if (callSignatures[isig].typeParameters)
59746
- return;
59747
- const returnType = callSignatures[isig].resolvedReturnType ?? getReturnTypeOfSignature(callSignatures[isig]);
59748
- Debug.assert(returnType);
59749
- rtset.add(returnType);
59750
- });
59751
- const art = [];
59752
- rtset.forEach((rt) => art.push(rt));
59753
- if (art.length === 0)
59754
- return void 0;
59755
- if (art.length === 1)
59756
- return art[0];
59757
- return getUnionType(art, 2 /* Subtype */);
59758
- });
59759
- const arrayArg = mapType(reducedType, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
59760
- const arrayType = createArrayType(arrayArg, someType(reducedType, (t) => isReadonlyArraySymbol(t.symbol.parent)));
59761
- const result2 = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
59762
- returnTypes.forEach((returnType, sigidx) => {
59763
- if (returnType)
59764
- result2[sigidx].resolvedReturnType = returnTypes[sigidx];
59765
- });
59766
- return reducedType.arrayFallbackSignatures = result2;
59767
- }
59757
+ function getSignaturesOfType(type, kind) {
59758
+ const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
59759
+ if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
59760
+ if (type.arrayFallbackSignatures) {
59761
+ return type.arrayFallbackSignatures;
59768
59762
  }
59769
- return void 0;
59770
- }
59771
- let result = carveoutResult();
59772
- if (result)
59773
- return result;
59774
- if (kind === 0 /* Call */ && reducedType.flags & 1048576 /* Union */) {
59775
- if (reducedType.arrayFallbackSignatures) {
59776
- return reducedType.arrayFallbackSignatures;
59763
+ let memberName;
59764
+ if (everyType(type, (t) => {
59765
+ var _a;
59766
+ return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
59767
+ })) {
59768
+ const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
59769
+ const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
59770
+ return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
59777
59771
  }
59778
- }
59779
- result = getSignaturesOfStructuredType(reducedType, kind);
59780
- if (kind === 0 /* Call */ && reducedType.flags & 1048576 /* Union */) {
59781
- reducedType.arrayFallbackSignatures = result;
59772
+ type.arrayFallbackSignatures = result;
59782
59773
  }
59783
59774
  return result;
59784
59775
  }
@@ -60776,7 +60767,7 @@ function createTypeChecker(host) {
60776
60767
  if (constraint) {
60777
60768
  constraints = append(constraints, constraint);
60778
60769
  }
60779
- } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && node === parent2.type) {
60770
+ } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && (node === parent2.type || node === parent2.nameType)) {
60780
60771
  const mappedType = getTypeFromTypeNode(parent2);
60781
60772
  if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
60782
60773
  const typeParameter = getHomomorphicTypeVariable(mappedType);
@@ -63824,6 +63815,7 @@ function createTypeChecker(host) {
63824
63815
  ) : strictNullChecks && modifiers & 8 /* ExcludeOptional */ && isOptional ? getTypeWithFacts(propType, 524288 /* NEUndefined */) : propType;
63825
63816
  }
63826
63817
  function instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments) {
63818
+ Debug.assert(type.symbol, "anonymous type must have symbol to be instantiated");
63827
63819
  const result = createObjectType(type.objectFlags & ~(524288 /* CouldContainTypeVariablesComputed */ | 1048576 /* CouldContainTypeVariables */) | 64 /* Instantiated */, type.symbol);
63828
63820
  if (type.objectFlags & 32 /* Mapped */) {
63829
63821
  result.declaration = type.declaration;
@@ -67071,6 +67063,7 @@ function createTypeChecker(host) {
67071
67063
  const sourceObjectFlags = getObjectFlags(source2);
67072
67064
  const targetObjectFlags = getObjectFlags(target2);
67073
67065
  if (sourceObjectFlags & 64 /* Instantiated */ && targetObjectFlags & 64 /* Instantiated */ && source2.symbol === target2.symbol || sourceObjectFlags & 4 /* Reference */ && targetObjectFlags & 4 /* Reference */ && source2.target === target2.target) {
67066
+ Debug.assertEqual(sourceSignatures.length, targetSignatures.length);
67074
67067
  for (let i = 0; i < targetSignatures.length; i++) {
67075
67068
  const related = signatureRelatedTo(
67076
67069
  sourceSignatures[i],
@@ -71281,6 +71274,9 @@ function createTypeChecker(host) {
71281
71274
  }
71282
71275
  function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
71283
71276
  if (!assumeTrue) {
71277
+ if (type === candidate) {
71278
+ return neverType;
71279
+ }
71284
71280
  if (checkDerived) {
71285
71281
  return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
71286
71282
  }
@@ -71297,6 +71293,9 @@ function createTypeChecker(host) {
71297
71293
  if (type.flags & 3 /* AnyOrUnknown */) {
71298
71294
  return candidate;
71299
71295
  }
71296
+ if (type === candidate) {
71297
+ return candidate;
71298
+ }
71300
71299
  const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
71301
71300
  const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
71302
71301
  const narrowedType = mapType(candidate, (c) => {
@@ -77322,14 +77321,7 @@ function createTypeChecker(host) {
77322
77321
  hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
77323
77322
  hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
77324
77323
  if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
77325
- const result3 = createAnonymousType(
77326
- /*symbol*/
77327
- void 0,
77328
- resolved.members,
77329
- callSignatures,
77330
- constructSignatures,
77331
- resolved.indexInfos
77332
- );
77324
+ const result3 = createAnonymousType(createSymbol(0 /* None */, "__instantiationExpression" /* InstantiationExpression */), resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
77333
77325
  result3.objectFlags |= 8388608 /* InstantiationExpressionType */;
77334
77326
  result3.node = node;
77335
77327
  return result3;
@@ -150319,7 +150311,17 @@ var errorCodes18 = [
150319
150311
  Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,
150320
150312
  Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
150321
150313
  Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code,
150322
- Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code
150314
+ Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code,
150315
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery.code,
150316
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later.code,
150317
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom.code,
150318
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig.code,
150319
+ Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code,
150320
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig.code,
150321
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha.code,
150322
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
150323
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig.code,
150324
+ Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code
150323
150325
  ];
150324
150326
  registerCodeFix({
150325
150327
  errorCodes: errorCodes18,
@@ -6887,6 +6887,7 @@ declare namespace ts {
6887
6887
  None = 0,
6888
6888
  NoTruncation = 1,
6889
6889
  WriteArrayAsGenericType = 2,
6890
+ GenerateNamesForShadowedTypeParams = 4,
6890
6891
  UseStructuralFallback = 8,
6891
6892
  WriteTypeArgumentsOfSignature = 32,
6892
6893
  UseFullyQualifiedType = 64,
@@ -6906,7 +6907,7 @@ declare namespace ts {
6906
6907
  InElementType = 2097152,
6907
6908
  InFirstTypeArgument = 4194304,
6908
6909
  InTypeAlias = 8388608,
6909
- NodeBuilderFlagsMask = 848330091,
6910
+ NodeBuilderFlagsMask = 848330095,
6910
6911
  }
6911
6912
  enum SymbolFormatFlags {
6912
6913
  None = 0,
@@ -7048,6 +7049,7 @@ declare namespace ts {
7048
7049
  ExportEquals = "export=",
7049
7050
  Default = "default",
7050
7051
  This = "this",
7052
+ InstantiationExpression = "__instantiationExpression",
7051
7053
  }
7052
7054
  /**
7053
7055
  * This represents a string whose leading underscore have been escaped by adding extra leading underscores.