@typescript-deploys/pr-build 5.1.0-pr-53225-3 → 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.20230327`;
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 = [];
@@ -50583,7 +50585,7 @@ function createTypeChecker(host) {
50583
50585
  return true;
50584
50586
  }
50585
50587
  function findResolutionCycleStartIndex(target, propertyName) {
50586
- for (let i = resolutionTargets.length - 1; i >= 0; i--) {
50588
+ for (let i = resolutionTargets.length - 1; i >= resolutionStart; i--) {
50587
50589
  if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
50588
50590
  return -1;
50589
50591
  }
@@ -61619,6 +61621,11 @@ function createTypeChecker(host) {
61619
61621
  const links = getSymbolLinks(symbol);
61620
61622
  if (!links.variances) {
61621
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
+ }
61622
61629
  links.variances = emptyArray;
61623
61630
  const variances = [];
61624
61631
  for (const tp of typeParameters) {
@@ -61647,6 +61654,10 @@ function createTypeChecker(host) {
61647
61654
  }
61648
61655
  variances.push(variance);
61649
61656
  }
61657
+ if (!oldVarianceComputation) {
61658
+ inVarianceComputation = false;
61659
+ resolutionStart = 0;
61660
+ }
61650
61661
  links.variances = variances;
61651
61662
  (_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
61652
61663
  }
@@ -91324,10 +91335,14 @@ function transformESDecorators(context) {
91324
91335
  visitor
91325
91336
  );
91326
91337
  const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
91327
- const indexOfFirstStatementAfterSuper = superStatementIndex >= 0 ? superStatementIndex + 1 : void 0;
91328
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, indexOfFirstStatementAfterSuper ? indexOfFirstStatementAfterSuper - nonPrologueStart : void 0));
91329
- addRange(statements, initializerStatements);
91330
- 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
+ }
91331
91346
  body = factory2.createBlock(
91332
91347
  statements,
91333
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.20230327`;
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 = [];
@@ -55225,7 +55227,7 @@ function createTypeChecker(host) {
55225
55227
  return true;
55226
55228
  }
55227
55229
  function findResolutionCycleStartIndex(target, propertyName) {
55228
- for (let i = resolutionTargets.length - 1; i >= 0; i--) {
55230
+ for (let i = resolutionTargets.length - 1; i >= resolutionStart; i--) {
55229
55231
  if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
55230
55232
  return -1;
55231
55233
  }
@@ -66261,6 +66263,11 @@ function createTypeChecker(host) {
66261
66263
  const links = getSymbolLinks(symbol);
66262
66264
  if (!links.variances) {
66263
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
+ }
66264
66271
  links.variances = emptyArray;
66265
66272
  const variances = [];
66266
66273
  for (const tp of typeParameters) {
@@ -66289,6 +66296,10 @@ function createTypeChecker(host) {
66289
66296
  }
66290
66297
  variances.push(variance);
66291
66298
  }
66299
+ if (!oldVarianceComputation) {
66300
+ inVarianceComputation = false;
66301
+ resolutionStart = 0;
66302
+ }
66292
66303
  links.variances = variances;
66293
66304
  (_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
66294
66305
  }
@@ -96137,10 +96148,14 @@ function transformESDecorators(context) {
96137
96148
  visitor
96138
96149
  );
96139
96150
  const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
96140
- const indexOfFirstStatementAfterSuper = superStatementIndex >= 0 ? superStatementIndex + 1 : void 0;
96141
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, indexOfFirstStatementAfterSuper ? indexOfFirstStatementAfterSuper - nonPrologueStart : void 0));
96142
- addRange(statements, initializerStatements);
96143
- 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
+ }
96144
96159
  body = factory2.createBlock(
96145
96160
  statements,
96146
96161
  /*multiLine*/
@@ -152471,10 +152486,34 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
152471
152486
  switch (parent2.kind) {
152472
152487
  case 199 /* LiteralType */: {
152473
152488
  const grandParent = walkUpParentheses(parent2.parent);
152474
- if (grandParent.kind === 203 /* ImportType */) {
152475
- return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
152489
+ switch (grandParent.kind) {
152490
+ case 231 /* ExpressionWithTypeArguments */:
152491
+ case 181 /* TypeReference */: {
152492
+ const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent);
152493
+ if (typeArgument) {
152494
+ return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false };
152495
+ }
152496
+ return void 0;
152497
+ }
152498
+ case 197 /* IndexedAccessType */:
152499
+ const { indexType, objectType } = grandParent;
152500
+ if (!rangeContainsPosition(indexType, position)) {
152501
+ return void 0;
152502
+ }
152503
+ return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType));
152504
+ case 203 /* ImportType */:
152505
+ return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
152506
+ case 190 /* UnionType */: {
152507
+ if (!isTypeReferenceNode(grandParent.parent)) {
152508
+ return void 0;
152509
+ }
152510
+ const alreadyUsedTypes = getAlreadyUsedTypesInStringLiteralUnion(grandParent, parent2);
152511
+ const types = getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(grandParent)).filter((t) => !contains(alreadyUsedTypes, t.value));
152512
+ return { kind: 2 /* Types */, types, isNewIdentifier: false };
152513
+ }
152514
+ default:
152515
+ return void 0;
152476
152516
  }
