typescript 5.6.0-dev.20240801 → 5.6.0-dev.20240803

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.20240801`;
21
+ var version = `${versionMajorMinor}.0-dev.20240803`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -17903,7 +17903,12 @@ function getJSXTransformEnabled(options) {
17903
17903
  function getJSXImplicitImportBase(compilerOptions, file) {
17904
17904
  const jsxImportSourcePragmas = file == null ? void 0 : file.pragmas.get("jsximportsource");
17905
17905
  const jsxImportSourcePragma = isArray(jsxImportSourcePragmas) ? jsxImportSourcePragmas[jsxImportSourcePragmas.length - 1] : jsxImportSourcePragmas;
17906
- return compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */ || compilerOptions.jsxImportSource || jsxImportSourcePragma ? (jsxImportSourcePragma == null ? void 0 : jsxImportSourcePragma.arguments.factory) || compilerOptions.jsxImportSource || "react" : void 0;
17906
+ const jsxRuntimePragmas = file == null ? void 0 : file.pragmas.get("jsxruntime");
17907
+ const jsxRuntimePragma = isArray(jsxRuntimePragmas) ? jsxRuntimePragmas[jsxRuntimePragmas.length - 1] : jsxRuntimePragmas;
17908
+ if ((jsxRuntimePragma == null ? void 0 : jsxRuntimePragma.arguments.factory) === "classic") {
17909
+ return void 0;
17910
+ }
17911
+ return compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */ || compilerOptions.jsxImportSource || jsxImportSourcePragma || (jsxRuntimePragma == null ? void 0 : jsxRuntimePragma.arguments.factory) === "automatic" ? (jsxImportSourcePragma == null ? void 0 : jsxImportSourcePragma.arguments.factory) || compilerOptions.jsxImportSource || "react" : void 0;
17907
17912
  }
17908
17913
  function getJSXRuntimeImport(base, options) {
17909
17914
  return base ? `${base}/${options.jsx === 5 /* ReactJSXDev */ ? "jsx-dev-runtime" : "jsx-runtime"}` : void 0;
@@ -72887,8 +72892,21 @@ function createTypeChecker(host) {
72887
72892
  function getEnclosingClassFromThisParameter(node) {
72888
72893
  const thisParameter = getThisParameterFromNodeContext(node);
72889
72894
  let thisType = (thisParameter == null ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type);
72890
- if (thisType && thisType.flags & 262144 /* TypeParameter */) {
72891
- 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
+ }
72892
72910
  }
72893
72911
  if (thisType && getObjectFlags(thisType) & (3 /* ClassOrInterface */ | 4 /* Reference */)) {
72894
72912
  return getTargetType(thisType);
@@ -79041,9 +79059,7 @@ function createTypeChecker(host) {
79041
79059
  }
79042
79060
  checkSourceElement(node.type);
79043
79061
  const { parameterName } = node;
79044
- if (typePredicate.kind === 0 /* This */ || typePredicate.kind === 2 /* AssertsThis */) {
79045
- getTypeFromThisTypeNode(parameterName);
79046
- } else {
79062
+ if (typePredicate.kind !== 0 /* This */ && typePredicate.kind !== 2 /* AssertsThis */) {
79047
79063
  if (typePredicate.parameterIndex >= 0) {
79048
79064
  if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
79049
79065
  error(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
@@ -81392,7 +81408,7 @@ function createTypeChecker(host) {
81392
81408
  bothHelper(location, body2);
81393
81409
  return;
81394
81410
  }
81395
- const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
81411
+ const type = location === condExpr2 ? condType : checkExpression(location);
81396
81412
  if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
81397
81413
  error(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
81398
81414
  return;
@@ -83587,6 +83603,7 @@ function createTypeChecker(host) {
83587
83603
  grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
83588
83604
  break;
83589
83605
  case 271 /* ImportEqualsDeclaration */:
83606
+ if (isInternalModuleImportEqualsDeclaration(node)) break;
83590
83607
  case 272 /* ImportDeclaration */:
83591
83608
  grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
83592
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.20240801`;
2263
+ var version = `${versionMajorMinor}.0-dev.20240803`;
2264
2264
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2265
2265
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2266
2266
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -21867,7 +21867,12 @@ function getJSXTransformEnabled(options) {
21867
21867
  function getJSXImplicitImportBase(compilerOptions, file) {
21868
21868
  const jsxImportSourcePragmas = file == null ? void 0 : file.pragmas.get("jsximportsource");
21869
21869
  const jsxImportSourcePragma = isArray(jsxImportSourcePragmas) ? jsxImportSourcePragmas[jsxImportSourcePragmas.length - 1] : jsxImportSourcePragmas;
21870
- return compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */ || compilerOptions.jsxImportSource || jsxImportSourcePragma ? (jsxImportSourcePragma == null ? void 0 : jsxImportSourcePragma.arguments.factory) || compilerOptions.jsxImportSource || "react" : void 0;
21870
+ const jsxRuntimePragmas = file == null ? void 0 : file.pragmas.get("jsxruntime");
21871
+ const jsxRuntimePragma = isArray(jsxRuntimePragmas) ? jsxRuntimePragmas[jsxRuntimePragmas.length - 1] : jsxRuntimePragmas;
21872
+ if ((jsxRuntimePragma == null ? void 0 : jsxRuntimePragma.arguments.factory) === "classic") {
21873
+ return void 0;
21874
+ }
21875
+ return compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */ || compilerOptions.jsxImportSource || jsxImportSourcePragma || (jsxRuntimePragma == null ? void 0 : jsxRuntimePragma.arguments.factory) === "automatic" ? (jsxImportSourcePragma == null ? void 0 : jsxImportSourcePragma.arguments.factory) || compilerOptions.jsxImportSource || "react" : void 0;
21871
21876
  }
21872
21877
  function getJSXRuntimeImport(base, options) {
21873
21878
  return base ? `${base}/${options.jsx === 5 /* ReactJSXDev */ ? "jsx-dev-runtime" : "jsx-runtime"}` : void 0;
@@ -77506,8 +77511,21 @@ function createTypeChecker(host) {
77506
77511
  function getEnclosingClassFromThisParameter(node) {
77507
77512
  const thisParameter = getThisParameterFromNodeContext(node);
77508
77513
  let thisType = (thisParameter == null ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type);
77509
- if (thisType && thisType.flags & 262144 /* TypeParameter */) {
77510
- 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
+ }
77511
77529
  }
77512
77530
  if (thisType && getObjectFlags(thisType) & (3 /* ClassOrInterface */ | 4 /* Reference */)) {
77513
77531
  return getTargetType(thisType);
@@ -83660,9 +83678,7 @@ function createTypeChecker(host) {
83660
83678
  }
83661
83679
  checkSourceElement(node.type);
83662
83680
  const { parameterName } = node;
83663
- if (typePredicate.kind === 0 /* This */ || typePredicate.kind === 2 /* AssertsThis */) {
83664
- getTypeFromThisTypeNode(parameterName);
83665
- } else {
83681
+ if (typePredicate.kind !== 0 /* This */ && typePredicate.kind !== 2 /* AssertsThis */) {
83666
83682
  if (typePredicate.parameterIndex >= 0) {
83667
83683
  if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
83668
83684
  error2(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
@@ -86011,7 +86027,7 @@ function createTypeChecker(host) {
86011
86027
  bothHelper(location, body2);
86012
86028
  return;
86013
86029
  }
86014
- const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
86030
+ const type = location === condExpr2 ? condType : checkExpression(location);
86015
86031
  if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
86016
86032
  error2(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
86017
86033
  return;
@@ -88206,6 +88222,7 @@ function createTypeChecker(host) {
88206
88222
  grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
88207
88223
  break;
88208
88224
  case 271 /* ImportEqualsDeclaration */:
88225
+ if (isInternalModuleImportEqualsDeclaration(node)) break;
88209
88226
  case 272 /* ImportDeclaration */:
88210
88227
  grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
88211
88228
  break;