typescript 5.1.3 → 5.1.6

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 = "5.1.3";
21
+ var version = "5.1.6";
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -52642,19 +52642,13 @@ function createTypeChecker(host) {
52642
52642
  if (getObjectFlags(type) & 4 /* Reference */) {
52643
52643
  const target = type.target;
52644
52644
  const typeArguments = getTypeArguments(type);
52645
- if (length(target.typeParameters) === length(typeArguments)) {
52646
- const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
52647
- return needApparentType ? getApparentType(ref) : ref;
52648
- }
52645
+ return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
52649
52646
  } else if (type.flags & 2097152 /* Intersection */) {
52650
52647
  const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
52651
52648
  return types !== type.types ? getIntersectionType(types) : type;
52652
52649
  }
52653
52650
  return needApparentType ? getApparentType(type) : type;
52654
52651
  }
52655
- function getThisArgument(type) {
52656
- return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
52657
- }
52658
52652
  function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
52659
52653
  let mapper;
52660
52654
  let members;
@@ -53720,7 +53714,7 @@ function createTypeChecker(host) {
53720
53714
  return type.resolvedBaseConstraint;
53721
53715
  }
53722
53716
  const stack = [];
53723
- return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type));
53717
+ return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
53724
53718
  function getImmediateBaseConstraint(t) {
53725
53719
  if (!t.immediateBaseConstraint) {
53726
53720
  if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
@@ -53812,18 +53806,18 @@ function createTypeChecker(host) {
53812
53806
  }
53813
53807
  if (isGenericTupleType(t)) {
53814
53808
  const newElements = map(getElementTypes(t), (v, i) => {
53815
- const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
53816
- return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
53809
+ const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
53810
+ return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
53817
53811
  });
53818
53812
  return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
53819
53813
  }
53820
53814
  return t;
53821
53815
  }
53822
53816
  }
53823
- function getApparentTypeOfIntersectionType(type) {
53817
+ function getApparentTypeOfIntersectionType(type, thisArgument) {
53824
53818
  return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
53825
53819
  type,
53826
- type,
53820
+ thisArgument,
53827
53821
  /*needApparentType*/
53828
53822
  true
53829
53823
  ));
@@ -53874,8 +53868,9 @@ function createTypeChecker(host) {
53874
53868
  return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
53875
53869
  }
53876
53870
  function getApparentType(type) {
53877
- const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
53878
- return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
53871
+ const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
53872
+ const objectFlags = getObjectFlags(t);
53873
+ return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
53879
53874
  }
53880
53875
  function getReducedApparentType(type) {
53881
53876
  return getReducedType(getApparentType(getReducedType(type)));
@@ -58055,7 +58050,10 @@ function createTypeChecker(host) {
58055
58050
  const newMapper = createTypeMapper(typeParameters, typeArguments);
58056
58051
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
58057
58052
  if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58058
- result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
58053
+ const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
58054
+ if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58055
+ result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
58056
+ }
58059
58057
  }
58060
58058
  target.instantiations.set(id, result);
58061
58059
  }
@@ -60581,7 +60579,6 @@ function createTypeChecker(host) {
60581
60579
  } else if (targetFlags & 8388608 /* IndexedAccess */) {
60582
60580
  if (sourceFlags & 8388608 /* IndexedAccess */) {
60583
60581
  if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
60584
- instantiateType(source2.objectType, reportUnreliableMapper);
60585
60582
  result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
60586
60583
  }
60587
60584
  if (result2) {
@@ -60661,7 +60658,7 @@ function createTypeChecker(host) {
60661
60658
  return 3 /* Maybe */;
60662
60659
  }
60663
60660
  const c = target2;
60664
- if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
60661
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
60665
60662
  const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
60666
60663
  const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
60667
60664
  if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
@@ -95306,7 +95303,7 @@ function transformJsx(context) {
95306
95303
  continue;
95307
95304
  }
95308
95305
  finishObjectLiteralIfNeeded();
95309
- expressions.push(attr.expression);
95306
+ expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression)));
95310
95307
  continue;
95311
95308
  }
95312
95309
  properties.push(transformJsxAttributeToObjectLiteralElement(attr));
package/lib/tsserver.js CHANGED
@@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
2304
2304
 
2305
2305
  // src/compiler/corePublic.ts
2306
2306
  var versionMajorMinor = "5.1";