152477
- return fromUnionableLiteralType(grandParent);
152478
152517
  }
152479
152518
  case 300 /* PropertyAssignment */:
152480
152519
  if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) {
@@ -152508,38 +152547,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
152508
152547
  const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
152509
152548
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
152510
152549
  default:
152511
- return fromContextualType();
152512
- }
152513
- function fromUnionableLiteralType(grandParent) {
152514
- switch (grandParent.kind) {
152515
- case 231 /* ExpressionWithTypeArguments */:
152516
- case 181 /* TypeReference */: {
152517
- const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent);
152518
- if (typeArgument) {
152519
- return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false };
152520
- }
152521
- return void 0;
152522
- }
152523
- case 197 /* IndexedAccessType */:
152524
- const { indexType, objectType } = grandParent;
152525
- if (!rangeContainsPosition(indexType, position)) {
152526
- return void 0;
152527
- }
152528
- return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType));
152529
- case 190 /* UnionType */: {
152530
- const result = fromUnionableLiteralType(walkUpParentheses(grandParent.parent));
152531
- if (!result) {
152532
- return void 0;
152533
- }
152534
- const alreadyUsedTypes = getAlreadyUsedTypesInStringLiteralUnion(grandParent, parent2);
152535
- if (result.kind === 1 /* Properties */) {
152536
- return { kind: 1 /* Properties */, symbols: result.symbols.filter((sym) => !contains(alreadyUsedTypes, sym.name)), hasIndexSignature: result.hasIndexSignature };
152537
- }
152538
- return { kind: 2 /* Types */, types: result.types.filter((t) => !contains(alreadyUsedTypes, t.value)), isNewIdentifier: false };
152539
- }
152540
- default:
152541
- return void 0;
152542
- }
152550
+ return fromContextualType() || fromContextualType(0 /* None */);
152543
152551
  }
152544
152552
  function fromContextualType(contextFlags = 4 /* Completions */) {
152545
152553
  const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
@@ -161604,9 +161612,9 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
161604
161612
  }
161605
161613
  callArguments.push(factory.createIdentifier(name));
161606
161614
  });
161607
- const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclaration(type) }));
161615
+ const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) }));
161608
161616
  const sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
161609
- const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : sortedTypeParametersAndDeclarations.map((t) => t.declaration);
161617
+ const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(sortedTypeParametersAndDeclarations, ({ declaration }) => declaration);
161610
161618
  const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode(
161611
161619
  decl.name,
161612
161620
  /*typeArguments*/
@@ -162083,12 +162091,12 @@ function getContainingVariableDeclarationIfInList(node, scope) {
162083
162091
  node = node.parent;
162084
162092
  }
162085
162093
  }
