typescript 5.9.0-dev.20250722 → 5.9.0-dev.20250724
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 +18 -8
- package/lib/fr/diagnosticMessages.generated.json +1 -1
- package/lib/ja/diagnosticMessages.generated.json +1 -1
- package/lib/ko/diagnosticMessages.generated.json +1 -1
- package/lib/pt-br/diagnosticMessages.generated.json +1 -1
- package/lib/typescript.js +18 -8
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -1
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -1
- package/package.json +2 -2
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.
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20250724`;
|
22
22
|
|
23
23
|
// src/compiler/core.ts
|
24
24
|
var emptyArray = [];
|
@@ -6014,15 +6014,16 @@ var Diagnostics = {
|
|
6014
6014
|
An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration: diag(1283, 1 /* Error */, "An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolve_1283", "An 'export =' declaration must reference a real value when 'verbatimModuleSyntax' is enabled, but '{0}' resolves to a type-only declaration."),
|
6015
6015
|
An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type: diag(1284, 1 /* Error */, "An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_1284", "An 'export default' must reference a value when 'verbatimModuleSyntax' is enabled, but '{0}' only refers to a type."),
|
6016
6016
|
An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration: diag(1285, 1 /* Error */, "An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_1285", "An 'export default' must reference a real value when 'verbatimModuleSyntax' is enabled, but '{0}' resolves to a type-only declaration."),
|
6017
|
-
|
6017
|
+
ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax: diag(1286, 1 /* Error */, "ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286", "ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'."),
|
6018
6018
|
A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled: diag(1287, 1 /* Error */, "A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimM_1287", "A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled."),
|
6019
6019
|
An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled: diag(1288, 1 /* Error */, "An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabl_1288", "An import alias cannot resolve to a type or type-only declaration when 'verbatimModuleSyntax' is enabled."),
|
6020
6020
|
_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1289, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1289", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
6021
6021
|
_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
6022
6022
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
6023
6023
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
6024
|
-
|
6024
|
+
ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
|
6025
6025
|
This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled: diag(1294, 1 /* Error */, "This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled_1294", "This syntax is not allowed when 'erasableSyntaxOnly' is enabled."),
|
6026
|
+
ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjust_the_type_field_in_the_nearest_package_json_to_make_this_file_an_ECMAScript_module_or_adjust_your_verbatimModuleSyntax_module_and_moduleResolution_settings_in_TypeScript: diag(1295, 1 /* Error */, "ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295", "ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript."),
|
6026
6027
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
6027
6028
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
6028
6029
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
@@ -47515,6 +47516,15 @@ function createTypeChecker(host) {
|
|
47515
47516
|
diagnostics.add(diagnostic);
|
47516
47517
|
return diagnostic;
|
47517
47518
|
}
|
47519
|
+
function getVerbatimModuleSyntaxErrorMessage(node) {
|
47520
|
+
const sourceFile = getSourceFileOfNode(node);
|
47521
|
+
const fileName = sourceFile.fileName;
|
47522
|
+
if (fileExtensionIsOneOf(fileName, [".cts" /* Cts */, ".cjs" /* Cjs */])) {
|
47523
|
+
return Diagnostics.ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax;
|
47524
|
+
} else {
|
47525
|
+
return Diagnostics.ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjust_the_type_field_in_the_nearest_package_json_to_make_this_file_an_ECMAScript_module_or_adjust_your_verbatimModuleSyntax_module_and_moduleResolution_settings_in_TypeScript;
|
47526
|
+
}
|
47527
|
+
}
|
47518
47528
|
function addErrorOrSuggestion(isError, diagnostic) {
|
47519
47529
|
if (isError) {
|
47520
47530
|
diagnostics.add(diagnostic);
|
@@ -50593,7 +50603,7 @@ function createTypeChecker(host) {
|
|
50593
50603
|
}
|
50594
50604
|
}
|
50595
50605
|
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter(""), maximumLength, verbosityLevel, out) {
|
50596
|
-
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
50606
|
+
const noTruncation = !maximumLength && compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
50597
50607
|
const typeNode = nodeBuilder.typeToTypeNode(
|
50598
50608
|
type,
|
50599
50609
|
enclosingDeclaration,
|
@@ -85883,9 +85893,9 @@ function createTypeChecker(host) {
|
|
85883
85893
|
}
|
85884
85894
|
}
|
85885
85895
|
if (compilerOptions.verbatimModuleSyntax && node.kind !== 272 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
85886
|
-
error(node,
|
85896
|
+
error(node, getVerbatimModuleSyntaxErrorMessage(node));
|
85887
85897
|
} else if (moduleKind === 200 /* Preserve */ && node.kind !== 272 /* ImportEqualsDeclaration */ && node.kind !== 261 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
85888
|
-
error(node, Diagnostics.
|
85898
|
+
error(node, Diagnostics.ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
|
85889
85899
|
}
|
85890
85900
|
if (compilerOptions.verbatimModuleSyntax && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */) && targetFlags & 128 /* ConstEnum */) {
|
85891
85901
|
const constEnumDeclaration = target.valueDeclaration;
|
@@ -86244,7 +86254,7 @@ function createTypeChecker(host) {
|
|
86244
86254
|
checkExpressionCached(node.expression);
|
86245
86255
|
}
|
86246
86256
|
if (isIllegalExportDefaultInCJS) {
|
86247
|
-
error(node,
|
86257
|
+
error(node, getVerbatimModuleSyntaxErrorMessage(node));
|
86248
86258
|
}
|
86249
86259
|
checkExternalModuleExports(container);
|
86250
86260
|
if (node.flags & 33554432 /* Ambient */ && !isEntityNameExpression(node.expression)) {
|
@@ -90112,7 +90122,7 @@ function createTypeChecker(host) {
|
|
90112
90122
|
}
|
90113
90123
|
function checkGrammarImportCallExpression(node) {
|
90114
90124
|
if (compilerOptions.verbatimModuleSyntax && moduleKind === 1 /* CommonJS */) {
|
90115
|
-
return grammarErrorOnNode(node,
|
90125
|
+
return grammarErrorOnNode(node, getVerbatimModuleSyntaxErrorMessage(node));
|
90116
90126
|
}
|
90117
90127
|
if (node.expression.kind === 237 /* MetaProperty */) {
|
90118
90128
|
if (moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
@@ -439,7 +439,7 @@
|
|
439
439
|
"Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036": "Impossible d'utiliser des éléments décoratifs de classe avec un identificateur privé static. Supprimez l'élément décoratif expérimental.",
|
440
440
|
"Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855": "Le champ de classe « {0} » défini par la classe parente n’est pas accessible dans la classe enfant via super.",
|
441
441
|
"Class_name_cannot_be_0_2414": "Le nom de la classe ne peut pas être '{0}'.",
|
442
|
-
"
|
442
|
+
"Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0_2725": "Le nom de la classe ne peut pas être « Object » quand ES5 et ses versions ultérieures sont ciblées avec le module {0}.",
|
443
443
|
"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417": "Le côté statique de la classe '{0}' étend de manière incorrecte le côté statique de la classe de base '{1}'.",
|
444
444
|
"Classes_can_only_extend_a_single_class_1174": "Les classes ne peuvent étendre qu'une seule classe.",
|
445
445
|
"Classes_may_not_have_a_field_named_constructor_18006": "Les classes n'ont peut-être pas de champ nommé 'constructor'.",
|
@@ -439,7 +439,7 @@
|
|
439
439
|
"Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036": "クラス デコレーターは、静的プライベート識別子と共に使用することはできません。試験段階のデコレーターを削除することをご検討ください。",
|
440
440
|
"Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855": "親クラスによって定義されたクラス フィールド '{0}' は、super を介して子クラスでアクセスすることはできません。",
|
441
441
|
"Class_name_cannot_be_0_2414": "クラス名を '{0}' にすることはできません。",
|
442
|
-
"
|
442
|
+
"Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0_2725": "モジュール {0} で ES5 以降を対象とする場合、クラス名を 'Object' にすることはできません。",
|
443
443
|
"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417": "クラス側の静的な '{0}' が基底クラス側の静的な '{1}' を正しく拡張していません。",
|
444
444
|
"Classes_can_only_extend_a_single_class_1174": "クラスで拡張できるクラスは 1 つのみです。",
|
445
445
|
"Classes_may_not_have_a_field_named_constructor_18006": "クラスに 'constructor' という名前のフィールドを含めることはできません。",
|
@@ -439,7 +439,7 @@
|
|
439
439
|
"Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036": "클래스 데코레이터는 정적 프라이빗 식별자와 함께 사용할 수 없습니다. 실험적 데코레이터를 제거하는 것이 좋습니다.",
|
440
440
|
"Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855": "부모 클래스에서 정의한 '{0}' 클래스 필드는 super를 통해 자식 클래스에서 액세스할 수 없습니다.",
|
441
441
|
"Class_name_cannot_be_0_2414": "클래스 이름은 '{0}'일 수 없습니다.",
|
442
|
-
"
|
442
|
+
"Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0_2725": "{0} 모듈을 사용하는 ES5를 대상으로 하는 경우 클래스 이름은 'Object'일 수 없습니다.",
|
443
443
|
"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417": "클래스 정적 측면 '{0}'이(가) 기본 클래스 정적 측면 '{1}'을(를) 잘못 확장합니다.",
|
444
444
|
"Classes_can_only_extend_a_single_class_1174": "클래스는 단일 클래스만 확장할 수 있습니다.",
|
445
445
|
"Classes_may_not_have_a_field_named_constructor_18006": "클래스에는 'constructor' 필드를 사용할 수 없습니다.",
|
@@ -439,7 +439,7 @@
|
|
439
439
|
"Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036": "Os decoradores de classe não podem ser usados com um identificador privado estático. Considere remover o decorador experimental.",
|
440
440
|
"Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855": "O campo de classe '{0}' definido pela classe pai não está acessível na classe filho via super.",
|
441
441
|
"Class_name_cannot_be_0_2414": "O nome de classe não pode ser '{0}'.",
|
442
|
-
"
|
442
|
+
"Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0_2725": "O nome da classe não pode ser 'Object' ao direcionar para ES5 e superior com o módulo {0}.",
|
443
443
|
"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417": "O lado estático da classe '{0}' incorretamente estende o lado estático da classe base '{1}'.",
|
444
444
|
"Classes_can_only_extend_a_single_class_1174": "Classes só podem estender uma única classe.",
|
445
445
|
"Classes_may_not_have_a_field_named_constructor_18006": "Classes não podem ter um campo denominado 'constructor'.",
|
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.
|
2288
|
+
var version = `${versionMajorMinor}.0-dev.20250724`;
|
2289
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
2290
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
2291
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
@@ -9400,15 +9400,16 @@ var Diagnostics = {
|
|
9400
9400
|
An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration: diag(1283, 1 /* Error */, "An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolve_1283", "An 'export =' declaration must reference a real value when 'verbatimModuleSyntax' is enabled, but '{0}' resolves to a type-only declaration."),
|
9401
9401
|
An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type: diag(1284, 1 /* Error */, "An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_1284", "An 'export default' must reference a value when 'verbatimModuleSyntax' is enabled, but '{0}' only refers to a type."),
|
9402
9402
|
An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration: diag(1285, 1 /* Error */, "An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_1285", "An 'export default' must reference a real value when 'verbatimModuleSyntax' is enabled, but '{0}' resolves to a type-only declaration."),
|
9403
|
-
|
9403
|
+
ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax: diag(1286, 1 /* Error */, "ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286", "ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'."),
|
9404
9404
|
A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled: diag(1287, 1 /* Error */, "A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimM_1287", "A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled."),
|
9405
9405
|
An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled: diag(1288, 1 /* Error */, "An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabl_1288", "An import alias cannot resolve to a type or type-only declaration when 'verbatimModuleSyntax' is enabled."),
|
9406
9406
|
_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1289, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1289", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
9407
9407
|
_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
9408
9408
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
9409
9409
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
9410
|
-
|
9410
|
+
ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
|
9411
9411
|
This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled: diag(1294, 1 /* Error */, "This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled_1294", "This syntax is not allowed when 'erasableSyntaxOnly' is enabled."),
|
9412
|
+
ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjust_the_type_field_in_the_nearest_package_json_to_make_this_file_an_ECMAScript_module_or_adjust_your_verbatimModuleSyntax_module_and_moduleResolution_settings_in_TypeScript: diag(1295, 1 /* Error */, "ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295", "ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript."),
|
9412
9413
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
9413
9414
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
9414
9415
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
@@ -52126,6 +52127,15 @@ function createTypeChecker(host) {
|
|
52126
52127
|
diagnostics.add(diagnostic);
|
52127
52128
|
return diagnostic;
|
52128
52129
|
}
|
52130
|
+
function getVerbatimModuleSyntaxErrorMessage(node) {
|
52131
|
+
const sourceFile = getSourceFileOfNode(node);
|
52132
|
+
const fileName = sourceFile.fileName;
|
52133
|
+
if (fileExtensionIsOneOf(fileName, [".cts" /* Cts */, ".cjs" /* Cjs */])) {
|
52134
|
+
return Diagnostics.ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax;
|
52135
|
+
} else {
|
52136
|
+
return Diagnostics.ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjust_the_type_field_in_the_nearest_package_json_to_make_this_file_an_ECMAScript_module_or_adjust_your_verbatimModuleSyntax_module_and_moduleResolution_settings_in_TypeScript;
|
52137
|
+
}
|
52138
|
+
}
|
52129
52139
|
function addErrorOrSuggestion(isError, diagnostic) {
|
52130
52140
|
if (isError) {
|
52131
52141
|
diagnostics.add(diagnostic);
|
@@ -55204,7 +55214,7 @@ function createTypeChecker(host) {
|
|
55204
55214
|
}
|
55205
55215
|
}
|
55206
55216
|
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter(""), maximumLength, verbosityLevel, out) {
|
55207
|
-
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
55217
|
+
const noTruncation = !maximumLength && compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
55208
55218
|
const typeNode = nodeBuilder.typeToTypeNode(
|
55209
55219
|
type,
|
55210
55220
|
enclosingDeclaration,
|
@@ -90494,9 +90504,9 @@ function createTypeChecker(host) {
|
|
90494
90504
|
}
|
90495
90505
|
}
|
90496
90506
|
if (compilerOptions.verbatimModuleSyntax && node.kind !== 272 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
90497
|
-
error2(node,
|
90507
|
+
error2(node, getVerbatimModuleSyntaxErrorMessage(node));
|
90498
90508
|
} else if (moduleKind === 200 /* Preserve */ && node.kind !== 272 /* ImportEqualsDeclaration */ && node.kind !== 261 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
90499
|
-
error2(node, Diagnostics.
|
90509
|
+
error2(node, Diagnostics.ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
|
90500
90510
|
}
|
90501
90511
|
if (compilerOptions.verbatimModuleSyntax && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */) && targetFlags & 128 /* ConstEnum */) {
|
90502
90512
|
const constEnumDeclaration = target.valueDeclaration;
|
@@ -90855,7 +90865,7 @@ function createTypeChecker(host) {
|
|
90855
90865
|
checkExpressionCached(node.expression);
|
90856
90866
|
}
|
90857
90867
|
if (isIllegalExportDefaultInCJS) {
|
90858
|
-
error2(node,
|
90868
|
+
error2(node, getVerbatimModuleSyntaxErrorMessage(node));
|
90859
90869
|
}
|
90860
90870
|
checkExternalModuleExports(container);
|
90861
90871
|
if (node.flags & 33554432 /* Ambient */ && !isEntityNameExpression(node.expression)) {
|
@@ -94723,7 +94733,7 @@ function createTypeChecker(host) {
|
|
94723
94733
|
}
|
94724
94734
|
function checkGrammarImportCallExpression(node) {
|
94725
94735
|
if (compilerOptions.verbatimModuleSyntax && moduleKind === 1 /* CommonJS */) {
|
94726
|
-
return grammarErrorOnNode(node,
|
94736
|
+
return grammarErrorOnNode(node, getVerbatimModuleSyntaxErrorMessage(node));
|
94727
94737
|
}
|
94728
94738
|
if (node.expression.kind === 237 /* MetaProperty */) {
|
94729
94739
|
if (moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
@@ -439,7 +439,7 @@
|
|
439
439
|
"Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036": "类修饰器不能与静态专用标识符一起使用。请考虑删除实验性修饰器。",
|
440
440
|
"Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855": "父类定义的类字段“{0}”无法通过 super 在子类中访问。",
|
441
441
|
"Class_name_cannot_be_0_2414": "类名不能为“{0}”。",
|
442
|
-
"
|
442
|
+
"Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0_2725": "使用模块 {0} 将目标设置为 ES5 及更高版本时,类名不能为 \"Object\"。",
|
443
443
|
"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417": "类静态侧“{0}”错误扩展基类静态侧“{1}”。",
|
444
444
|
"Classes_can_only_extend_a_single_class_1174": "类只能扩展一个类。",
|
445
445
|
"Classes_may_not_have_a_field_named_constructor_18006": "类不能具有名为 \"constructor\" 的字段。",
|
@@ -439,7 +439,7 @@
|
|
439
439
|
"Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036": "類別裝飾項目無法與靜態私人識別碼一起使用。請考慮移除實驗性裝飾項目。",
|
440
440
|
"Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855": "父類別所定義的類別欄位 '{0}' 無法透過超級在子類別中存取。",
|
441
441
|
"Class_name_cannot_be_0_2414": "類別名稱不得為 '{0}'。",
|
442
|
-
"
|
442
|
+
"Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0_2725": "當目標為具有模組 {0} 的 ES5 和更新版本時,類別名稱不可為 'Object'。",
|
443
443
|
"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417": "類別靜態端 '{0}' 不正確地擴充基底類別靜態端 '{1}'。",
|
444
444
|
"Classes_can_only_extend_a_single_class_1174": "類別只能擴充一個類別。",
|
445
445
|
"Classes_may_not_have_a_field_named_constructor_18006": "類別不能具有名為 'constructor' 的欄位。",
|
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.
|
5
|
+
"version": "5.9.0-dev.20250724",
|
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": "
|
119
|
+
"gitHead": "be8678315541e814da14316848a9468e8f90ab11"
|
120
120
|
}
|