@typescript-deploys/pr-build 5.4.0-pr-56281-22 → 5.4.0-pr-56356-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.
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.4";
38
- version = `${versionMajorMinor}.0-insiders.20231104`;
38
+ version = `${versionMajorMinor}.0-insiders.20231109`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -4165,6 +4165,7 @@ ${lanes.join("\n")}
4165
4165
  TypeFormatFlags2[TypeFormatFlags2["None"] = 0] = "None";
4166
4166
  TypeFormatFlags2[TypeFormatFlags2["NoTruncation"] = 1] = "NoTruncation";
4167
4167
  TypeFormatFlags2[TypeFormatFlags2["WriteArrayAsGenericType"] = 2] = "WriteArrayAsGenericType";
4168
+ TypeFormatFlags2[TypeFormatFlags2["GenerateNamesForShadowedTypeParams"] = 4] = "GenerateNamesForShadowedTypeParams";
4168
4169
  TypeFormatFlags2[TypeFormatFlags2["UseStructuralFallback"] = 8] = "UseStructuralFallback";
4169
4170
  TypeFormatFlags2[TypeFormatFlags2["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature";
4170
4171
  TypeFormatFlags2[TypeFormatFlags2["UseFullyQualifiedType"] = 64] = "UseFullyQualifiedType";
@@ -4184,7 +4185,7 @@ ${lanes.join("\n")}
4184
4185
  TypeFormatFlags2[TypeFormatFlags2["InElementType"] = 2097152] = "InElementType";
4185
4186
  TypeFormatFlags2[TypeFormatFlags2["InFirstTypeArgument"] = 4194304] = "InFirstTypeArgument";
4186
4187
  TypeFormatFlags2[TypeFormatFlags2["InTypeAlias"] = 8388608] = "InTypeAlias";
4187
- TypeFormatFlags2[TypeFormatFlags2["NodeBuilderFlagsMask"] = 848330091] = "NodeBuilderFlagsMask";
4188
+ TypeFormatFlags2[TypeFormatFlags2["NodeBuilderFlagsMask"] = 848330095] = "NodeBuilderFlagsMask";
4188
4189
  return TypeFormatFlags2;
4189
4190
  })(TypeFormatFlags || {});
4190
4191
  SymbolFormatFlags = /* @__PURE__ */ ((SymbolFormatFlags2) => {
@@ -4349,6 +4350,7 @@ ${lanes.join("\n")}
4349
4350
  InternalSymbolName2["ExportEquals"] = "export=";
4350
4351
  InternalSymbolName2["Default"] = "default";
4351
4352
  InternalSymbolName2["This"] = "this";
4353
+ InternalSymbolName2["InstantiationExpression"] = "__instantiationExpression";
4352
4354
  return InternalSymbolName2;
4353
4355
  })(InternalSymbolName || {});
4354
4356
  NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags2) => {
@@ -50168,7 +50170,7 @@ ${lanes.join("\n")}
50168
50170
  return symbol && !!symbol.valueDeclaration && isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration);
50169
50171
  }
50170
50172
  function toNodeBuilderFlags(flags = 0 /* None */) {
50171
- return flags & 848330091 /* NodeBuilderFlagsMask */;
50173
+ return flags & 848330095 /* NodeBuilderFlagsMask */;
50172
50174
  }
50173
50175
  function isClassInstanceSide(type) {
50174
50176
  return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 524288 /* Object */) && !!(getObjectFlags(type) & 16777216 /* IsClassInstanceClone */));
@@ -50417,7 +50419,7 @@ ${lanes.join("\n")}
50417
50419
  }
50418
50420
  return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
50419
50421
  }