162086
- function getFirstDeclaration(type) {
162094
+ function getFirstDeclarationBeforePosition(type, position) {
162087
162095
  let firstDeclaration;
162088
162096
  const symbol = type.symbol;
162089
162097
  if (symbol && symbol.declarations) {
162090
162098
  for (const declaration of symbol.declarations) {
162091
- if (firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) {
162099
+ if ((firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) && declaration.pos < position) {
162092
162100
  firstDeclaration = declaration;
162093
162101
  }
162094
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.20230327`;
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 = [];
@@ -53033,7 +53035,7 @@ ${lanes.join("\n")}
53033
53035
  return true;
53034
53036
  }
53035
53037
  function findResolutionCycleStartIndex(target, propertyName) {
53036
- for (let i = resolutionTargets.length - 1; i >= 0; i--) {
53038
+ for (let i = resolutionTargets.length - 1; i >= resolutionStart; i--) {
53037
53039
  if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
53038
53040
  return -1;
53039
53041
  }
@@ -64069,6 +64071,11 @@ ${lanes.join("\n")}
64069
64071
  const links = getSymbolLinks(symbol);
64070
64072
  if (!links.variances) {
64071
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
+ }
64072
64079
  links.variances = emptyArray;
64073
64080
  const variances = [];
64074
64081
  for (const tp of typeParameters) {
@@ -64097,6 +64104,10 @@ ${lanes.join("\n")}
64097
64104
  }
64098
64105
  variances.push(variance);
64099
64106
  }
64107
+ if (!oldVarianceComputation) {
64108
+ inVarianceComputation = false;
64109
+ resolutionStart = 0;
64110
+ }
64100
64111
  links.variances = variances;
64101
64112
  (_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
64102
64113
  }
@@ -94138,10 +94149,14 @@ ${lanes.join("\n")}
94138
94149
  visitor
94139
94150
  );
94140
94151
  const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
94141
- const indexOfFirstStatementAfterSuper = superStatementIndex >= 0 ? superStatementIndex + 1 : void 0;
94142
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, indexOfFirstStatementAfterSuper ? indexOfFirstStatementAfterSuper - nonPrologueStart : void 0));
94143
- addRange(statements, initializerStatements);
94144
- 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
+ }
94145
94160
  body = factory2.createBlock(
94146
94161
  statements,
94147
94162
  /*multiLine*/
@@ -151568,10 +151583,34 @@ ${lanes.join("\n")}
151568
151583
  switch (parent2.kind) {
151569
151584
  case 199 /* LiteralType */: {
151570
151585
  const grandParent = walkUpParentheses(parent2.parent);
151571
- if (grandParent.kind === 203 /* ImportType */) {
151572
- return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
151586
+ switch (grandParent.kind) {
151587
+ case 231 /* ExpressionWithTypeArguments */:
151588
+ case 181 /* TypeReference */: {
151589
+ const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent);
151590
+ if (typeArgument) {
151591
+ return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false };
151592
+ }
151593
+ return void 0;
151594
+ }
151595
+ case 197 /* IndexedAccessType */:
151596
+ const { indexType, objectType } = grandParent;
151597
+ if (!rangeContainsPosition(indexType, position)) {
151598
+ return void 0;
151599
+ }
151600
+ return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType));
151601
+ case 203 /* ImportType */:
151602
+ return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
151603
+ case 190 /* UnionType */: {
151604
+ if (!isTypeReferenceNode(grandParent.parent)) {
151605
+ return void 0;
151606
+ }
151607
+ const alreadyUsedTypes = getAlreadyUsedTypesInStringLiteralUnion(grandParent, parent2);
151608
+ const types = getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(grandParent)).filter((t) => !contains(alreadyUsedTypes, t.value));
151609
+ return { kind: 2 /* Types */, types, isNewIdentifier: false };
151610
+ }
151611
+ default:
151612
+ return void 0;
151573
151613
  }
151574
- return fromUnionableLiteralType(grandParent);
151575
151614
  }
151576
151615
  case 300 /* PropertyAssignment */:
151577
151616
  if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) {
@@ -151605,38 +151644,7 @@ ${lanes.join("\n")}
151605
151644
  const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
151606
151645
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
151607
151646
  default:
151608
- return fromContextualType();
151609
- }
151610
- function fromUnionableLiteralType(grandParent) {
151611
- switch (grandParent.kind) {
151612
- case 231 /* ExpressionWithTypeArguments */:
151613
- case 181 /* TypeReference */: {
151614
- const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent);
151615
- if (typeArgument) {
151616
- return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false };
151617
- }
151618
- return void 0;
151619
- }
151620
- case 197 /* IndexedAccessType */:
151621
- const { indexType, objectType } = grandParent;
151622
- if (!rangeContainsPosition(indexType, position)) {
151623
- return void 0;
151624
- }
151625
- return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType));
151626
- case 190 /* UnionType */: {
151627
- const result = fromUnionableLiteralType(walkUpParentheses(grandParent.parent));
151628
- if (!result) {
151629
- return void 0;
151630
- }
151631
- const alreadyUsedTypes = getAlreadyUsedTypesInStringLiteralUnion(grandParent, parent2);
151632
- if (result.kind === 1 /* Properties */) {
151633
- return { kind: 1 /* Properties */, symbols: result.symbols.filter((sym) => !contains(alreadyUsedTypes, sym.name)), hasIndexSignature: result.hasIndexSignature };
151634
- }
151635
- return { kind: 2 /* Types */, types: result.types.filter((t) => !contains(alreadyUsedTypes, t.value)), isNewIdentifier: false };
151636
- }
151637
- default:
151638
- return void 0;
151639
- }
151647
+ return fromContextualType() || fromContextualType(0 /* None */);
151640
151648
  }
151641
151649
  function fromContextualType(contextFlags = 4 /* Completions */) {
151642
151650
  const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
@@ -160874,9 +160882,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160874
160882
  }
160875
160883
  callArguments.push(factory.createIdentifier(name));
160876
160884
  });
160877
- const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclaration(type) }));
160885
+ const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) }));
160878
160886
  const sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
160879
- const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : sortedTypeParametersAndDeclarations.map((t) => t.declaration);
160887
+ const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(sortedTypeParametersAndDeclarations, ({ declaration }) => declaration);
160880
160888
  const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode(
160881
160889
  decl.name,
160882
160890
  /*typeArguments*/
@@ -161353,12 +161361,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161353
161361
  node = node.parent;
161354
161362
  }
161355
161363
  }
161356
- function getFirstDeclaration(type) {
161364
+ function getFirstDeclarationBeforePosition(type, position) {
161357
161365
  let firstDeclaration;
161358
161366
  const symbol = type.symbol;
161359
161367
  if (symbol && symbol.declarations) {
161360
161368
  for (const declaration of symbol.declarations) {
161361
- if (firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) {
161369
+ if ((firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) && declaration.pos < position) {
161362
161370
  firstDeclaration = declaration;
161363
161371
  }
161364
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.20230327`;
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 = [];
@@ -53033,7 +53035,7 @@ ${lanes.join("\n")}
53033
53035
  return true;
53034
53036
  }
53035
53037
  function findResolutionCycleStartIndex(target, propertyName) {
53036
- for (let i = resolutionTargets.length - 1; i >= 0; i--) {
53038
+ for (let i = resolutionTargets.length - 1; i >= resolutionStart; i--) {
53037
53039
  if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
53038
53040
  return -1;
53039
53041
  }
@@ -64069,6 +64071,11 @@ ${lanes.join("\n")}
64069
64071
  const links = getSymbolLinks(symbol);
64070
64072
  if (!links.variances) {
64071
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
+ }
64072
64079
  links.variances = emptyArray;
64073
64080
  const variances = [];
64074
64081
  for (const tp of typeParameters) {
@@ -64097,6 +64104,10 @@ ${lanes.join("\n")}
64097
64104
  }
64098
64105
  variances.push(variance);
64099
64106
  }
64107
+ if (!oldVarianceComputation) {
64108
+ inVarianceComputation = false;
64109
+ resolutionStart = 0;
64110
+ }
64100
64111
  links.variances = variances;
64101
64112
  (_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) });
64102
64113
  }
@@ -94138,10 +94149,14 @@ ${lanes.join("\n")}
94138
94149
  visitor
94139
94150
  );
94140
94151
  const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
94141
- const indexOfFirstStatementAfterSuper = superStatementIndex >= 0 ? superStatementIndex + 1 : void 0;
94142
- addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, indexOfFirstStatementAfterSuper ? indexOfFirstStatementAfterSuper - nonPrologueStart : void 0));
94143
- addRange(statements, initializerStatements);
94144
- 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
+ }
94145
94160
  body = factory2.createBlock(
94146
94161
  statements,
94147
94162
  /*multiLine*/
@@ -151582,10 +151597,34 @@ ${lanes.join("\n")}
151582
151597
  switch (parent2.kind) {
151583
151598
  case 199 /* LiteralType */: {
151584
151599
  const grandParent = walkUpParentheses(parent2.parent);
151585
- if (grandParent.kind === 203 /* ImportType */) {
151586
- return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
151600
+ switch (grandParent.kind) {
151601
+ case 231 /* ExpressionWithTypeArguments */:
151602
+ case 181 /* TypeReference */: {
151603
+ const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent);
151604
+ if (typeArgument) {
151605
+ return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false };
151606
+ }
151607
+ return void 0;
151608
+ }
151609
+ case 197 /* IndexedAccessType */:
151610
+ const { indexType, objectType } = grandParent;
151611
+ if (!rangeContainsPosition(indexType, position)) {
151612
+ return void 0;
151613
+ }
151614
+ return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType));
151615
+ case 203 /* ImportType */:
151616
+ return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
151617
+ case 190 /* UnionType */: {
151618
+ if (!isTypeReferenceNode(grandParent.parent)) {
151619
+ return void 0;
151620
+ }
151621
+ const alreadyUsedTypes = getAlreadyUsedTypesInStringLiteralUnion(grandParent, parent2);
151622
+ const types = getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(grandParent)).filter((t) => !contains(alreadyUsedTypes, t.value));
151623
+ return { kind: 2 /* Types */, types, isNewIdentifier: false };
151624
+ }
151625
+ default:
151626
+ return void 0;
151587
151627
  }
