typescript 5.9.0-dev.20250221 → 5.9.0-dev.20250223

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.9";
21
- var version = `${versionMajorMinor}.0-dev.20250221`;
21
+ var version = `${versionMajorMinor}.0-dev.20250223`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6825,6 +6825,7 @@ var Diagnostics = {
6825
6825
  This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2878, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2878", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
6826
6826
  Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found: diag(2879, 1 /* Error */, "Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found_2879", "Using JSX fragments requires fragment factory '{0}' to be in scope, but it could not be found."),
6827
6827
  Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert: diag(2880, 1 /* Error */, "Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert_2880", "Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'."),
6828
+ This_expression_is_never_nullish: diag(2881, 1 /* Error */, "This_expression_is_never_nullish_2881", "This expression is never nullish."),
6828
6829
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6829
6830
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6830
6831
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -78841,21 +78842,36 @@ function createTypeChecker(host) {
78841
78842
  if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
78842
78843
  grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
78843
78844
  }
78844
- const leftTarget = skipOuterExpressions(left, 63 /* All */);
78845
- const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
78846
- if (nullishSemantics !== 3 /* Sometimes */) {
78847
- if (node.parent.kind === 226 /* BinaryExpression */) {
78848
- error(leftTarget, Diagnostics.This_binary_expression_is_never_nullish_Are_you_missing_parentheses);
78849
- } else {
78850
- if (nullishSemantics === 1 /* Always */) {
78851
- error(leftTarget, Diagnostics.This_expression_is_always_nullish);
78852
- } else {
78853
- error(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
78854
- }
78855
- }
78845
+ checkNullishCoalesceOperandLeft(node);
78846
+ checkNullishCoalesceOperandRight(node);
78847
+ }
78848
+ }
78849
+ function checkNullishCoalesceOperandLeft(node) {
78850
+ const leftTarget = skipOuterExpressions(node.left, 63 /* All */);
78851
+ const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
78852
+ if (nullishSemantics !== 3 /* Sometimes */) {
78853
+ if (nullishSemantics === 1 /* Always */) {
78854
+ error(leftTarget, Diagnostics.This_expression_is_always_nullish);
78855
+ } else {
78856
+ error(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
78856
78857
  }
78857
78858
  }
78858
78859
  }
78860
+ function checkNullishCoalesceOperandRight(node) {
78861
+ const rightTarget = skipOuterExpressions(node.right, 63 /* All */);
78862
+ const nullishSemantics = getSyntacticNullishnessSemantics(rightTarget);
78863
+ if (isNotWithinNullishCoalesceExpression(node)) {
78864
+ return;
78865
+ }
78866
+ if (nullishSemantics === 1 /* Always */) {
78867
+ error(rightTarget, Diagnostics.This_expression_is_always_nullish);
78868
+ } else if (nullishSemantics === 2 /* Never */) {
78869
+ error(rightTarget, Diagnostics.This_expression_is_never_nullish);
78870
+ }
78871
+ }
78872
+ function isNotWithinNullishCoalesceExpression(node) {
78873
+ return !isBinaryExpression(node.parent) || node.parent.operatorToken.kind !== 61 /* QuestionQuestionToken */;
78874
+ }
78859
78875
  function getSyntacticNullishnessSemantics(node) {
78860
78876
  node = skipOuterExpressions(node);
78861
78877
  switch (node.kind) {
package/lib/typescript.js CHANGED
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
2285
2285
 
2286
2286
  // src/compiler/corePublic.ts
2287
2287
  var versionMajorMinor = "5.9";
2288
- var version = `${versionMajorMinor}.0-dev.20250221`;
2288
+ var version = `${versionMajorMinor}.0-dev.20250223`;
2289
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10211,6 +10211,7 @@ var Diagnostics = {
10211
10211
  This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2878, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2878", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
10212
10212
  Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found: diag(2879, 1 /* Error */, "Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found_2879", "Using JSX fragments requires fragment factory '{0}' to be in scope, but it could not be found."),
10213
10213
  Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert: diag(2880, 1 /* Error */, "Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert_2880", "Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'."),
10214
+ This_expression_is_never_nullish: diag(2881, 1 /* Error */, "This_expression_is_never_nullish_2881", "This expression is never nullish."),
10214
10215
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
10215
10216
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
10216
10217
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -83451,21 +83452,36 @@ function createTypeChecker(host) {
83451
83452
  if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
83452
83453
  grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
83453
83454
  }
83454
- const leftTarget = skipOuterExpressions(left, 63 /* All */);
83455
- const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
83456
- if (nullishSemantics !== 3 /* Sometimes */) {
83457
- if (node.parent.kind === 226 /* BinaryExpression */) {
83458
- error2(leftTarget, Diagnostics.This_binary_expression_is_never_nullish_Are_you_missing_parentheses);
83459
- } else {
83460
- if (nullishSemantics === 1 /* Always */) {
83461
- error2(leftTarget, Diagnostics.This_expression_is_always_nullish);
83462
- } else {
83463
- error2(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
83464
- }
83465
- }
83455
+ checkNullishCoalesceOperandLeft(node);
83456
+ checkNullishCoalesceOperandRight(node);
83457
+ }
83458
+ }
83459
+ function checkNullishCoalesceOperandLeft(node) {
83460
+ const leftTarget = skipOuterExpressions(node.left, 63 /* All */);
83461
+ const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
83462
+ if (nullishSemantics !== 3 /* Sometimes */) {
83463
+ if (nullishSemantics === 1 /* Always */) {
83464
+ error2(leftTarget, Diagnostics.This_expression_is_always_nullish);
83465
+ } else {
83466
+ error2(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
83466
83467
  }
83467
83468
  }
83468
83469
  }
83470
+ function checkNullishCoalesceOperandRight(node) {
83471
+ const rightTarget = skipOuterExpressions(node.right, 63 /* All */);
83472
+ const nullishSemantics = getSyntacticNullishnessSemantics(rightTarget);
83473
+ if (isNotWithinNullishCoalesceExpression(node)) {
83474
+ return;
83475
+ }
83476
+ if (nullishSemantics === 1 /* Always */) {
83477
+ error2(rightTarget, Diagnostics.This_expression_is_always_nullish);
83478
+ } else if (nullishSemantics === 2 /* Never */) {
83479
+ error2(rightTarget, Diagnostics.This_expression_is_never_nullish);
83480
+ }
83481
+ }
83482
+ function isNotWithinNullishCoalesceExpression(node) {
83483
+ return !isBinaryExpression(node.parent) || node.parent.operatorToken.kind !== 61 /* QuestionQuestionToken */;
83484
+ }
83469
83485
  function getSyntacticNullishnessSemantics(node) {
83470
83486
  node = skipOuterExpressions(node);
83471
83487
  switch (node.kind) {
@@ -144173,6 +144189,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
144173
144189
  if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) {
144174
144190
  for (const moduleSpecifier of sourceFile.imports) {
144175
144191
  const importNode = importFromModuleSpecifier(moduleSpecifier);
144192
+ if (isImportEqualsDeclaration(importNode) && hasSyntacticModifier(importNode, 32 /* Export */)) continue;
144176
144193
  const name = importNameForConvertToDefaultImport(importNode);
144177
144194
  if (!name) continue;
144178
144195
  const module2 = (_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier, sourceFile)) == null ? void 0 : _a.resolvedModule;
@@ -173254,8 +173271,8 @@ var Core;
173254
173271
  if (!(symbol2.flags & (32 /* Class */ | 64 /* Interface */)) || !addToSeen(seen, symbol2)) return;
173255
173272
  return firstDefined(symbol2.declarations, (declaration) => firstDefined(getAllSuperTypeNodes(declaration), (typeReference) => {
173256
173273
  const type = checker.getTypeAtLocation(typeReference);
173257
- const propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName);
173258
- return type && propertySymbol && (firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol));
173274
+ const propertySymbol = type.symbol && checker.getPropertyOfType(type, propertyName);
173275
+ return propertySymbol && firstDefined(checker.getRootSymbols(propertySymbol), cb) || type.symbol && recur(type.symbol);
173259
173276
  }));
173260
173277
  }
173261
173278
  }
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.9.0-dev.20250221",
5
+ "version": "5.9.0-dev.20250223",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -116,5 +116,5 @@
116
116
  "node": "20.1.0",
117
117
  "npm": "8.19.4"
118
118
  },
119
- "gitHead": "b95187d1ce2368a93a51b31c0cd11f5ba2557627"
119
+ "gitHead": "1cd8e20f947513cc8c0c7c59e55b2f4524eff316"
120
120
  }