50420
- if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
50422
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */) {
50421
50423
  const name2 = typeParameterToName(type, context);
50422
50424
  context.approximateLength += idText(name2).length;
50423
50425
  return factory.createTypeReferenceNode(
@@ -50628,6 +50630,21 @@ ${lanes.join("\n")}
50628
50630
  const typeId = type2.id;
50629
50631
  const symbol = type2.symbol;
50630
50632
  if (symbol) {
50633
+ const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
50634
+ if (isInstantiationExpressionType) {
50635
+ const instantiationExpressionType = type2;
50636
+ const existing = instantiationExpressionType.node;
50637
+ if (isTypeQueryNode(existing) && getTypeFromTypeNode(existing) === type2) {
50638
+ const typeNode = serializeExistingTypeNode(context, existing);
50639
+ if (typeNode) {
50640
+ return typeNode;
50641
+ }
50642
+ }
50643
+ if ((_a2 = context.visitedTypes) == null ? void 0 : _a2.has(typeId)) {
50644
+ return createElidedInformationPlaceholder(context);
50645
+ }
50646
+ return visitAndTransformType(type2, createTypeNodeFromObjectType);
50647
+ }
50631
50648
  const isInstanceType = isClassInstanceSide(type2) ? 788968 /* Type */ : 111551 /* Value */;
50632
50649
  if (isJSConstructor(symbol.valueDeclaration)) {
50633
50650
  return symbolToTypeNode(symbol, context, isInstanceType);
@@ -50639,7 +50656,7 @@ ${lanes.join("\n")}
50639
50656
  false
50640
50657
  ).accessibility !== 0 /* Accessible */)) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol()) {
50641
50658
  return symbolToTypeNode(symbol, context, isInstanceType);
50642
- } else if ((_a2 = context.visitedTypes) == null ? void 0 : _a2.has(typeId)) {
50659
+ } else if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
50643
50660
  const typeAlias = getTypeAliasForTypeLiteral(type2);
50644
50661
  if (typeAlias) {
50645
50662
  return symbolToTypeNode(typeAlias, context, 788968 /* Type */);
@@ -50650,20 +50667,6 @@ ${lanes.join("\n")}
50650
50667
  return visitAndTransformType(type2, createTypeNodeFromObjectType);
50651
50668
  }
50652
50669
  } else {
50653
- const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
50654
- if (isInstantiationExpressionType) {
50655
- const instantiationExpressionType = type2;
50656
- if (isTypeQueryNode(instantiationExpressionType.node)) {
50657
- const typeNode = serializeExistingTypeNode(context, instantiationExpressionType.node);
50658
- if (typeNode) {
50659
- return typeNode;
50660
- }
50661
- }
50662
- if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
50663
- return createElidedInformationPlaceholder(context);
50664
- }
50665
- return visitAndTransformType(type2, createTypeNodeFromObjectType);
50666
- }
50667
50670
  return createTypeNodeFromObjectType(type2);
50668
50671
  }
50669
50672
  function shouldWriteTypeOfFunctionSymbol() {
@@ -51217,36 +51220,65 @@ ${lanes.join("\n")}
51217
51220
  true
51218
51221
  )[0];
51219
51222
  let cleanup;