151588
- return fromUnionableLiteralType(grandParent);
151589
151628
  }
151590
151629
  case 300 /* PropertyAssignment */:
151591
151630
  if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) {
@@ -151619,38 +151658,7 @@ ${lanes.join("\n")}
151619
151658
  const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
151620
151659
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
151621
151660
  default:
151622
- return fromContextualType();
151623
- }
151624
- function fromUnionableLiteralType(grandParent) {
151625
- switch (grandParent.kind) {
151626
- case 231 /* ExpressionWithTypeArguments */:
151627
- case 181 /* TypeReference */: {
151628
- const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent);
151629
- if (typeArgument) {
151630
- return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false };
151631
- }
151632
- return void 0;
151633
- }
151634
- case 197 /* IndexedAccessType */:
151635
- const { indexType, objectType } = grandParent;
151636
- if (!rangeContainsPosition(indexType, position)) {
151637
- return void 0;
151638
- }
151639
- return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType));
151640
- case 190 /* UnionType */: {
151641
- const result = fromUnionableLiteralType(walkUpParentheses(grandParent.parent));
151642
- if (!result) {
151643
- return void 0;
151644
- }
151645
- const alreadyUsedTypes = getAlreadyUsedTypesInStringLiteralUnion(grandParent, parent2);
151646
- if (result.kind === 1 /* Properties */) {
151647
- return { kind: 1 /* Properties */, symbols: result.symbols.filter((sym) => !contains(alreadyUsedTypes, sym.name)), hasIndexSignature: result.hasIndexSignature };
151648
- }
151649
- return { kind: 2 /* Types */, types: result.types.filter((t) => !contains(alreadyUsedTypes, t.value)), isNewIdentifier: false };
151650
- }
151651
- default:
151652
- return void 0;
151653
- }
151661
+ return fromContextualType() || fromContextualType(0 /* None */);
151654
151662
  }
151655
151663
  function fromContextualType(contextFlags = 4 /* Completions */) {
151656
151664
  const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
@@ -160888,9 +160896,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160888
160896
  }
160889
160897
  callArguments.push(factory.createIdentifier(name));
160890
160898
  });
160891
- const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclaration(type) }));
160899
+ const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) }));
160892
160900
  const sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
160893
- const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : sortedTypeParametersAndDeclarations.map((t) => t.declaration);
160901
+ const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(sortedTypeParametersAndDeclarations, ({ declaration }) => declaration);
160894
160902
  const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode(
160895
160903
  decl.name,
160896
160904
  /*typeArguments*/
@@ -161367,12 +161375,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161367
161375
  node = node.parent;
161368
161376
  }
161369
161377
  }
161370
- function getFirstDeclaration(type) {
161378
+ function getFirstDeclarationBeforePosition(type, position) {
161371
161379
  let firstDeclaration;
161372
161380
  const symbol = type.symbol;
161373
161381
  if (symbol && symbol.declarations) {
161374
161382
  for (const declaration of symbol.declarations) {
161375
- if (firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) {
161383
+ if ((firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) && declaration.pos < position) {
161376
161384
  firstDeclaration = declaration;
161377
161385
  }
161378
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.20230327`;
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-53225-3",
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": "40752246a29a1d9984ce52601e401eb72bbec8bb"
117
+ "gitHead": "80b6b038e269d5c218bfde672c663dbadc5b1525"
118
118
  }