2307
- var version = "5.1.3";
2307
+ var version = "5.1.6";
2308
2308
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2309
2309
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2310
2310
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -57293,19 +57293,13 @@ function createTypeChecker(host) {
57293
57293
  if (getObjectFlags(type) & 4 /* Reference */) {
57294
57294
  const target = type.target;
57295
57295
  const typeArguments = getTypeArguments(type);
57296
- if (length(target.typeParameters) === length(typeArguments)) {
57297
- const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
57298
- return needApparentType ? getApparentType(ref) : ref;
57299
- }
57296
+ return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
57300
57297
  } else if (type.flags & 2097152 /* Intersection */) {
57301
57298
  const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
57302
57299
  return types !== type.types ? getIntersectionType(types) : type;
57303
57300
  }
57304
57301
  return needApparentType ? getApparentType(type) : type;
57305
57302
  }
57306
- function getThisArgument(type) {
57307
- return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
57308
- }
57309
57303
  function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
57310
57304
  let mapper;
57311
57305
  let members;
@@ -58371,7 +58365,7 @@ function createTypeChecker(host) {
58371
58365
  return type.resolvedBaseConstraint;
58372
58366
  }
58373
58367
  const stack = [];
58374
- return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type));
58368
+ return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
58375
58369
  function getImmediateBaseConstraint(t) {
58376
58370
  if (!t.immediateBaseConstraint) {
58377
58371
  if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
@@ -58463,18 +58457,18 @@ function createTypeChecker(host) {
58463
58457
  }
58464
58458
  if (isGenericTupleType(t)) {
58465
58459
  const newElements = map(getElementTypes(t), (v, i) => {
58466
- const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
58467
- return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
58460
+ const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
58461
+ return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
58468
58462
  });
58469
58463
  return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
58470
58464
  }
58471
58465
  return t;
58472
58466
  }
58473
58467
  }
58474
- function getApparentTypeOfIntersectionType(type) {
58468
+ function getApparentTypeOfIntersectionType(type, thisArgument) {
58475
58469
  return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
58476
58470
  type,
58477
- type,
58471
+ thisArgument,
58478
58472
  /*needApparentType*/
58479
58473
  true
58480
58474
  ));
@@ -58525,8 +58519,9 @@ function createTypeChecker(host) {
58525
58519
  return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
58526
58520
  }
58527
58521
  function getApparentType(type) {
58528
- const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
58529
- return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
58522
+ const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
58523
+ const objectFlags = getObjectFlags(t);
58524
+ return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
58530
58525
  }
58531
58526
  function getReducedApparentType(type) {
58532
58527
  return getReducedType(getApparentType(getReducedType(type)));
@@ -62706,7 +62701,10 @@ function createTypeChecker(host) {
62706
62701
  const newMapper = createTypeMapper(typeParameters, typeArguments);
62707
62702
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
62708
62703
  if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
62709
- result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
62704
+ const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
62705
+ if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
62706
+ result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
62707
+ }
62710
62708
  }
62711
62709
  target.instantiations.set(id, result);
62712
62710
  }
@@ -65232,7 +65230,6 @@ function createTypeChecker(host) {
65232
65230
  } else if (targetFlags & 8388608 /* IndexedAccess */) {
65233
65231
  if (sourceFlags & 8388608 /* IndexedAccess */) {
65234
65232
  if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
65235
- instantiateType(source2.objectType, reportUnreliableMapper);
65236
65233
  result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
65237
65234
  }
65238
65235
  if (result2) {
@@ -65312,7 +65309,7 @@ function createTypeChecker(host) {
65312
65309
  return 3 /* Maybe */;
65313
65310
  }
65314
65311
  const c = target2;
65315
- if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
65312
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
65316
65313
  const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
65317
65314
  const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
65318
65315
  if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
@@ -100128,7 +100125,7 @@ function transformJsx(context) {
100128
100125
  continue;
100129
100126
  }
100130
100127
  finishObjectLiteralIfNeeded();
100131
- expressions.push(attr.expression);
100128
+ expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression)));
100132
100129
  continue;
100133
100130
  }
100134
100131
  properties.push(transformJsxAttributeToObjectLiteralElement(attr));
@@ -156311,7 +156308,7 @@ function getSourceFromOrigin(origin) {
156311
156308
  }
156312
156309
  function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
156313
156310
  const start2 = timestamp();
156314
- const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken);
156311
+ const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
156315
156312
  const useSemicolons = probablyUsesSemicolons(sourceFile);