51220
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
51221
- const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
51222
- Debug.assertOptionalNode(existingFakeScope, isBlock);
51223
- const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
51224
- let newLocals;
51225
- for (const param of expandedParams) {
51226
- if (!locals.has(param.escapedName)) {
51227
- newLocals = append(newLocals, param.escapedName);
51228
- locals.set(param.escapedName, param);
51229
- }
51230
- }
51231
- if (newLocals) {
51232
- let removeNewLocals2 = function() {
51223
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && (some(expandedParams) || some(signature.typeParameters))) {
51224
+ let pushFakeScope2 = function(kind2, addAll) {
51225
+ Debug.assert(context.enclosingDeclaration);
51226
+ let existingFakeScope;
51227
+ if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind2) {
51228
+ existingFakeScope = context.enclosingDeclaration;
51229
+ } else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind2) {
51230
+ existingFakeScope = context.enclosingDeclaration.parent;
51231
+ }
51232
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
51233
+ const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
51234
+ let newLocals;
51235
+ addAll((name, symbol) => {
51236
+ if (!locals.has(name)) {
51237
+ newLocals = append(newLocals, name);
51238
+ locals.set(name, symbol);
51239
+ }
51240
+ });
51241
+ if (!newLocals)
51242
+ return;
51243
+ const oldCleanup = cleanup;
51244
+ function undo() {
51233
51245
  forEach(newLocals, (s) => locals.delete(s));
51234
- };
51235
- var removeNewLocals = removeNewLocals2;
51246
+ oldCleanup == null ? void 0 : oldCleanup();
51247
+ }
51236
51248
  if (existingFakeScope) {
51237
- cleanup = removeNewLocals2;
51249
+ cleanup = undo;
51238
51250
  } else {
51239
51251
  const fakeScope = parseNodeFactory.createBlock(emptyArray);
51240
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
51252
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind2;
51241
51253
  fakeScope.locals = locals;
51242
51254
  const saveEnclosingDeclaration = context.enclosingDeclaration;
51243
51255
  setParent(fakeScope, saveEnclosingDeclaration);
51244
51256
  context.enclosingDeclaration = fakeScope;
51245
51257
  cleanup = () => {
51246
51258
  context.enclosingDeclaration = saveEnclosingDeclaration;
51247
- removeNewLocals2();
51259
+ undo();
51248
51260
  };
51249
51261
  }
51262
+ };
51263
+ var pushFakeScope = pushFakeScope2;
51264
+ pushFakeScope2(
51265
+ "params",
51266
+ (add) => {
51267
+ for (const param of expandedParams) {
51268
+ add(param.escapedName, param);
51269
+ }
51270
+ }
51271
+ );
51272
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
51273
+ pushFakeScope2(
51274
+ "typeParams",
51275
+ (add) => {
51276
+ for (const typeParam of signature.typeParameters ?? emptyArray) {
51277
+ const typeParamName = typeParameterToName(typeParam, context).escapedText;
51278
+ add(typeParamName, typeParam.symbol);
51279
+ }
51280
+ }
51281
+ );
51250
51282
  }
51251
51283
  }
51252
51284
  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));
@@ -51791,7 +51823,7 @@ ${lanes.join("\n")}
51791
51823
  return identifier;
51792
51824
  }
51793
51825
  }
51794
- function typeParameterShadowsNameInScope(escapedName, context, type) {
51826
+ function typeParameterShadowsOtherTypeParameterInScope(escapedName, context, type) {
51795
51827
  const result = resolveName(
51796
51828
  context.enclosingDeclaration,
51797
51829
  escapedName,
@@ -51802,11 +51834,8 @@ ${lanes.join("\n")}
51802
51834
  /*isUse*/
51803
51835
  false
51804
51836
  );
51805
- if (result) {
51806
- if (result.flags & 262144 /* TypeParameter */ && result === type.symbol) {
51807
- return false;
51808
- }
51809
- return true;
51837
+ if (result && result.flags & 262144 /* TypeParameter */) {
51838
+ return result !== type.symbol;
51810
51839
  }
51811
51840
  return false;
51812
51841
  }
@@ -51832,7 +51861,7 @@ ${lanes.join("\n")}
51832
51861
  const rawtext = result.escapedText;
51833
51862
  let i = ((_a = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a.get(rawtext)) || 0;
51834
51863
  let text = rawtext;
51835
- while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsNameInScope(text, context, type)) {
51864
+ while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
51836
51865
  i++;
51837
51866
  text = `${rawtext}_${i}`;
51838
51867
  }
@@ -51843,7 +51872,7 @@ ${lanes.join("\n")}
51843
51872
  }
51844
51873
  (context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = /* @__PURE__ */ new Map())).set(rawtext, i);
