typescript 5.6.0-dev.20240802 → 5.6.0-dev.20240804

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.6";
21
- var version = `${versionMajorMinor}.0-dev.20240802`;
21
+ var version = `${versionMajorMinor}.0-dev.20240804`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -72892,8 +72892,21 @@ function createTypeChecker(host) {
72892
72892
  function getEnclosingClassFromThisParameter(node) {
72893
72893
  const thisParameter = getThisParameterFromNodeContext(node);
72894
72894
  let thisType = (thisParameter == null ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type);
72895
- if (thisType && thisType.flags & 262144 /* TypeParameter */) {
72896
- thisType = getConstraintOfTypeParameter(thisType);
72895
+ if (thisType) {
72896
+ if (thisType.flags & 262144 /* TypeParameter */) {
72897
+ thisType = getConstraintOfTypeParameter(thisType);
72898
+ }
72899
+ } else {
72900
+ const thisContainer = getThisContainer(
72901
+ node,
72902
+ /*includeArrowFunctions*/
72903
+ false,
72904
+ /*includeClassComputedPropertyName*/
72905
+ false
72906
+ );
72907
+ if (isFunctionLike(thisContainer)) {
72908
+ thisType = getContextualThisParameterType(thisContainer);
72909
+ }
72897
72910
  }
72898
72911
  if (thisType && getObjectFlags(thisType) & (3 /* ClassOrInterface */ | 4 /* Reference */)) {
72899
72912
  return getTargetType(thisType);
@@ -79046,9 +79059,7 @@ function createTypeChecker(host) {
79046
79059
  }
79047
79060
  checkSourceElement(node.type);
79048
79061
  const { parameterName } = node;
79049
- if (typePredicate.kind === 0 /* This */ || typePredicate.kind === 2 /* AssertsThis */) {
79050
- getTypeFromThisTypeNode(parameterName);
79051
- } else {
79062
+ if (typePredicate.kind !== 0 /* This */ && typePredicate.kind !== 2 /* AssertsThis */) {
79052
79063
  if (typePredicate.parameterIndex >= 0) {
79053
79064
  if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
79054
79065
  error(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
@@ -81397,7 +81408,7 @@ function createTypeChecker(host) {
81397
81408
  bothHelper(location, body2);
81398
81409
  return;
81399
81410
  }
81400
- const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
81411
+ const type = location === condExpr2 ? condType : checkExpression(location);
81401
81412
  if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
81402
81413
  error(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
81403
81414
  return;
@@ -83592,6 +83603,7 @@ function createTypeChecker(host) {
83592
83603
  grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
83593
83604
  break;
83594
83605
  case 271 /* ImportEqualsDeclaration */:
83606
+ if (isInternalModuleImportEqualsDeclaration(node)) break;
83595
83607
  case 272 /* ImportDeclaration */:
83596
83608
  grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
83597
83609
  break;
package/lib/typescript.js CHANGED
@@ -2260,7 +2260,7 @@ module.exports = __toCommonJS(typescript_exports);
2260
2260
 
2261
2261
  // src/compiler/corePublic.ts
2262
2262
  var versionMajorMinor = "5.6";
2263
- var version = `${versionMajorMinor}.0-dev.20240802`;
2263
+ var version = `${versionMajorMinor}.0-dev.20240804`;
2264
2264
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2265
2265
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2266
2266
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -77511,8 +77511,21 @@ function createTypeChecker(host) {
77511
77511
  function getEnclosingClassFromThisParameter(node) {
77512
77512
  const thisParameter = getThisParameterFromNodeContext(node);
77513
77513
  let thisType = (thisParameter == null ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type);
77514
- if (thisType && thisType.flags & 262144 /* TypeParameter */) {
77515
- thisType = getConstraintOfTypeParameter(thisType);
77514
+ if (thisType) {
77515
+ if (thisType.flags & 262144 /* TypeParameter */) {
77516
+ thisType = getConstraintOfTypeParameter(thisType);
77517
+ }
77518
+ } else {
77519
+ const thisContainer = getThisContainer(
77520
+ node,
77521
+ /*includeArrowFunctions*/
77522
+ false,
77523
+ /*includeClassComputedPropertyName*/
77524
+ false
77525
+ );
77526
+ if (isFunctionLike(thisContainer)) {
77527
+ thisType = getContextualThisParameterType(thisContainer);
77528
+ }
77516
77529
  }
77517
77530
  if (thisType && getObjectFlags(thisType) & (3 /* ClassOrInterface */ | 4 /* Reference */)) {
77518
77531
  return getTargetType(thisType);
@@ -83665,9 +83678,7 @@ function createTypeChecker(host) {
83665
83678
  }
83666
83679
  checkSourceElement(node.type);
83667
83680
  const { parameterName } = node;
83668
- if (typePredicate.kind === 0 /* This */ || typePredicate.kind === 2 /* AssertsThis */) {
83669
- getTypeFromThisTypeNode(parameterName);
83670
- } else {
83681
+ if (typePredicate.kind !== 0 /* This */ && typePredicate.kind !== 2 /* AssertsThis */) {
83671
83682
  if (typePredicate.parameterIndex >= 0) {
83672
83683
  if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
83673
83684
  error2(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
@@ -86016,7 +86027,7 @@ function createTypeChecker(host) {
86016
86027
  bothHelper(location, body2);
86017
86028
  return;
86018
86029
  }
86019
- const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
86030
+ const type = location === condExpr2 ? condType : checkExpression(location);
86020
86031
  if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
86021
86032
  error2(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
86022
86033
  return;
@@ -88211,6 +88222,7 @@ function createTypeChecker(host) {
88211
88222
  grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
88212
88223
  break;
88213
88224
  case 271 /* ImportEqualsDeclaration */:
88225
+ if (isInternalModuleImportEqualsDeclaration(node)) break;
88214
88226
  case 272 /* ImportDeclaration */:
88215
88227
  grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
88216
88228
  break;