156316
156313
  const typeChecker = program.getTypeChecker();
156317
156314
  const uniques = /* @__PURE__ */ new Map();
@@ -158490,11 +158487,12 @@ function isModuleSpecifierMissingOrEmpty(specifier) {
158490
158487
  return true;
158491
158488
  return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
158492
158489
  }
158493
- function getVariableOrParameterDeclaration(contextToken) {
158490
+ function getVariableOrParameterDeclaration(contextToken, location) {
158494
158491
  if (!contextToken)
158495
158492
  return;
158496
- const declaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node) || (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
158497
- return declaration;
158493
+ const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
158494
+ const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node));
158495
+ return possiblyParameterDeclaration || possiblyVariableDeclaration;
158498
158496
  }
158499
158497
  function isArrowFunctionBody(node) {
158500
158498
  return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
@@ -158736,7 +158734,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
158736
158734
  case 290 /* JsxAttribute */:
158737
158735
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
158738
158736
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
158739
- return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType();
158737
+ return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
158740
158738
  }
158741
158739
  case 271 /* ImportDeclaration */:
158742
158740
  case 277 /* ExportDeclaration */:
@@ -5446,7 +5446,6 @@ declare namespace ts {
5446
5446
  type JsxAttributeValue = StringLiteral | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment;
5447
5447
  interface JsxSpreadAttribute extends ObjectLiteralElement {
5448
5448
  readonly kind: SyntaxKind.JsxSpreadAttribute;
5449
- readonly name: PropertyName;
5450
5449
  readonly parent: JsxAttributes;
5451
5450
  readonly expression: Expression;
5452
5451
  }
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = "5.1.3";
38
+ version = "5.1.6";
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -55084,19 +55084,13 @@ ${lanes.join("\n")}
55084
55084
  if (getObjectFlags(type) & 4 /* Reference */) {
55085
55085
  const target = type.target;
55086
55086
  const typeArguments = getTypeArguments(type);
55087
- if (length(target.typeParameters) === length(typeArguments)) {
55088
- const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
55089
- return needApparentType ? getApparentType(ref) : ref;
55090
- }
55087
+ return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
55091
55088
  } else if (type.flags & 2097152 /* Intersection */) {
55092
55089
  const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
55093
55090
  return types !== type.types ? getIntersectionType(types) : type;
55094
55091
  }
55095
55092
  return needApparentType ? getApparentType(type) : type;
55096
55093
  }
55097
- function getThisArgument(type) {
55098
- return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
55099
- }
55100
55094
  function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
55101
55095
  let mapper;
55102
55096
  let members;
@@ -56162,7 +56156,7 @@ ${lanes.join("\n")}
56162
56156
  return type.resolvedBaseConstraint;
56163
56157
  }
56164
56158
  const stack = [];
56165
- return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type));
56159
+ return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
56166
56160
  function getImmediateBaseConstraint(t) {
56167
56161
  if (!t.immediateBaseConstraint) {
56168
56162
  if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
@@ -56254,18 +56248,18 @@ ${lanes.join("\n")}
56254
56248
  }
56255
56249
  if (isGenericTupleType(t)) {
56256
56250
  const newElements = map(getElementTypes(t), (v, i) => {
56257
- const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
56258
- return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
56251
+ const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
56252
+ return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
56259
56253
  });
56260
56254
  return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
56261
56255
  }
56262
56256
  return t;
56263
56257
  }
56264
56258
  }
56265
- function getApparentTypeOfIntersectionType(type) {
56259
+ function getApparentTypeOfIntersectionType(type, thisArgument) {
56266
56260
  return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
56267
56261
  type,
56268
- type,
56262
+ thisArgument,
56269
56263
  /*needApparentType*/
56270
56264
  true
56271
56265
  ));
@@ -56316,8 +56310,9 @@ ${lanes.join("\n")}
56316
56310
  return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
56317
56311
  }
56318
56312
  function getApparentType(type) {
56319
- const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
56320
- return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
56313
+ const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
56314
+ const objectFlags = getObjectFlags(t);
56315
+ return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
56321
56316
  }
56322
56317
  function getReducedApparentType(type) {
56323
56318
  return getReducedType(getApparentType(getReducedType(type)));
@@ -60497,7 +60492,10 @@ ${lanes.join("\n")}
60497
60492
  const newMapper = createTypeMapper(typeParameters, typeArguments);
60498
60493
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
60499
60494
  if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
60500
- result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
60495
+ const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
60496
+ if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
60497
+ result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
60498
+ }
60501
60499
  }