51845
51874
  (context.typeParameterNames || (context.typeParameterNames = /* @__PURE__ */ new Map())).set(getTypeId(type), result);
51846
- (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(rawtext);
51875
+ (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(text);
51847
51876
  }
51848
51877
  return result;
51849
51878
  }
@@ -51988,7 +52017,10 @@ ${lanes.join("\n")}
51988
52017
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
51989
52018
  }
51990
52019
  function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
51991
- return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
52020
+ while (getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration) {
52021
+ enclosingDeclaration = enclosingDeclaration.parent;
52022
+ }
52023
+ return enclosingDeclaration;
51992
52024
  }
51993
52025
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
51994
52026
  if (!isErrorType(type) && enclosingDeclaration) {
@@ -52068,7 +52100,7 @@ ${lanes.join("\n")}
52068
52100
  }
52069
52101
  if (isIdentifier(node)) {
52070
52102
  const type = getDeclaredTypeOfSymbol(sym);
52071
- const name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : factory.cloneNode(node);
52103
+ const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
52072
52104
  name.symbol = sym;
52073
52105
  return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
52074
52106
  }
@@ -57481,69 +57513,22 @@ ${lanes.join("\n")}
57481
57513
  }
57482
57514
  return emptyArray;
57483
57515
  }
57484
- function getSignaturesOfType(typeIn, kind) {
57485
- const reducedType = getReducedApparentType(typeIn);
57486
- function carveoutResult() {
57487
- var _a;
57488
- if (kind === 0 /* Call */ && reducedType.flags & 1048576 /* Union */) {
57489
- let memberName;
57490
- if (everyType(reducedType, (t) => {
57491
- var _a2;
57492
- return !!((_a2 = t.symbol) == null ? void 0 : _a2.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
57493
- })) {
57494
- if (reducedType.arrayFallbackSignatures) {
57495
- return reducedType.arrayFallbackSignatures;
57496
- }
57497
- const numTypes = reducedType.types.length;
57498
- const numSigs = (_a = reducedType.types[0].symbol.declarations) == null ? void 0 : _a.length;
57499
- Debug.assert(numSigs);
57500
- const returnTypes = new Array(numSigs).fill(
57501
- /*value*/
57502
- void 0
57503
- ).map((_, isig) => {
57504
- const rtset = /* @__PURE__ */ new Set();
57505
- new Array(numTypes).fill(
57506
- /*value*/
57507
- void 0
57508
- ).forEach((_2, itype) => {
57509
- const callSignatures = reducedType.types[itype].callSignatures ?? getSignaturesOfStructuredType(reducedType.types[itype], 0 /* Call */);
57510
- if (callSignatures[isig].typeParameters)
57511
- return;
57512
- const returnType = callSignatures[isig].resolvedReturnType ?? getReturnTypeOfSignature(callSignatures[isig]);
57513
- Debug.assert(returnType);
57514
- rtset.add(returnType);
57515
- });
57516
- const art = [];
57517
- rtset.forEach((rt) => art.push(rt));
57518
- if (art.length === 0)
57519
- return void 0;
57520
- if (art.length === 1)
57521
- return art[0];
57522
- return getUnionType(art, 2 /* Subtype */);
57523
- });
57524
- const arrayArg = mapType(reducedType, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
57525
- const arrayType = createArrayType(arrayArg, someType(reducedType, (t) => isReadonlyArraySymbol(t.symbol.parent)));
57526
- const result2 = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
57527
- returnTypes.forEach((returnType, sigidx) => {
57528
- if (returnType)
57529
- result2[sigidx].resolvedReturnType = returnTypes[sigidx];
57530
- });
57531
- return reducedType.arrayFallbackSignatures = result2;
57532
- }
57516
+ function getSignaturesOfType(type, kind) {
57517
+ const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
57518
+ if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
57519
+ if (type.arrayFallbackSignatures) {
57520
+ return type.arrayFallbackSignatures;
57533
57521
  }
57534
- return void 0;
57535
- }
57536
- let result = carveoutResult();
57537
- if (result)
57538
- return result;
57539
- if (kind === 0 /* Call */ && reducedType.flags & 1048576 /* Union */) {
57540
- if (reducedType.arrayFallbackSignatures) {
57541
- return reducedType.arrayFallbackSignatures;
57522
+ let memberName;
57523
+ if (everyType(type, (t) => {
57524
+ var _a;
57525
+ return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
57526
+ })) {
57527
+ const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
57528
+ const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
57529
+ return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
57542
57530
  }
57543
- }
57544
- result = getSignaturesOfStructuredType(reducedType, kind);
57545
- if (kind === 0 /* Call */ && reducedType.flags & 1048576 /* Union */) {
57546
- reducedType.arrayFallbackSignatures = result;
57531
+ type.arrayFallbackSignatures = result;
57547
57532
  }
57548
57533
  return result;
57549
57534
  }
@@ -61589,6 +61574,7 @@ ${lanes.join("\n")}
61589
61574
  ) : strictNullChecks && modifiers & 8 /* ExcludeOptional */ && isOptional ? getTypeWithFacts(propType, 524288 /* NEUndefined */) : propType;
61590
61575
  }
61591
61576
  function instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments) {
61577
+ Debug.assert(type.symbol, "anonymous type must have symbol to be instantiated");
61592
61578
  const result = createObjectType(type.objectFlags & ~(524288 /* CouldContainTypeVariablesComputed */ | 1048576 /* CouldContainTypeVariables */) | 64 /* Instantiated */, type.symbol);
61593
61579
  if (type.objectFlags & 32 /* Mapped */) {
61594
61580
  result.declaration = type.declaration;
@@ -64836,6 +64822,7 @@ ${lanes.join("\n")}
64836
64822
  const sourceObjectFlags = getObjectFlags(source2);
64837
64823
  const targetObjectFlags = getObjectFlags(target2);
64838
64824
  if (sourceObjectFlags & 64 /* Instantiated */ && targetObjectFlags & 64 /* Instantiated */ && source2.symbol === target2.symbol || sourceObjectFlags & 4 /* Reference */ && targetObjectFlags & 4 /* Reference */ && source2.target === target2.target) {
64825
+ Debug.assertEqual(sourceSignatures.length, targetSignatures.length);
64839
64826
  for (let i = 0; i < targetSignatures.length; i++) {
64840
64827
  const related = signatureRelatedTo(
64841
64828
  sourceSignatures[i],
@@ -68129,6 +68116,10 @@ ${lanes.join("\n")}
68129
68116
  case 211 /* PropertyAccessExpression */:
68130
68117
  case 212 /* ElementAccessExpression */:
68131
68118
  return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol);
68119
+ case 206 /* ObjectBindingPattern */:
68120
+ case 207 /* ArrayBindingPattern */:
68121
+ const rootDeclaration = getRootDeclaration(node.parent);
68122
+ return isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
68132
68123
  }
68133
68124
  return false;
68134
68125
  }
@@ -69046,6 +69037,9 @@ ${lanes.join("\n")}
69046
69037
  }
69047
69038
  function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
69048
69039
  if (!assumeTrue) {
69040
+ if (type === candidate) {
69041
+ return neverType;
69042
+ }
69049
69043
  if (checkDerived) {
69050
69044
  return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
69051
69045
  }
@@ -69062,6 +69056,9 @@ ${lanes.join("\n")}
69062
69056
  if (type.flags & 3 /* AnyOrUnknown */) {
69063
69057
  return candidate;
69064
69058
  }
69059
+ if (type === candidate) {
69060
+ return candidate;
69061
+ }
69065
69062
  const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
69066
69063
  const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
69067
69064
  const narrowedType = mapType(candidate, (c) => {
@@ -75087,14 +75084,7 @@ ${lanes.join("\n")}
75087
75084
  hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
75088
75085
  hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
75089
75086
  if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
75090
- const result3 = createAnonymousType(
75091
- /*symbol*/
75092
- void 0,
75093
- resolved.members,
75094
- callSignatures,
75095
- constructSignatures,
75096
- resolved.indexInfos
75097
- );
75087
+ const result3 = createAnonymousType(createSymbol(0 /* None */, "__instantiationExpression" /* InstantiationExpression */), resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
75098
75088
  result3.objectFlags |= 8388608 /* InstantiationExpressionType */;
75099
75089
  result3.node = node;
75100
75090
  return result3;
@@ -142997,6 +142987,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
142997
142987
  return sourceFile;
142998
142988
  }
142999
142989
  function synchronizeHostData() {
142990
+ if (host.updateFromProject && !host.updateFromProjectInProgress) {
142991
+ host.updateFromProject();
142992
+ } else {
142993
+ synchronizeHostDataWorker();
142994
+ }
142995
+ }
142996
+ function synchronizeHostDataWorker() {
143000
142997
  var _a2, _b, _c;
143001
142998
  Debug.assert(languageServiceMode !== 2 /* Syntactic */);
143002
142999
  if (host.getProjectVersion) {
@@ -150320,7 +150317,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150320
150317
  Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,
150321
150318
  Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
150322
150319
  Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code,
150323
- Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code
150320
+ Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code,
150321
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery.code,
150322
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later.code,
150323
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom.code,
150324
+ 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,
150325
+ Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code,
150326
+ 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,
150327
+ 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,
150328
+ Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
150329
+ 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,
150330
+ Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code
150324
150331
  ];
150325
150332
  registerCodeFix({
150326
150333
  errorCodes: errorCodes18,
@@ -172628,6 +172635,35 @@ ${options.prefix}` : "\n" : options.prefix
172628
172635
  }
172629
172636
  }
172630
172637
  }
172638
+ /** @internal */
172639
+ installPackage(req) {
172640
+ const { fileName, packageName, projectName, projectRootPath } = req;
172641
+ const cwd = forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => {
172642
+ if (this.installTypingHost.fileExists(combinePaths(directory, "package.json"))) {
172643
+ return directory;
172644
+ }
172645
+ }) || projectRootPath;
172646
+ if (cwd) {
172647
+ this.installWorker(-1, [packageName], cwd, (success) => {
172648
+ const message = success ? `Package ${packageName} installed.` : `There was an error installing ${packageName}.`;
172649
+ const response = {
172650
+ kind: ActionPackageInstalled,
172651
+ projectName,
172652
+ success,
172653
+ message
172654
+ };
172655
+ this.sendResponse(response);
172656
+ });
172657
+ } else {
172658
+ const response = {
172659
+ kind: ActionPackageInstalled,
172660
+ projectName,
172661
+ success: false,
172662
+ message: "Could not determine a project root path."
172663
+ };
172664
+ this.sendResponse(response);
172665
+ }
172666
+ }
172631
172667
  initializeSafeList() {
172632
172668
  if (this.typesMapLocation) {
172633
172669
  const safeListFromMap = ts_JsTyping_exports.loadTypesMap(this.installTypingHost, this.typesMapLocation);
@@ -174119,6 +174155,8 @@ ${options.prefix}` : "\n" : options.prefix
174119
174155
  this.createHash = maybeBind(this.projectService.host, this.projectService.host.createHash);
174120
174156
  /** @internal */
174121
174157
  this.globalCacheResolutionModuleName = ts_JsTyping_exports.nonRelativeModuleNameForTypingCache;
174158
+ /** @internal */
174159
+ this.updateFromProjectInProgress = false;
174122
174160
  this.projectName = projectName;
174123
174161
  this.directoryStructureHost = directoryStructureHost;
174124
174162
  this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
@@ -174863,6 +174901,10 @@ ${options.prefix}` : "\n" : options.prefix
174863
174901
  onDiscoveredSymlink() {
174864
174902
  this.hasAddedOrRemovedSymlinks = true;
174865
174903
  }
174904
+ /** @internal */
174905
+ updateFromProject() {
174906
+ updateProjectIfDirty(this);
174907
+ }
174866
174908
  /**
174867
174909
  * Updates set of files that contribute to this project
174868
174910
  * @returns: true if set of files in the project stays the same and false - otherwise.
@@ -174880,7 +174922,7 @@ ${options.prefix}` : "\n" : options.prefix
174880
174922
  for (const file of changedFiles) {
174881
174923
  this.cachedUnresolvedImportsPerFile.delete(file);
174882
174924
  }
174883
- if (this.languageServiceEnabled && this.projectService.serverMode === 0 /* Semantic */) {
174925
+ if (this.languageServiceEnabled && this.projectService.serverMode === 0 /* Semantic */ && !this.isOrphan()) {
174884
174926
  if (hasNewProgram || changedFiles.length) {
174885
174927
  this.lastCachedUnresolvedImportsList = getUnresolvedImports(this.program, this.cachedUnresolvedImportsPerFile);
174886
174928
  }
@@ -175021,8 +175063,10 @@ ${options.prefix}` : "\n" : options.prefix
175021
175063
  this.hasInvalidatedResolutions = hasInvalidatedResolutions;
175022
175064
  this.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
175023
175065
  this.resolutionCache.startCachingPerDirectoryResolution();
175024
- this.program = this.languageService.getProgram();
175025
175066
  this.dirty = false;
175067
+ this.updateFromProjectInProgress = true;
175068
+ this.program = this.languageService.getProgram();
175069
+ this.updateFromProjectInProgress = false;
175026
175070
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "finishCachingPerDirectoryResolution");
175027
175071
  this.resolutionCache.finishCachingPerDirectoryResolution(this.program, oldProgram);
175028
175072
  (_b = tracing) == null ? void 0 : _b.pop();
@@ -181206,9 +181250,10 @@ ${json}${newLine}`;
181206
181250
  }
181207
181251
  }
181208
181252
  projectsUpdatedInBackgroundEvent(openFiles) {
181209
- this.projectService.logger.info(`got projects updated in background, updating diagnostics for ${openFiles}`);
181253
+ this.projectService.logger.info(`got projects updated in background ${openFiles}`);
181210
181254
  if (openFiles.length) {
181211
181255
  if (!this.suppressDiagnosticEvents && !this.noGetErrOnBackgroundUpdate) {
181256
+ this.projectService.logger.info(`Queueing diagnostics update for ${openFiles}`);
181212
181257
  this.errorCheck.startNew((next) => this.updateErrorCheck(
181213
181258
  next,
181214
181259
  openFiles,
@@ -181279,7 +181324,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
181279
181324
  send(msg) {
181280
181325
  if (msg.type === "event" && !this.canUseEvents) {
181281
181326
  if (this.logger.hasLevel(3 /* verbose */)) {
181282
- this.logger.info(`Session does not support events: ignored event: ${JSON.stringify(msg)}`);
181327
+ this.logger.info(`Session does not support events: ignored event: ${stringifyIndented(msg)}`);
181283
181328
  }
181284
181329
  return;
181285
181330
  }
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.4";
57
- var version = `${versionMajorMinor}.0-insiders.20231104`;
57
+ var version = `${versionMajorMinor}.0-insiders.20231109`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -31902,6 +31902,35 @@ var TypingsInstaller = class {
31902
31902
  }
31903
31903
  }
31904
31904
  }
31905
+ /** @internal */
31906
+ installPackage(req) {
31907
+ const { fileName, packageName, projectName, projectRootPath } = req;
31908
+ const cwd = forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => {
31909
+ if (this.installTypingHost.fileExists(combinePaths(directory, "package.json"))) {
31910
+ return directory;
31911
+ }
31912
+ }) || projectRootPath;
31913
+ if (cwd) {
31914
+ this.installWorker(-1, [packageName], cwd, (success) => {
31915
+ const message = success ? `Package ${packageName} installed.` : `There was an error installing ${packageName}.`;
31916
+ const response = {
31917
+ kind: ActionPackageInstalled,
31918
+ projectName,
31919
+ success,
31920
+ message
31921
+ };
31922
+ this.sendResponse(response);
31923
+ });
31924
+ } else {
31925
+ const response = {
31926
+ kind: ActionPackageInstalled,
31927
+ projectName,
31928
+ success: false,
31929
+ message: "Could not determine a project root path."
31930
+ };
31931
+ this.sendResponse(response);
31932
+ }
31933
+ }
31905
31934
  initializeSafeList() {
31906
31935
  if (this.typesMapLocation) {
31907
31936
  const safeListFromMap = ts_JsTyping_exports.loadTypesMap(this.installTypingHost, this.typesMapLocation);
@@ -32252,18 +32281,7 @@ var NodeTypingsInstaller = class extends TypingsInstaller {
32252
32281
  break;
32253
32282
  }
32254
32283
  case "installPackage": {
32255
- const { fileName, packageName, projectName, projectRootPath } = req;
32256
- const cwd = getDirectoryOfPackageJson(fileName, this.installTypingHost) || projectRootPath;
32257
- if (cwd) {
32258
- this.installWorker(-1, [packageName], cwd, (success) => {
32259
- const message = success ? `Package ${packageName} installed.` : `There was an error installing ${packageName}.`;
32260
- const response = { kind: ActionPackageInstalled, projectName, success, message };
32261
- this.sendResponse(response);
32262
- });
32263
- } else {
32264
- const response = { kind: ActionPackageInstalled, projectName, success: false, message: "Could not determine a project root path." };
32265
- this.sendResponse(response);
32266
- }
32284
+ this.installPackage(req);
32267
32285
  break;
32268
32286
  }
32269
32287
  default:
@@ -32281,7 +32299,7 @@ var NodeTypingsInstaller = class extends TypingsInstaller {
32281
32299
  }
32282
32300
  installWorker(requestId, packageNames, cwd, onRequestCompleted) {
32283
32301
  if (this.log.isEnabled()) {
32284
- this.log.writeLine(`#${requestId} with arguments'${JSON.stringify(packageNames)}'.`);
32302
+ this.log.writeLine(`#${requestId} with cwd: ${cwd} arguments: ${JSON.stringify(packageNames)}`);
32285
32303
  }
32286
32304
  const start = Date.now();
32287
32305
  const hasError = installNpmPackages(this.npmPath, version, packageNames, (command) => this.execSyncAndLog(command, { cwd }));
@@ -32308,13 +32326,6 @@ var NodeTypingsInstaller = class extends TypingsInstaller {
32308
32326
  }
32309
32327
  }
32310
32328
  };
32311
- function getDirectoryOfPackageJson(fileName, host) {
32312
- return forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => {
32313
- if (host.fileExists(combinePaths(directory, "package.json"))) {
32314
- return directory;
32315
- }
32316
- });
32317
- }
32318
32329
  var logFilePath = findArgument(Arguments.LogFile);
32319
32330
  var globalTypingsCacheLocation = findArgument(Arguments.GlobalCacheLocation);
32320
32331
  var typingSafeListLocation = findArgument(Arguments.TypingSafeListLocation);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.4.0-pr-56281-22",
5
+ "version": "5.4.0-pr-56356-2",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "20.1.0",
116
116
  "npm": "8.19.4"
117
117
  },
118
- "gitHead": "69a6124f01b72b1debf235cf3b0e48c67eea23b8"
118
+ "gitHead": "dc574fde3ad2ebc9dbad161f1b58409c91c712a1"
119
119
  }