@typescript-deploys/pr-build 5.1.0-pr-53502-7 → 5.1.0-pr-53549-16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.1";
21
- var version = `${versionMajorMinor}.0-insiders.20230325`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230328`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -43383,6 +43383,8 @@ function createTypeChecker(host) {
43383
43383
  var resolutionTargets = [];
43384
43384
  var resolutionResults = [];
43385
43385
  var resolutionPropertyNames = [];
43386
+ var resolutionStart = 0;
43387
+ var inVarianceComputation = false;
43386
43388
  var suggestionCount = 0;
43387
43389
  var maximumSuggestionCount = 10;
43388
43390
  var mergedSymbols = [];
@@ -49912,6 +49914,7 @@ function createTypeChecker(host) {
49912
49914
  ), 0 /* None */);
49913
49915
  }
49914
49916
  function serializeMaybeAliasAssignment(symbol) {
49917
+ var _a2;
49915
49918
  if (symbol.flags & 4194304 /* Prototype */) {
49916
49919
  return false;
49917
49920
  }
@@ -49991,7 +49994,7 @@ function createTypeChecker(host) {
49991
49994
  void 0,
49992
49995
  serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled)
49993
49996
  )
49994
- ], 2 /* Const */)
49997
+ ], ((_a2 = context.enclosingDeclaration) == null ? void 0 : _a2.kind) === 265 /* ModuleDeclaration */ ? 1 /* Let */ : 2 /* Const */)
49995
49998
  );
49996
49999
  addResult(
49997
50000
  statement,
@@ -50027,7 +50030,7 @@ function createTypeChecker(host) {
50027
50030
  if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
50028
50031
  return [];
50029
50032
  }
50030
- if (p.flags & 4194304 /* Prototype */ || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) {
50033
+ if (p.flags & 4194304 /* Prototype */ || p.escapedName === "constructor" || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) {
50031
50034
  return [];
50032
50035
  }
50033
50036
  const flag = modifierFlags & ~512 /* Async */ | (isStatic2 ? 32 /* Static */ : 0);
@@ -50582,7 +50585,7 @@ function createTypeChecker(host) {
50582
50585
  return true;
50583
50586
  }
50584
50587
  function findResolutionCycleStartIndex(target, propertyName) {
50585
- for (let i = resolutionTargets.length - 1; i >= 0; i--) {
50588
+ for (let i = resolutionTargets.length - 1; i >= resolutionStart; i--) {
50586
50589
  if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
50587
50590
  return -1;
50588
50591
  }
@@ -53527,6 +53530,9 @@ function createTypeChecker(host) {
53527
53530
  return type.resolvedDefaultConstraint;
53528
53531
  }
53529
53532
  function getConstraintOfDistributiveConditionalType(type) {
53533
+ if (type.resolvedConstraintOfDistributive !== void 0) {
53534
+ return type.resolvedConstraintOfDistributive || void 0;
53535
+ }
53530
53536
  if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
53531
53537
  const simplified = getSimplifiedType(
53532
53538
  type.checkType,
@@ -53537,10 +53543,12 @@ function createTypeChecker(host) {
53537
53543
  if (constraint && constraint !== type.checkType) {
53538
53544
  const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
53539
53545
  if (!(instantiated.flags & 131072 /* Never */)) {
53546
+ type.resolvedConstraintOfDistributive = instantiated;
53540
53547
  return instantiated;
53541
53548
  }
53542
53549
  }
53543
53550
  }
53551
+ type.resolvedConstraintOfDistributive = false;
53544
53552
  return void 0;
53545
53553
  }
53546
53554
  function getConstraintFromConditionalType(type) {
@@ -61613,6 +61621,11 @@ function createTypeChecker(host) {
61613
61621
  const links = getSymbolLinks(symbol);
61614
61622
  if (!links.variances) {
61615
61623
  (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
61624
+ const oldVarianceComputation = inVarianceComputation;
61625
+ if (!inVarianceComputation) {
61626
+ inVarianceComputation = true;
61627
+ resolutionStart = resolutionTargets.length;
61628
+ }
61616
61629
  links.variances = emptyArray;
61617
61630
  const variances = [];
61618
61631
  for (const tp of typeParameters) {
@@ -61641,6 +61654,10 @@ function createTypeChecker(host) {
61641
61654
  }
61642
61655
  variances.push(variance);
61643
61656
  }
61657
+ if (!oldVarianceComputation) {
61658
+ inVarianceComputation = false;
61659
+ resolutionStart = 0;
61660
+ }
61644
61661
  links.variances = variances;
61645
61662
  (_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
61646
61663
  }
@@ -66803,7 +66820,7 @@ function createTypeChecker(host) {
66803
66820
  return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : void 0;
66804
66821
  }
66805
66822
  function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
66806
- const attributesType = getApparentTypeOfContextualType(node.openingElement.attributes, contextFlags);
66823
+ const attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags);
66807
66824
  const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
66808
66825
  if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
66809
66826
  return void 0;
@@ -72228,7 +72245,7 @@ function createTypeChecker(host) {
72228
72245
  function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
72229
72246
  const functionFlags = getFunctionFlags(func);
72230
72247
  const type = returnType && unwrapReturnType(returnType, functionFlags);
72231
- if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
72248
+ if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */ | 2 /* Unknown */)) {
72232
72249
  return;
72233
72250
  }
72234
72251
  if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
@@ -91318,10 +91335,14 @@ function transformESDecorators(context) {
91318
91335
  visitor
91319
91336
  );
91320
91337
  const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
91321
- const indexOfFirstStatementAfterSuper = superStatementIndex >= 0 ? superStatementIndex + 1 : void 0;
91322
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, indexOfFirstStatementAfterSuper ? indexOfFirstStatementAfterSuper - nonPrologueStart : void 0));
91323
- addRange(statements, initializerStatements);
91324
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, indexOfFirstStatementAfterSuper));
91338
+ if (superStatementIndex >= 0) {
91339
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, superStatementIndex + 1 - nonPrologueStart));
91340
+ addRange(statements, initializerStatements);
91341
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, superStatementIndex + 1));
91342
+ } else {
91343
+ addRange(statements, initializerStatements);
91344
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement));
91345
+ }
91325
91346
  body = factory2.createBlock(
91326
91347
  statements,
91327
91348
  /*multiLine*/
package/lib/tsserver.js CHANGED
@@ -2286,7 +2286,7 @@ module.exports = __toCommonJS(server_exports);
2286
2286
 
2287
2287
  // src/compiler/corePublic.ts
2288
2288
  var versionMajorMinor = "5.1";
2289
- var version = `${versionMajorMinor}.0-insiders.20230325`;
2289
+ var version = `${versionMajorMinor}.0-insiders.20230328`;
2290
2290
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2291
2291
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2292
2292
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -48025,6 +48025,8 @@ function createTypeChecker(host) {
48025
48025
  var resolutionTargets = [];
48026
48026
  var resolutionResults = [];
48027
48027
  var resolutionPropertyNames = [];
48028
+ var resolutionStart = 0;
48029
+ var inVarianceComputation = false;
48028
48030
  var suggestionCount = 0;
48029
48031
  var maximumSuggestionCount = 10;
48030
48032
  var mergedSymbols = [];
@@ -54554,6 +54556,7 @@ function createTypeChecker(host) {
54554
54556
  ), 0 /* None */);
54555
54557
  }
54556
54558
  function serializeMaybeAliasAssignment(symbol) {
54559
+ var _a2;
54557
54560
  if (symbol.flags & 4194304 /* Prototype */) {
54558
54561
  return false;
54559
54562
  }
@@ -54633,7 +54636,7 @@ function createTypeChecker(host) {
54633
54636
  void 0,
54634
54637
  serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled)
54635
54638
  )
54636
- ], 2 /* Const */)
54639
+ ], ((_a2 = context.enclosingDeclaration) == null ? void 0 : _a2.kind) === 265 /* ModuleDeclaration */ ? 1 /* Let */ : 2 /* Const */)
54637
54640
  );
54638
54641
  addResult(
54639
54642
  statement,
@@ -54669,7 +54672,7 @@ function createTypeChecker(host) {
54669
54672
  if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
54670
54673
  return [];
54671
54674
  }
54672
- if (p.flags & 4194304 /* Prototype */ || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) {
54675
+ if (p.flags & 4194304 /* Prototype */ || p.escapedName === "constructor" || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) {
54673
54676
  return [];
54674
54677
  }
54675
54678
  const flag = modifierFlags & ~512 /* Async */ | (isStatic2 ? 32 /* Static */ : 0);
@@ -55224,7 +55227,7 @@ function createTypeChecker(host) {
55224
55227
  return true;
55225
55228
  }
55226
55229
  function findResolutionCycleStartIndex(target, propertyName) {
55227
- for (let i = resolutionTargets.length - 1; i >= 0; i--) {
55230
+ for (let i = resolutionTargets.length - 1; i >= resolutionStart; i--) {
55228
55231
  if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
55229
55232
  return -1;
55230
55233
  }
@@ -58169,6 +58172,9 @@ function createTypeChecker(host) {
58169
58172
  return type.resolvedDefaultConstraint;
58170
58173
  }
58171
58174
  function getConstraintOfDistributiveConditionalType(type) {
58175
+ if (type.resolvedConstraintOfDistributive !== void 0) {
58176
+ return type.resolvedConstraintOfDistributive || void 0;
58177
+ }
58172
58178
  if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
58173
58179
  const simplified = getSimplifiedType(
58174
58180
  type.checkType,
@@ -58179,10 +58185,12 @@ function createTypeChecker(host) {
58179
58185
  if (constraint && constraint !== type.checkType) {
58180
58186
  const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
58181
58187
  if (!(instantiated.flags & 131072 /* Never */)) {
58188
+ type.resolvedConstraintOfDistributive = instantiated;
58182
58189
  return instantiated;
58183
58190
  }
58184
58191
  }
58185
58192
  }
58193
+ type.resolvedConstraintOfDistributive = false;
58186
58194
  return void 0;
58187
58195
  }
58188
58196
  function getConstraintFromConditionalType(type) {
@@ -66255,6 +66263,11 @@ function createTypeChecker(host) {
66255
66263
  const links = getSymbolLinks(symbol);
66256
66264
  if (!links.variances) {
66257
66265
  (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
66266
+ const oldVarianceComputation = inVarianceComputation;
66267
+ if (!inVarianceComputation) {
66268
+ inVarianceComputation = true;
66269
+ resolutionStart = resolutionTargets.length;
66270
+ }
66258
66271
  links.variances = emptyArray;
66259
66272
  const variances = [];
66260
66273
  for (const tp of typeParameters) {
@@ -66283,6 +66296,10 @@ function createTypeChecker(host) {
66283
66296
  }
66284
66297
  variances.push(variance);
66285
66298
  }
66299
+ if (!oldVarianceComputation) {
66300
+ inVarianceComputation = false;
66301
+ resolutionStart = 0;
66302
+ }
66286
66303
  links.variances = variances;
66287
66304
  (_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
66288
66305
  }
@@ -71445,7 +71462,7 @@ function createTypeChecker(host) {
71445
71462
  return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType2(conditional, contextFlags) : void 0;
71446
71463
  }
71447
71464
  function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
71448
- const attributesType = getApparentTypeOfContextualType(node.openingElement.attributes, contextFlags);
71465
+ const attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags);
71449
71466
  const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
71450
71467
  if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
71451
71468
  return void 0;
@@ -76870,7 +76887,7 @@ function createTypeChecker(host) {
76870
76887
  function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
76871
76888
  const functionFlags = getFunctionFlags(func);
76872
76889
  const type = returnType && unwrapReturnType(returnType, functionFlags);
76873
- if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
76890
+ if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */ | 2 /* Unknown */)) {
76874
76891
  return;
76875
76892
  }
76876
76893
  if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
@@ -96131,10 +96148,14 @@ function transformESDecorators(context) {
96131
96148
  visitor
96132
96149
  );
96133
96150
  const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
96134
- const indexOfFirstStatementAfterSuper = superStatementIndex >= 0 ? superStatementIndex + 1 : void 0;
96135
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, indexOfFirstStatementAfterSuper ? indexOfFirstStatementAfterSuper - nonPrologueStart : void 0));
96136
- addRange(statements, initializerStatements);
96137
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, indexOfFirstStatementAfterSuper));
96151
+ if (superStatementIndex >= 0) {
96152
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, superStatementIndex + 1 - nonPrologueStart));
96153
+ addRange(statements, initializerStatements);
96154
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, superStatementIndex + 1));
96155
+ } else {
96156
+ addRange(statements, initializerStatements);
96157
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement));
96158
+ }
96138
96159
  body = factory2.createBlock(
96139
96160
  statements,
96140
96161
  /*multiLine*/
@@ -152526,7 +152547,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
152526
152547
  const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
152527
152548
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
152528
152549
  default:
152529
- return fromContextualType();
152550
+ return fromContextualType() || fromContextualType(0 /* None */);
152530
152551
  }
152531
152552
  function fromContextualType(contextFlags = 4 /* Completions */) {
152532
152553
  const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
@@ -161591,9 +161612,9 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
161591
161612
  }
161592
161613
  callArguments.push(factory.createIdentifier(name));
161593
161614
  });
161594
- const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclaration(type) }));
161615
+ const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) }));
161595
161616
  const sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
161596
- const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : sortedTypeParametersAndDeclarations.map((t) => t.declaration);
161617
+ const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(sortedTypeParametersAndDeclarations, ({ declaration }) => declaration);
161597
161618
  const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode(
161598
161619
  decl.name,
161599
161620
  /*typeArguments*/
@@ -162070,12 +162091,12 @@ function getContainingVariableDeclarationIfInList(node, scope) {
162070
162091
  node = node.parent;
162071
162092
  }
162072
162093
  }
162073
- function getFirstDeclaration(type) {
162094
+ function getFirstDeclarationBeforePosition(type, position) {
162074
162095
  let firstDeclaration;
162075
162096
  const symbol = type.symbol;
162076
162097
  if (symbol && symbol.declarations) {
162077
162098
  for (const declaration of symbol.declarations) {
162078
- if (firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) {
162099
+ if ((firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) && declaration.pos < position) {
162079
162100
  firstDeclaration = declaration;
162080
162101
  }
162081
162102
  }
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = `${versionMajorMinor}.0-insiders.20230325`;
38
+ version = `${versionMajorMinor}.0-insiders.20230328`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -45833,6 +45833,8 @@ ${lanes.join("\n")}
45833
45833
  var resolutionTargets = [];
45834
45834
  var resolutionResults = [];
45835
45835
  var resolutionPropertyNames = [];
45836
+ var resolutionStart = 0;
45837
+ var inVarianceComputation = false;
45836
45838
  var suggestionCount = 0;
45837
45839
  var maximumSuggestionCount = 10;
45838
45840
  var mergedSymbols = [];
@@ -52362,6 +52364,7 @@ ${lanes.join("\n")}
52362
52364
  ), 0 /* None */);
52363
52365
  }
52364
52366
  function serializeMaybeAliasAssignment(symbol) {
52367
+ var _a2;
52365
52368
  if (symbol.flags & 4194304 /* Prototype */) {
52366
52369
  return false;
52367
52370
  }
@@ -52441,7 +52444,7 @@ ${lanes.join("\n")}
52441
52444
  void 0,
52442
52445
  serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled)
52443
52446
  )
52444
- ], 2 /* Const */)
52447
+ ], ((_a2 = context.enclosingDeclaration) == null ? void 0 : _a2.kind) === 265 /* ModuleDeclaration */ ? 1 /* Let */ : 2 /* Const */)
52445
52448
  );
52446
52449
  addResult(
52447
52450
  statement,
@@ -52477,7 +52480,7 @@ ${lanes.join("\n")}
52477
52480
  if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
52478
52481
  return [];
52479
52482
  }
52480
- if (p.flags & 4194304 /* Prototype */ || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) {
52483
+ if (p.flags & 4194304 /* Prototype */ || p.escapedName === "constructor" || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) {
52481
52484
  return [];
52482
52485
  }
52483
52486
  const flag = modifierFlags & ~512 /* Async */ | (isStatic2 ? 32 /* Static */ : 0);
@@ -53032,7 +53035,7 @@ ${lanes.join("\n")}
53032
53035
  return true;
53033
53036
  }
53034
53037
  function findResolutionCycleStartIndex(target, propertyName) {
53035
- for (let i = resolutionTargets.length - 1; i >= 0; i--) {
53038
+ for (let i = resolutionTargets.length - 1; i >= resolutionStart; i--) {
53036
53039
  if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
53037
53040
  return -1;
53038
53041
  }
@@ -55977,6 +55980,9 @@ ${lanes.join("\n")}
55977
55980
  return type.resolvedDefaultConstraint;
55978
55981
  }
55979
55982
  function getConstraintOfDistributiveConditionalType(type) {
55983
+ if (type.resolvedConstraintOfDistributive !== void 0) {
55984
+ return type.resolvedConstraintOfDistributive || void 0;
55985
+ }
55980
55986
  if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
55981
55987
  const simplified = getSimplifiedType(
55982
55988
  type.checkType,
@@ -55987,10 +55993,12 @@ ${lanes.join("\n")}
55987
55993
  if (constraint && constraint !== type.checkType) {
55988
55994
  const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
55989
55995
  if (!(instantiated.flags & 131072 /* Never */)) {
55996
+ type.resolvedConstraintOfDistributive = instantiated;
55990
55997
  return instantiated;
55991
55998
  }
55992
55999
  }
55993
56000
  }
56001
+ type.resolvedConstraintOfDistributive = false;
55994
56002
  return void 0;
55995
56003
  }
55996
56004
  function getConstraintFromConditionalType(type) {
@@ -64063,6 +64071,11 @@ ${lanes.join("\n")}
64063
64071
  const links = getSymbolLinks(symbol);
64064
64072
  if (!links.variances) {
64065
64073
  (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
64074
+ const oldVarianceComputation = inVarianceComputation;
64075
+ if (!inVarianceComputation) {
64076
+ inVarianceComputation = true;
64077
+ resolutionStart = resolutionTargets.length;
64078
+ }
64066
64079
  links.variances = emptyArray;
64067
64080
  const variances = [];
64068
64081
  for (const tp of typeParameters) {
@@ -64091,6 +64104,10 @@ ${lanes.join("\n")}
64091
64104
  }
64092
64105
  variances.push(variance);
64093
64106
  }
64107
+ if (!oldVarianceComputation) {
64108
+ inVarianceComputation = false;
64109
+ resolutionStart = 0;
64110
+ }
64094
64111
  links.variances = variances;
64095
64112
  (_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
64096
64113
  }
@@ -69253,7 +69270,7 @@ ${lanes.join("\n")}
69253
69270
  return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType2(conditional, contextFlags) : void 0;
69254
69271
  }
69255
69272
  function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
69256
- const attributesType = getApparentTypeOfContextualType(node.openingElement.attributes, contextFlags);
69273
+ const attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags);
69257
69274
  const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
69258
69275
  if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
69259
69276
  return void 0;
@@ -74678,7 +74695,7 @@ ${lanes.join("\n")}
74678
74695
  function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
74679
74696
  const functionFlags = getFunctionFlags(func);
74680
74697
  const type = returnType && unwrapReturnType(returnType, functionFlags);
74681
- if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
74698
+ if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */ | 2 /* Unknown */)) {
74682
74699
  return;
74683
74700
  }
74684
74701
  if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
@@ -94132,10 +94149,14 @@ ${lanes.join("\n")}
94132
94149
  visitor
94133
94150
  );
94134
94151
  const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
94135
- const indexOfFirstStatementAfterSuper = superStatementIndex >= 0 ? superStatementIndex + 1 : void 0;
94136
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, indexOfFirstStatementAfterSuper ? indexOfFirstStatementAfterSuper - nonPrologueStart : void 0));
94137
- addRange(statements, initializerStatements);
94138
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, indexOfFirstStatementAfterSuper));
94152
+ if (superStatementIndex >= 0) {
94153
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, superStatementIndex + 1 - nonPrologueStart));
94154
+ addRange(statements, initializerStatements);
94155
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, superStatementIndex + 1));
94156
+ } else {
94157
+ addRange(statements, initializerStatements);
94158
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement));
94159
+ }
94139
94160
  body = factory2.createBlock(
94140
94161
  statements,
94141
94162
  /*multiLine*/
@@ -151623,7 +151644,7 @@ ${lanes.join("\n")}
151623
151644
  const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
151624
151645
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
151625
151646
  default:
151626
- return fromContextualType();
151647
+ return fromContextualType() || fromContextualType(0 /* None */);
151627
151648
  }
151628
151649
  function fromContextualType(contextFlags = 4 /* Completions */) {
151629
151650
  const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
@@ -160861,9 +160882,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160861
160882
  }
160862
160883
  callArguments.push(factory.createIdentifier(name));
160863
160884
  });
160864
- const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclaration(type) }));
160885
+ const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) }));
160865
160886
  const sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
160866
- const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : sortedTypeParametersAndDeclarations.map((t) => t.declaration);
160887
+ const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(sortedTypeParametersAndDeclarations, ({ declaration }) => declaration);
160867
160888
  const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode(
160868
160889
  decl.name,
160869
160890
  /*typeArguments*/
@@ -161340,12 +161361,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161340
161361
  node = node.parent;
161341
161362
  }
161342
161363
  }
161343
- function getFirstDeclaration(type) {
161364
+ function getFirstDeclarationBeforePosition(type, position) {
161344
161365
  let firstDeclaration;
161345
161366
  const symbol = type.symbol;
161346
161367
  if (symbol && symbol.declarations) {
161347
161368
  for (const declaration of symbol.declarations) {
161348
- if (firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) {
161369
+ if ((firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) && declaration.pos < position) {
161349
161370
  firstDeclaration = declaration;
161350
161371
  }
161351
161372
  }
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.1";
38
- version = `${versionMajorMinor}.0-insiders.20230325`;
38
+ version = `${versionMajorMinor}.0-insiders.20230328`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -45833,6 +45833,8 @@ ${lanes.join("\n")}
45833
45833
  var resolutionTargets = [];
45834
45834
  var resolutionResults = [];
45835
45835
  var resolutionPropertyNames = [];
45836
+ var resolutionStart = 0;
45837
+ var inVarianceComputation = false;
45836
45838
  var suggestionCount = 0;
45837
45839
  var maximumSuggestionCount = 10;
45838
45840
  var mergedSymbols = [];
@@ -52362,6 +52364,7 @@ ${lanes.join("\n")}
52362
52364
  ), 0 /* None */);
52363
52365
  }
52364
52366
  function serializeMaybeAliasAssignment(symbol) {
52367
+ var _a2;
52365
52368
  if (symbol.flags & 4194304 /* Prototype */) {
52366
52369
  return false;
52367
52370
  }
@@ -52441,7 +52444,7 @@ ${lanes.join("\n")}
52441
52444
  void 0,
52442
52445
  serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled)
52443
52446
  )
52444
- ], 2 /* Const */)
52447
+ ], ((_a2 = context.enclosingDeclaration) == null ? void 0 : _a2.kind) === 265 /* ModuleDeclaration */ ? 1 /* Let */ : 2 /* Const */)
52445
52448
  );
52446
52449
  addResult(
52447
52450
  statement,
@@ -52477,7 +52480,7 @@ ${lanes.join("\n")}
52477
52480
  if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
52478
52481
  return [];
52479
52482
  }
52480
- if (p.flags & 4194304 /* Prototype */ || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) {
52483
+ if (p.flags & 4194304 /* Prototype */ || p.escapedName === "constructor" || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) {
52481
52484
  return [];
52482
52485
  }
52483
52486
  const flag = modifierFlags & ~512 /* Async */ | (isStatic2 ? 32 /* Static */ : 0);
@@ -53032,7 +53035,7 @@ ${lanes.join("\n")}
53032
53035
  return true;
53033
53036
  }
53034
53037
  function findResolutionCycleStartIndex(target, propertyName) {
53035
- for (let i = resolutionTargets.length - 1; i >= 0; i--) {
53038
+ for (let i = resolutionTargets.length - 1; i >= resolutionStart; i--) {
53036
53039
  if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
53037
53040
  return -1;
53038
53041
  }
@@ -55977,6 +55980,9 @@ ${lanes.join("\n")}
55977
55980
  return type.resolvedDefaultConstraint;
55978
55981
  }
55979
55982
  function getConstraintOfDistributiveConditionalType(type) {
55983
+ if (type.resolvedConstraintOfDistributive !== void 0) {
55984
+ return type.resolvedConstraintOfDistributive || void 0;
55985
+ }
55980
55986
  if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
55981
55987
  const simplified = getSimplifiedType(
55982
55988
  type.checkType,
@@ -55987,10 +55993,12 @@ ${lanes.join("\n")}
55987
55993
  if (constraint && constraint !== type.checkType) {
55988
55994
  const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
55989
55995
  if (!(instantiated.flags & 131072 /* Never */)) {
55996
+ type.resolvedConstraintOfDistributive = instantiated;
55990
55997
  return instantiated;
55991
55998
  }
55992
55999
  }
55993
56000
  }
56001
+ type.resolvedConstraintOfDistributive = false;
55994
56002
  return void 0;
55995
56003
  }
55996
56004
  function getConstraintFromConditionalType(type) {
@@ -64063,6 +64071,11 @@ ${lanes.join("\n")}
64063
64071
  const links = getSymbolLinks(symbol);
64064
64072
  if (!links.variances) {
64065
64073
  (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
64074
+ const oldVarianceComputation = inVarianceComputation;
64075
+ if (!inVarianceComputation) {
64076
+ inVarianceComputation = true;
64077
+ resolutionStart = resolutionTargets.length;
64078
+ }
64066
64079
  links.variances = emptyArray;
64067
64080
  const variances = [];
64068
64081
  for (const tp of typeParameters) {
@@ -64091,6 +64104,10 @@ ${lanes.join("\n")}
64091
64104
  }
64092
64105
  variances.push(variance);
64093
64106
  }
64107
+ if (!oldVarianceComputation) {
64108
+ inVarianceComputation = false;
64109
+ resolutionStart = 0;
64110
+ }
64094
64111
  links.variances = variances;
64095
64112
  (_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
64096
64113
  }
@@ -69253,7 +69270,7 @@ ${lanes.join("\n")}
69253
69270
  return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType2(conditional, contextFlags) : void 0;
69254
69271
  }
69255
69272
  function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
69256
- const attributesType = getApparentTypeOfContextualType(node.openingElement.attributes, contextFlags);
69273
+ const attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags);
69257
69274
  const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
69258
69275
  if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
69259
69276
  return void 0;
@@ -74678,7 +74695,7 @@ ${lanes.join("\n")}
74678
74695
  function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
74679
74696
  const functionFlags = getFunctionFlags(func);
74680
74697
  const type = returnType && unwrapReturnType(returnType, functionFlags);
74681
- if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
74698
+ if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */ | 2 /* Unknown */)) {
74682
74699
  return;
74683
74700
  }
74684
74701
  if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
@@ -94132,10 +94149,14 @@ ${lanes.join("\n")}
94132
94149
  visitor
94133
94150
  );
94134
94151
  const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
94135
- const indexOfFirstStatementAfterSuper = superStatementIndex >= 0 ? superStatementIndex + 1 : void 0;
94136
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, indexOfFirstStatementAfterSuper ? indexOfFirstStatementAfterSuper - nonPrologueStart : void 0));
94137
- addRange(statements, initializerStatements);
94138
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, indexOfFirstStatementAfterSuper));
94152
+ if (superStatementIndex >= 0) {
94153
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, superStatementIndex + 1 - nonPrologueStart));
94154
+ addRange(statements, initializerStatements);
94155
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, superStatementIndex + 1));
94156
+ } else {
94157
+ addRange(statements, initializerStatements);
94158
+ addRange(statements, visitNodes2(node.body.statements, visitor, isStatement));
94159
+ }
94139
94160
  body = factory2.createBlock(
94140
94161
  statements,
94141
94162
  /*multiLine*/
@@ -151637,7 +151658,7 @@ ${lanes.join("\n")}
151637
151658
  const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
151638
151659
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
151639
151660
  default:
151640
- return fromContextualType();
151661
+ return fromContextualType() || fromContextualType(0 /* None */);
151641
151662
  }
151642
151663
  function fromContextualType(contextFlags = 4 /* Completions */) {
151643
151664
  const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
@@ -160875,9 +160896,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160875
160896
  }
160876
160897
  callArguments.push(factory.createIdentifier(name));
160877
160898
  });
160878
- const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclaration(type) }));
160899
+ const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) }));
160879
160900
  const sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
160880
- const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : sortedTypeParametersAndDeclarations.map((t) => t.declaration);
160901
+ const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(sortedTypeParametersAndDeclarations, ({ declaration }) => declaration);
160881
160902
  const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode(
160882
160903
  decl.name,
160883
160904
  /*typeArguments*/
@@ -161354,12 +161375,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161354
161375
  node = node.parent;
161355
161376
  }
161356
161377
  }
161357
- function getFirstDeclaration(type) {
161378
+ function getFirstDeclarationBeforePosition(type, position) {
161358
161379
  let firstDeclaration;
161359
161380
  const symbol = type.symbol;
161360
161381
  if (symbol && symbol.declarations) {
161361
161382
  for (const declaration of symbol.declarations) {
161362
- if (firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) {
161383
+ if ((firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) && declaration.pos < position) {
161363
161384
  firstDeclaration = declaration;
161364
161385
  }
161365
161386
  }
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-insiders.20230325`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230328`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
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.1.0-pr-53502-7",
5
+ "version": "5.1.0-pr-53549-16",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "14.21.1",
115
115
  "npm": "8.19.3"
116
116
  },
117
- "gitHead": "31793330fc1f6663df6b0efa88f13142285b80f4"
117
+ "gitHead": "80b6b038e269d5c218bfde672c663dbadc5b1525"
118
118
  }