60502
60500
  target.instantiations.set(id, result);
60503
60501
  }
@@ -63023,7 +63021,6 @@ ${lanes.join("\n")}
63023
63021
  } else if (targetFlags & 8388608 /* IndexedAccess */) {
63024
63022
  if (sourceFlags & 8388608 /* IndexedAccess */) {
63025
63023
  if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
63026
- instantiateType(source2.objectType, reportUnreliableMapper);
63027
63024
  result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
63028
63025
  }
63029
63026
  if (result2) {
@@ -63103,7 +63100,7 @@ ${lanes.join("\n")}
63103
63100
  return 3 /* Maybe */;
63104
63101
  }
63105
63102
  const c = target2;
63106
- if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
63103
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
63107
63104
  const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
63108
63105
  const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
63109
63106
  if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
@@ -98154,7 +98151,7 @@ ${lanes.join("\n")}
98154
98151
  continue;
98155
98152
  }
98156
98153
  finishObjectLiteralIfNeeded();
98157
- expressions.push(attr.expression);
98154
+ expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression)));
98158
98155
  continue;
98159
98156
  }
98160
98157
  properties.push(transformJsxAttributeToObjectLiteralElement(attr));
@@ -155543,7 +155540,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
155543
155540
  }
155544
155541
  function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
155545
155542
  const start = timestamp();
155546
- const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken);
155543
+ const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
155547
155544
  const useSemicolons = probablyUsesSemicolons(sourceFile);
155548
155545
  const typeChecker = program.getTypeChecker();
155549
155546
  const uniques = /* @__PURE__ */ new Map();
@@ -157700,11 +157697,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157700
157697
  return true;
157701
157698
  return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
157702
157699
  }
157703
- function getVariableOrParameterDeclaration(contextToken) {
157700
+ function getVariableOrParameterDeclaration(contextToken, location) {
157704
157701
  if (!contextToken)
157705
157702
  return;
157706
- const declaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node) || (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
157707
- return declaration;
157703
+ const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
157704
+ const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node));
157705
+ return possiblyParameterDeclaration || possiblyVariableDeclaration;
157708
157706
  }
157709
157707
  function isArrowFunctionBody(node) {
157710
157708
  return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
@@ -158011,7 +158009,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158011
158009
  case 290 /* JsxAttribute */:
158012
158010
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
158013
158011
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
158014
- return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType();
158012
+ return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
158015
158013
  }
158016
158014
  case 271 /* ImportDeclaration */:
158017
158015
  case 277 /* ExportDeclaration */:
@@ -1398,7 +1398,6 @@ declare namespace ts {
1398
1398
  type JsxAttributeValue = StringLiteral | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment;
1399
1399
  interface JsxSpreadAttribute extends ObjectLiteralElement {
1400
1400
  readonly kind: SyntaxKind.JsxSpreadAttribute;
1401
- readonly name: PropertyName;
1402
1401
  readonly parent: JsxAttributes;
1403
1402
  readonly expression: Expression;
1404
1403
  }
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 = "5.1.3";
38
+ version = "5.1.6";
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -55084,19 +55084,13 @@ ${lanes.join("\n")}
55084
55084
  if (getObjectFlags(type) & 4 /* Reference */) {
55085
55085
  const target = type.target;
55086
55086
  const typeArguments = getTypeArguments(type);
55087
- if (length(target.typeParameters) === length(typeArguments)) {
55088
- const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
55089
- return needApparentType ? getApparentType(ref) : ref;
55090
- }
55087
+ return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
55091
55088
  } else if (type.flags & 2097152 /* Intersection */) {
55092
55089
  const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
55093
55090
  return types !== type.types ? getIntersectionType(types) : type;
55094
55091
  }
55095
55092
  return needApparentType ? getApparentType(type) : type;
55096
55093
  }
55097
- function getThisArgument(type) {
55098
- return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
55099
- }
55100
55094
  function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
55101
55095
  let mapper;
55102
55096
  let members;
@@ -56162,7 +56156,7 @@ ${lanes.join("\n")}
56162
56156
  return type.resolvedBaseConstraint;
56163
56157
  }
56164
56158
  const stack = [];
56165
- return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type));
56159
+ return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
56166
56160
  function getImmediateBaseConstraint(t) {
56167
56161
  if (!t.immediateBaseConstraint) {
56168
56162
  if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
@@ -56254,18 +56248,18 @@ ${lanes.join("\n")}
56254
56248
  }
56255
56249
  if (isGenericTupleType(t)) {
56256
56250
  const newElements = map(getElementTypes(t), (v, i) => {
56257
- const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
56258
- return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
56251
+ const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
56252
+ return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
56259
56253
  });
56260
56254
  return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
56261
56255
  }
56262
56256
  return t;
56263
56257
  }
56264
56258
  }
56265
- function getApparentTypeOfIntersectionType(type) {
56259
+ function getApparentTypeOfIntersectionType(type, thisArgument) {
56266
56260
  return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
56267
56261
  type,
56268
- type,
56262
+ thisArgument,
56269
56263
  /*needApparentType*/
56270
56264
  true
56271
56265
  ));
@@ -56316,8 +56310,9 @@ ${lanes.join("\n")}
56316
56310
  return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
56317
56311
  }
56318
56312
  function getApparentType(type) {
56319
- const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
56320
- return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
56313
+ const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
56314
+ const objectFlags = getObjectFlags(t);
56315
+ return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
56321
56316
  }
56322
56317
  function getReducedApparentType(type) {
56323
56318
  return getReducedType(getApparentType(getReducedType(type)));
@@ -60497,7 +60492,10 @@ ${lanes.join("\n")}
60497
60492
  const newMapper = createTypeMapper(typeParameters, typeArguments);
60498
60493
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
60499
60494
  if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
60500
- result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
60495
+ const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
60496
+ if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
60497
+ result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
60498
+ }
60501
60499
  }
60502
60500
  target.instantiations.set(id, result);
60503
60501
  }
@@ -63023,7 +63021,6 @@ ${lanes.join("\n")}
63023
63021
  } else if (targetFlags & 8388608 /* IndexedAccess */) {
63024
63022
  if (sourceFlags & 8388608 /* IndexedAccess */) {
63025
63023
  if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
63026
- instantiateType(source2.objectType, reportUnreliableMapper);
63027
63024
  result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
63028
63025
  }
63029
63026
  if (result2) {
@@ -63103,7 +63100,7 @@ ${lanes.join("\n")}
63103
63100
  return 3 /* Maybe */;
63104
63101
  }
63105
63102
  const c = target2;
63106
- if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
63103
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
63107
63104
  const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
63108
63105
  const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
63109
63106
  if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
@@ -98154,7 +98151,7 @@ ${lanes.join("\n")}
98154
98151
  continue;
98155
98152
  }
98156
98153
  finishObjectLiteralIfNeeded();
98157
- expressions.push(attr.expression);
98154
+ expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression)));
98158
98155
  continue;
98159
98156
  }
98160
98157
  properties.push(transformJsxAttributeToObjectLiteralElement(attr));
@@ -155558,7 +155555,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
155558
155555
  }
155559
155556
  function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
155560
155557
  const start = timestamp();
155561
- const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken);
155558
+ const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
155562
155559
  const useSemicolons = probablyUsesSemicolons(sourceFile);
155563
155560
  const typeChecker = program.getTypeChecker();
155564
155561
  const uniques = /* @__PURE__ */ new Map();
@@ -157715,11 +157712,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157715
157712
  return true;
157716
157713
  return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
157717
157714
  }
157718
- function getVariableOrParameterDeclaration(contextToken) {
157715
+ function getVariableOrParameterDeclaration(contextToken, location) {
157719
157716
  if (!contextToken)
157720
157717
  return;
157721
- const declaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node) || (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
157722
- return declaration;
157718
+ const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
157719
+ const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node));
157720
+ return possiblyParameterDeclaration || possiblyVariableDeclaration;
157723
157721
  }
157724
157722
  function isArrowFunctionBody(node) {
157725
157723
  return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
@@ -158026,7 +158024,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158026
158024
  case 290 /* JsxAttribute */:
158027
158025
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
158028
158026
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
158029
- return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType();
158027
+ return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
158030
158028
  }
158031
158029
  case 271 /* ImportDeclaration */:
158032
158030
  case 277 /* ExportDeclaration */:
@@ -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 = "5.1.3";
57
+ var version = "5.1.6";
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.1.3",
5
+ "version": "5.1.6",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [