mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into fix-defineProperty-parameter-property-emit
This commit is contained in:
@@ -90,6 +90,7 @@ tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
|
||||
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
|
||||
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
|
||||
tests/cases/user/create-react-app/create-react-app
|
||||
tests/cases/user/fp-ts/fp-ts
|
||||
tests/cases/user/webpack/webpack
|
||||
tests/cases/user/puppeteer/puppeteer
|
||||
tests/cases/user/axios-src/axios-src
|
||||
|
||||
+7
-7
@@ -63,7 +63,7 @@ TypeScript is currently accepting contributions in the form of bug fixes. A bug
|
||||
|
||||
## Contributing features
|
||||
|
||||
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved ([labelled "help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22 or in the "Backlog" milestone) by a TypeScript project maintainer) in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
|
||||
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (labelled ["help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) or in the "Backlog" milestone) by a TypeScript project maintainer) in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
|
||||
|
||||
Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue.
|
||||
|
||||
@@ -71,19 +71,19 @@ Design changes will not be accepted at this time. If you have a design change pr
|
||||
|
||||
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
|
||||
|
||||
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.pdf](https://opensource.microsoft.com/pdf/microsoft-contribution-license-agreement.pdf)), sign, scan, and email it back to <cla@microsoft.com>. Be sure to include your GitHub user name along with the agreement. Once we have received the signed CLA, we'll review the request.
|
||||
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.pdf](https://opensource.microsoft.com/pdf/microsoft-contribution-license-agreement.pdf)), sign, scan, and email it back to <cla@microsoft.com>. Be sure to include your GitHub user name along with the agreement. Once we have received the signed CLA, we'll review the request.
|
||||
|
||||
## Housekeeping
|
||||
|
||||
Your pull request should:
|
||||
Your pull request should:
|
||||
|
||||
* Include a description of what your change intends to do
|
||||
* Be a child commit of a reasonably recent commit in the **master** branch
|
||||
* Be a child commit of a reasonably recent commit in the **master** branch
|
||||
* Requests need not be a single commit, but should be a linear sequence of commits (i.e. no merge commits in your PR)
|
||||
* It is desirable, but not necessary, for the tests to pass at each commit
|
||||
* Have clear commit messages
|
||||
* Have clear commit messages
|
||||
* e.g. "Minor refactor in goToTypeDefinition", "Fix iterated type in for-await-of", "Add test for preserveWatchOutput on command line"
|
||||
* Include adequate tests
|
||||
* Include adequate tests
|
||||
* At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why
|
||||
* Tests should include reasonable permutations of the target fix/change
|
||||
* Include baseline changes with your change
|
||||
@@ -133,7 +133,7 @@ e.g. to run all compiler baseline tests:
|
||||
gulp runtests --tests=compiler
|
||||
```
|
||||
|
||||
or to run a specific test: `tests\cases\compiler\2dArrays.ts`
|
||||
or to run a specific test: `tests\cases\compiler\2dArrays.ts`
|
||||
|
||||
```Shell
|
||||
gulp runtests --tests=2dArrays
|
||||
|
||||
@@ -477,7 +477,6 @@ task("runtests-parallel").flags = {
|
||||
" --workers=<number>": "The number of parallel workers to use.",
|
||||
" --timeout=<ms>": "Overrides the default test timeout.",
|
||||
" --built": "Compile using the built version of the compiler.",
|
||||
" --skipPercent=<number>": "Skip expensive tests with <percent> chance to miss an edit. Default 5%.",
|
||||
" --shards": "Total number of shards running tests (default: 1)",
|
||||
" --shardId": "1-based ID of this shard (default: 1)",
|
||||
};
|
||||
|
||||
@@ -441,7 +441,7 @@
|
||||
"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391": "Implementace funkce chybí nebo nenásleduje hned po deklaraci.",
|
||||
"Function_implementation_name_must_be_0_2389": "Název implementace funkce musí být {0}.",
|
||||
"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024": "Funkce implicitně obsahuje návratový typ any, protože neobsahuje anotaci návratového typu a odkazuje se na ni přímo nebo nepřímo v jednom z jejích návratových výrazů.",
|
||||
"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Ve funkci chybí koncový návratový příkaz a návratový typ neobsahuje undefined.",
|
||||
"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Ve funkci chybí koncový příkaz return a návratový typ neobsahuje undefined.",
|
||||
"Function_overload_must_be_static_2387": "Přetížení funkce musí být statické.",
|
||||
"Function_overload_must_not_be_static_2388": "Přetížení funkce nesmí být statické.",
|
||||
"Generate_get_and_set_accessors_95046": "Generovat přístupové objekty get a set",
|
||||
|
||||
@@ -1032,7 +1032,7 @@
|
||||
"await_expression_is_only_allowed_within_an_async_function_1308": "Der Ausdruck \"await\" ist nur in einer asynchronen Funktion zulässig.",
|
||||
"await_expressions_cannot_be_used_in_a_parameter_initializer_2524": "await-Ausdrücke dürfen nicht in einem Parameterinitialisierer verwendet werden.",
|
||||
"baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106": "Die Option \"baseUrl\" ist auf \"{0}\" festgelegt. Dieser Wert wird verwendet, um den nicht relativen Modulnamen \"{1}\" aufzulösen.",
|
||||
"can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312": "\"=\" kann nur in einer Objektliteraleigenschaft innerhalb eines Destrukturierungsauftrags verwendet werden.",
|
||||
"can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312": "\"=\" kann nur in einer Objektliteraleigenschaft innerhalb eines Destrukturierungszuweisung verwendet werden.",
|
||||
"case_or_default_expected_1130": "\"case\" oder \"default\" wurde erwartet.",
|
||||
"class_expressions_are_not_currently_supported_9003": "class-Ausdrücke werden zurzeit nicht unterstützt.",
|
||||
"const_declarations_can_only_be_declared_inside_a_block_1156": "const-Deklarationen können nur innerhalb eines Blocks deklariert werden.",
|
||||
|
||||
@@ -441,7 +441,7 @@
|
||||
"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391": "Falta la implementación de función o no sigue inmediatamente a la declaración.",
|
||||
"Function_implementation_name_must_be_0_2389": "El nombre de la implementación de función debe ser '{0}'.",
|
||||
"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024": "La función tiene el tipo de valor devuelto \"any\" implícitamente porque no tiene una anotación de tipo de valor devuelto y se hace referencia a ella directa o indirectamente en una de sus expresiones return.",
|
||||
"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Falta la instrucción return final en la función y el tipo de valor devuelto no incluye 'undefined'.",
|
||||
"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Falta la instrucción \"return\" final en la función y el tipo de valor devuelto no incluye 'undefined'.",
|
||||
"Function_overload_must_be_static_2387": "La sobrecarga de función debe ser estática.",
|
||||
"Function_overload_must_not_be_static_2388": "La sobrecarga de función no debe ser estática.",
|
||||
"Generate_get_and_set_accessors_95046": "Generar los descriptores de acceso \"get\" y \"set\"",
|
||||
@@ -453,7 +453,7 @@
|
||||
"Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220": "Los generadores solo están disponibles cuando el destino es ECMAScript 2015 o una versión posterior.",
|
||||
"Generic_type_0_requires_1_type_argument_s_2314": "El tipo genérico '{0}' requiere los siguientes argumentos de tipo: {1}.",
|
||||
"Generic_type_0_requires_between_1_and_2_type_arguments_2707": "El tipo genérico \"{0}\" requiere entre {1} y {2} argumentos de tipo.",
|
||||
"Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550": "La creación de instancias de tipo genérico es excesivamente profunda y posiblemente infinita.",
|
||||
"Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550": "La creación de una instancia de tipo genérico es excesivamente profunda y posiblemente infinita.",
|
||||
"Getter_and_setter_accessors_do_not_agree_in_visibility_2379": "Los descriptores de acceso de captador y establecedor no se corresponden respecto a la visibilidad.",
|
||||
"Global_module_exports_may_only_appear_at_top_level_1316": "Las exportaciones de módulos globales solo pueden aparecer en el nivel superior.",
|
||||
"Global_module_exports_may_only_appear_in_declaration_files_1315": "Las exportaciones de módulos globales solo pueden aparecer en archivos de declaración.",
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
"An_async_iterator_must_have_a_next_method_2519": "Un itérateur asynchrone doit comporter une méthode 'next()'.",
|
||||
"An_element_access_expression_should_take_an_argument_1011": "Une expression d'accès à un élément doit accepter un argument.",
|
||||
"An_enum_member_cannot_have_a_numeric_name_2452": "Un membre enum ne peut pas avoir un nom numérique.",
|
||||
"An_export_assignment_can_only_be_used_in_a_module_1231": "Une attribution d'exportation peut uniquement être utilisée dans un module.",
|
||||
"An_export_assignment_can_only_be_used_in_a_module_1231": "Une affectation d'exportation peut uniquement être utilisée dans un module.",
|
||||
"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309": "Impossible d'utiliser une assignation d'exportation dans un module comportant d'autres éléments exportés.",
|
||||
"An_export_assignment_cannot_be_used_in_a_namespace_1063": "Une affectation d'exportation ne peut pas être utilisée dans un espace de noms.",
|
||||
"An_export_assignment_cannot_have_modifiers_1120": "Une assignation d'exportation ne peut pas avoir de modificateurs.",
|
||||
@@ -594,7 +594,7 @@
|
||||
"No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003": "Aucune entrée dans le fichier config '{0}'. Les chemins 'include' spécifiés étaient '{1}' et les chemins 'exclude' étaient '{2}'.",
|
||||
"Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515": "La classe non abstraite '{0}' n'implémente pas le membre abstrait '{1}' hérité de la classe '{2}'.",
|
||||
"Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653": "L'expression de classe non abstraite '{0}' n'implémente pas le membre abstrait hérité '{0}' de la classe '{1}'.",
|
||||
"Not_all_code_paths_return_a_value_7030": "Les chemins de code ne retournent pas tous une valeur.",
|
||||
"Not_all_code_paths_return_a_value_7030": "Les chemins du code ne retournent pas tous une valeur.",
|
||||
"Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413": "Impossible d'assigner le type d'index numérique '{0}' au type d'index de chaîne '{1}'.",
|
||||
"Numeric_separators_are_not_allowed_here_6188": "Les séparateurs numériques ne sont pas autorisés ici.",
|
||||
"Object_is_of_type_unknown_2571": "L'objet est de type 'unknown'.",
|
||||
@@ -745,7 +745,7 @@
|
||||
"Remove_unused_label_95053": "Supprimer l'étiquette inutilisée",
|
||||
"Remove_variable_statement_90010": "Supprimer l'instruction de variable",
|
||||
"Replace_import_with_0_95015": "Remplacez l'importation par '{0}'.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Signalez une erreur quand les chemins de code de la fonction ne retournent pas tous une valeur.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Signalez une erreur quand les chemins du code de la fonction ne retournent pas tous une valeur.",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Signalez les erreurs pour les case avec fallthrough dans une instruction switch.",
|
||||
"Report_errors_in_js_files_8019": "Signalez les erreurs dans les fichiers .js.",
|
||||
"Report_errors_on_unused_locals_6134": "Signaler les erreurs sur les variables locales inutilisées.",
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "'--isolatedModules' フラグが指定されている場合、アンビエント const 列挙型は使用できません。",
|
||||
"Ambient_module_declaration_cannot_specify_relative_module_name_2436": "アンビエント モジュール宣言では、相対モジュール名を指定できません。",
|
||||
"Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435": "アンビエント モジュールを、他のモジュールまたは名前空間内の入れ子にすることはできません。",
|
||||
"An_AMD_module_cannot_have_multiple_name_assignments_2458": "AMD モジュールに複数の名前を割り当てることはできません。",
|
||||
"An_AMD_module_cannot_have_multiple_name_assignments_2458": "AMD モジュールに複数の名前を代入することはできません。",
|
||||
"An_abstract_accessor_cannot_have_an_implementation_1318": "抽象アクセサーに実装を含めることはできません。",
|
||||
"An_accessor_cannot_be_declared_in_an_ambient_context_1086": "環境コンテキストではアクセサーは宣言できません。",
|
||||
"An_accessor_cannot_have_type_parameters_1094": "アクセサーに型パラメーターを指定することはできません。",
|
||||
@@ -142,10 +142,10 @@
|
||||
"An_async_iterator_must_have_a_next_method_2519": "非同期反復子には 'next()' メソッドが必要です。",
|
||||
"An_element_access_expression_should_take_an_argument_1011": "要素アクセス式では、引数を取る必要があります。",
|
||||
"An_enum_member_cannot_have_a_numeric_name_2452": "列挙型メンバーに数値名を含めることはできません。",
|
||||
"An_export_assignment_can_only_be_used_in_a_module_1231": "エクスポートの割り当てはモジュールでのみ使用可能です。",
|
||||
"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309": "エクスポートの割り当ては、エクスポートされた他の要素を含むモジュールでは使用できません。",
|
||||
"An_export_assignment_cannot_be_used_in_a_namespace_1063": "エクスポートの割り当ては、名前空間では使用できません。",
|
||||
"An_export_assignment_cannot_have_modifiers_1120": "エクスポートの割り当てに修飾子を指定することはできません。",
|
||||
"An_export_assignment_can_only_be_used_in_a_module_1231": "エクスポートの代入はモジュールでのみ使用可能です。",
|
||||
"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309": "エクスポートの代入は、エクスポートされた他の要素を含むモジュールでは使用できません。",
|
||||
"An_export_assignment_cannot_be_used_in_a_namespace_1063": "エクスポートの代入は、名前空間では使用できません。",
|
||||
"An_export_assignment_cannot_have_modifiers_1120": "エクスポートの代入に修飾子を指定することはできません。",
|
||||
"An_export_declaration_can_only_be_used_in_a_module_1233": "エクスポート宣言はモジュールでのみ使用可能です。",
|
||||
"An_export_declaration_cannot_have_modifiers_1193": "エクスポート宣言に修飾子を指定することはできません。",
|
||||
"An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198": "拡張された Unicode エスケープ値は 0x0 と 0x10FFFF の間 (両端を含む) でなければなりません。",
|
||||
@@ -389,8 +389,8 @@
|
||||
"Experimental_Options_6177": "試験的なオプション",
|
||||
"Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "デコレーターの実験的なサポートは将来のリリースで変更になる可能性がある機能です。'experimentalDecorators' オプションを設定してこの警告を削除します。",
|
||||
"Explicitly_specified_module_resolution_kind_Colon_0_6087": "明示的に指定されたモジュール解決の種類 '{0}'。",
|
||||
"Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "ECMAScript モジュールを対象にする場合は、エクスポート割り当てを使用できません。代わりに 'export default' または別のモジュール書式の使用をご検討ください。",
|
||||
"Export_assignment_is_not_supported_when_module_flag_is_system_1218": "割り当てのエクスポートは、'--module' フラグが 'system' の場合にはサポートされません。",
|
||||
"Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "ECMAScript モジュールを対象にする場合は、エクスポート代入を使用できません。代わりに 'export default' または別のモジュール書式の使用をご検討ください。",
|
||||
"Export_assignment_is_not_supported_when_module_flag_is_system_1218": "代入のエクスポートは、'--module' フラグが 'system' の場合にはサポートされません。",
|
||||
"Export_declaration_conflicts_with_exported_declaration_of_0_2484": "エクスポート宣言が、'{0}' のエクスポートされた宣言と競合しています。",
|
||||
"Export_declarations_are_not_permitted_in_a_namespace_1194": "エクスポート宣言は名前空間でサポートされません。",
|
||||
"Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656": "エクスポートされた外部パッケージの型指定のファイル '{0}' はモジュールではありません。パッケージ定義を更新する場合は、パッケージの作成者にお問い合わせください。",
|
||||
@@ -399,7 +399,7 @@
|
||||
"Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023": "エクスポートされた変数 '{0}' が外部モジュール {2} の名前 '{1}' を持っているか使用していますが、名前を指定することはできません。",
|
||||
"Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024": "エクスポートされた変数 '{0}' がプライベート モジュール '{2}' の名前 '{1}' を持っているか、使用しています。",
|
||||
"Exported_variable_0_has_or_is_using_private_name_1_4025": "エクスポートされた変数 '{0}' がプライベート名 '{1}' を持っているか、使用しています。",
|
||||
"Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666": "エクスポートとエクスポートの割り当てはモジュールの拡張では許可されていません。",
|
||||
"Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666": "エクスポートとエクスポートの代入はモジュールの拡張では許可されていません。",
|
||||
"Expression_expected_1109": "式が必要です。",
|
||||
"Expression_or_comma_expected_1137": "式またはコンマが必要です。",
|
||||
"Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402": "式は、コンパイラが基底クラスの参照をキャプチャするために使用する '_super' に解決されます。",
|
||||
@@ -473,7 +473,7 @@
|
||||
"Implement_interface_0_90006": "インターフェイス '{0}' を実装する",
|
||||
"Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019": "エクスポートされたクラス '{0}' の Implements 句がプライベート名 '{1}' を持っているか、使用しています。",
|
||||
"Import_0_from_module_1_90013": "モジュール \"{1}\" から '{0}' をインポートする",
|
||||
"Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_1202": "ECMAScript モジュールを対象にする場合は、インポート割り当てを使用できません。代わりに 'import * as ns from \"mod\"'、'import {a} from \"mod\"'、'import d from \"mod\"' などのモジュール書式の使用をご検討ください。",
|
||||
"Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_1202": "ECMAScript モジュールを対象にする場合は、インポート代入を使用できません。代わりに 'import * as ns from \"mod\"'、'import {a} from \"mod\"'、'import d from \"mod\"' などのモジュール書式の使用をご検討ください。",
|
||||
"Import_declaration_0_is_using_private_name_1_4000": "インポート宣言 '{0}' がプライベート名 '{1}' を使用しています。",
|
||||
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "インポート宣言が、'{0}' のローカル宣言と競合しています。",
|
||||
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "名前空間内のインポート宣言は、モジュールを参照できません。",
|
||||
@@ -536,7 +536,7 @@
|
||||
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "JSX 要素に同じ名前の複数の属性を指定することはできません。",
|
||||
"JSX_expressions_must_have_one_parent_element_2657": "JSX 式には 1 つの親要素が必要です。",
|
||||
"JSX_fragment_has_no_corresponding_closing_tag_17014": "JSX フラグメントには対応する終了タグがありません。",
|
||||
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "JSX フラグメントはインライン JSX ファクトリ プラグマの使用時にサポートされていません",
|
||||
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "JSX フラグメントはインライン JSX ファクトリ pragma の使用時にサポートされていません",
|
||||
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "--jsxFactory を使う場合、JSX フラグメントはサポートされません",
|
||||
"JSX_spread_child_must_be_an_array_type_2609": "JSX スプレッドの子は、配列型でなければなりません。",
|
||||
"Jump_target_cannot_cross_function_boundary_1107": "ジャンプ先は関数の境界を越えることはできません。",
|
||||
@@ -714,7 +714,7 @@
|
||||
"Property_0_of_exported_interface_has_or_is_using_private_name_1_4033": "エクスポートされたインターフェイスのプロパティ '{0}' が、プライベート名 '{1}' を持っているか、使用しています。",
|
||||
"Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412": "型 '{1}' のプロパティ '{0}' を数値インデックス型 '{2}' に割り当てることはできません。",
|
||||
"Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411": "型 '{1}' のプロパティ '{0}' を文字列インデックス型 '{2}' に割り当てることはできません。",
|
||||
"Property_assignment_expected_1136": "プロパティの割り当てが必要です。",
|
||||
"Property_assignment_expected_1136": "プロパティの代入が必要です。",
|
||||
"Property_destructuring_pattern_expected_1180": "プロパティの非構造化パターンが必要です。",
|
||||
"Property_or_signature_expected_1131": "プロパティまたはシグネチャが必要です。",
|
||||
"Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328": "プロパティ値には、文字列リテラル、数値リテラル、'true'、'false'、'null'、オブジェクト リテラルまたは配列リテラルのみ使用できます。",
|
||||
@@ -850,7 +850,7 @@
|
||||
"The_character_set_of_the_input_files_6163": "入力ファイルの文字セット。",
|
||||
"The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "含まれている関数またはモジュールの本体は、制御フロー解析には大きすぎます。",
|
||||
"The_current_host_does_not_support_the_0_option_5001": "現在のホストは '{0}' オプションをサポートしていません。",
|
||||
"The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "エクスポートの割り当ての式は、環境コンテキストの識別子または修飾名にする必要があります。",
|
||||
"The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "エクスポートの代入の式は、環境コンテキストの識別子または修飾名にする必要があります。",
|
||||
"The_files_list_in_config_file_0_is_empty_18002": "構成ファイル '{0}' の 'files' リストが空です。",
|
||||
"The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060": "Promise では、'then' メソッドの最初のパラメーターはコールバックでなければなりません。",
|
||||
"The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "グローバル型 'JSX.{0}' には複数のプロパティが含まれていない可能性があります。",
|
||||
@@ -882,7 +882,7 @@
|
||||
"The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "instanceof' 式の右辺には、'any' 型、または 'Function' インターフェイス型に割り当てることができる型を指定してください。",
|
||||
"The_specified_path_does_not_exist_Colon_0_5058": "指定されたパスがありません: '{0}'。",
|
||||
"The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541": "代入式のターゲットは、変数またはプロパティ アクセスである必要があります。",
|
||||
"The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701": "オブジェクトの残り部分の割り当ての対象は、変数またはプロパティ アクセスである必要があります。",
|
||||
"The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701": "オブジェクトの残り部分の代入の対象は、変数またはプロパティ アクセスである必要があります。",
|
||||
"The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684": "型 '{0}' の 'this' コンテキストを型 '{1}' のメソッドの 'this' に割り当てることはできません。",
|
||||
"The_this_types_of_each_signature_are_incompatible_2685": "各シグネチャの 'this' 型に互換性がありません。",
|
||||
"The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453": "型パラメーター '{0}' の型引数を使用法から推論することはできません。型引数を明示的に指定してください。",
|
||||
@@ -1032,14 +1032,14 @@
|
||||
"await_expression_is_only_allowed_within_an_async_function_1308": "'await' 式は、非同期関数内でのみ使用できます。",
|
||||
"await_expressions_cannot_be_used_in_a_parameter_initializer_2524": "'await' 式は、パラメーター初期化子では使用できません。",
|
||||
"baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106": "'baseUrl' オプションは '{0}' に設定され、この値を使用して非相対モジュール名 '{1}' を解決します。",
|
||||
"can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312": "'=' は、非構造化割り当て内のオブジェクト リテラル プロパティでのみ使用できます。",
|
||||
"can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312": "'=' は、非構造化代入内のオブジェクト リテラル プロパティでのみ使用できます。",
|
||||
"case_or_default_expected_1130": "'case' または 'default' が必要です。",
|
||||
"class_expressions_are_not_currently_supported_9003": "'class' 式は現在サポートされていません。",
|
||||
"const_declarations_can_only_be_declared_inside_a_block_1156": "'const' 宣言は、ブロック内でのみ宣言できます。",
|
||||
"const_declarations_must_be_initialized_1155": "'const' 宣言は初期化する必要があります。",
|
||||
"const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477": "'const' 列挙型メンバーの初期化子が、無限値に評価されました。",
|
||||
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "'const' 列挙型メンバーの初期化子が、許可されない値 'NaN' に評価されました。",
|
||||
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "'const' 列挙型は、プロパティまたはインデックスのアクセス式、インポート宣言またはエクスポートの割り当ての右辺、型のクエリにのみ使用できます。",
|
||||
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "'const' 列挙型は、プロパティまたはインデックスのアクセス式、インポート宣言またはエクスポートの代入の右辺、型のクエリにのみ使用できます。",
|
||||
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "厳格モードでは 'delete' を識別子で呼び出すことはできません。",
|
||||
"delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "これを削除します - プロジェクト '{0}' は、以前にビルドされているため、最新の状態です",
|
||||
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "'列挙型宣言' を使用できるのは .ts ファイル内のみです。",
|
||||
|
||||
Vendored
+2
-2
@@ -9782,7 +9782,7 @@ interface ImageData {
|
||||
declare var ImageData: {
|
||||
prototype: ImageData;
|
||||
new(width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height?: number): ImageData;
|
||||
};
|
||||
|
||||
interface InnerHTML {
|
||||
@@ -19103,7 +19103,7 @@ declare namespace WebAssembly {
|
||||
|
||||
var Instance: {
|
||||
prototype: Instance;
|
||||
new(module: Module, importObject?: any): Instance;
|
||||
new(module: Module, importObject?: Imports): Instance;
|
||||
};
|
||||
|
||||
interface LinkError {
|
||||
|
||||
Vendored
+8
-8
@@ -702,8 +702,8 @@ interface Math {
|
||||
/** Returns a pseudorandom number between 0 and 1. */
|
||||
random(): number;
|
||||
/**
|
||||
* Returns a supplied numeric expression rounded to the nearest number.
|
||||
* @param x The value to be rounded to the nearest number.
|
||||
* Returns a supplied numeric expression rounded to the nearest integer.
|
||||
* @param x The value to be rounded to the nearest integer.
|
||||
*/
|
||||
round(x: number): number;
|
||||
/**
|
||||
@@ -893,12 +893,12 @@ interface DateConstructor {
|
||||
/**
|
||||
* Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
|
||||
* @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
|
||||
* @param month The month as an number between 0 and 11 (January to December).
|
||||
* @param date The date as an number between 1 and 31.
|
||||
* @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour.
|
||||
* @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes.
|
||||
* @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds.
|
||||
* @param ms An number from 0 to 999 that specifies the milliseconds.
|
||||
* @param month The month as a number between 0 and 11 (January to December).
|
||||
* @param date The date as a number between 1 and 31.
|
||||
* @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
|
||||
* @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
|
||||
* @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
|
||||
* @param ms A number from 0 to 999 that specifies the milliseconds.
|
||||
*/
|
||||
UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
|
||||
now(): number;
|
||||
|
||||
Vendored
+2
-2
@@ -2222,7 +2222,7 @@ interface ImageData {
|
||||
declare var ImageData: {
|
||||
prototype: ImageData;
|
||||
new(width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height?: number): ImageData;
|
||||
};
|
||||
|
||||
/** This Channel Messaging API interface allows us to create a new message channel and send data through it via its two MessagePort properties. */
|
||||
@@ -5629,7 +5629,7 @@ declare namespace WebAssembly {
|
||||
|
||||
var Instance: {
|
||||
prototype: Instance;
|
||||
new(module: Module, importObject?: any): Instance;
|
||||
new(module: Module, importObject?: Imports): Instance;
|
||||
};
|
||||
|
||||
interface Memory {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249": "Dekorator może dekorować jedynie implementację metody, a nie przeciążenie.",
|
||||
"A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113": "Klauzula „default” nie może występować więcej niż raz w instrukcji „switch”.",
|
||||
"A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319": "Eksport domyślny może być używany tylko w module w stylu języka ECMAScript.",
|
||||
"A_definite_assignment_assertion_is_not_permitted_in_this_context_1255": "Asercja określonego przydziału „!” nie jest dozwolona w tym kontekście.",
|
||||
"A_definite_assignment_assertion_is_not_permitted_in_this_context_1255": "Asercja określonego przypisania „!” nie jest dozwolona w tym kontekście.",
|
||||
"A_destructuring_declaration_must_have_an_initializer_1182": "Deklaracja usuwająca strukturę musi mieć inicjator.",
|
||||
"A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declarat_2712": "Wywołanie dynamicznego importowania w wersji ES5/ES3 wymaga konstruktora „Promise”. Upewnij się, że masz deklarację dla konstruktora „Promise”, lub uwzględnij wartość „ES2015” w opcji „--lib”.",
|
||||
"A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711": "Wywołanie dynamicznego importowania zwraca element „Promise”. Upewnij się, że masz deklarację elementu „Promise” lub uwzględnij wartość „ES2015” w opcji „--lib”.",
|
||||
@@ -441,7 +441,7 @@
|
||||
"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391": "Brak implementacji funkcji lub nie występuje ona bezpośrednio po deklaracji.",
|
||||
"Function_implementation_name_must_be_0_2389": "Implementacja funkcji musi mieć nazwę „{0}”.",
|
||||
"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024": "Dla funkcji niejawnie określono zwracany typ „any”, ponieważ nie zawiera ona adnotacji zwracanego typu i jest przywoływana bezpośrednio lub pośrednio w jednym z jej zwracanych wyrażeń.",
|
||||
"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Funkcja nie zawiera końcowej instrukcji „return”, a zwracany typ nie obejmuje wartości „undefined”.",
|
||||
"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "Funkcja nie zawiera końcowej instrukcji return, a zwracany typ nie obejmuje wartości „undefined”.",
|
||||
"Function_overload_must_be_static_2387": "Przeciążenie funkcji musi być statyczne.",
|
||||
"Function_overload_must_not_be_static_2388": "Przeciążenie funkcji nie może być statyczne.",
|
||||
"Generate_get_and_set_accessors_95046": "Generuj metody dostępu „get” i „set”.",
|
||||
@@ -594,7 +594,7 @@
|
||||
"No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003": "Nie można znaleźć danych wejściowych w pliku konfiguracji „{0}”. Określone ścieżki „include” to „{1}”, a „exclude” to „{2}”.",
|
||||
"Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515": "Klasa nieabstrakcyjna „{0}” nie implementuje odziedziczonej abstrakcyjnej składowej „{1}” z klasy „{2}”.",
|
||||
"Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653": "Wyrażenie klasy nieabstrakcyjnej nie implementuje odziedziczonej abstrakcyjnej składowej „{0}” z klasy „{1}”.",
|
||||
"Not_all_code_paths_return_a_value_7030": "Nie wszystkie ścieżki kodu zwracają wartość.",
|
||||
"Not_all_code_paths_return_a_value_7030": "Nie wszystkie ścieżki w kodzie zwracają wartość.",
|
||||
"Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413": "Nie można przypisać typu indeksu numerycznego „{0}” do typu indeksu ciągu „{1}”.",
|
||||
"Numeric_separators_are_not_allowed_here_6188": "Separatory liczbowe nie są dozwolone w tym miejscu.",
|
||||
"Object_is_of_type_unknown_2571": "Obiekt jest typu „nieznany”.",
|
||||
@@ -745,7 +745,7 @@
|
||||
"Remove_unused_label_95053": "Usuń nieużywaną etykietę",
|
||||
"Remove_variable_statement_90010": "Usuń instrukcję zmiennej",
|
||||
"Replace_import_with_0_95015": "Zamień import na element „{0}”.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Zgłoś błąd, gdy nie wszystkie ścieżki kodu zwracają wartość.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Zgłoś błąd, gdy nie wszystkie ścieżki w kodzie zwracają wartość.",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Zgłoś błędy dla przepuszczających klauzul case w instrukcji switch.",
|
||||
"Report_errors_in_js_files_8019": "Zgłaszaj błędy w plikach js.",
|
||||
"Report_errors_on_unused_locals_6134": "Raportuj błędy dla nieużywanych elementów lokalnych.",
|
||||
|
||||
Vendored
+10
-2
@@ -652,9 +652,11 @@ declare namespace ts.server.protocol {
|
||||
interface DefinitionResponse extends Response {
|
||||
body?: FileSpanWithContext[];
|
||||
}
|
||||
interface DefinitionInfoAndBoundSpanReponse extends Response {
|
||||
interface DefinitionInfoAndBoundSpanResponse extends Response {
|
||||
body?: DefinitionInfoAndBoundSpan;
|
||||
}
|
||||
/** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */
|
||||
type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse;
|
||||
/**
|
||||
* Definition response message. Gives text range for definition.
|
||||
*/
|
||||
@@ -2317,7 +2319,13 @@ declare namespace ts.server.protocol {
|
||||
* For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
|
||||
*/
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
/**
|
||||
* Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled,
|
||||
* member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined
|
||||
* values, with insertion text to replace preceding `.` tokens with `?.`.
|
||||
*/
|
||||
readonly includeAutomaticOptionalChainCompletions?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
readonly lazyConfiguredProjectsFromExternalProject?: boolean;
|
||||
readonly providePrefixAndSuffixTextForRename?: boolean;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249": "Декоратор может только декорировать реализацию метода, а не перегрузку.",
|
||||
"A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113": "Предложение default не может повторяться в операторе switch.",
|
||||
"A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319": "Экспорт по умолчанию можно использовать только в модуле в стиле ECMAScript.",
|
||||
"A_definite_assignment_assertion_is_not_permitted_in_this_context_1255": "Утверждение определенного присваивания \"!\" запрещено в этом контексте.",
|
||||
"A_definite_assignment_assertion_is_not_permitted_in_this_context_1255": "Утверждение определенного назначения \"!\" запрещено в этом контексте.",
|
||||
"A_destructuring_declaration_must_have_an_initializer_1182": "Объявление деструктурирования должно включать инициализатор.",
|
||||
"A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declarat_2712": "Для вызова динамического импорта в ES5/ES3 требуется конструктор \"Promise\". Объявите конструктор \"Promise\" или включите \"ES2015\" в параметр \"--lib\".",
|
||||
"A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711": "Вызов динамического импорта возвращает конструктор \"Promise\". Объявите конструктор \"Promise\" или включите \"ES2015\" в параметр \"--lib\".",
|
||||
@@ -103,8 +103,8 @@
|
||||
"Add_all_missing_super_calls_95039": "Добавить все отсутствующие вызовы super",
|
||||
"Add_async_modifier_to_containing_function_90029": "Добавьте модификатор async в содержащую функцию",
|
||||
"Add_braces_to_arrow_function_95059": "Добавить скобки в стрелочную функцию",
|
||||
"Add_definite_assignment_assertion_to_property_0_95020": "Добавить утверждение определенного присваивания к свойству \"{0}\"",
|
||||
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Добавить утверждения определенного присваивания ко всем неинициализированным свойствам",
|
||||
"Add_definite_assignment_assertion_to_property_0_95020": "Добавить утверждение определенного назначения к свойству \"{0}\"",
|
||||
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Добавить утверждения определенного назначения ко всем неинициализированным свойствам",
|
||||
"Add_index_signature_for_property_0_90017": "Добавьте сигнатуру индекса для свойства \"{0}\"",
|
||||
"Add_initializer_to_property_0_95019": "Добавить инициализатор к свойству \"{0}\"",
|
||||
"Add_initializers_to_all_uninitialized_properties_95027": "Добавить инициализаторы ко всем неинициализированным свойствам",
|
||||
@@ -130,7 +130,7 @@
|
||||
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "Перечисление внешних констант не разрешено, если задан флаг \"--isolatedModules\".",
|
||||
"Ambient_module_declaration_cannot_specify_relative_module_name_2436": "Объявление окружающего модуля не может содержать относительное имя модуля.",
|
||||
"Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435": "Внешний модуль не может быть вложен в другие модули или пространства имен.",
|
||||
"An_AMD_module_cannot_have_multiple_name_assignments_2458": "Модуль AMD не может иметь несколько присваиваний имен.",
|
||||
"An_AMD_module_cannot_have_multiple_name_assignments_2458": "Модуль AMD не может иметь несколько назначений имен.",
|
||||
"An_abstract_accessor_cannot_have_an_implementation_1318": "У абстрактного метода доступа не может быть реализации.",
|
||||
"An_accessor_cannot_be_declared_in_an_ambient_context_1086": "Метод доступа нельзя объявить в окружающем контексте.",
|
||||
"An_accessor_cannot_have_type_parameters_1094": "Метод доступа не может иметь параметры типа.",
|
||||
@@ -142,10 +142,10 @@
|
||||
"An_async_iterator_must_have_a_next_method_2519": "В асинхронном итераторе должен быть метод next().",
|
||||
"An_element_access_expression_should_take_an_argument_1011": "Выражение доступа к элементу должно принимать аргумент.",
|
||||
"An_enum_member_cannot_have_a_numeric_name_2452": "Имя элемента перечисления не может быть числовым.",
|
||||
"An_export_assignment_can_only_be_used_in_a_module_1231": "Присваивание экспорта может быть использовано только в модуле.",
|
||||
"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309": "Присваивание экспорта нельзя использовать в модуле с другими экспортированными элементами.",
|
||||
"An_export_assignment_cannot_be_used_in_a_namespace_1063": "Присваивание экспорта нельзя использовать в пространстве имен.",
|
||||
"An_export_assignment_cannot_have_modifiers_1120": "Присваивание экспорта не может иметь модификаторы.",
|
||||
"An_export_assignment_can_only_be_used_in_a_module_1231": "Назначение экспорта может быть использовано только в модуле.",
|
||||
"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309": "Назначение экспорта нельзя использовать в модуле с другими экспортированными элементами.",
|
||||
"An_export_assignment_cannot_be_used_in_a_namespace_1063": "Назначение экспорта нельзя использовать в пространстве имен.",
|
||||
"An_export_assignment_cannot_have_modifiers_1120": "Назначение экспорта не может иметь модификаторы.",
|
||||
"An_export_declaration_can_only_be_used_in_a_module_1233": "Объявление экспорта может быть использовано только в модуле.",
|
||||
"An_export_declaration_cannot_have_modifiers_1193": "Объявление экспорта не может иметь модификаторы.",
|
||||
"An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198": "Расширенное escape-значение в Юникоде должно быть в пределах от 0x0 до 0x10FFFF включительно.",
|
||||
@@ -390,7 +390,7 @@
|
||||
"Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "Экспериментальная поддержка для декораторов — это функция, которая будет изменена в будущем выпуске. Задайте параметр experimentalDecorators, чтобы удалить это предупреждение.",
|
||||
"Explicitly_specified_module_resolution_kind_Colon_0_6087": "Явно указанный тип разрешения модуля: \"{0}\".",
|
||||
"Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "Назначение экспорта невозможно использовать при разработке для модулей ECMAScript. Попробуйте использовать \"export default\" или другой формат модуля.",
|
||||
"Export_assignment_is_not_supported_when_module_flag_is_system_1218": "Присваивание экспорта не поддерживается, если флаг \"--module\" имеет значение \"system\".",
|
||||
"Export_assignment_is_not_supported_when_module_flag_is_system_1218": "Назначение экспорта не поддерживается, если флаг \"--module\" имеет значение \"system\".",
|
||||
"Export_declaration_conflicts_with_exported_declaration_of_0_2484": "Объявление экспорта конфликтует с экспортированным объявлением \"{0}\".",
|
||||
"Export_declarations_are_not_permitted_in_a_namespace_1194": "Объявления экспорта не разрешены в пространстве имен.",
|
||||
"Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656": "Файл экспортированных внешних типизаций пакета \"{0}\" не является модулем. Обратитесь к автору пакета для обновления определения пакета.",
|
||||
@@ -441,7 +441,7 @@
|
||||
"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391": "Реализация функции отсутствует либо не идет сразу после объявления.",
|
||||
"Function_implementation_name_must_be_0_2389": "Имя реализации функции должно иметь значение \"{0}\".",
|
||||
"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024": "Функция неявно имеет тип возвращаемого значения any, так как у нее нет заметки с типом возвращаемого значения, а также на нее прямо или косвенно указывает ссылка в одном из ее выражений \"return\".",
|
||||
"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "В функции отсутствует завершающий оператор возвращаемого значения, а тип возвращаемого значения не включает undefined.",
|
||||
"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "В функции отсутствует завершающий оператор return, а тип возвращаемого значения не включает \"undefined\".",
|
||||
"Function_overload_must_be_static_2387": "Перегрузка функции должна быть статической.",
|
||||
"Function_overload_must_not_be_static_2388": "Перегрузка функции не должна быть статической.",
|
||||
"Generate_get_and_set_accessors_95046": "Создать методы доступа get и set",
|
||||
@@ -594,7 +594,7 @@
|
||||
"No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003": "Не удалось найти входные данные в файле конфигурации \"{0}\". Указанные пути \"include\": \"{1}\", пути \"exclude\": \"{2}\".",
|
||||
"Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515": "Класс \"{0}\", не являющийся абстрактным, не реализует наследуемый абстрактный элемент \"{1}\" класса \"{2}\".",
|
||||
"Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653": "Выражение неабстрактного класса не реализует унаследованный абстрактный элемент \"{0}\" класса \"{1}\".",
|
||||
"Not_all_code_paths_return_a_value_7030": "Не все пути кода возвращают значение.",
|
||||
"Not_all_code_paths_return_a_value_7030": "Не все пути к коду возвращают значение.",
|
||||
"Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413": "Тип числового индекса \"{0}\" нельзя назначить типу строкового индекса \"{1}\".",
|
||||
"Numeric_separators_are_not_allowed_here_6188": "Числовые разделители здесь запрещены.",
|
||||
"Object_is_of_type_unknown_2571": "Объект имеет тип \"Неизвестный\".",
|
||||
@@ -714,7 +714,7 @@
|
||||
"Property_0_of_exported_interface_has_or_is_using_private_name_1_4033": "Свойство \"{0}\" экспортированного интерфейса имеет или использует закрытое имя \"{1}\".",
|
||||
"Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412": "Свойство \"{0}\" типа \"{1}\" нельзя назначить типу числового индекса \"{2}\".",
|
||||
"Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411": "Свойство \"{0}\" типа \"{1}\" нельзя назначить типу строкового индекса \"{2}\".",
|
||||
"Property_assignment_expected_1136": "Ожидалось присваивание свойства.",
|
||||
"Property_assignment_expected_1136": "Ожидалось назначение свойства.",
|
||||
"Property_destructuring_pattern_expected_1180": "Ожидался шаблон деструктурирования свойства.",
|
||||
"Property_or_signature_expected_1131": "Ожидалось свойство или сигнатура.",
|
||||
"Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328": "Значение свойства может быть только строковым или числовым литералом, True, False, Null, объектным литералом либо литералом массива.",
|
||||
@@ -745,7 +745,7 @@
|
||||
"Remove_unused_label_95053": "Удалить неиспользуемую метку",
|
||||
"Remove_variable_statement_90010": "Удалить оператор с переменной",
|
||||
"Replace_import_with_0_95015": "Замена импорта на \"{0}\".",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Сообщать об ошибке, если не все пути кода в функции возвращают значение.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Сообщать об ошибке, если не все пути к коду в функции возвращают значение.",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Сообщать об ошибках для случаев передачи управления в операторе switch.",
|
||||
"Report_errors_in_js_files_8019": "Сообщать об ошибках в JS-файлах.",
|
||||
"Report_errors_on_unused_locals_6134": "Сообщать об ошибках в неиспользованных локальных переменных.",
|
||||
@@ -850,7 +850,7 @@
|
||||
"The_character_set_of_the_input_files_6163": "Кодировка входных файлов.",
|
||||
"The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Содержащая функция или текст модуля слишком велики для анализа потока управления.",
|
||||
"The_current_host_does_not_support_the_0_option_5001": "Текущий узел не поддерживает параметр \"{0}\".",
|
||||
"The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "Выражение присваивания экспорта должно представлять собой идентификатор или полное имя в окружающем контексте.",
|
||||
"The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "Выражение назначения экспорта должно представлять собой идентификатор или полное имя в окружающем контексте.",
|
||||
"The_files_list_in_config_file_0_is_empty_18002": "Список \"files\" в файле конфигурации \"{0}\" пуст.",
|
||||
"The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060": "Первым параметром метода then класса promise должен быть обратный вызов.",
|
||||
"The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "Глобальный тип \"JSX.{0}\" не может иметь больше одного свойства.",
|
||||
@@ -1039,7 +1039,7 @@
|
||||
"const_declarations_must_be_initialized_1155": "Объявления \"const\" должны быть инициализированы.",
|
||||
"const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477": "Инициализатор элементов перечисления const был вычислен в неконечное значение.",
|
||||
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "Инициализатор элементов перечисления const был вычислен в запрещенное значение NaN.",
|
||||
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "Перечисления const можно использовать только в выражениях доступа к свойству или индексу, а также в правой части объявления импорта, присваивания экспорта или запроса типа.",
|
||||
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "Перечисления const можно использовать только в выражениях доступа к свойству или индексу, а также в правой части объявления импорта, назначения экспорта или запроса типа.",
|
||||
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "Невозможно вызвать оператор delete с идентификатором в строгом режиме.",
|
||||
"delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "удалить это — проект \"{0}\" не требует обновления, так как был собран ранее",
|
||||
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "Объявления перечислений можно использовать только в TS-файле.",
|
||||
|
||||
@@ -453,7 +453,7 @@
|
||||
"Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220": "Oluşturucular yalnızca ECMEAScript 2015 veya üstü hedeflenirken kullanılabilir.",
|
||||
"Generic_type_0_requires_1_type_argument_s_2314": "'{0}' genel türü, {1} tür bağımsız değişkenini gerektiriyor.",
|
||||
"Generic_type_0_requires_between_1_and_2_type_arguments_2707": "'{0}' genel türü {1} ile {2} arasında bağımsız değişken gerektirir.",
|
||||
"Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550": "Genel tür oluşturma işlemi, fazla ayrıntılı ve büyük olasılıkla sınırsız.",
|
||||
"Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550": "Genel tür örneği oluşturma işlemi, fazla ayrıntılı ve büyük olasılıkla sınırsız.",
|
||||
"Getter_and_setter_accessors_do_not_agree_in_visibility_2379": "Alıcı ve ayarlayıcı erişimcileri görünürlükte anlaşamıyor.",
|
||||
"Global_module_exports_may_only_appear_at_top_level_1316": "Genel modül dışarı aktarmaları yalnızca en üst düzeyde görünebilir.",
|
||||
"Global_module_exports_may_only_appear_in_declaration_files_1315": "Genel modül dışarı aktarmaları yalnızca bildirim dosyalarında görünebilir.",
|
||||
|
||||
+1856
-1504
File diff suppressed because it is too large
Load Diff
+2250
-1731
File diff suppressed because it is too large
Load Diff
Vendored
+28
-7
@@ -14,7 +14,7 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
declare namespace ts {
|
||||
const versionMajorMinor = "3.7";
|
||||
const versionMajorMinor = "3.8";
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version: string;
|
||||
}
|
||||
@@ -1964,6 +1964,8 @@ declare namespace ts {
|
||||
DiagnosticsPresent_OutputsSkipped = 1,
|
||||
DiagnosticsPresent_OutputsGenerated = 2,
|
||||
InvalidProject_OutputsSkipped = 3,
|
||||
ProjectReferenceCycle_OutputsSkipped = 4,
|
||||
/** @deprecated Use ProjectReferenceCycle_OutputsSkipped instead. */
|
||||
ProjectReferenceCycle_OutputsSkupped = 4
|
||||
}
|
||||
export interface EmitResult {
|
||||
@@ -2376,6 +2378,7 @@ declare namespace ts {
|
||||
JSLiteral = 16384,
|
||||
FreshLiteral = 32768,
|
||||
ArrayLiteral = 65536,
|
||||
ObjectRestType = 131072,
|
||||
ClassOrInterface = 3,
|
||||
}
|
||||
export interface ObjectType extends Type {
|
||||
@@ -3169,8 +3172,9 @@ declare namespace ts {
|
||||
readonly disableSuggestions?: boolean;
|
||||
readonly quotePreference?: "auto" | "double" | "single";
|
||||
readonly includeCompletionsForModuleExports?: boolean;
|
||||
readonly includeAutomaticOptionalChainCompletions?: boolean;
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
|
||||
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
|
||||
readonly importModuleSpecifierEnding?: "minimal" | "index" | "js";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
@@ -3522,6 +3526,7 @@ declare namespace ts {
|
||||
function isCallExpression(node: Node): node is CallExpression;
|
||||
function isCallChain(node: Node): node is CallChain;
|
||||
function isOptionalChain(node: Node): node is PropertyAccessChain | ElementAccessChain | CallChain;
|
||||
function isNullishCoalesce(node: Node): boolean;
|
||||
function isNewExpression(node: Node): node is NewExpression;
|
||||
function isTaggedTemplateExpression(node: Node): node is TaggedTemplateExpression;
|
||||
function isTypeAssertion(node: Node): node is TypeAssertion;
|
||||
@@ -5071,7 +5076,7 @@ declare namespace ts {
|
||||
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
|
||||
organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
|
||||
getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
|
||||
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
|
||||
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean, forceDtsEmit?: boolean): EmitOutput;
|
||||
getProgram(): Program | undefined;
|
||||
dispose(): void;
|
||||
}
|
||||
@@ -5194,7 +5199,7 @@ declare namespace ts {
|
||||
}
|
||||
interface FileTextChanges {
|
||||
fileName: string;
|
||||
textChanges: TextChange[];
|
||||
textChanges: readonly TextChange[];
|
||||
isNewFile?: boolean;
|
||||
}
|
||||
interface CodeAction {
|
||||
@@ -6626,9 +6631,11 @@ declare namespace ts.server.protocol {
|
||||
interface DefinitionResponse extends Response {
|
||||
body?: FileSpanWithContext[];
|
||||
}
|
||||
interface DefinitionInfoAndBoundSpanReponse extends Response {
|
||||
interface DefinitionInfoAndBoundSpanResponse extends Response {
|
||||
body?: DefinitionInfoAndBoundSpan;
|
||||
}
|
||||
/** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */
|
||||
type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse;
|
||||
/**
|
||||
* Definition response message. Gives text range for definition.
|
||||
*/
|
||||
@@ -8291,7 +8298,13 @@ declare namespace ts.server.protocol {
|
||||
* For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
|
||||
*/
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
/**
|
||||
* Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled,
|
||||
* member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined
|
||||
* values, with insertion text to replace preceding `.` tokens with `?.`.
|
||||
*/
|
||||
readonly includeAutomaticOptionalChainCompletions?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
readonly lazyConfiguredProjectsFromExternalProject?: boolean;
|
||||
readonly providePrefixAndSuffixTextForRename?: boolean;
|
||||
@@ -8556,7 +8569,7 @@ declare namespace ts.server {
|
||||
static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined;
|
||||
isKnownTypesPackageName(name: string): boolean;
|
||||
installPackage(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
|
||||
private readonly typingsCache;
|
||||
private get typingsCache();
|
||||
getCompilationSettings(): CompilerOptions;
|
||||
getCompilerOptions(): CompilerOptions;
|
||||
getNewLine(): string;
|
||||
@@ -8672,23 +8685,31 @@ declare namespace ts.server {
|
||||
readonly canonicalConfigFilePath: NormalizedPath;
|
||||
private projectReferenceCallbacks;
|
||||
private mapOfDeclarationDirectories;
|
||||
private symlinkedDirectories;
|
||||
private symlinkedFiles;
|
||||
/** Ref count to the project when opened from external project */
|
||||
private externalProjectRefCount;
|
||||
private projectErrors;
|
||||
private projectReferences;
|
||||
protected isInitialLoadPending: () => boolean;
|
||||
private fileExistsIfProjectReferenceDts;
|
||||
/**
|
||||
* This implementation of fileExists checks if the file being requested is
|
||||
* .d.ts file for the referenced Project.
|
||||
* If it is it returns true irrespective of whether that file exists on host
|
||||
*/
|
||||
fileExists(file: string): boolean;
|
||||
private directoryExistsIfProjectReferenceDeclDir;
|
||||
/**
|
||||
* This implementation of directoryExists checks if the directory being requested is
|
||||
* directory of .d.ts file for the referenced Project.
|
||||
* If it is it returns true irrespective of whether that directory exists on host
|
||||
*/
|
||||
directoryExists(path: string): boolean;
|
||||
private realpathIfSymlinkedProjectReferenceDts;
|
||||
private getRealpath;
|
||||
private handleDirectoryCouldBeSymlink;
|
||||
private fileOrDirectoryExistsUsingSource;
|
||||
/**
|
||||
* If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
|
||||
* @returns: true if set of files in the project stays the same and false - otherwise.
|
||||
|
||||
+2305
-1635
File diff suppressed because it is too large
Load Diff
Vendored
+9
-4
@@ -14,7 +14,7 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
declare namespace ts {
|
||||
const versionMajorMinor = "3.7";
|
||||
const versionMajorMinor = "3.8";
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version: string;
|
||||
}
|
||||
@@ -1964,6 +1964,8 @@ declare namespace ts {
|
||||
DiagnosticsPresent_OutputsSkipped = 1,
|
||||
DiagnosticsPresent_OutputsGenerated = 2,
|
||||
InvalidProject_OutputsSkipped = 3,
|
||||
ProjectReferenceCycle_OutputsSkipped = 4,
|
||||
/** @deprecated Use ProjectReferenceCycle_OutputsSkipped instead. */
|
||||
ProjectReferenceCycle_OutputsSkupped = 4
|
||||
}
|
||||
export interface EmitResult {
|
||||
@@ -2376,6 +2378,7 @@ declare namespace ts {
|
||||
JSLiteral = 16384,
|
||||
FreshLiteral = 32768,
|
||||
ArrayLiteral = 65536,
|
||||
ObjectRestType = 131072,
|
||||
ClassOrInterface = 3,
|
||||
}
|
||||
export interface ObjectType extends Type {
|
||||
@@ -3169,8 +3172,9 @@ declare namespace ts {
|
||||
readonly disableSuggestions?: boolean;
|
||||
readonly quotePreference?: "auto" | "double" | "single";
|
||||
readonly includeCompletionsForModuleExports?: boolean;
|
||||
readonly includeAutomaticOptionalChainCompletions?: boolean;
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
|
||||
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
|
||||
readonly importModuleSpecifierEnding?: "minimal" | "index" | "js";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
@@ -3522,6 +3526,7 @@ declare namespace ts {
|
||||
function isCallExpression(node: Node): node is CallExpression;
|
||||
function isCallChain(node: Node): node is CallChain;
|
||||
function isOptionalChain(node: Node): node is PropertyAccessChain | ElementAccessChain | CallChain;
|
||||
function isNullishCoalesce(node: Node): boolean;
|
||||
function isNewExpression(node: Node): node is NewExpression;
|
||||
function isTaggedTemplateExpression(node: Node): node is TaggedTemplateExpression;
|
||||
function isTypeAssertion(node: Node): node is TypeAssertion;
|
||||
@@ -5071,7 +5076,7 @@ declare namespace ts {
|
||||
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
|
||||
organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
|
||||
getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
|
||||
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
|
||||
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean, forceDtsEmit?: boolean): EmitOutput;
|
||||
getProgram(): Program | undefined;
|
||||
dispose(): void;
|
||||
}
|
||||
@@ -5194,7 +5199,7 @@ declare namespace ts {
|
||||
}
|
||||
interface FileTextChanges {
|
||||
fileName: string;
|
||||
textChanges: TextChange[];
|
||||
textChanges: readonly TextChange[];
|
||||
isNewFile?: boolean;
|
||||
}
|
||||
interface CodeAction {
|
||||
|
||||
+2154
-1603
File diff suppressed because it is too large
Load Diff
Vendored
+9
-4
@@ -14,7 +14,7 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
declare namespace ts {
|
||||
const versionMajorMinor = "3.7";
|
||||
const versionMajorMinor = "3.8";
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version: string;
|
||||
}
|
||||
@@ -1964,6 +1964,8 @@ declare namespace ts {
|
||||
DiagnosticsPresent_OutputsSkipped = 1,
|
||||
DiagnosticsPresent_OutputsGenerated = 2,
|
||||
InvalidProject_OutputsSkipped = 3,
|
||||
ProjectReferenceCycle_OutputsSkipped = 4,
|
||||
/** @deprecated Use ProjectReferenceCycle_OutputsSkipped instead. */
|
||||
ProjectReferenceCycle_OutputsSkupped = 4
|
||||
}
|
||||
export interface EmitResult {
|
||||
@@ -2376,6 +2378,7 @@ declare namespace ts {
|
||||
JSLiteral = 16384,
|
||||
FreshLiteral = 32768,
|
||||
ArrayLiteral = 65536,
|
||||
ObjectRestType = 131072,
|
||||
ClassOrInterface = 3,
|
||||
}
|
||||
export interface ObjectType extends Type {
|
||||
@@ -3169,8 +3172,9 @@ declare namespace ts {
|
||||
readonly disableSuggestions?: boolean;
|
||||
readonly quotePreference?: "auto" | "double" | "single";
|
||||
readonly includeCompletionsForModuleExports?: boolean;
|
||||
readonly includeAutomaticOptionalChainCompletions?: boolean;
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
|
||||
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
|
||||
readonly importModuleSpecifierEnding?: "minimal" | "index" | "js";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
@@ -3522,6 +3526,7 @@ declare namespace ts {
|
||||
function isCallExpression(node: Node): node is CallExpression;
|
||||
function isCallChain(node: Node): node is CallChain;
|
||||
function isOptionalChain(node: Node): node is PropertyAccessChain | ElementAccessChain | CallChain;
|
||||
function isNullishCoalesce(node: Node): boolean;
|
||||
function isNewExpression(node: Node): node is NewExpression;
|
||||
function isTaggedTemplateExpression(node: Node): node is TaggedTemplateExpression;
|
||||
function isTypeAssertion(node: Node): node is TypeAssertion;
|
||||
@@ -5071,7 +5076,7 @@ declare namespace ts {
|
||||
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
|
||||
organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
|
||||
getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
|
||||
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
|
||||
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean, forceDtsEmit?: boolean): EmitOutput;
|
||||
getProgram(): Program | undefined;
|
||||
dispose(): void;
|
||||
}
|
||||
@@ -5194,7 +5199,7 @@ declare namespace ts {
|
||||
}
|
||||
interface FileTextChanges {
|
||||
fileName: string;
|
||||
textChanges: TextChange[];
|
||||
textChanges: readonly TextChange[];
|
||||
isNewFile?: boolean;
|
||||
}
|
||||
interface CodeAction {
|
||||
|
||||
+2154
-1603
File diff suppressed because it is too large
Load Diff
+1936
-1615
File diff suppressed because it is too large
Load Diff
@@ -441,7 +441,7 @@
|
||||
"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391": "函数实现缺失或未立即出现在声明之后。",
|
||||
"Function_implementation_name_must_be_0_2389": "函数实现名称必须为“{0}”。",
|
||||
"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024": "由于函数不具有返回类型批注并且在它的一个返回表达式中得到直接或间接引用,因此它隐式具有返回类型 \"any\"。",
|
||||
"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "函数缺少结束返回语句,返回类型不包括 \"undefined\"。",
|
||||
"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366": "函数缺少结束 return 语句,返回类型不包括 \"undefined\"。",
|
||||
"Function_overload_must_be_static_2387": "函数重载必须为静态。",
|
||||
"Function_overload_must_not_be_static_2388": "函数重载不能为静态。",
|
||||
"Generate_get_and_set_accessors_95046": "生成 \"get\" 和 \"set\" 访问器",
|
||||
@@ -536,7 +536,7 @@
|
||||
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "JSX 元素不能具有多个名称相同的特性。",
|
||||
"JSX_expressions_must_have_one_parent_element_2657": "JSX 表达式必须具有一个父元素。",
|
||||
"JSX_fragment_has_no_corresponding_closing_tag_17014": "JSX 片段没有相应的结束标记。",
|
||||
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "使用内联 JSX 工厂杂注时,不支持 JSX 片段",
|
||||
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "使用内联 JSX 工厂 pragma 时,不支持 JSX 片段",
|
||||
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "使用 --jsxFactory 时不支持 JSX 片段",
|
||||
"JSX_spread_child_must_be_an_array_type_2609": "JSX 扩展子属性必须为数组类型。",
|
||||
"Jump_target_cannot_cross_function_boundary_1107": "跳转目标不能跨越函数边界。",
|
||||
|
||||
+1
-3
@@ -92,7 +92,6 @@
|
||||
"prex": "^0.4.3",
|
||||
"q": "latest",
|
||||
"remove-internal": "^2.9.2",
|
||||
"simple-git": "^1.113.0",
|
||||
"source-map-support": "latest",
|
||||
"through2": "latest",
|
||||
"travis-fold": "latest",
|
||||
@@ -117,8 +116,7 @@
|
||||
"lint:ci": "gulp lint --ci",
|
||||
"lint:compiler": "gulp lint-compiler",
|
||||
"lint:scripts": "gulp lint-scripts",
|
||||
"setup-hooks": "node scripts/link-hooks.js",
|
||||
"update-costly-tests": "node scripts/costly-tests.js"
|
||||
"setup-hooks": "node scripts/link-hooks.js"
|
||||
},
|
||||
"browser": {
|
||||
"fs": false,
|
||||
|
||||
@@ -4,8 +4,8 @@ const os = require("os");
|
||||
|
||||
/** @type {CommandLineOptions} */
|
||||
module.exports = minimist(process.argv.slice(2), {
|
||||
boolean: ["debug", "dirty", "inspect", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built"],
|
||||
string: ["browser", "tests", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"],
|
||||
boolean: ["debug", "dirty", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built"],
|
||||
string: ["browser", "tests", "inspect", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"],
|
||||
alias: {
|
||||
"b": "browser",
|
||||
"d": "debug", "debug-brk": "debug",
|
||||
@@ -14,7 +14,6 @@ module.exports = minimist(process.argv.slice(2), {
|
||||
"ru": "runners", "runner": "runners",
|
||||
"r": "reporter",
|
||||
"c": "colors", "color": "colors",
|
||||
"skip-percent": "skipPercent",
|
||||
"skippercent": "skipPercent",
|
||||
"w": "workers",
|
||||
"f": "fix"
|
||||
@@ -50,7 +49,6 @@ if (module.exports.built) {
|
||||
* @typedef TypedOptions
|
||||
* @property {boolean} debug
|
||||
* @property {boolean} dirty
|
||||
* @property {boolean} inspect
|
||||
* @property {boolean} light
|
||||
* @property {boolean} colors
|
||||
* @property {boolean} lint
|
||||
@@ -60,6 +58,7 @@ if (module.exports.built) {
|
||||
* @property {boolean} fix
|
||||
* @property {string} browser
|
||||
* @property {string} tests
|
||||
* @property {string} inspect
|
||||
* @property {string} runners
|
||||
* @property {string|number} workers
|
||||
* @property {string} host
|
||||
|
||||
@@ -31,7 +31,6 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
|
||||
const inspect = cmdLineOptions.inspect;
|
||||
const runners = cmdLineOptions.runners;
|
||||
const light = cmdLineOptions.light;
|
||||
const skipPercent = process.env.CI === "true" ? 0 : cmdLineOptions.skipPercent;
|
||||
const stackTraceLimit = cmdLineOptions.stackTraceLimit;
|
||||
const testConfigFile = "test.config";
|
||||
const failed = cmdLineOptions.failed;
|
||||
@@ -65,8 +64,8 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
|
||||
testTimeout = 400000;
|
||||
}
|
||||
|
||||
if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed || skipPercent !== undefined || shards || shardId) {
|
||||
writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed, shards, shardId);
|
||||
if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed || shards || shardId) {
|
||||
writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed, shards, shardId);
|
||||
}
|
||||
|
||||
const colors = cmdLineOptions.colors;
|
||||
@@ -90,8 +89,8 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
|
||||
else {
|
||||
args.push("--no-colors");
|
||||
}
|
||||
if (inspect) {
|
||||
args.unshift("--inspect-brk");
|
||||
if (inspect !== undefined) {
|
||||
args.unshift(inspect == "" ? "--inspect-brk" : "--inspect-brk="+inspect);
|
||||
}
|
||||
else if (debug) {
|
||||
args.unshift("--debug-brk");
|
||||
@@ -161,7 +160,6 @@ exports.cleanTestDirs = cleanTestDirs;
|
||||
* @param {string} tests
|
||||
* @param {string} runners
|
||||
* @param {boolean} light
|
||||
* @param {string} skipPercent
|
||||
* @param {string} [taskConfigsFolder]
|
||||
* @param {string | number} [workerCount]
|
||||
* @param {string} [stackTraceLimit]
|
||||
@@ -170,12 +168,11 @@ exports.cleanTestDirs = cleanTestDirs;
|
||||
* @param {number | undefined} [shards]
|
||||
* @param {number | undefined} [shardId]
|
||||
*/
|
||||
function writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) {
|
||||
function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) {
|
||||
const testConfigContents = JSON.stringify({
|
||||
test: tests ? [tests] : undefined,
|
||||
runners: runners ? runners.split(",") : undefined,
|
||||
light,
|
||||
skipPercent,
|
||||
workerCount,
|
||||
stackTraceLimit,
|
||||
taskConfigsFolder,
|
||||
|
||||
@@ -8,7 +8,7 @@ const mkdirp = require("mkdirp");
|
||||
const del = require("del");
|
||||
const File = require("vinyl");
|
||||
const ts = require("../../lib/typescript");
|
||||
const { default: chalk } = require("chalk");
|
||||
const chalk = require("chalk");
|
||||
const { spawn } = require("child_process");
|
||||
const { CancellationToken, CancelError, Deferred } = require("prex");
|
||||
const { Readable, Duplex } = require("stream");
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
// @ts-check
|
||||
const fs = require("fs");
|
||||
const git = require('simple-git/promise')('.')
|
||||
const readline = require('readline')
|
||||
|
||||
/** @typedef {{ [s: string]: number}} Histogram */
|
||||
|
||||
async function main() {
|
||||
/** @type {Histogram} */
|
||||
const edits = Object.create(null)
|
||||
/** @type {Histogram} */
|
||||
const perf = JSON.parse(fs.readFileSync('.parallelperf.json', 'utf8'))
|
||||
|
||||
await collectCommits(git, "release-2.3", "master", /*author*/ undefined, files => fillMap(files, edits))
|
||||
|
||||
const totalTime = Object.values(perf).reduce((n,m) => n + m, 0)
|
||||
const untouched = Object.values(perf).length - Object.values(edits).length
|
||||
const totalEdits = Object.values(edits).reduce((n,m) => n + m, 0) + untouched + Object.values(edits).length
|
||||
|
||||
let i = 0
|
||||
/** @type {{ name: string, time: number, edits: number, cost: number }[]} */
|
||||
let data = []
|
||||
for (const k in perf) {
|
||||
const otherk = k.replace(/tsrunner-[a-z-]+?:\/\//, '')
|
||||
const percentTime = perf[k] / totalTime
|
||||
const percentHits = (1 + (edits[otherk] || 0)) / totalEdits
|
||||
const cost = 5 + Math.log(percentTime / percentHits)
|
||||
data.push({ name: otherk, time: perf[k], edits: 1 + (edits[otherk] || 0), cost})
|
||||
if (edits[otherk])
|
||||
i++
|
||||
}
|
||||
const output = {
|
||||
totalTime,
|
||||
totalEdits,
|
||||
data: data.sort((x,y) => y.cost - x.cost).map(x => ({ ...x, cost: x.cost.toFixed(2) }))
|
||||
}
|
||||
|
||||
fs.writeFileSync('tests/.test-cost.json', JSON.stringify(output), 'utf8')
|
||||
}
|
||||
|
||||
main().catch(e => {
|
||||
console.log(e);
|
||||
process.exit(1);
|
||||
})
|
||||
|
||||
/**
|
||||
* @param {string[]} files
|
||||
* @param {Histogram} histogram
|
||||
*/
|
||||
function fillMap(files, histogram) {
|
||||
// keep edits to test cases (but not /users), and not file moves
|
||||
const tests = files.filter(f => f.startsWith('tests/cases/') && !f.startsWith('tests/cases/user') && !/=>/.test(f))
|
||||
for (const test of tests) {
|
||||
histogram[test] = (histogram[test] || 0) + 1
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} s
|
||||
*/
|
||||
function isSquashMergeMessage(s) {
|
||||
return /\(#[0-9]+\)$/.test(s)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} s
|
||||
*/
|
||||
function isMergeCommit(s) {
|
||||
return /Merge pull request #[0-9]+/.test(s)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} s
|
||||
*/
|
||||
function parseFiles(s) {
|
||||
const lines = s.split('\n')
|
||||
// Note that slice(2) only works for merge commits, which have an empty newline after the title
|
||||
return lines.slice(2, lines.length - 2).map(line => line.split("|")[0].trim())
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('simple-git/promise').SimpleGit} git
|
||||
* @param {string} from
|
||||
* @param {string} to
|
||||
* @param {string | undefined} author - only include commits from this author
|
||||
* @param {(files: string[]) => void} update
|
||||
*/
|
||||
async function collectCommits(git, from, to, author, update) {
|
||||
let i = 0
|
||||
for (const commit of (await git.log({ from, to })).all) {
|
||||
i++
|
||||
if ((!author || commit.author_name === author) && isMergeCommit(commit.message) || isSquashMergeMessage(commit.message)) {
|
||||
readline.clearLine(process.stdout, /*left*/ -1)
|
||||
readline.cursorTo(process.stdout, 0)
|
||||
process.stdout.write(i + ": " + commit.date)
|
||||
const files = parseFiles(await git.show([commit.hash, "--stat=1000,960,40", "--pretty=oneline"]))
|
||||
update(files)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ async function main() {
|
||||
// so that the playgrounds deployment process can find these comments.
|
||||
|
||||
await gh.issues.createComment({
|
||||
number: +process.env.SOURCE_ISSUE,
|
||||
issue_number: +process.env.SOURCE_ISSUE,
|
||||
owner: "Microsoft",
|
||||
repo: "TypeScript",
|
||||
body: `Hey @${process.env.REQUESTING_USER}, I've packed this into [an installable tgz](${link}). You can install it for testing by referencing it in your \`package.json\` like so:
|
||||
@@ -50,8 +50,7 @@ and then running \`npm install\`.
|
||||
|
||||
// Temporarily disable until we get access controls set up right
|
||||
// Send a ping to https://github.com/orta/make-monaco-builds#pull-request-builds
|
||||
// await gh.request("POST /repos/orta/make-monaco-builds/dispatches",
|
||||
// { event_type: +process.env.SOURCE_ISSUE, headers: { "Accept": "application/vnd.github.everest-preview+json" }})
|
||||
await gh.request("POST /repos/orta/make-monaco-builds/dispatches", { event_type: process.env.SOURCE_ISSUE, headers: { Accept: "application/vnd.github.everest-preview+json" }});
|
||||
}
|
||||
|
||||
main().catch(async e => {
|
||||
|
||||
@@ -2752,7 +2752,7 @@ namespace ts {
|
||||
|
||||
function bindObjectDefinePrototypeProperty(node: BindableObjectDefinePropertyCall) {
|
||||
const namespaceSymbol = lookupSymbolForPropertyAccess((node.arguments[0] as PropertyAccessExpression).expression as EntityNameExpression);
|
||||
if (namespaceSymbol) {
|
||||
if (namespaceSymbol && namespaceSymbol.valueDeclaration) {
|
||||
// Ensure the namespace symbol becomes class-like
|
||||
addDeclarationToSymbol(namespaceSymbol, namespaceSymbol.valueDeclaration, SymbolFlags.Class);
|
||||
}
|
||||
@@ -3595,7 +3595,8 @@ namespace ts {
|
||||
|| hasModifier(node, ModifierFlags.TypeScriptModifier)
|
||||
|| node.typeParameters
|
||||
|| node.type
|
||||
|| !node.body) {
|
||||
|| !node.body
|
||||
|| node.questionToken) {
|
||||
transformFlags |= TransformFlags.AssertTypeScript;
|
||||
}
|
||||
|
||||
@@ -3642,7 +3643,7 @@ namespace ts {
|
||||
let transformFlags = subtreeFlags | TransformFlags.ContainsClassFields;
|
||||
|
||||
// Decorators, TypeScript-specific modifiers, and type annotations are TypeScript syntax.
|
||||
if (some(node.decorators) || hasModifier(node, ModifierFlags.TypeScriptModifier) || node.type) {
|
||||
if (some(node.decorators) || hasModifier(node, ModifierFlags.TypeScriptModifier) || node.type || node.questionToken || node.exclamationToken) {
|
||||
transformFlags |= TransformFlags.AssertTypeScript;
|
||||
}
|
||||
|
||||
@@ -3806,7 +3807,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Type annotations are TypeScript syntax.
|
||||
if (node.type) {
|
||||
if (node.type || node.exclamationToken) {
|
||||
transformFlags |= TransformFlags.AssertTypeScript;
|
||||
}
|
||||
|
||||
|
||||
+129
-117
@@ -3312,8 +3312,8 @@ namespace ts {
|
||||
return [symbol!];
|
||||
}
|
||||
|
||||
// Check if symbol is any of the alias
|
||||
return forEachEntry(symbols, symbolFromSymbolTable => {
|
||||
// Check if symbol is any of the aliases in scope
|
||||
const result = forEachEntry(symbols, symbolFromSymbolTable => {
|
||||
if (symbolFromSymbolTable.flags & SymbolFlags.Alias
|
||||
&& symbolFromSymbolTable.escapedName !== InternalSymbolName.ExportEquals
|
||||
&& symbolFromSymbolTable.escapedName !== InternalSymbolName.Default
|
||||
@@ -3326,16 +3326,9 @@ namespace ts {
|
||||
) {
|
||||
|
||||
const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
|
||||
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
|
||||
return [symbolFromSymbolTable];
|
||||
}
|
||||
|
||||
// Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain
|
||||
// but only if the symbolFromSymbolTable can be qualified
|
||||
const candidateTable = getExportsOfSymbol(resolvedImportedSymbol);
|
||||
const accessibleSymbolsFromExports = candidateTable && getAccessibleSymbolChainFromSymbolTable(candidateTable, /*ignoreQualification*/ true);
|
||||
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
|
||||
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
|
||||
const candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification);
|
||||
if (candidate) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
if (symbolFromSymbolTable.escapedName === symbol!.escapedName && symbolFromSymbolTable.exportSymbol) {
|
||||
@@ -3344,6 +3337,23 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// If there's no result and we're looking at the global symbol table, treat `globalThis` like an alias and try to lookup thru that
|
||||
return result || (symbols === globals ? getCandidateListForSymbol(globalThisSymbol, globalThisSymbol, ignoreQualification) : undefined);
|
||||
}
|
||||
|
||||
function getCandidateListForSymbol(symbolFromSymbolTable: Symbol, resolvedImportedSymbol: Symbol, ignoreQualification: boolean | undefined) {
|
||||
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
|
||||
return [symbolFromSymbolTable];
|
||||
}
|
||||
|
||||
// Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain
|
||||
// but only if the symbolFromSymbolTable can be qualified
|
||||
const candidateTable = getExportsOfSymbol(resolvedImportedSymbol);
|
||||
const accessibleSymbolsFromExports = candidateTable && getAccessibleSymbolChainFromSymbolTable(candidateTable, /*ignoreQualification*/ true);
|
||||
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
|
||||
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7310,11 +7320,7 @@ namespace ts {
|
||||
if (!declaration.statements.length) {
|
||||
return emptyObjectType;
|
||||
}
|
||||
const type = getWidenedLiteralType(checkExpression(declaration.statements[0].expression));
|
||||
if (type.flags & TypeFlags.Object) {
|
||||
return getRegularTypeOfObjectLiteral(type);
|
||||
}
|
||||
return type;
|
||||
return getWidenedType(getWidenedLiteralType(checkExpression(declaration.statements[0].expression)));
|
||||
}
|
||||
|
||||
// Handle variable, parameter or property
|
||||
@@ -9372,25 +9378,6 @@ namespace ts {
|
||||
return type.resolvedProperties;
|
||||
}
|
||||
|
||||
function getPossiblePropertiesOfUnionType(type: UnionType): Symbol[] {
|
||||
if (type.possiblePropertyCache) {
|
||||
return type.possiblePropertyCache.size ? arrayFrom(type.possiblePropertyCache.values()) : emptyArray;
|
||||
}
|
||||
type.possiblePropertyCache = createSymbolTable();
|
||||
for (const t of type.types) {
|
||||
for (const p of getPropertiesOfType(t)) {
|
||||
if (!type.possiblePropertyCache.has(p.escapedName)) {
|
||||
const prop = getUnionOrIntersectionProperty(type, p.escapedName);
|
||||
if (prop) {
|
||||
type.possiblePropertyCache.set(p.escapedName, prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// We can't simply use the normal property cache here, since that will contain cached apparent type members :(
|
||||
return type.possiblePropertyCache.size ? arrayFrom(type.possiblePropertyCache.values()) : emptyArray;
|
||||
}
|
||||
|
||||
function getPropertiesOfType(type: Type): Symbol[] {
|
||||
type = getApparentType(type);
|
||||
return type.flags & TypeFlags.UnionOrIntersection ?
|
||||
@@ -10852,7 +10839,8 @@ namespace ts {
|
||||
}
|
||||
isRequireAlias = isCallExpression(expr) && isRequireCall(expr, /*requireStringLiteralLikeArgument*/ true) && !!valueType.symbol;
|
||||
}
|
||||
if (isRequireAlias || node.kind === SyntaxKind.ImportType) {
|
||||
const isImportTypeWithQualifier = node.kind === SyntaxKind.ImportType && (node as ImportTypeNode).qualifier;
|
||||
if (isRequireAlias || isImportTypeWithQualifier) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@@ -12017,7 +12005,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
const suggestion = getSuggestionForNonexistentIndexSignature(objectType, accessExpression);
|
||||
const suggestion = getSuggestionForNonexistentIndexSignature(objectType, accessExpression, indexType);
|
||||
if (suggestion !== undefined) {
|
||||
error(accessExpression, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion);
|
||||
}
|
||||
@@ -14531,32 +14519,33 @@ namespace ts {
|
||||
* if we have found an elaboration, or we should ignore
|
||||
* any other elaborations when relating the `source` and
|
||||
* `target` types.
|
||||
*
|
||||
* @param source
|
||||
* @param target
|
||||
* @param reportErrors
|
||||
*/
|
||||
function tryElaborateArrayLikeErrors(source: Type, target: Type, reportErrors: boolean): boolean {
|
||||
if (isTupleLikeType(source)) {
|
||||
const sourceTuple: TupleType | undefined = (source as TupleTypeReference).target;
|
||||
if (sourceTuple && sourceTuple.readonly && isArrayOrTupleLikeType(target) &&
|
||||
(!isReadonlyArrayType(target) || isTupleType(target) && !target.target.readonly)) {
|
||||
/**
|
||||
* The spec for elaboration is:
|
||||
* - If the source is a readonly tuple and the target is a mutable array or tuple, elaborate on mutability and skip property elaborations.
|
||||
* - If the source is a tuple then skip property elaborations if the target is an array or tuple.
|
||||
* - If the source is a readonly array and the target is a mutable array or tuple, elaborate on mutability and skip property elaborations.
|
||||
* - If the source an array then skip property elaborations if the target is a tuple.
|
||||
*/
|
||||
if (isTupleType(source)) {
|
||||
if (source.target.readonly && isMutableArrayOrTuple(target)) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return isArrayLikeType(target);
|
||||
return isTupleType(target) || isArrayType(target);
|
||||
}
|
||||
if (isTupleLikeType(target)) {
|
||||
return isArrayLikeType(source);
|
||||
}
|
||||
if (isReadonlyArrayType(source) && isArrayType(target) && !isReadonlyArrayType(target)) {
|
||||
if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (isTupleType(target)) {
|
||||
return isArrayType(source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14616,8 +14605,7 @@ namespace ts {
|
||||
const isComparingJsxAttributes = !!(getObjectFlags(source) & ObjectFlags.JsxAttributes);
|
||||
const isPerformingExcessPropertyChecks = !isApparentIntersectionConstituent && (isObjectLiteralType(source) && getObjectFlags(source) & ObjectFlags.FreshLiteral);
|
||||
if (isPerformingExcessPropertyChecks) {
|
||||
const discriminantType = target.flags & TypeFlags.Union ? findMatchingDiscriminantType(source, target as UnionType) : undefined;
|
||||
if (hasExcessProperties(<FreshObjectLiteralType>source, target, discriminantType, reportErrors)) {
|
||||
if (hasExcessProperties(<FreshObjectLiteralType>source, target, reportErrors)) {
|
||||
if (reportErrors) {
|
||||
reportRelationError(headMessage, source, target);
|
||||
}
|
||||
@@ -14659,13 +14647,6 @@ namespace ts {
|
||||
else {
|
||||
if (target.flags & TypeFlags.Union) {
|
||||
result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), <UnionType>target, reportErrors && !(source.flags & TypeFlags.Primitive) && !(target.flags & TypeFlags.Primitive));
|
||||
if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
|
||||
// Validate against excess props using the original `source`
|
||||
const discriminantType = findMatchingDiscriminantType(source, target as UnionType) || filterPrimitivesIfContainsNonPrimitive(target as UnionType);
|
||||
if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined, isIntersectionConstituent)) {
|
||||
return Ternary.False;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (target.flags & TypeFlags.Intersection) {
|
||||
isIntersectionConstituent = true; // set here to affect the following trio of checks
|
||||
@@ -14778,26 +14759,38 @@ namespace ts {
|
||||
return Ternary.False;
|
||||
}
|
||||
|
||||
function hasExcessProperties(source: FreshObjectLiteralType, target: Type, discriminant: Type | undefined, reportErrors: boolean): boolean {
|
||||
if (!noImplicitAny && getObjectFlags(target) & ObjectFlags.JSLiteral) {
|
||||
function getTypeOfPropertyInTypes(types: Type[], name: __String) {
|
||||
const appendPropType = (propTypes: Type[] | undefined, type: Type) => {
|
||||
type = getApparentType(type);
|
||||
const prop = type.flags & TypeFlags.UnionOrIntersection ? getPropertyOfUnionOrIntersectionType(<UnionOrIntersectionType>type, name) : getPropertyOfObjectType(type, name);
|
||||
const propType = prop && getTypeOfSymbol(prop) || isNumericLiteralName(name) && getIndexTypeOfType(type, IndexKind.Number) || getIndexTypeOfType(type, IndexKind.String) || undefinedType;
|
||||
return append(propTypes, propType);
|
||||
};
|
||||
return getUnionType(reduceLeft(types, appendPropType, /*initial*/ undefined) || emptyArray);
|
||||
}
|
||||
|
||||
function hasExcessProperties(source: FreshObjectLiteralType, target: Type, reportErrors: boolean): boolean {
|
||||
if (!isExcessPropertyCheckTarget(target) || !noImplicitAny && getObjectFlags(target) & ObjectFlags.JSLiteral) {
|
||||
return false; // Disable excess property checks on JS literals to simulate having an implicit "index signature" - but only outside of noImplicitAny
|
||||
}
|
||||
if (isExcessPropertyCheckTarget(target)) {
|
||||
const isComparingJsxAttributes = !!(getObjectFlags(source) & ObjectFlags.JsxAttributes);
|
||||
if ((relation === assignableRelation || relation === comparableRelation) &&
|
||||
(isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
|
||||
return false;
|
||||
}
|
||||
if (discriminant) {
|
||||
// check excess properties against discriminant type only, not the entire union
|
||||
return hasExcessProperties(source, discriminant, /*discriminant*/ undefined, reportErrors);
|
||||
}
|
||||
for (const prop of getPropertiesOfType(source)) {
|
||||
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) {
|
||||
const isComparingJsxAttributes = !!(getObjectFlags(source) & ObjectFlags.JsxAttributes);
|
||||
if ((relation === assignableRelation || relation === comparableRelation) &&
|
||||
(isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
|
||||
return false;
|
||||
}
|
||||
let reducedTarget = target;
|
||||
let checkTypes: Type[] | undefined;
|
||||
if (target.flags & TypeFlags.Union) {
|
||||
reducedTarget = findMatchingDiscriminantType(source, <UnionType>target) || filterPrimitivesIfContainsNonPrimitive(<UnionType>target);
|
||||
checkTypes = reducedTarget.flags & TypeFlags.Union ? (<UnionType>reducedTarget).types : [reducedTarget];
|
||||
}
|
||||
for (const prop of getPropertiesOfType(source)) {
|
||||
if (shouldCheckAsExcessProperty(prop, source.symbol)) {
|
||||
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
||||
if (reportErrors) {
|
||||
// Report error in terms of object types in the target as those are the only ones
|
||||
// we check in isKnownProperty.
|
||||
const errorTarget = filterType(target, isExcessPropertyCheckTarget);
|
||||
const errorTarget = filterType(reducedTarget, isExcessPropertyCheckTarget);
|
||||
// We know *exactly* where things went wrong when comparing the types.
|
||||
// Use this property as the error node as this will be more helpful in
|
||||
// reasoning about what went wrong.
|
||||
@@ -14806,7 +14799,7 @@ namespace ts {
|
||||
// JsxAttributes has an object-literal flag and undergo same type-assignablity check as normal object-literal.
|
||||
// However, using an object-literal error message will be very confusing to the users so we give different a message.
|
||||
// TODO: Spelling suggestions for excess jsx attributes (needs new diagnostic messages)
|
||||
if (prop.valueDeclaration && isJsxAttribute(prop.valueDeclaration)) {
|
||||
if (prop.valueDeclaration && isJsxAttribute(prop.valueDeclaration) && getSourceFileOfNode(errorNode) === getSourceFileOfNode(prop.valueDeclaration.name)) {
|
||||
// Note that extraneous children (as in `<NoChild>extra</NoChild>`) don't pass this check,
|
||||
// since `children` is a SyntaxKind.PropertySignature instead of a SyntaxKind.JsxAttribute.
|
||||
errorNode = prop.valueDeclaration.name;
|
||||
@@ -14817,7 +14810,7 @@ namespace ts {
|
||||
// use the property's value declaration if the property is assigned inside the literal itself
|
||||
const objectLiteralDeclaration = source.symbol && firstOrUndefined(source.symbol.declarations);
|
||||
let suggestion;
|
||||
if (prop.valueDeclaration && findAncestor(prop.valueDeclaration, d => d === objectLiteralDeclaration)) {
|
||||
if (prop.valueDeclaration && findAncestor(prop.valueDeclaration, d => d === objectLiteralDeclaration) && getSourceFileOfNode(objectLiteralDeclaration) === getSourceFileOfNode(errorNode)) {
|
||||
const propDeclaration = prop.valueDeclaration as ObjectLiteralElementLike;
|
||||
Debug.assertNode(propDeclaration, isObjectLiteralElementLike);
|
||||
|
||||
@@ -14828,7 +14821,6 @@ namespace ts {
|
||||
suggestion = getSuggestionForNonexistentProperty(name, errorTarget);
|
||||
}
|
||||
}
|
||||
|
||||
if (suggestion !== undefined) {
|
||||
reportError(Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2,
|
||||
symbolToString(prop), typeToString(errorTarget), suggestion);
|
||||
@@ -14841,6 +14833,12 @@ namespace ts {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (checkTypes && !isRelatedTo(getTypeOfSymbol(prop), getTypeOfPropertyInTypes(checkTypes, prop.escapedName), reportErrors)) {
|
||||
if (reportErrors) {
|
||||
reportIncompatibleError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(prop));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -15841,7 +15839,7 @@ namespace ts {
|
||||
}
|
||||
// We only call this for union target types when we're attempting to do excess property checking - in those cases, we want to get _all possible props_
|
||||
// from the target union, across all members
|
||||
const properties = target.flags & TypeFlags.Union ? getPossiblePropertiesOfUnionType(target as UnionType) : getPropertiesOfType(target);
|
||||
const properties = getPropertiesOfType(target);
|
||||
const numericNamesOnly = isTupleType(source) && isTupleType(target);
|
||||
for (const targetProp of excludeProperties(properties, excludedProperties)) {
|
||||
const name = targetProp.escapedName;
|
||||
@@ -16568,6 +16566,10 @@ namespace ts {
|
||||
return !!(getObjectFlags(type) & ObjectFlags.Reference) && (<TypeReference>type).target === globalReadonlyArrayType;
|
||||
}
|
||||
|
||||
function isMutableArrayOrTuple(type: Type): boolean {
|
||||
return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
|
||||
}
|
||||
|
||||
function getElementTypeOfArrayType(type: Type): Type | undefined {
|
||||
return isArrayType(type) ? getTypeArguments(type as TypeReference)[0] : undefined;
|
||||
}
|
||||
@@ -17346,7 +17348,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function* getUnmatchedProperties(source: Type, target: Type, requireOptionalProperties: boolean, matchDiscriminantProperties: boolean): IterableIterator<Symbol> {
|
||||
const properties = target.flags & TypeFlags.Union ? getPossiblePropertiesOfUnionType(target as UnionType) : getPropertiesOfType(target);
|
||||
const properties = getPropertiesOfType(target);
|
||||
for (const targetProp of properties) {
|
||||
if (requireOptionalProperties || !(targetProp.flags & SymbolFlags.Optional || getCheckFlags(targetProp) & CheckFlags.Partial)) {
|
||||
const sourceProp = getPropertyOfType(source, targetProp.escapedName);
|
||||
@@ -17560,9 +17562,12 @@ namespace ts {
|
||||
inferFromTypes(getTrueTypeFromConditionalType(<ConditionalType>source), getTrueTypeFromConditionalType(<ConditionalType>target));
|
||||
inferFromTypes(getFalseTypeFromConditionalType(<ConditionalType>source), getFalseTypeFromConditionalType(<ConditionalType>target));
|
||||
}
|
||||
else if (target.flags & TypeFlags.Conditional && !contravariant) {
|
||||
else if (target.flags & TypeFlags.Conditional) {
|
||||
const savePriority = priority;
|
||||
priority |= contravariant ? InferencePriority.ContravariantConditional : 0;
|
||||
const targetTypes = [getTrueTypeFromConditionalType(<ConditionalType>target), getFalseTypeFromConditionalType(<ConditionalType>target)];
|
||||
inferToMultipleTypes(source, targetTypes, target.flags);
|
||||
priority = savePriority;
|
||||
}
|
||||
else if (target.flags & TypeFlags.UnionOrIntersection) {
|
||||
inferToMultipleTypes(source, (<UnionOrIntersectionType>target).types, target.flags);
|
||||
@@ -19294,9 +19299,6 @@ namespace ts {
|
||||
else if (containsMatchingReferenceDiscriminant(reference, expr)) {
|
||||
type = declaredType;
|
||||
}
|
||||
else if (flow.clauseStart === flow.clauseEnd && isExhaustiveSwitchStatement(flow.switchStatement)) {
|
||||
return unreachableNeverType;
|
||||
}
|
||||
}
|
||||
return createFlowType(type, isIncomplete(flowType));
|
||||
}
|
||||
@@ -19305,6 +19307,7 @@ namespace ts {
|
||||
const antecedentTypes: Type[] = [];
|
||||
let subtypeReduction = false;
|
||||
let seenIncomplete = false;
|
||||
let bypassFlow: FlowSwitchClause | undefined;
|
||||
for (const antecedent of flow.antecedents!) {
|
||||
if (antecedent.flags & FlowFlags.PreFinally && (<PreFinallyFlow>antecedent).lock.locked) {
|
||||
// if flow correspond to branch from pre-try to finally and this branch is locked - this means that
|
||||
@@ -19312,6 +19315,11 @@ namespace ts {
|
||||
// in this case we should ignore this branch.
|
||||
continue;
|
||||
}
|
||||
if (!bypassFlow && antecedent.flags & FlowFlags.SwitchClause && (<FlowSwitchClause>antecedent).clauseStart === (<FlowSwitchClause>antecedent).clauseEnd) {
|
||||
// The antecedent is the bypass branch of a potentially exhaustive switch statement.
|
||||
bypassFlow = <FlowSwitchClause>antecedent;
|
||||
continue;
|
||||
}
|
||||
const flowType = getTypeAtFlowNode(antecedent);
|
||||
const type = getTypeFromFlowType(flowType);
|
||||
// If the type at a particular antecedent path is the declared type and the
|
||||
@@ -19332,6 +19340,25 @@ namespace ts {
|
||||
seenIncomplete = true;
|
||||
}
|
||||
}
|
||||
if (bypassFlow) {
|
||||
const flowType = getTypeAtFlowNode(bypassFlow);
|
||||
const type = getTypeFromFlowType(flowType);
|
||||
// If the bypass flow contributes a type we haven't seen yet and the switch statement
|
||||
// isn't exhaustive, process the bypass flow type. Since exhaustiveness checks increase
|
||||
// the risk of circularities, we only want to perform them when they make a difference.
|
||||
if (!contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.switchStatement)) {
|
||||
if (type === declaredType && declaredType === initialType) {
|
||||
return type;
|
||||
}
|
||||
antecedentTypes.push(type);
|
||||
if (!isTypeSubsetOf(type, declaredType)) {
|
||||
subtypeReduction = true;
|
||||
}
|
||||
if (isIncomplete(flowType)) {
|
||||
seenIncomplete = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return createFlowType(getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction ? UnionReduction.Subtype : UnionReduction.Literal), seenIncomplete);
|
||||
}
|
||||
|
||||
@@ -22076,8 +22103,13 @@ namespace ts {
|
||||
if (spread !== emptyObjectType) {
|
||||
if (propertiesArray.length > 0) {
|
||||
spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, objectFlags, inConstContext);
|
||||
propertiesArray = [];
|
||||
propertiesTable = createSymbolTable();
|
||||
hasComputedStringProperty = false;
|
||||
hasComputedNumberProperty = false;
|
||||
}
|
||||
return spread;
|
||||
// remap the raw emptyObjectType fed in at the top into a fresh empty object literal type, unique to this use site
|
||||
return mapType(spread, t => t === emptyObjectType ? createObjectLiteralType() : t);
|
||||
}
|
||||
|
||||
return createObjectLiteralType();
|
||||
@@ -22531,7 +22563,8 @@ namespace ts {
|
||||
return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol);
|
||||
}
|
||||
else if (links.jsxFlags & JsxFlags.IntrinsicIndexedElement) {
|
||||
return links.resolvedJsxElementAttributesType = getIndexInfoOfSymbol(symbol, IndexKind.String)!.type;
|
||||
return links.resolvedJsxElementAttributesType =
|
||||
getIndexTypeOfType(getDeclaredTypeOfSymbol(symbol), IndexKind.String)!;
|
||||
}
|
||||
else {
|
||||
return links.resolvedJsxElementAttributesType = errorType;
|
||||
@@ -23140,15 +23173,13 @@ namespace ts {
|
||||
return suggestion && symbolName(suggestion);
|
||||
}
|
||||
|
||||
function getSuggestionForNonexistentIndexSignature(objectType: Type, expr: ElementAccessExpression): string | undefined {
|
||||
function getSuggestionForNonexistentIndexSignature(objectType: Type, expr: ElementAccessExpression, keyedType: Type): string | undefined {
|
||||
// check if object type has setter or getter
|
||||
const hasProp = (name: "set" | "get", argCount = 1) => {
|
||||
function hasProp(name: "set" | "get") {
|
||||
const prop = getPropertyOfObjectType(objectType, <__String>name);
|
||||
if (prop) {
|
||||
const s = getSingleCallSignature(getTypeOfSymbol(prop));
|
||||
if (s && getMinArgumentCount(s) === argCount && typeToString(getTypeAtPosition(s, 0)) === "string") {
|
||||
return true;
|
||||
}
|
||||
return !!s && getMinArgumentCount(s) >= 1 && isTypeAssignableTo(keyedType, getTypeAtPosition(s, 0));
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@@ -23158,7 +23189,7 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let suggestion = tryGetPropertyAccessOrIdentifierToString(expr);
|
||||
let suggestion = tryGetPropertyAccessOrIdentifierToString(expr.expression);
|
||||
if (suggestion === undefined) {
|
||||
suggestion = suggestedMethod;
|
||||
}
|
||||
@@ -23668,10 +23699,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getArrayifiedType(type: Type) {
|
||||
if (forEachType(type, t => !(t.flags & (TypeFlags.Any | TypeFlags.Instantiable) || isArrayType(t) || isTupleType(t)))) {
|
||||
return createArrayType(getIndexedAccessType(type, numberType));
|
||||
}
|
||||
return type;
|
||||
return type.flags & TypeFlags.Union ? mapType(type, getArrayifiedType) :
|
||||
type.flags & (TypeFlags.Any | TypeFlags.Instantiable) || isMutableArrayOrTuple(type) ? type :
|
||||
isTupleType(type) ? createTupleType(getTypeArguments(type), type.target.minLength, type.target.hasRestElement, /*readonly*/ false, type.target.associatedNames) :
|
||||
createArrayType(getIndexedAccessType(type, numberType));
|
||||
}
|
||||
|
||||
function getSpreadArgumentType(args: readonly Expression[], index: number, argCount: number, restType: Type, context: InferenceContext | undefined) {
|
||||
@@ -26296,8 +26327,7 @@ namespace ts {
|
||||
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
||||
const diagnostic = createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.await_expression_is_only_allowed_within_an_async_function);
|
||||
const func = getContainingFunction(node);
|
||||
if (func && func.kind !== SyntaxKind.Constructor) {
|
||||
Debug.assert((getFunctionFlags(func) & FunctionFlags.Async) === 0, "Enclosing function should never be an async function.");
|
||||
if (func && func.kind !== SyntaxKind.Constructor && (getFunctionFlags(func) & FunctionFlags.Async) === 0) {
|
||||
const relatedInfo = createDiagnosticForNode(func, Diagnostics.Did_you_mean_to_mark_this_function_as_async);
|
||||
addRelatedInfo(diagnostic, relatedInfo);
|
||||
}
|
||||
@@ -27109,28 +27139,10 @@ namespace ts {
|
||||
return [ effectiveLeft, effectiveRight ];
|
||||
}
|
||||
|
||||
function isYieldExpressionInClass(node: YieldExpression): boolean {
|
||||
let current: Node = node;
|
||||
let parent = node.parent;
|
||||
while (parent) {
|
||||
if (isFunctionLike(parent) && current === (<FunctionLikeDeclaration>parent).body) {
|
||||
return false;
|
||||
}
|
||||
else if (isClassLike(current)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
current = parent;
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkYieldExpression(node: YieldExpression): Type {
|
||||
// Grammar checking
|
||||
if (produceDiagnostics) {
|
||||
if (!(node.flags & NodeFlags.YieldContext) || isYieldExpressionInClass(node)) {
|
||||
if (!(node.flags & NodeFlags.YieldContext)) {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
|
||||
}
|
||||
|
||||
|
||||
@@ -1087,12 +1087,15 @@ namespace ts {
|
||||
[option: string]: CompilerOptionsValue | undefined;
|
||||
}
|
||||
|
||||
/** Tuple with error messages for 'unknown compiler option', 'option requires type' */
|
||||
type ParseCommandLineWorkerDiagnostics = [DiagnosticMessage, DiagnosticMessage];
|
||||
interface ParseCommandLineWorkerDiagnostics {
|
||||
unknownOptionDiagnostic: DiagnosticMessage,
|
||||
unknownDidYouMeanDiagnostic: DiagnosticMessage,
|
||||
optionTypeMismatchDiagnostic: DiagnosticMessage
|
||||
}
|
||||
|
||||
function parseCommandLineWorker(
|
||||
getOptionNameMap: () => OptionNameMap,
|
||||
[unknownOptionDiagnostic, optionTypeMismatchDiagnostic]: ParseCommandLineWorkerDiagnostics,
|
||||
diagnostics: ParseCommandLineWorkerDiagnostics,
|
||||
commandLine: readonly string[],
|
||||
readFile?: (path: string) => string | undefined) {
|
||||
const options = {} as OptionsBase;
|
||||
@@ -1123,7 +1126,7 @@ namespace ts {
|
||||
else {
|
||||
// Check to see if no argument was provided (e.g. "--locale" is the last command-line argument).
|
||||
if (!args[i] && opt.type !== "boolean") {
|
||||
errors.push(createCompilerDiagnostic(optionTypeMismatchDiagnostic, opt.name));
|
||||
errors.push(createCompilerDiagnostic(diagnostics.optionTypeMismatchDiagnostic, opt.name));
|
||||
}
|
||||
|
||||
switch (opt.type) {
|
||||
@@ -1160,7 +1163,13 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(unknownOptionDiagnostic, s));
|
||||
const possibleOption = getSpellingSuggestion(s, optionDeclarations, opt => `--${opt.name}`);
|
||||
if (possibleOption) {
|
||||
errors.push(createCompilerDiagnostic(diagnostics.unknownDidYouMeanDiagnostic, s, possibleOption.name));
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(diagnostics.unknownOptionDiagnostic, s));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1203,11 +1212,13 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
const compilerOptionsDefaultDiagnostics = {
|
||||
unknownOptionDiagnostic: Diagnostics.Unknown_compiler_option_0,
|
||||
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
|
||||
optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
|
||||
};
|
||||
export function parseCommandLine(commandLine: readonly string[], readFile?: (path: string) => string | undefined): ParsedCommandLine {
|
||||
return parseCommandLineWorker(getOptionNameMap, [
|
||||
Diagnostics.Unknown_compiler_option_0,
|
||||
Diagnostics.Compiler_option_0_expects_an_argument
|
||||
], commandLine, readFile);
|
||||
return parseCommandLineWorker(getOptionNameMap, compilerOptionsDefaultDiagnostics, commandLine, readFile);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
@@ -1239,10 +1250,11 @@ namespace ts {
|
||||
export function parseBuildCommand(args: readonly string[]): ParsedBuildCommand {
|
||||
let buildOptionNameMap: OptionNameMap | undefined;
|
||||
const returnBuildOptionNameMap = () => (buildOptionNameMap || (buildOptionNameMap = createOptionNameMap(buildOpts)));
|
||||
const { options, fileNames: projects, errors } = parseCommandLineWorker(returnBuildOptionNameMap, [
|
||||
Diagnostics.Unknown_build_option_0,
|
||||
Diagnostics.Build_option_0_requires_a_value_of_type_1
|
||||
], args);
|
||||
const { options, fileNames: projects, errors } = parseCommandLineWorker(returnBuildOptionNameMap, {
|
||||
unknownOptionDiagnostic: Diagnostics.Unknown_build_option_0,
|
||||
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_build_option_0_Did_you_mean_1,
|
||||
optionTypeMismatchDiagnostic: Diagnostics.Build_option_0_requires_a_value_of_type_1
|
||||
}, args);
|
||||
const buildOptions = options as BuildOptions;
|
||||
|
||||
if (projects.length === 0) {
|
||||
@@ -1389,19 +1401,28 @@ namespace ts {
|
||||
name: "compilerOptions",
|
||||
type: "object",
|
||||
elementOptions: commandLineOptionsToMap(optionDeclarations),
|
||||
extraKeyDiagnosticMessage: Diagnostics.Unknown_compiler_option_0
|
||||
extraKeyDiagnostics: {
|
||||
unknownOptionDiagnostic: Diagnostics.Unknown_compiler_option_0,
|
||||
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "typingOptions",
|
||||
type: "object",
|
||||
elementOptions: commandLineOptionsToMap(typeAcquisitionDeclarations),
|
||||
extraKeyDiagnosticMessage: Diagnostics.Unknown_type_acquisition_option_0
|
||||
extraKeyDiagnostics: {
|
||||
unknownOptionDiagnostic: Diagnostics.Unknown_type_acquisition_option_0,
|
||||
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "typeAcquisition",
|
||||
type: "object",
|
||||
elementOptions: commandLineOptionsToMap(typeAcquisitionDeclarations),
|
||||
extraKeyDiagnosticMessage: Diagnostics.Unknown_type_acquisition_option_0
|
||||
extraKeyDiagnostics: {
|
||||
unknownOptionDiagnostic: Diagnostics.Unknown_type_acquisition_option_0,
|
||||
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "extends",
|
||||
@@ -1507,7 +1528,7 @@ namespace ts {
|
||||
function convertObjectLiteralExpressionToJson(
|
||||
node: ObjectLiteralExpression,
|
||||
knownOptions: Map<CommandLineOption> | undefined,
|
||||
extraKeyDiagnosticMessage: DiagnosticMessage | undefined,
|
||||
extraKeyDiagnostics: DidYouMeanOptionalDiagnostics | undefined,
|
||||
parentOption: string | undefined
|
||||
): any {
|
||||
const result: any = returnValue ? {} : undefined;
|
||||
@@ -1518,7 +1539,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (element.questionToken) {
|
||||
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.questionToken, Diagnostics._0_can_only_be_used_in_a_ts_file, "?"));
|
||||
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.questionToken, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
|
||||
}
|
||||
if (!isDoubleQuotedString(element.name)) {
|
||||
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, Diagnostics.String_literal_with_double_quotes_expected));
|
||||
@@ -1527,8 +1548,19 @@ namespace ts {
|
||||
const textOfKey = getTextOfPropertyName(element.name);
|
||||
const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey);
|
||||
const option = keyText && knownOptions ? knownOptions.get(keyText) : undefined;
|
||||
if (keyText && extraKeyDiagnosticMessage && !option) {
|
||||
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnosticMessage, keyText));
|
||||
if (keyText && extraKeyDiagnostics && !option) {
|
||||
if (knownOptions) {
|
||||
const possibleOption = getSpellingSuggestion(keyText, arrayFrom(knownOptions.keys()), identity);
|
||||
if (possibleOption) {
|
||||
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownDidYouMeanDiagnostic, keyText, possibleOption));
|
||||
}
|
||||
else {
|
||||
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
|
||||
}
|
||||
}
|
||||
else {
|
||||
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
|
||||
}
|
||||
}
|
||||
const value = convertPropertyValueToJson(element.initializer, option);
|
||||
if (typeof keyText !== "undefined") {
|
||||
@@ -1630,9 +1662,9 @@ namespace ts {
|
||||
// vs what we set in the json
|
||||
// If need arises, we can modify this interface and callbacks as needed
|
||||
if (option) {
|
||||
const { elementOptions, extraKeyDiagnosticMessage, name: optionName } = <TsConfigOnlyOption>option;
|
||||
const { elementOptions, extraKeyDiagnostics, name: optionName } = <TsConfigOnlyOption>option;
|
||||
return convertObjectLiteralExpressionToJson(objectLiteralExpression,
|
||||
elementOptions, extraKeyDiagnosticMessage, optionName);
|
||||
elementOptions, extraKeyDiagnostics, optionName);
|
||||
}
|
||||
else {
|
||||
return convertObjectLiteralExpressionToJson(
|
||||
@@ -2468,7 +2500,7 @@ namespace ts {
|
||||
basePath: string, errors: Push<Diagnostic>, configFileName?: string): CompilerOptions {
|
||||
|
||||
const options = getDefaultCompilerOptions(configFileName);
|
||||
convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_compiler_option_0, errors);
|
||||
convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, options, compilerOptionsDefaultDiagnostics, errors);
|
||||
if (configFileName) {
|
||||
options.configFilePath = normalizeSlashes(configFileName);
|
||||
}
|
||||
@@ -2484,13 +2516,19 @@ namespace ts {
|
||||
|
||||
const options = getDefaultTypeAcquisition(configFileName);
|
||||
const typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
|
||||
convertOptionsFromJson(typeAcquisitionDeclarations, typeAcquisition, basePath, options, Diagnostics.Unknown_type_acquisition_option_0, errors);
|
||||
|
||||
const diagnostics = {
|
||||
unknownOptionDiagnostic: Diagnostics.Unknown_type_acquisition_option_0,
|
||||
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1 ,
|
||||
};
|
||||
convertOptionsFromJson(typeAcquisitionDeclarations, typeAcquisition, basePath, options, diagnostics, errors);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
function convertOptionsFromJson(optionDeclarations: readonly CommandLineOption[], jsonOptions: any, basePath: string,
|
||||
defaultOptions: CompilerOptions | TypeAcquisition, diagnosticMessage: DiagnosticMessage, errors: Push<Diagnostic>) {
|
||||
defaultOptions: CompilerOptions | TypeAcquisition, diagnostics: DidYouMeanOptionalDiagnostics, errors: Push<Diagnostic>) {
|
||||
|
||||
if (!jsonOptions) {
|
||||
return;
|
||||
@@ -2504,7 +2542,13 @@ namespace ts {
|
||||
defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(diagnosticMessage, id));
|
||||
const possibleOption = getSpellingSuggestion(id, <CommandLineOption[]>optionDeclarations, opt => opt.name);
|
||||
if (possibleOption) {
|
||||
errors.push(createCompilerDiagnostic(diagnostics.unknownDidYouMeanDiagnostic, id, possibleOption.name));
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(diagnostics.unknownOptionDiagnostic, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3177,6 +3177,10 @@
|
||||
"category": "Error",
|
||||
"code": 5024
|
||||
},
|
||||
"Unknown compiler option '{0}'. Did you mean '{1}'?": {
|
||||
"category": "Error",
|
||||
"code": 5025
|
||||
},
|
||||
"Could not write file '{0}': {1}.": {
|
||||
"category": "Error",
|
||||
"code": 5033
|
||||
@@ -3237,7 +3241,7 @@
|
||||
"category": "Error",
|
||||
"code": 5061
|
||||
},
|
||||
"Substitution '{0}' in pattern '{1}' in can have at most one '*' character.": {
|
||||
"Substitution '{0}' in pattern '{1}' can have at most one '*' character.": {
|
||||
"category": "Error",
|
||||
"code": 5062
|
||||
},
|
||||
@@ -3297,6 +3301,10 @@
|
||||
"category": "Error",
|
||||
"code": 5076
|
||||
},
|
||||
"Unknown build option '{0}'. Did you mean '{1}'?": {
|
||||
"category": "Error",
|
||||
"code": 5077
|
||||
},
|
||||
|
||||
"Generates a sourcemap for each corresponding '.d.ts' file.": {
|
||||
"category": "Message",
|
||||
@@ -4510,7 +4518,7 @@
|
||||
"category": "Error",
|
||||
"code": 7051
|
||||
},
|
||||
"Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}' ?": {
|
||||
"Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}'?": {
|
||||
"category": "Error",
|
||||
"code": 7052
|
||||
},
|
||||
@@ -4535,59 +4543,51 @@
|
||||
"category": "Error",
|
||||
"code": 8001
|
||||
},
|
||||
"'import ... =' can only be used in a .ts file.": {
|
||||
"'import ... =' can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8002
|
||||
},
|
||||
"'export=' can only be used in a .ts file.": {
|
||||
"'export =' can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8003
|
||||
},
|
||||
"'type parameter declarations' can only be used in a .ts file.": {
|
||||
"Type parameter declarations can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8004
|
||||
},
|
||||
"'implements clauses' can only be used in a .ts file.": {
|
||||
"'implements' clauses can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8005
|
||||
},
|
||||
"'interface declarations' can only be used in a .ts file.": {
|
||||
"'{0}' declarations can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8006
|
||||
},
|
||||
"'module declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8007
|
||||
},
|
||||
"'type aliases' can only be used in a .ts file.": {
|
||||
"Type aliases can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8008
|
||||
},
|
||||
"'{0}' can only be used in a .ts file.": {
|
||||
"The '{0}' modifier can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8009
|
||||
},
|
||||
"'types' can only be used in a .ts file.": {
|
||||
"Type annotations can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8010
|
||||
},
|
||||
"'type arguments' can only be used in a .ts file.": {
|
||||
"Type arguments can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8011
|
||||
},
|
||||
"'parameter modifiers' can only be used in a .ts file.": {
|
||||
"Parameter modifiers can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8012
|
||||
},
|
||||
"'non-null assertions' can only be used in a .ts file.": {
|
||||
"Non-null assertions can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8013
|
||||
},
|
||||
"'enum declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8015
|
||||
},
|
||||
"'type assertion expressions' can only be used in a .ts file.": {
|
||||
"Type assertion expressions can only be used in TypeScript files.": {
|
||||
"category": "Error",
|
||||
"code": 8016
|
||||
},
|
||||
@@ -4747,7 +4747,10 @@
|
||||
"category": "Error",
|
||||
"code": 17017
|
||||
},
|
||||
|
||||
"Unknown type acquisition option '{0}'. Did you mean '{1}'?": {
|
||||
"category": "Error",
|
||||
"code": 17018
|
||||
},
|
||||
"Circularity detected while resolving configuration: {0}": {
|
||||
"category": "Error",
|
||||
"code": 18000
|
||||
|
||||
@@ -2741,6 +2741,7 @@ namespace ts {
|
||||
|
||||
function emitVariableDeclaration(node: VariableDeclaration) {
|
||||
emit(node.name);
|
||||
emit(node.exclamationToken);
|
||||
emitTypeAnnotation(node.type);
|
||||
emitInitializer(node.initializer, node.type ? node.type.end : node.name.end, node);
|
||||
}
|
||||
|
||||
@@ -1937,6 +1937,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function createVariableDeclaration(name: string | BindingName, type?: TypeNode, initializer?: Expression) {
|
||||
/* Internally, one should probably use createTypeScriptVariableDeclaration instead and handle definite assignment assertions */
|
||||
const node = <VariableDeclaration>createSynthesizedNode(SyntaxKind.VariableDeclaration);
|
||||
node.name = asName(name);
|
||||
node.type = type;
|
||||
@@ -1945,6 +1946,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined) {
|
||||
/* Internally, one should probably use updateTypeScriptVariableDeclaration instead and handle definite assignment assertions */
|
||||
return node.name !== name
|
||||
|| node.type !== type
|
||||
|| node.initializer !== initializer
|
||||
@@ -1952,6 +1954,26 @@ namespace ts {
|
||||
: node;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function createTypeScriptVariableDeclaration(name: string | BindingName, exclaimationToken?: Token<SyntaxKind.ExclamationToken>, type?: TypeNode, initializer?: Expression) {
|
||||
const node = <VariableDeclaration>createSynthesizedNode(SyntaxKind.VariableDeclaration);
|
||||
node.name = asName(name);
|
||||
node.type = type;
|
||||
node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;
|
||||
node.exclamationToken = exclaimationToken;
|
||||
return node;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function updateTypeScriptVariableDeclaration(node: VariableDeclaration, name: BindingName, exclaimationToken: Token<SyntaxKind.ExclamationToken> | undefined, type: TypeNode | undefined, initializer: Expression | undefined) {
|
||||
return node.name !== name
|
||||
|| node.type !== type
|
||||
|| node.initializer !== initializer
|
||||
|| node.exclamationToken !== exclaimationToken
|
||||
? updateNode(createTypeScriptVariableDeclaration(name, exclaimationToken, type, initializer), node)
|
||||
: node;
|
||||
}
|
||||
|
||||
export function createVariableDeclarationList(declarations: readonly VariableDeclaration[], flags = NodeFlags.None) {
|
||||
const node = <VariableDeclarationList>createSynthesizedNode(SyntaxKind.VariableDeclarationList);
|
||||
node.flags |= flags & NodeFlags.BlockScoped;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ts.moduleSpecifiers {
|
||||
function getPreferencesForUpdate(compilerOptions: CompilerOptions, oldImportSpecifier: string): Preferences {
|
||||
return {
|
||||
relativePreference: isExternalModuleNameRelative(oldImportSpecifier) ? RelativePreference.Relative : RelativePreference.NonRelative,
|
||||
ending: hasJSOrJsonFileExtension(oldImportSpecifier) ?
|
||||
ending: hasJSFileExtension(oldImportSpecifier) ?
|
||||
Ending.JsExtension :
|
||||
getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeJs || endsWith(oldImportSpecifier, "index") ? Ending.Index : Ending.Minimal,
|
||||
};
|
||||
@@ -163,7 +163,7 @@ namespace ts.moduleSpecifiers {
|
||||
}
|
||||
|
||||
function usesJsExtensionOnImports({ imports }: SourceFile): boolean {
|
||||
return firstDefined(imports, ({ text }) => pathIsRelative(text) ? hasJSOrJsonFileExtension(text) : undefined) || false;
|
||||
return firstDefined(imports, ({ text }) => pathIsRelative(text) ? hasJSFileExtension(text) : undefined) || false;
|
||||
}
|
||||
|
||||
function numberOfDirectorySeparators(str: string) {
|
||||
|
||||
+6
-14
@@ -1029,6 +1029,10 @@ namespace ts {
|
||||
return doInsideOfContext(NodeFlags.YieldContext | NodeFlags.AwaitContext, func);
|
||||
}
|
||||
|
||||
function doOutsideOfYieldAndAwaitContext<T>(func: () => T): T {
|
||||
return doOutsideOfContext(NodeFlags.YieldContext | NodeFlags.AwaitContext, func);
|
||||
}
|
||||
|
||||
function inContext(flags: NodeFlags) {
|
||||
return (contextFlags & flags) !== 0;
|
||||
}
|
||||
@@ -5865,19 +5869,7 @@ namespace ts {
|
||||
node.exclamationToken = parseTokenNode<Token<SyntaxKind.ExclamationToken>>();
|
||||
}
|
||||
node.type = parseTypeAnnotation();
|
||||
|
||||
// For instance properties specifically, since they are evaluated inside the constructor,
|
||||
// we do *not * want to parse yield expressions, so we specifically turn the yield context
|
||||
// off. The grammar would look something like this:
|
||||
//
|
||||
// MemberVariableDeclaration[Yield]:
|
||||
// AccessibilityModifier_opt PropertyName TypeAnnotation_opt Initializer_opt[In];
|
||||
// AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initializer_opt[In, ?Yield];
|
||||
//
|
||||
// The checker may still error in the static case to explicitly disallow the yield expression.
|
||||
node.initializer = hasModifier(node, ModifierFlags.Static)
|
||||
? allowInAnd(parseInitializer)
|
||||
: doOutsideOfContext(NodeFlags.YieldContext | NodeFlags.DisallowInContext, parseInitializer);
|
||||
node.initializer = doOutsideOfContext(NodeFlags.YieldContext | NodeFlags.AwaitContext | NodeFlags.DisallowInContext, parseInitializer);
|
||||
|
||||
parseSemicolon();
|
||||
return finishNode(node);
|
||||
@@ -6213,7 +6205,7 @@ namespace ts {
|
||||
parseExpected(SyntaxKind.EnumKeyword);
|
||||
node.name = parseIdentifier();
|
||||
if (parseExpected(SyntaxKind.OpenBraceToken)) {
|
||||
node.members = parseDelimitedList(ParsingContext.EnumMembers, parseEnumMember);
|
||||
node.members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(ParsingContext.EnumMembers, parseEnumMember));
|
||||
parseExpected(SyntaxKind.CloseBraceToken);
|
||||
}
|
||||
else {
|
||||
|
||||
+20
-17
@@ -1797,7 +1797,7 @@ namespace ts {
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
if ((<ParameterDeclaration | PropertyDeclaration | MethodDeclaration>parent).questionToken === node) {
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_can_only_be_used_in_a_ts_file, "?"));
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
|
||||
return;
|
||||
}
|
||||
// falls through
|
||||
@@ -1811,45 +1811,48 @@ namespace ts {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
// type annotation
|
||||
if ((<FunctionLikeDeclaration | VariableDeclaration | ParameterDeclaration | PropertyDeclaration>parent).type === node) {
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.types_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.import_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.import_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
case SyntaxKind.ExportAssignment:
|
||||
if ((<ExportAssignment>node).isExportEquals) {
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.HeritageClause:
|
||||
const heritageClause = <HeritageClause>node;
|
||||
if (heritageClause.token === SyntaxKind.ImplementsKeyword) {
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.Interface_declaration_cannot_have_implements_clause));
|
||||
return;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
|
||||
const moduleKeyword = node.flags & NodeFlags.Namespace ? tokenToString(SyntaxKind.NamespaceKeyword) : tokenToString(SyntaxKind.ModuleKeyword);
|
||||
Debug.assertDefined(moduleKeyword);
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword));
|
||||
return;
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
|
||||
const enumKeyword = Debug.assertDefined(tokenToString(SyntaxKind.EnumKeyword));
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword));
|
||||
return;
|
||||
case SyntaxKind.NonNullExpression:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
case SyntaxKind.AsExpression:
|
||||
diagnostics.push(createDiagnosticForNode((node as AsExpression).type, Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNode((node as AsExpression).type, Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX.
|
||||
@@ -1878,7 +1881,7 @@ namespace ts {
|
||||
case SyntaxKind.ArrowFunction:
|
||||
// Check type parameters
|
||||
if (nodes === (<DeclarationWithTypeParameterChildren>parent).typeParameters) {
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
}
|
||||
// falls through
|
||||
@@ -1894,7 +1897,7 @@ namespace ts {
|
||||
if (nodes === (<PropertyDeclaration>parent).modifiers) {
|
||||
for (const modifier of <NodeArray<Modifier>>nodes) {
|
||||
if (modifier.kind !== SyntaxKind.StaticKeyword) {
|
||||
diagnostics.push(createDiagnosticForNode(modifier, Diagnostics._0_can_only_be_used_in_a_ts_file, tokenToString(modifier.kind)));
|
||||
diagnostics.push(createDiagnosticForNode(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1903,7 +1906,7 @@ namespace ts {
|
||||
case SyntaxKind.Parameter:
|
||||
// Check modifiers of parameter declaration
|
||||
if (nodes === (<ParameterDeclaration>parent).modifiers) {
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -1915,7 +1918,7 @@ namespace ts {
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
// Check type arguments
|
||||
if (nodes === (<NodeWithTypeArguments>parent).typeArguments) {
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -1941,7 +1944,7 @@ namespace ts {
|
||||
case SyntaxKind.ReadonlyKeyword:
|
||||
case SyntaxKind.DeclareKeyword:
|
||||
case SyntaxKind.AbstractKeyword:
|
||||
diagnostics.push(createDiagnosticForNode(modifier, Diagnostics._0_can_only_be_used_in_a_ts_file, tokenToString(modifier.kind)));
|
||||
diagnostics.push(createDiagnosticForNode(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
|
||||
break;
|
||||
|
||||
// These are all legal modifiers.
|
||||
@@ -2980,7 +2983,7 @@ namespace ts {
|
||||
const typeOfSubst = typeof subst;
|
||||
if (typeOfSubst === "string") {
|
||||
if (!hasZeroOrOneAsteriskCharacter(subst)) {
|
||||
createDiagnosticForOptionPathKeyValue(key, i, Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key);
|
||||
createDiagnosticForOptionPathKeyValue(key, i, Diagnostics.Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character, subst, key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -937,7 +937,7 @@ namespace ts {
|
||||
}
|
||||
shouldEnterSuppressNewDiagnosticsContextContext = true;
|
||||
suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types
|
||||
return cleanup(updateVariableDeclaration(input, input.name, ensureType(input, input.type), ensureNoInitializer(input)));
|
||||
return cleanup(updateTypeScriptVariableDeclaration(input, input.name, /*exclaimationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input)));
|
||||
}
|
||||
case SyntaxKind.TypeParameter: {
|
||||
if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) {
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace ts {
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
if (node.flags & NodeFlags.OptionalChain) {
|
||||
const updated = visitOptionalExpression(node as OptionalChain, /*captureThisArg*/ false);
|
||||
const updated = visitOptionalExpression(node as OptionalChain, /*captureThisArg*/ false, /*isDelete*/ false);
|
||||
Debug.assertNotNode(updated, isSyntheticReference);
|
||||
return updated;
|
||||
}
|
||||
@@ -34,6 +34,8 @@ namespace ts {
|
||||
return transformNullishCoalescingExpression(<BinaryExpression>node);
|
||||
}
|
||||
return visitEachChild(node, visitor, context);
|
||||
case SyntaxKind.DeleteExpression:
|
||||
return visitDeleteExpression(node as DeleteExpression);
|
||||
default:
|
||||
return visitEachChild(node, visitor, context);
|
||||
}
|
||||
@@ -48,8 +50,8 @@ namespace ts {
|
||||
return { expression: chain.expression, chain: links };
|
||||
}
|
||||
|
||||
function visitNonOptionalParenthesizedExpression(node: ParenthesizedExpression, captureThisArg: boolean): Expression {
|
||||
const expression = visitNonOptionalExpression(node.expression, captureThisArg);
|
||||
function visitNonOptionalParenthesizedExpression(node: ParenthesizedExpression, captureThisArg: boolean, isDelete: boolean): Expression {
|
||||
const expression = visitNonOptionalExpression(node.expression, captureThisArg, isDelete);
|
||||
if (isSyntheticReference(expression)) {
|
||||
// `(a.b)` -> { expression `((_a = a).b)`, thisArg: `_a` }
|
||||
// `(a[b])` -> { expression `((_a = a)[b])`, thisArg: `_a` }
|
||||
@@ -58,100 +60,85 @@ namespace ts {
|
||||
return updateParen(node, expression);
|
||||
}
|
||||
|
||||
function visitNonOptionalPropertyAccessExpression(node: PropertyAccessExpression, captureThisArg: boolean): Expression {
|
||||
function visitNonOptionalPropertyOrElementAccessExpression(node: AccessExpression, captureThisArg: boolean, isDelete: boolean): Expression {
|
||||
if (isOptionalChain(node)) {
|
||||
// If `node` is an optional chain, then it is the outermost chain of an optional expression.
|
||||
return visitOptionalExpression(node, captureThisArg);
|
||||
return visitOptionalExpression(node, captureThisArg, isDelete);
|
||||
}
|
||||
|
||||
let expression = visitNode(node.expression, visitor, isExpression);
|
||||
let expression: Expression = visitNode(node.expression, visitor, isExpression);
|
||||
Debug.assertNotNode(expression, isSyntheticReference);
|
||||
|
||||
let thisArg: Expression | undefined;
|
||||
if (captureThisArg) {
|
||||
// `a.b` -> { expression: `(_a = a).b`, thisArg: `_a` }
|
||||
thisArg = createTempVariable(hoistVariableDeclaration);
|
||||
expression = createParen(createAssignment(thisArg, expression));
|
||||
if (shouldCaptureInTempVariable(expression)) {
|
||||
thisArg = createTempVariable(hoistVariableDeclaration);
|
||||
expression = createAssignment(thisArg, expression);
|
||||
}
|
||||
else {
|
||||
thisArg = expression;
|
||||
}
|
||||
}
|
||||
|
||||
expression = updatePropertyAccess(node, expression, visitNode(node.name, visitor, isIdentifier));
|
||||
return thisArg ? createSyntheticReferenceExpression(expression, thisArg) : expression;
|
||||
}
|
||||
|
||||
function visitNonOptionalElementAccessExpression(node: ElementAccessExpression, captureThisArg: boolean): Expression {
|
||||
if (isOptionalChain(node)) {
|
||||
// If `node` is an optional chain, then it is the outermost chain of an optional expression.
|
||||
return visitOptionalExpression(node, captureThisArg);
|
||||
}
|
||||
|
||||
let expression = visitNode(node.expression, visitor, isExpression);
|
||||
Debug.assertNotNode(expression, isSyntheticReference);
|
||||
|
||||
let thisArg: Expression | undefined;
|
||||
if (captureThisArg) {
|
||||
// `a[b]` -> { expression: `(_a = a)[b]`, thisArg: `_a` }
|
||||
thisArg = createTempVariable(hoistVariableDeclaration);
|
||||
expression = createParen(createAssignment(thisArg, expression));
|
||||
}
|
||||
|
||||
expression = updateElementAccess(node, expression, visitNode(node.argumentExpression, visitor, isExpression));
|
||||
expression = node.kind === SyntaxKind.PropertyAccessExpression
|
||||
? updatePropertyAccess(node, expression, visitNode(node.name, visitor, isIdentifier))
|
||||
: updateElementAccess(node, expression, visitNode(node.argumentExpression, visitor, isExpression));
|
||||
return thisArg ? createSyntheticReferenceExpression(expression, thisArg) : expression;
|
||||
}
|
||||
|
||||
function visitNonOptionalCallExpression(node: CallExpression, captureThisArg: boolean): Expression {
|
||||
if (isOptionalChain(node)) {
|
||||
// If `node` is an optional chain, then it is the outermost chain of an optional expression.
|
||||
return visitOptionalExpression(node, captureThisArg);
|
||||
return visitOptionalExpression(node, captureThisArg, /*isDelete*/ false);
|
||||
}
|
||||
return visitEachChild(node, visitor, context);
|
||||
}
|
||||
|
||||
function visitNonOptionalExpression(node: Expression, captureThisArg: boolean): Expression {
|
||||
function visitNonOptionalExpression(node: Expression, captureThisArg: boolean, isDelete: boolean): Expression {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ParenthesizedExpression: return visitNonOptionalParenthesizedExpression(node as ParenthesizedExpression, captureThisArg);
|
||||
case SyntaxKind.PropertyAccessExpression: return visitNonOptionalPropertyAccessExpression(node as PropertyAccessExpression, captureThisArg);
|
||||
case SyntaxKind.ElementAccessExpression: return visitNonOptionalElementAccessExpression(node as ElementAccessExpression, captureThisArg);
|
||||
case SyntaxKind.ParenthesizedExpression: return visitNonOptionalParenthesizedExpression(node as ParenthesizedExpression, captureThisArg, isDelete);
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression: return visitNonOptionalPropertyOrElementAccessExpression(node as AccessExpression, captureThisArg, isDelete);
|
||||
case SyntaxKind.CallExpression: return visitNonOptionalCallExpression(node as CallExpression, captureThisArg);
|
||||
default: return visitNode(node, visitor, isExpression);
|
||||
}
|
||||
}
|
||||
|
||||
function visitOptionalExpression(node: OptionalChain, captureThisArg: boolean): Expression {
|
||||
function visitOptionalExpression(node: OptionalChain, captureThisArg: boolean, isDelete: boolean): Expression {
|
||||
const { expression, chain } = flattenChain(node);
|
||||
const left = visitNonOptionalExpression(expression, isCallChain(chain[0]));
|
||||
const temp = createTempVariable(hoistVariableDeclaration);
|
||||
const left = visitNonOptionalExpression(expression, isCallChain(chain[0]), /*isDelete*/ false);
|
||||
const leftThisArg = isSyntheticReference(left) ? left.thisArg : undefined;
|
||||
const leftExpression = isSyntheticReference(left) ? left.expression : left;
|
||||
let rightExpression: Expression = temp;
|
||||
let leftExpression = isSyntheticReference(left) ? left.expression : left;
|
||||
let capturedLeft: Expression = leftExpression;
|
||||
if (shouldCaptureInTempVariable(leftExpression)) {
|
||||
capturedLeft = createTempVariable(hoistVariableDeclaration);
|
||||
leftExpression = createAssignment(capturedLeft, leftExpression);
|
||||
}
|
||||
let rightExpression = capturedLeft;
|
||||
let thisArg: Expression | undefined;
|
||||
for (let i = 0; i < chain.length; i++) {
|
||||
const segment = chain[i];
|
||||
switch (segment.kind) {
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
if (i === chain.length - 1 && captureThisArg) {
|
||||
thisArg = createTempVariable(hoistVariableDeclaration);
|
||||
rightExpression = createParen(createAssignment(thisArg, rightExpression));
|
||||
}
|
||||
rightExpression = createPropertyAccess(
|
||||
rightExpression,
|
||||
visitNode(segment.name, visitor, isIdentifier)
|
||||
);
|
||||
break;
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
if (i === chain.length - 1 && captureThisArg) {
|
||||
thisArg = createTempVariable(hoistVariableDeclaration);
|
||||
rightExpression = createParen(createAssignment(thisArg, rightExpression));
|
||||
if (shouldCaptureInTempVariable(rightExpression)) {
|
||||
thisArg = createTempVariable(hoistVariableDeclaration);
|
||||
rightExpression = createAssignment(thisArg, rightExpression);
|
||||
}
|
||||
else {
|
||||
thisArg = rightExpression;
|
||||
}
|
||||
}
|
||||
rightExpression = createElementAccess(
|
||||
rightExpression,
|
||||
visitNode(segment.argumentExpression, visitor, isExpression)
|
||||
);
|
||||
rightExpression = segment.kind === SyntaxKind.PropertyAccessExpression
|
||||
? createPropertyAccess(rightExpression, visitNode(segment.name, visitor, isIdentifier))
|
||||
: createElementAccess(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression));
|
||||
break;
|
||||
case SyntaxKind.CallExpression:
|
||||
if (i === 0 && leftThisArg) {
|
||||
rightExpression = createFunctionCall(
|
||||
rightExpression,
|
||||
leftThisArg,
|
||||
leftThisArg.kind === SyntaxKind.SuperKeyword ? createThis() : leftThisArg,
|
||||
visitNodes(segment.arguments, visitor, isExpression)
|
||||
);
|
||||
}
|
||||
@@ -167,49 +154,54 @@ namespace ts {
|
||||
setOriginalNode(rightExpression, segment);
|
||||
}
|
||||
|
||||
const target = createConditional(
|
||||
createLogicalOr(
|
||||
createStrictEquality(createAssignment(temp, leftExpression), createNull()),
|
||||
createStrictEquality(temp, createVoidZero())
|
||||
),
|
||||
createVoidZero(),
|
||||
rightExpression
|
||||
);
|
||||
const target = isDelete
|
||||
? createConditional(createNotNullCondition(leftExpression, capturedLeft, /*invert*/ true), createTrue(), createDelete(rightExpression))
|
||||
: createConditional(createNotNullCondition(leftExpression, capturedLeft, /*invert*/ true), createVoidZero(), rightExpression);
|
||||
return thisArg ? createSyntheticReferenceExpression(target, thisArg) : target;
|
||||
}
|
||||
|
||||
function createNotNullCondition(node: Expression) {
|
||||
function createNotNullCondition(left: Expression, right: Expression, invert?: boolean) {
|
||||
return createBinary(
|
||||
createBinary(
|
||||
node,
|
||||
createToken(SyntaxKind.ExclamationEqualsEqualsToken),
|
||||
left,
|
||||
createToken(invert ? SyntaxKind.EqualsEqualsEqualsToken : SyntaxKind.ExclamationEqualsEqualsToken),
|
||||
createNull()
|
||||
),
|
||||
createToken(SyntaxKind.AmpersandAmpersandToken),
|
||||
createToken(invert ? SyntaxKind.BarBarToken : SyntaxKind.AmpersandAmpersandToken),
|
||||
createBinary(
|
||||
node,
|
||||
createToken(SyntaxKind.ExclamationEqualsEqualsToken),
|
||||
right,
|
||||
createToken(invert ? SyntaxKind.EqualsEqualsEqualsToken : SyntaxKind.ExclamationEqualsEqualsToken),
|
||||
createVoidZero()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function transformNullishCoalescingExpression(node: BinaryExpression) {
|
||||
const expressions: Expression[] = [];
|
||||
let left = visitNode(node.left, visitor, isExpression);
|
||||
if (!isIdentifier(left)) {
|
||||
const temp = createTempVariable(hoistVariableDeclaration);
|
||||
expressions.push(createAssignment(temp, left));
|
||||
left = temp;
|
||||
let right = left;
|
||||
if (shouldCaptureInTempVariable(left)) {
|
||||
right = createTempVariable(hoistVariableDeclaration);
|
||||
left = createAssignment(right, left);
|
||||
}
|
||||
expressions.push(
|
||||
createParen(
|
||||
createConditional(
|
||||
createNotNullCondition(left),
|
||||
left,
|
||||
visitNode(node.right, visitor, isExpression)))
|
||||
);
|
||||
return inlineExpressions(expressions);
|
||||
return createConditional(
|
||||
createNotNullCondition(left, right),
|
||||
right,
|
||||
visitNode(node.right, visitor, isExpression),
|
||||
);
|
||||
}
|
||||
|
||||
function shouldCaptureInTempVariable(expression: Expression): boolean {
|
||||
// don't capture identifiers and `this` in a temporary variable
|
||||
// `super` cannot be captured as it's no real variable
|
||||
return !isIdentifier(expression) &&
|
||||
expression.kind !== SyntaxKind.ThisKeyword &&
|
||||
expression.kind !== SyntaxKind.SuperKeyword;
|
||||
}
|
||||
|
||||
function visitDeleteExpression(node: DeleteExpression) {
|
||||
return isOptionalChain(skipParentheses(node.expression))
|
||||
? setOriginalNode(visitNonOptionalExpression(node.expression, /*captureThisArg*/ false, /*isDelete*/ true), node)
|
||||
: updateDelete(node, visitNode(node.expression, visitor, isExpression));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1873,6 +1873,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
function visitPropertyDeclaration(node: PropertyDeclaration) {
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return undefined;
|
||||
}
|
||||
const updated = updateProperty(
|
||||
node,
|
||||
/*decorators*/ undefined,
|
||||
@@ -2188,9 +2191,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function visitVariableDeclaration(node: VariableDeclaration) {
|
||||
return updateVariableDeclaration(
|
||||
return updateTypeScriptVariableDeclaration(
|
||||
node,
|
||||
visitNode(node.name, visitor, isBindingName),
|
||||
/*exclaimationToken*/ undefined,
|
||||
/*type*/ undefined,
|
||||
visitNode(node.initializer, visitor, isExpression));
|
||||
}
|
||||
|
||||
+14
-9
@@ -4484,8 +4484,6 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface UnionType extends UnionOrIntersectionType {
|
||||
/* @internal */
|
||||
possiblePropertyCache?: SymbolTable; // Cache of _all_ resolved properties less any from aparent members
|
||||
}
|
||||
|
||||
export interface IntersectionType extends UnionOrIntersectionType {
|
||||
@@ -4742,11 +4740,12 @@ namespace ts {
|
||||
HomomorphicMappedType = 1 << 1, // Reverse inference for homomorphic mapped type
|
||||
PartialHomomorphicMappedType = 1 << 2, // Partial reverse inference for homomorphic mapped type
|
||||
MappedTypeConstraint = 1 << 3, // Reverse inference for mapped type
|
||||
ReturnType = 1 << 4, // Inference made from return type of generic function
|
||||
LiteralKeyof = 1 << 5, // Inference made from a string literal to a keyof T
|
||||
NoConstraints = 1 << 6, // Don't infer from constraints of instantiable types
|
||||
AlwaysStrict = 1 << 7, // Always use strict rules for contravariant inferences
|
||||
MaxValue = 1 << 8, // Seed for inference priority tracking
|
||||
ContravariantConditional = 1 << 4, // Conditional type in contravariant position
|
||||
ReturnType = 1 << 5, // Inference made from return type of generic function
|
||||
LiteralKeyof = 1 << 6, // Inference made from a string literal to a keyof T
|
||||
NoConstraints = 1 << 7, // Don't infer from constraints of instantiable types
|
||||
AlwaysStrict = 1 << 8, // Always use strict rules for contravariant inferences
|
||||
MaxValue = 1 << 9, // Seed for inference priority tracking
|
||||
|
||||
PriorityImpliesCombination = ReturnType | MappedTypeConstraint | LiteralKeyof, // These priorities imply that the resulting type should be a combination of all candidates
|
||||
Circularity = -1, // Inference circularity (value less than all other priorities)
|
||||
@@ -5199,11 +5198,17 @@ namespace ts {
|
||||
type: Map<number | string>; // an object literal mapping named values to actual values
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface DidYouMeanOptionalDiagnostics {
|
||||
unknownOptionDiagnostic: DiagnosticMessage,
|
||||
unknownDidYouMeanDiagnostic: DiagnosticMessage,
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface TsConfigOnlyOption extends CommandLineOptionBase {
|
||||
type: "object";
|
||||
elementOptions?: Map<CommandLineOption>;
|
||||
extraKeyDiagnosticMessage?: DiagnosticMessage;
|
||||
extraKeyDiagnostics?: DidYouMeanOptionalDiagnostics;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -6458,7 +6463,7 @@ namespace ts {
|
||||
readonly includeCompletionsForModuleExports?: boolean;
|
||||
readonly includeAutomaticOptionalChainCompletions?: boolean;
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
|
||||
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
|
||||
readonly importModuleSpecifierEnding?: "minimal" | "index" | "js";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
|
||||
@@ -1221,11 +1221,8 @@ namespace ts {
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
// These are not allowed inside a generator now, but eventually they may be allowed
|
||||
// as local types. Regardless, any yield statements contained within them should be
|
||||
// skipped in this traversal.
|
||||
// as local types. Regardless, skip them to avoid the work.
|
||||
return;
|
||||
default:
|
||||
if (isFunctionLike(node)) {
|
||||
@@ -4244,9 +4241,12 @@ namespace ts {
|
||||
|
||||
export function tryGetPropertyAccessOrIdentifierToString(expr: Expression): string | undefined {
|
||||
if (isPropertyAccessExpression(expr)) {
|
||||
return tryGetPropertyAccessOrIdentifierToString(expr.expression) + "." + expr.name;
|
||||
const baseStr = tryGetPropertyAccessOrIdentifierToString(expr.expression);
|
||||
if (baseStr !== undefined) {
|
||||
return baseStr + "." + expr.name;
|
||||
}
|
||||
}
|
||||
if (isIdentifier(expr)) {
|
||||
else if (isIdentifier(expr)) {
|
||||
return unescapeLeadingUnderscores(expr.escapedText);
|
||||
}
|
||||
return undefined;
|
||||
@@ -8131,10 +8131,6 @@ namespace ts {
|
||||
return some(supportedJSExtensions, extension => fileExtensionIs(fileName, extension));
|
||||
}
|
||||
|
||||
export function hasJSOrJsonFileExtension(fileName: string): boolean {
|
||||
return supportedJSAndJsonExtensions.some(ext => fileExtensionIs(fileName, ext));
|
||||
}
|
||||
|
||||
export function hasTSFileExtension(fileName: string): boolean {
|
||||
return some(supportedTSExtensions, extension => fileExtensionIs(fileName, extension));
|
||||
}
|
||||
@@ -8286,6 +8282,7 @@ namespace ts {
|
||||
export function matchPatternOrExact(patternStrings: readonly string[], candidate: string): string | Pattern | undefined {
|
||||
const patterns: Pattern[] = [];
|
||||
for (const patternString of patternStrings) {
|
||||
if (!hasZeroOrOneAsteriskCharacter(patternString)) continue;
|
||||
const pattern = tryParsePattern(patternString);
|
||||
if (pattern) {
|
||||
patterns.push(pattern);
|
||||
|
||||
@@ -702,8 +702,9 @@ namespace ts {
|
||||
visitNode((<TryStatement>node).finallyBlock, visitor, isBlock));
|
||||
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return updateVariableDeclaration(<VariableDeclaration>node,
|
||||
return updateTypeScriptVariableDeclaration(<VariableDeclaration>node,
|
||||
visitNode((<VariableDeclaration>node).name, visitor, isBindingName),
|
||||
visitNode((<VariableDeclaration>node).exclamationToken, tokenVisitor, isToken),
|
||||
visitNode((<VariableDeclaration>node).type, visitor, isTypeNode),
|
||||
visitNode((<VariableDeclaration>node).initializer, visitor, isExpression));
|
||||
|
||||
|
||||
@@ -374,12 +374,14 @@ namespace ts.server {
|
||||
private getDiagnostics(file: string, command: CommandNames): DiagnosticWithLocation[] {
|
||||
const request = this.processRequest<protocol.SyntacticDiagnosticsSyncRequest | protocol.SemanticDiagnosticsSyncRequest | protocol.SuggestionDiagnosticsSyncRequest>(command, { file, includeLinePosition: true });
|
||||
const response = this.processResponse<protocol.SyntacticDiagnosticsSyncResponse | protocol.SemanticDiagnosticsSyncResponse | protocol.SuggestionDiagnosticsSyncResponse>(request);
|
||||
const sourceText = getSnapshotText(this.host.getScriptSnapshot(file)!);
|
||||
const fakeSourceFile = { fileName: file, text: sourceText } as SourceFile; // Warning! This is a huge lie!
|
||||
|
||||
return (<protocol.DiagnosticWithLinePosition[]>response.body).map((entry): DiagnosticWithLocation => {
|
||||
const category = firstDefined(Object.keys(DiagnosticCategory), id =>
|
||||
isString(id) && entry.category === id.toLowerCase() ? (<any>DiagnosticCategory)[id] : undefined);
|
||||
return {
|
||||
file: undefined!, // TODO: GH#18217
|
||||
file: fakeSourceFile,
|
||||
start: entry.start,
|
||||
length: entry.length,
|
||||
messageText: entry.message,
|
||||
@@ -518,14 +520,14 @@ namespace ts.server {
|
||||
return notImplemented();
|
||||
}
|
||||
|
||||
getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems {
|
||||
getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems | undefined {
|
||||
const args: protocol.SignatureHelpRequestArgs = this.createFileLocationRequestArgs(fileName, position);
|
||||
|
||||
const request = this.processRequest<protocol.SignatureHelpRequest>(CommandNames.SignatureHelp, args);
|
||||
const response = this.processResponse<protocol.SignatureHelpResponse>(request);
|
||||
|
||||
if (!response.body) {
|
||||
return undefined!; // TODO: GH#18217
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const { items, applicableSpan: encodedApplicableSpan, selectedItemIndex, argumentIndex, argumentCount } = response.body;
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
constructor(private basePath: string, private testType: FourSlashTestType, public testData: FourSlashData) {
|
||||
constructor(private originalInputFileName: string, private basePath: string, private testType: FourSlashTestType, public testData: FourSlashData) {
|
||||
// Create a new Services Adapter
|
||||
this.cancellationToken = new TestCancellationToken();
|
||||
let compilationOptions = convertGlobalOptionsToCompilerOptions(this.testData.globalOptions);
|
||||
@@ -1475,7 +1475,7 @@ namespace FourSlash {
|
||||
}
|
||||
|
||||
public baselineCurrentFileBreakpointLocations() {
|
||||
const baselineFile = this.getBaselineFileName().replace("breakpointValidation", "bpSpan");
|
||||
const baselineFile = this.getBaselineFileNameForInternalFourslashFile().replace("breakpointValidation", "bpSpan");
|
||||
Harness.Baseline.runBaseline(baselineFile, this.baselineCurrentFileLocations(pos => this.getBreakpointStatementLocation(pos)!));
|
||||
}
|
||||
|
||||
@@ -1554,8 +1554,49 @@ namespace FourSlash {
|
||||
return result;
|
||||
}
|
||||
|
||||
public baselineSyntacticDiagnostics() {
|
||||
const files = this.getCompilerTestFiles();
|
||||
const result = this.getSyntacticDiagnosticBaselineText(files);
|
||||
Harness.Baseline.runBaseline(this.getBaselineFileNameForContainingTestFile(), result);
|
||||
}
|
||||
|
||||
private getCompilerTestFiles() {
|
||||
return ts.map(this.testData.files, ({ content, fileName }) => ({
|
||||
content, unitName: fileName
|
||||
}));
|
||||
}
|
||||
|
||||
public baselineSyntacticAndSemanticDiagnostics() {
|
||||
const files = this.getCompilerTestFiles();
|
||||
const result = this.getSyntacticDiagnosticBaselineText(files)
|
||||
+ Harness.IO.newLine()
|
||||
+ Harness.IO.newLine()
|
||||
+ this.getSemanticDiagnosticBaselineText(files);
|
||||
Harness.Baseline.runBaseline(this.getBaselineFileNameForContainingTestFile(), result);
|
||||
}
|
||||
|
||||
private getSyntacticDiagnosticBaselineText(files: Harness.Compiler.TestFile[]) {
|
||||
const diagnostics = ts.flatMap(files,
|
||||
file => this.languageService.getSyntacticDiagnostics(file.unitName)
|
||||
);
|
||||
const result = `Syntactic Diagnostics for file '${this.originalInputFileName}':`
|
||||
+ Harness.IO.newLine()
|
||||
+ Harness.Compiler.getErrorBaseline(files, diagnostics, /*pretty*/ false);
|
||||
return result;
|
||||
}
|
||||
|
||||
private getSemanticDiagnosticBaselineText(files: Harness.Compiler.TestFile[]) {
|
||||
const diagnostics = ts.flatMap(files,
|
||||
file => this.languageService.getSemanticDiagnostics(file.unitName)
|
||||
);
|
||||
const result = `Semantic Diagnostics for file '${this.originalInputFileName}':`
|
||||
+ Harness.IO.newLine()
|
||||
+ Harness.Compiler.getErrorBaseline(files, diagnostics, /*pretty*/ false);
|
||||
return result;
|
||||
}
|
||||
|
||||
public baselineQuickInfo() {
|
||||
const baselineFile = this.getBaselineFileName();
|
||||
const baselineFile = this.getBaselineFileNameForInternalFourslashFile();
|
||||
Harness.Baseline.runBaseline(
|
||||
baselineFile,
|
||||
stringify(
|
||||
@@ -1567,7 +1608,7 @@ namespace FourSlash {
|
||||
|
||||
public baselineSmartSelection() {
|
||||
const n = "\n";
|
||||
const baselineFile = this.getBaselineFileName();
|
||||
const baselineFile = this.getBaselineFileNameForInternalFourslashFile();
|
||||
const markers = this.getMarkers();
|
||||
const fileContent = this.activeFile.content;
|
||||
const text = markers.map(marker => {
|
||||
@@ -1652,11 +1693,15 @@ namespace FourSlash {
|
||||
Harness.IO.log(stringify(help.items[help.selectedItemIndex]));
|
||||
}
|
||||
|
||||
private getBaselineFileName() {
|
||||
private getBaselineFileNameForInternalFourslashFile() {
|
||||
return this.testData.globalOptions[MetadataOptionNames.baselineFile] ||
|
||||
ts.getBaseFileName(this.activeFile.fileName).replace(ts.Extension.Ts, ".baseline");
|
||||
}
|
||||
|
||||
private getBaselineFileNameForContainingTestFile() {
|
||||
return ts.getBaseFileName(this.originalInputFileName).replace(ts.Extension.Ts, ".baseline");
|
||||
}
|
||||
|
||||
private getSignatureHelp({ triggerReason }: FourSlashInterface.VerifySignatureHelpOptions): ts.SignatureHelpItems | undefined {
|
||||
return this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition, {
|
||||
triggerReason
|
||||
@@ -2358,9 +2403,9 @@ namespace FourSlash {
|
||||
if (!details) {
|
||||
return this.raiseError(`No completions were found for the given name, source, and preferences.`);
|
||||
}
|
||||
const codeActions = details.codeActions!;
|
||||
if (codeActions.length !== 1) {
|
||||
this.raiseError(`Expected one code action, got ${codeActions.length}`);
|
||||
const codeActions = details.codeActions;
|
||||
if (codeActions?.length !== 1) {
|
||||
this.raiseError(`Expected one code action, got ${codeActions?.length ?? 0}`);
|
||||
}
|
||||
const codeAction = ts.first(codeActions);
|
||||
|
||||
@@ -3263,7 +3308,7 @@ namespace FourSlash {
|
||||
|
||||
// Parse out the files and their metadata
|
||||
const testData = parseTestData(absoluteBasePath, content, absoluteFileName);
|
||||
const state = new TestState(absoluteBasePath, testType, testData);
|
||||
const state = new TestState(absoluteFileName, absoluteBasePath, testType, testData);
|
||||
const output = ts.transpileModule(content, { reportDiagnostics: true, compilerOptions: { target: ts.ScriptTarget.ES2015 } });
|
||||
if (output.diagnostics!.length > 0) {
|
||||
throw new Error(`Syntax error in ${absoluteBasePath}: ${output.diagnostics![0].messageText}`);
|
||||
@@ -4122,6 +4167,14 @@ namespace FourSlashInterface {
|
||||
this.state.baselineSmartSelection();
|
||||
}
|
||||
|
||||
public baselineSyntacticDiagnostics() {
|
||||
this.state.baselineSyntacticDiagnostics();
|
||||
}
|
||||
|
||||
public baselineSyntacticAndSemanticDiagnostics() {
|
||||
this.state.baselineSyntacticAndSemanticDiagnostics();
|
||||
}
|
||||
|
||||
public nameOrDottedNameSpanTextIs(text: string) {
|
||||
this.state.verifyCurrentNameOrDottedNameSpanText(text);
|
||||
}
|
||||
|
||||
+80
-5
@@ -1412,10 +1412,65 @@ namespace Harness {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
function splitVaryBySettingValue(text: string): string[] | undefined {
|
||||
function splitVaryBySettingValue(text: string, varyBy: string): string[] | undefined {
|
||||
if (!text) return undefined;
|
||||
const entries = text.split(/,/).map(s => s.trim().toLowerCase()).filter(s => s.length > 0);
|
||||
return entries && entries.length > 1 ? entries : undefined;
|
||||
|
||||
let star = false;
|
||||
const includes: string[] = [];
|
||||
const excludes: string[] = [];
|
||||
for (let s of text.split(/,/g)) {
|
||||
s = s.trim().toLowerCase();
|
||||
if (s.length === 0) continue;
|
||||
if (s === "*") {
|
||||
star = true;
|
||||
}
|
||||
else if (ts.startsWith(s, "-") || ts.startsWith(s, "!")) {
|
||||
excludes.push(s.slice(1));
|
||||
}
|
||||
else {
|
||||
includes.push(s);
|
||||
}
|
||||
}
|
||||
|
||||
// do nothing if the setting has no variations
|
||||
if (includes.length <= 1 && !star && excludes.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const variations: { key: string, value?: string | number }[] = [];
|
||||
const values = getVaryByStarSettingValues(varyBy);
|
||||
|
||||
// add (and deduplicate) all included entries
|
||||
for (const include of includes) {
|
||||
const value = values?.get(include);
|
||||
if (ts.findIndex(variations, v => v.key === include || value !== undefined && v.value === value) === -1) {
|
||||
variations.push({ key: include, value });
|
||||
}
|
||||
}
|
||||
|
||||
if (star && values) {
|
||||
// add all entries
|
||||
for (const [key, value] of ts.arrayFrom(values.entries())) {
|
||||
if (ts.findIndex(variations, v => v.key === key || v.value === value) === -1) {
|
||||
variations.push({ key, value });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove all excluded entries
|
||||
for (const exclude of excludes) {
|
||||
const value = values?.get(exclude);
|
||||
let index: number;
|
||||
while ((index = ts.findIndex(variations, v => v.key === exclude || value !== undefined && v.value === value)) >= 0) {
|
||||
ts.orderedRemoveItemAt(variations, index);
|
||||
}
|
||||
}
|
||||
|
||||
if (variations.length === 0) {
|
||||
throw new Error(`Variations in test option '@${varyBy}' resulted in an empty set.`);
|
||||
}
|
||||
|
||||
return ts.map(variations, v => v.key);
|
||||
}
|
||||
|
||||
function computeFileBasedTestConfigurationVariations(configurations: FileBasedTestConfiguration[], variationState: FileBasedTestConfiguration, varyByEntries: [string, string[]][], offset: number) {
|
||||
@@ -1433,17 +1488,37 @@ namespace Harness {
|
||||
}
|
||||
}
|
||||
|
||||
let booleanVaryByStarSettingValues: ts.Map<string | number> | undefined;
|
||||
|
||||
function getVaryByStarSettingValues(varyBy: string): ts.ReadonlyMap<string | number> | undefined {
|
||||
const option = ts.forEach(ts.optionDeclarations, decl => ts.equateStringsCaseInsensitive(decl.name, varyBy) ? decl : undefined);
|
||||
if (option) {
|
||||
if (typeof option.type === "object") {
|
||||
return option.type;
|
||||
}
|
||||
if (option.type === "boolean") {
|
||||
return booleanVaryByStarSettingValues || (booleanVaryByStarSettingValues = ts.createMapFromTemplate({
|
||||
true: 1,
|
||||
false: 0
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute FileBasedTestConfiguration variations based on a supplied list of variable settings.
|
||||
*/
|
||||
export function getFileBasedTestConfigurations(settings: TestCaseParser.CompilerSettings, varyBy: string[]): FileBasedTestConfiguration[] | undefined {
|
||||
export function getFileBasedTestConfigurations(settings: TestCaseParser.CompilerSettings, varyBy: readonly string[]): FileBasedTestConfiguration[] | undefined {
|
||||
let varyByEntries: [string, string[]][] | undefined;
|
||||
let variationCount = 1;
|
||||
for (const varyByKey of varyBy) {
|
||||
if (ts.hasProperty(settings, varyByKey)) {
|
||||
// we only consider variations when there are 2 or more variable entries.
|
||||
const entries = splitVaryBySettingValue(settings[varyByKey]);
|
||||
const entries = splitVaryBySettingValue(settings[varyByKey], varyByKey);
|
||||
if (entries) {
|
||||
if (!varyByEntries) varyByEntries = [];
|
||||
variationCount *= entries.length;
|
||||
if (variationCount > 25) throw new Error(`Provided test options exceeded the maximum number of variations: ${varyBy.map(v => `'@${v}'`).join(", ")}`);
|
||||
varyByEntries.push([varyByKey, entries]);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+58
-33
@@ -1496,6 +1496,16 @@ interface RTCTransportStats extends RTCStats {
|
||||
selectedCandidatePairId?: string;
|
||||
}
|
||||
|
||||
interface ReadableStreamReadDoneResult<T> {
|
||||
done: true;
|
||||
value?: T;
|
||||
}
|
||||
|
||||
interface ReadableStreamReadValueResult<T> {
|
||||
done: false;
|
||||
value: T;
|
||||
}
|
||||
|
||||
interface RegistrationOptions {
|
||||
scope?: string;
|
||||
type?: WorkerType;
|
||||
@@ -2815,7 +2825,7 @@ interface CSSStyleDeclaration {
|
||||
clip: string;
|
||||
clipPath: string;
|
||||
clipRule: string;
|
||||
color: string | null;
|
||||
color: string;
|
||||
colorInterpolation: string;
|
||||
colorInterpolationFilters: string;
|
||||
columnCount: string;
|
||||
@@ -2992,7 +3002,7 @@ interface CSSStyleDeclaration {
|
||||
msWrapThrough: string;
|
||||
objectFit: string;
|
||||
objectPosition: string;
|
||||
opacity: string | null;
|
||||
opacity: string;
|
||||
order: string;
|
||||
orphans: string;
|
||||
outline: string;
|
||||
@@ -3032,14 +3042,14 @@ interface CSSStyleDeclaration {
|
||||
right: string;
|
||||
rotate: string;
|
||||
rowGap: string;
|
||||
rubyAlign: string | null;
|
||||
rubyAlign: string;
|
||||
rubyOverhang: string | null;
|
||||
rubyPosition: string | null;
|
||||
rubyPosition: string;
|
||||
scale: string;
|
||||
scrollBehavior: string;
|
||||
shapeRendering: string;
|
||||
stopColor: string | null;
|
||||
stopOpacity: string | null;
|
||||
stopColor: string;
|
||||
stopOpacity: string;
|
||||
stroke: string;
|
||||
strokeDasharray: string;
|
||||
strokeDashoffset: string;
|
||||
@@ -3052,7 +3062,7 @@ interface CSSStyleDeclaration {
|
||||
tableLayout: string;
|
||||
textAlign: string;
|
||||
textAlignLast: string;
|
||||
textAnchor: string | null;
|
||||
textAnchor: string;
|
||||
textCombineUpright: string;
|
||||
textDecoration: string;
|
||||
textDecorationColor: string;
|
||||
@@ -3344,7 +3354,7 @@ interface CacheStorage {
|
||||
delete(cacheName: string): Promise<boolean>;
|
||||
has(cacheName: string): Promise<boolean>;
|
||||
keys(): Promise<string[]>;
|
||||
match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response | undefined>;
|
||||
match(request: RequestInfo, options?: MultiCacheQueryOptions): Promise<Response | undefined>;
|
||||
open(cacheName: string): Promise<Cache>;
|
||||
}
|
||||
|
||||
@@ -4016,6 +4026,7 @@ interface DOMMatrixReadOnly {
|
||||
toJSON(): any;
|
||||
transformPoint(point?: DOMPointInit): DOMPoint;
|
||||
translate(tx?: number, ty?: number, tz?: number): DOMMatrix;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
declare var DOMMatrixReadOnly: {
|
||||
@@ -4024,6 +4035,7 @@ declare var DOMMatrixReadOnly: {
|
||||
fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly;
|
||||
fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly;
|
||||
fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly;
|
||||
toString(): string;
|
||||
};
|
||||
|
||||
/** Provides the ability to parse XML or HTML source code from a string into a DOM Document. */
|
||||
@@ -4181,6 +4193,7 @@ interface DOMTokenList {
|
||||
* Can be set, to change the associated attribute.
|
||||
*/
|
||||
value: string;
|
||||
toString(): string;
|
||||
/**
|
||||
* Adds all arguments passed, except those already present.
|
||||
*
|
||||
@@ -4416,6 +4429,7 @@ interface DeviceMotionEvent extends Event {
|
||||
declare var DeviceMotionEvent: {
|
||||
prototype: DeviceMotionEvent;
|
||||
new(type: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent;
|
||||
requestPermission(): Promise<PermissionState>;
|
||||
};
|
||||
|
||||
interface DeviceMotionEventAcceleration {
|
||||
@@ -4441,6 +4455,7 @@ interface DeviceOrientationEvent extends Event {
|
||||
declare var DeviceOrientationEvent: {
|
||||
prototype: DeviceOrientationEvent;
|
||||
new(type: string, eventInitDict?: DeviceOrientationEventInit): DeviceOrientationEvent;
|
||||
requestPermission(): Promise<PermissionState>;
|
||||
};
|
||||
|
||||
/** Provides information about the rate at which the device is rotating around all three axes. */
|
||||
@@ -6096,10 +6111,10 @@ interface GlobalEventHandlers {
|
||||
*/
|
||||
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
||||
ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
||||
ontouchcancel: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
|
||||
ontouchend: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
|
||||
ontouchmove: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
|
||||
ontouchstart: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
|
||||
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
|
||||
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
|
||||
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
|
||||
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
|
||||
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
||||
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
||||
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
||||
@@ -7059,6 +7074,7 @@ interface HTMLHyperlinkElementUtils {
|
||||
host: string;
|
||||
hostname: string;
|
||||
href: string;
|
||||
toString(): string;
|
||||
readonly origin: string;
|
||||
password: string;
|
||||
pathname: string;
|
||||
@@ -7344,7 +7360,7 @@ interface HTMLInputElement extends HTMLElement {
|
||||
* When present, marks an element that can't be submitted without a value.
|
||||
*/
|
||||
required: boolean;
|
||||
selectionDirection: string | null;
|
||||
selectionDirection: "forward" | "backward" | "none" | null;
|
||||
/**
|
||||
* Gets or sets the end position or offset of a text selection.
|
||||
*/
|
||||
@@ -8935,7 +8951,7 @@ interface HTMLTextAreaElement extends HTMLElement {
|
||||
* Sets or retrieves the number of horizontal rows contained in the object.
|
||||
*/
|
||||
rows: number;
|
||||
selectionDirection: string;
|
||||
selectionDirection: "forward" | "backward" | "none";
|
||||
/**
|
||||
* Gets or sets the end position or offset of a text selection.
|
||||
*/
|
||||
@@ -9912,6 +9928,7 @@ interface Location {
|
||||
* Can be set, to navigate to the given URL.
|
||||
*/
|
||||
href: string;
|
||||
toString(): string;
|
||||
/**
|
||||
* Returns the Location object's URL's origin.
|
||||
*/
|
||||
@@ -10370,10 +10387,10 @@ declare var MediaKeys: {
|
||||
interface MediaList {
|
||||
readonly length: number;
|
||||
mediaText: string;
|
||||
toString(): string;
|
||||
appendMedium(medium: string): void;
|
||||
deleteMedium(medium: string): void;
|
||||
item(index: number): string | null;
|
||||
toString(): number;
|
||||
[index: number]: string;
|
||||
}
|
||||
|
||||
@@ -10985,7 +11002,7 @@ interface Node extends EventTarget {
|
||||
/**
|
||||
* Returns the previous sibling.
|
||||
*/
|
||||
readonly previousSibling: Node | null;
|
||||
readonly previousSibling: ChildNode | null;
|
||||
textContent: string | null;
|
||||
appendChild<T extends Node>(newChild: T): T;
|
||||
/**
|
||||
@@ -12640,6 +12657,7 @@ interface Range extends AbstractRange {
|
||||
setStartAfter(node: Node): void;
|
||||
setStartBefore(node: Node): void;
|
||||
surroundContents(newParent: Node): void;
|
||||
toString(): string;
|
||||
readonly END_TO_END: number;
|
||||
readonly END_TO_START: number;
|
||||
readonly START_TO_END: number;
|
||||
@@ -12653,6 +12671,7 @@ declare var Range: {
|
||||
readonly END_TO_START: number;
|
||||
readonly START_TO_END: number;
|
||||
readonly START_TO_START: number;
|
||||
toString(): string;
|
||||
};
|
||||
|
||||
interface ReadableByteStreamController {
|
||||
@@ -12707,11 +12726,6 @@ interface ReadableStreamDefaultReader<R = any> {
|
||||
releaseLock(): void;
|
||||
}
|
||||
|
||||
interface ReadableStreamReadResult<T> {
|
||||
done: boolean;
|
||||
value: T;
|
||||
}
|
||||
|
||||
interface ReadableStreamReader<R = any> {
|
||||
cancel(): Promise<void>;
|
||||
read(): Promise<ReadableStreamReadResult<R>>;
|
||||
@@ -14358,7 +14372,7 @@ declare var SVGPathSegMovetoRel: {
|
||||
};
|
||||
|
||||
/** Corresponds to the <pattern> element. */
|
||||
interface SVGPatternElement extends SVGElement, SVGFitToViewBox, SVGTests, SVGURIReference {
|
||||
interface SVGPatternElement extends SVGElement, SVGFitToViewBox, SVGURIReference {
|
||||
readonly height: SVGAnimatedLength;
|
||||
readonly patternContentUnits: SVGAnimatedEnumeration;
|
||||
readonly patternTransform: SVGAnimatedTransformList;
|
||||
@@ -14464,6 +14478,7 @@ declare var SVGPreserveAspectRatio: {
|
||||
interface SVGRadialGradientElement extends SVGGradientElement {
|
||||
readonly cx: SVGAnimatedLength;
|
||||
readonly cy: SVGAnimatedLength;
|
||||
readonly fr: SVGAnimatedLength;
|
||||
readonly fx: SVGAnimatedLength;
|
||||
readonly fy: SVGAnimatedLength;
|
||||
readonly r: SVGAnimatedLength;
|
||||
@@ -14680,13 +14695,13 @@ interface SVGTests {
|
||||
interface SVGTextContentElement extends SVGGraphicsElement {
|
||||
readonly lengthAdjust: SVGAnimatedEnumeration;
|
||||
readonly textLength: SVGAnimatedLength;
|
||||
getCharNumAtPosition(point: SVGPoint): number;
|
||||
getCharNumAtPosition(point?: DOMPointInit): number;
|
||||
getComputedTextLength(): number;
|
||||
getEndPositionOfChar(charnum: number): SVGPoint;
|
||||
getExtentOfChar(charnum: number): SVGRect;
|
||||
getEndPositionOfChar(charnum: number): DOMPoint;
|
||||
getExtentOfChar(charnum: number): DOMRect;
|
||||
getNumberOfChars(): number;
|
||||
getRotationOfChar(charnum: number): number;
|
||||
getStartPositionOfChar(charnum: number): SVGPoint;
|
||||
getStartPositionOfChar(charnum: number): DOMPoint;
|
||||
getSubStringLength(charnum: number, nchars: number): number;
|
||||
selectSubString(charnum: number, nchars: number): void;
|
||||
readonly LENGTHADJUST_SPACING: number;
|
||||
@@ -15029,11 +15044,13 @@ interface Selection {
|
||||
selectAllChildren(node: Node): void;
|
||||
setBaseAndExtent(anchorNode: Node, anchorOffset: number, focusNode: Node, focusOffset: number): void;
|
||||
setPosition(node: Node | null, offset?: number): void;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
declare var Selection: {
|
||||
prototype: Selection;
|
||||
new(): Selection;
|
||||
toString(): string;
|
||||
};
|
||||
|
||||
interface ServiceUIFrameContext {
|
||||
@@ -15660,6 +15677,8 @@ interface TextDecoderCommon {
|
||||
}
|
||||
|
||||
interface TextDecoderStream extends GenericTransformStream, TextDecoderCommon {
|
||||
readonly readable: ReadableStream<string>;
|
||||
readonly writable: WritableStream<BufferSource>;
|
||||
}
|
||||
|
||||
declare var TextDecoderStream: {
|
||||
@@ -15692,6 +15711,8 @@ interface TextEncoderCommon {
|
||||
}
|
||||
|
||||
interface TextEncoderStream extends GenericTransformStream, TextEncoderCommon {
|
||||
readonly readable: ReadableStream<Uint8Array>;
|
||||
readonly writable: WritableStream<string>;
|
||||
}
|
||||
|
||||
declare var TextEncoderStream: {
|
||||
@@ -16034,6 +16055,7 @@ interface URL {
|
||||
host: string;
|
||||
hostname: string;
|
||||
href: string;
|
||||
toString(): string;
|
||||
readonly origin: string;
|
||||
password: string;
|
||||
pathname: string;
|
||||
@@ -16081,12 +16103,14 @@ interface URLSearchParams {
|
||||
*/
|
||||
set(name: string, value: string): void;
|
||||
sort(): void;
|
||||
toString(): string;
|
||||
forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
|
||||
}
|
||||
|
||||
declare var URLSearchParams: {
|
||||
prototype: URLSearchParams;
|
||||
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
|
||||
toString(): string;
|
||||
};
|
||||
|
||||
/** This WebVR API interface represents any VR device supported by this API. It includes generic information such as device IDs and descriptions, as well as methods for starting to present a VR scene, retrieving eye parameters and display capabilities, and other important functionality. */
|
||||
@@ -18668,7 +18692,7 @@ interface WindowEventHandlersEventMap {
|
||||
"pagehide": PageTransitionEvent;
|
||||
"pageshow": PageTransitionEvent;
|
||||
"popstate": PopStateEvent;
|
||||
"rejectionhandled": Event;
|
||||
"rejectionhandled": PromiseRejectionEvent;
|
||||
"storage": StorageEvent;
|
||||
"unhandledrejection": PromiseRejectionEvent;
|
||||
"unload": Event;
|
||||
@@ -18687,7 +18711,7 @@ interface WindowEventHandlers {
|
||||
onpagehide: ((this: WindowEventHandlers, ev: PageTransitionEvent) => any) | null;
|
||||
onpageshow: ((this: WindowEventHandlers, ev: PageTransitionEvent) => any) | null;
|
||||
onpopstate: ((this: WindowEventHandlers, ev: PopStateEvent) => any) | null;
|
||||
onrejectionhandled: ((this: WindowEventHandlers, ev: Event) => any) | null;
|
||||
onrejectionhandled: ((this: WindowEventHandlers, ev: PromiseRejectionEvent) => any) | null;
|
||||
onstorage: ((this: WindowEventHandlers, ev: StorageEvent) => any) | null;
|
||||
onunhandledrejection: ((this: WindowEventHandlers, ev: PromiseRejectionEvent) => any) | null;
|
||||
onunload: ((this: WindowEventHandlers, ev: Event) => any) | null;
|
||||
@@ -19886,10 +19910,10 @@ declare var onsuspend: ((this: Window, ev: Event) => any) | null;
|
||||
*/
|
||||
declare var ontimeupdate: ((this: Window, ev: Event) => any) | null;
|
||||
declare var ontoggle: ((this: Window, ev: Event) => any) | null;
|
||||
declare var ontouchcancel: ((this: Window, ev: TouchEvent) => any) | null;
|
||||
declare var ontouchend: ((this: Window, ev: TouchEvent) => any) | null;
|
||||
declare var ontouchmove: ((this: Window, ev: TouchEvent) => any) | null;
|
||||
declare var ontouchstart: ((this: Window, ev: TouchEvent) => any) | null;
|
||||
declare var ontouchcancel: ((this: Window, ev: TouchEvent) => any) | null | undefined;
|
||||
declare var ontouchend: ((this: Window, ev: TouchEvent) => any) | null | undefined;
|
||||
declare var ontouchmove: ((this: Window, ev: TouchEvent) => any) | null | undefined;
|
||||
declare var ontouchstart: ((this: Window, ev: TouchEvent) => any) | null | undefined;
|
||||
declare var ontransitioncancel: ((this: Window, ev: TransitionEvent) => any) | null;
|
||||
declare var ontransitionend: ((this: Window, ev: TransitionEvent) => any) | null;
|
||||
declare var ontransitionrun: ((this: Window, ev: TransitionEvent) => any) | null;
|
||||
@@ -19939,7 +19963,7 @@ declare var ononline: ((this: Window, ev: Event) => any) | null;
|
||||
declare var onpagehide: ((this: Window, ev: PageTransitionEvent) => any) | null;
|
||||
declare var onpageshow: ((this: Window, ev: PageTransitionEvent) => any) | null;
|
||||
declare var onpopstate: ((this: Window, ev: PopStateEvent) => any) | null;
|
||||
declare var onrejectionhandled: ((this: Window, ev: Event) => any) | null;
|
||||
declare var onrejectionhandled: ((this: Window, ev: PromiseRejectionEvent) => any) | null;
|
||||
declare var onstorage: ((this: Window, ev: StorageEvent) => any) | null;
|
||||
declare var onunhandledrejection: ((this: Window, ev: PromiseRejectionEvent) => any) | null;
|
||||
declare var onunload: ((this: Window, ev: Event) => any) | null;
|
||||
@@ -19967,6 +19991,7 @@ type ConstrainDouble = number | ConstrainDoubleRange;
|
||||
type ConstrainBoolean = boolean | ConstrainBooleanParameters;
|
||||
type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;
|
||||
type PerformanceEntryList = PerformanceEntry[];
|
||||
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
|
||||
type VibratePattern = number | number[];
|
||||
type COSEAlgorithmIdentifier = number;
|
||||
type AuthenticatorSelectionList = AAGUID[];
|
||||
|
||||
Vendored
+20
-7
@@ -371,6 +371,16 @@ interface QueuingStrategy<T = any> {
|
||||
size?: QueuingStrategySizeCallback<T>;
|
||||
}
|
||||
|
||||
interface ReadableStreamReadDoneResult<T> {
|
||||
done: true;
|
||||
value?: T;
|
||||
}
|
||||
|
||||
interface ReadableStreamReadValueResult<T> {
|
||||
done: false;
|
||||
value: T;
|
||||
}
|
||||
|
||||
interface RegistrationOptions {
|
||||
scope?: string;
|
||||
type?: WorkerType;
|
||||
@@ -703,7 +713,7 @@ interface CacheStorage {
|
||||
delete(cacheName: string): Promise<boolean>;
|
||||
has(cacheName: string): Promise<boolean>;
|
||||
keys(): Promise<string[]>;
|
||||
match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response | undefined>;
|
||||
match(request: RequestInfo, options?: MultiCacheQueryOptions): Promise<Response | undefined>;
|
||||
open(cacheName: string): Promise<Cache>;
|
||||
}
|
||||
|
||||
@@ -2760,11 +2770,6 @@ interface ReadableStreamDefaultReader<R = any> {
|
||||
releaseLock(): void;
|
||||
}
|
||||
|
||||
interface ReadableStreamReadResult<T> {
|
||||
done: boolean;
|
||||
value: T;
|
||||
}
|
||||
|
||||
interface ReadableStreamReader<R = any> {
|
||||
cancel(): Promise<void>;
|
||||
read(): Promise<ReadableStreamReadResult<R>>;
|
||||
@@ -3083,6 +3088,8 @@ interface TextDecoderCommon {
|
||||
}
|
||||
|
||||
interface TextDecoderStream extends GenericTransformStream, TextDecoderCommon {
|
||||
readonly readable: ReadableStream<string>;
|
||||
readonly writable: WritableStream<BufferSource>;
|
||||
}
|
||||
|
||||
declare var TextDecoderStream: {
|
||||
@@ -3115,6 +3122,8 @@ interface TextEncoderCommon {
|
||||
}
|
||||
|
||||
interface TextEncoderStream extends GenericTransformStream, TextEncoderCommon {
|
||||
readonly readable: ReadableStream<Uint8Array>;
|
||||
readonly writable: WritableStream<string>;
|
||||
}
|
||||
|
||||
declare var TextEncoderStream: {
|
||||
@@ -3202,6 +3211,7 @@ interface URL {
|
||||
host: string;
|
||||
hostname: string;
|
||||
href: string;
|
||||
toString(): string;
|
||||
readonly origin: string;
|
||||
password: string;
|
||||
pathname: string;
|
||||
@@ -3246,12 +3256,14 @@ interface URLSearchParams {
|
||||
*/
|
||||
set(name: string, value: string): void;
|
||||
sort(): void;
|
||||
toString(): string;
|
||||
forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
|
||||
}
|
||||
|
||||
declare var URLSearchParams: {
|
||||
prototype: URLSearchParams;
|
||||
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
|
||||
toString(): string;
|
||||
};
|
||||
|
||||
interface WEBGL_color_buffer_float {
|
||||
@@ -5380,12 +5392,12 @@ interface WorkerLocation {
|
||||
readonly host: string;
|
||||
readonly hostname: string;
|
||||
readonly href: string;
|
||||
toString(): string;
|
||||
readonly origin: string;
|
||||
readonly pathname: string;
|
||||
readonly port: string;
|
||||
readonly protocol: string;
|
||||
readonly search: string;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
declare var WorkerLocation: {
|
||||
@@ -5804,6 +5816,7 @@ type ImageBitmapSource = CanvasImageSource | Blob | ImageData;
|
||||
type TimerHandler = string | Function;
|
||||
type PerformanceEntryList = PerformanceEntry[];
|
||||
type PushMessageDataInit = BufferSource | string;
|
||||
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
|
||||
type VibratePattern = number | number[];
|
||||
type AlgorithmIdentifier = string | Algorithm;
|
||||
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
||||
|
||||
@@ -1141,7 +1141,7 @@ namespace ts.server {
|
||||
|
||||
const project = this.getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) ||
|
||||
this.getOrCreateSingleInferredProjectIfEnabled() ||
|
||||
this.getOrCreateSingleInferredWithoutProjectRoot(info.isDynamic ? this.currentDirectory : getDirectoryPath(info.path));
|
||||
this.getOrCreateSingleInferredWithoutProjectRoot(info.isDynamic ? projectRootPath || this.currentDirectory : getDirectoryPath(info.path));
|
||||
|
||||
project.addRoot(info);
|
||||
if (info.containingProjects[0] !== project) {
|
||||
@@ -1503,6 +1503,8 @@ namespace ts.server {
|
||||
|
||||
Debug.assert(!isOpenScriptInfo(info) || this.openFiles.has(info.path));
|
||||
const projectRootPath = this.openFiles.get(info.path);
|
||||
const scriptInfo = Debug.assertDefined(this.getScriptInfo(info.path));
|
||||
if (scriptInfo.isDynamic) return undefined;
|
||||
|
||||
let searchPath = asNormalizedPath(getDirectoryPath(info.fileName));
|
||||
const isSearchPathInProjectRoot = () => containsPath(projectRootPath!, searchPath, this.currentDirectory, !this.host.useCaseSensitiveFileNames);
|
||||
@@ -1943,7 +1945,9 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
private getOrCreateInferredProjectForProjectRootPathIfEnabled(info: ScriptInfo, projectRootPath: NormalizedPath | undefined): InferredProject | undefined {
|
||||
if (info.isDynamic || !this.useInferredProjectPerProjectRoot) {
|
||||
if (!this.useInferredProjectPerProjectRoot ||
|
||||
// Its a dynamic info opened without project root
|
||||
(info.isDynamic && projectRootPath === undefined)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -2228,7 +2232,7 @@ namespace ts.server {
|
||||
const isDynamic = isDynamicFileName(fileName);
|
||||
Debug.assert(isRootedDiskPath(fileName) || isDynamic || openedByClient, "", () => `${JSON.stringify({ fileName, currentDirectory, hostCurrentDirectory: this.currentDirectory, openKeys: arrayFrom(this.openFilesWithNonRootedDiskPath.keys()) })}\nScript info with non-dynamic relative file name can only be open script info or in context of host currentDirectory`);
|
||||
Debug.assert(!isRootedDiskPath(fileName) || this.currentDirectory === currentDirectory || !this.openFilesWithNonRootedDiskPath.has(this.toCanonicalFileName(fileName)), "", () => `${JSON.stringify({ fileName, currentDirectory, hostCurrentDirectory: this.currentDirectory, openKeys: arrayFrom(this.openFilesWithNonRootedDiskPath.keys()) })}\nOpen script files with non rooted disk path opened with current directory context cannot have same canonical names`);
|
||||
Debug.assert(!isDynamic || this.currentDirectory === currentDirectory, "", () => `${JSON.stringify({ fileName, currentDirectory, hostCurrentDirectory: this.currentDirectory, openKeys: arrayFrom(this.openFilesWithNonRootedDiskPath.keys()) })}\nDynamic files must always have current directory context since containing external project name will always match the script info name.`);
|
||||
Debug.assert(!isDynamic || this.currentDirectory === currentDirectory || this.useInferredProjectPerProjectRoot, "", () => `${JSON.stringify({ fileName, currentDirectory, hostCurrentDirectory: this.currentDirectory, openKeys: arrayFrom(this.openFilesWithNonRootedDiskPath.keys()) })}\nDynamic files must always be opened with service's current directory or service should support inferred project per projectRootPath.`);
|
||||
// If the file is not opened by client and the file doesnot exist on the disk, return
|
||||
if (!openedByClient && !isDynamic && !(hostToQueryFileExistsOn || this.host).fileExists(fileName)) {
|
||||
return;
|
||||
@@ -2239,7 +2243,7 @@ namespace ts.server {
|
||||
if (!openedByClient) {
|
||||
this.watchClosedScriptInfo(info);
|
||||
}
|
||||
else if (!isRootedDiskPath(fileName) && !isDynamic) {
|
||||
else if (!isRootedDiskPath(fileName) && (!isDynamic || this.currentDirectory !== currentDirectory)) {
|
||||
// File that is opened by user but isn't rooted disk path
|
||||
this.openFilesWithNonRootedDiskPath.set(this.toCanonicalFileName(fileName), info);
|
||||
}
|
||||
|
||||
@@ -3013,7 +3013,7 @@ namespace ts.server.protocol {
|
||||
* values, with insertion text to replace preceding `.` tokens with `?.`.
|
||||
*/
|
||||
readonly includeAutomaticOptionalChainCompletions?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
readonly lazyConfiguredProjectsFromExternalProject?: boolean;
|
||||
readonly providePrefixAndSuffixTextForRename?: boolean;
|
||||
|
||||
@@ -257,6 +257,7 @@ namespace ts.codefix {
|
||||
sourceFile,
|
||||
insertionSite.parent.expression,
|
||||
createParen(createAwait(insertionSite.parent.expression)));
|
||||
insertLeadingSemicolonIfNeeded(changeTracker, insertionSite.parent.expression, sourceFile);
|
||||
}
|
||||
else if (contains(callableConstructableErrorCodes, errorCode) && isCallOrNewExpression(insertionSite.parent)) {
|
||||
if (fixedDeclarations && isIdentifier(insertionSite)) {
|
||||
@@ -266,6 +267,7 @@ namespace ts.codefix {
|
||||
}
|
||||
}
|
||||
changeTracker.replaceNode(sourceFile, insertionSite, createParen(createAwait(insertionSite)));
|
||||
insertLeadingSemicolonIfNeeded(changeTracker, insertionSite, sourceFile);
|
||||
}
|
||||
else {
|
||||
if (fixedDeclarations && isVariableDeclaration(insertionSite.parent) && isIdentifier(insertionSite.parent.name)) {
|
||||
@@ -277,4 +279,11 @@ namespace ts.codefix {
|
||||
changeTracker.replaceNode(sourceFile, insertionSite, createAwait(insertionSite));
|
||||
}
|
||||
}
|
||||
|
||||
function insertLeadingSemicolonIfNeeded(changeTracker: textChanges.ChangeTracker, beforeNode: Node, sourceFile: SourceFile) {
|
||||
const precedingToken = findPrecedingToken(beforeNode.pos, sourceFile);
|
||||
if (precedingToken && positionIsASICandidate(precedingToken.end, precedingToken.parent, sourceFile)) {
|
||||
changeTracker.insertText(sourceFile, beforeNode.getStart(sourceFile), ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace ts.codefix {
|
||||
const nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(and(symbolPointsToNonPrivateMember, symbol => !maybeHeritageClauseSymbol.has(symbol.escapedName)));
|
||||
|
||||
const classType = checker.getTypeAtLocation(classDeclaration);
|
||||
const constructor = find(classDeclaration.members, m => isConstructorDeclaration(m));
|
||||
|
||||
if (!classType.getNumberIndexType()) {
|
||||
createMissingIndexSignatureDeclaration(implementedType, IndexKind.Number);
|
||||
@@ -62,12 +63,22 @@ namespace ts.codefix {
|
||||
createMissingIndexSignatureDeclaration(implementedType, IndexKind.String);
|
||||
}
|
||||
|
||||
createMissingMemberNodes(classDeclaration, nonPrivateAndNotExistedInHeritageClauseMembers, context, preferences, member => changeTracker.insertNodeAtClassStart(sourceFile, classDeclaration, member));
|
||||
createMissingMemberNodes(classDeclaration, nonPrivateAndNotExistedInHeritageClauseMembers, context, preferences, member => insertInterfaceMemberNode(sourceFile, classDeclaration, member));
|
||||
|
||||
function createMissingIndexSignatureDeclaration(type: InterfaceType, kind: IndexKind): void {
|
||||
const indexInfoOfKind = checker.getIndexInfoOfType(type, kind);
|
||||
if (indexInfoOfKind) {
|
||||
changeTracker.insertNodeAtClassStart(sourceFile, classDeclaration, checker.indexInfoToIndexSignatureDeclaration(indexInfoOfKind, kind, classDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context))!);
|
||||
insertInterfaceMemberNode(sourceFile, classDeclaration, checker.indexInfoToIndexSignatureDeclaration(indexInfoOfKind, kind, classDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context))!);
|
||||
}
|
||||
}
|
||||
|
||||
// Either adds the node at the top of the class, or if there's a constructor right after that
|
||||
function insertInterfaceMemberNode(sourceFile: SourceFile, cls: ClassLikeDeclaration | InterfaceDeclaration, newElement: ClassElement): void {
|
||||
if (constructor) {
|
||||
changeTracker.insertNodeAfter(sourceFile, constructor, newElement);
|
||||
}
|
||||
else {
|
||||
changeTracker.insertNodeAtClassStart(sourceFile, cls, newElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +373,13 @@ namespace ts.Completions {
|
||||
}
|
||||
if (origin && originIsPromise(origin) && propertyAccessToConvert) {
|
||||
if (insertText === undefined) insertText = name;
|
||||
const awaitText = `(await ${propertyAccessToConvert.expression.getText()})`;
|
||||
const precedingToken = findPrecedingToken(propertyAccessToConvert.pos, sourceFile);
|
||||
let awaitText = "";
|
||||
if (precedingToken && positionIsASICandidate(precedingToken.end, precedingToken.parent, sourceFile)) {
|
||||
awaitText = ";";
|
||||
}
|
||||
|
||||
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
|
||||
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
|
||||
replacementSpan = createTextSpanFromBounds(propertyAccessToConvert.getStart(sourceFile), propertyAccessToConvert.end);
|
||||
}
|
||||
|
||||
@@ -855,13 +855,6 @@ namespace ts.formatting {
|
||||
}
|
||||
|
||||
function isSemicolonInsertionContext(context: FormattingContext): boolean {
|
||||
const contextAncestor = findAncestor(context.currentTokenParent, ancestor => {
|
||||
if (ancestor.end !== context.currentTokenSpan.end) {
|
||||
return "quit";
|
||||
}
|
||||
return syntaxMayBeASICandidate(ancestor.kind);
|
||||
});
|
||||
|
||||
return !!contextAncestor && isASICandidate(contextAncestor, context.sourceFile);
|
||||
return positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,8 @@ namespace ts {
|
||||
const toImport = oldFromNew !== undefined
|
||||
// If we're at the new location (file was already renamed), need to redo module resolution starting from the old location.
|
||||
// TODO:GH#18217
|
||||
? getSourceFileToImportFromResolved(resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host as ModuleResolutionHost), oldToNew)
|
||||
? getSourceFileToImportFromResolved(resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host as ModuleResolutionHost),
|
||||
oldToNew, allFiles)
|
||||
: getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, host, oldToNew);
|
||||
|
||||
// Need an update if the imported file moved, or the importing file moved and was using a relative path.
|
||||
@@ -192,11 +193,11 @@ namespace ts {
|
||||
const resolved = host.resolveModuleNames
|
||||
? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName)
|
||||
: program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName);
|
||||
return getSourceFileToImportFromResolved(resolved, oldToNew);
|
||||
return getSourceFileToImportFromResolved(resolved, oldToNew, program.getSourceFiles());
|
||||
}
|
||||
}
|
||||
|
||||
function getSourceFileToImportFromResolved(resolved: ResolvedModuleWithFailedLookupLocations | undefined, oldToNew: PathUpdater): ToImport | undefined {
|
||||
function getSourceFileToImportFromResolved(resolved: ResolvedModuleWithFailedLookupLocations | undefined, oldToNew: PathUpdater, sourceFiles: readonly SourceFile[]): ToImport | undefined {
|
||||
// Search through all locations looking for a moved file, and only then test already existing files.
|
||||
// This is because if `a.ts` is compiled to `a.js` and `a.ts` is moved, we don't want to resolve anything to `a.js`, but to `a.ts`'s new location.
|
||||
if (!resolved) return undefined;
|
||||
@@ -207,13 +208,21 @@ namespace ts {
|
||||
if (result) return result;
|
||||
}
|
||||
|
||||
// Then failed lookups except package.json since we dont want to touch them (only included ts/js files)
|
||||
const result = forEach(resolved.failedLookupLocations, tryChangeWithIgnoringPackageJson);
|
||||
// Then failed lookups that are in the list of sources
|
||||
const result = forEach(resolved.failedLookupLocations, tryChangeWithIgnoringPackageJsonExisting)
|
||||
// Then failed lookups except package.json since we dont want to touch them (only included ts/js files)
|
||||
|| forEach(resolved.failedLookupLocations, tryChangeWithIgnoringPackageJson);
|
||||
if (result) return result;
|
||||
|
||||
// If nothing changed, then result is resolved module file thats not updated
|
||||
return resolved.resolvedModule && { newFileName: resolved.resolvedModule.resolvedFileName, updated: false };
|
||||
|
||||
function tryChangeWithIgnoringPackageJsonExisting(oldFileName: string) {
|
||||
const newFileName = oldToNew(oldFileName);
|
||||
return newFileName && find(sourceFiles, src => src.fileName === newFileName)
|
||||
? tryChangeWithIgnoringPackageJson(oldFileName) : undefined;
|
||||
}
|
||||
|
||||
function tryChangeWithIgnoringPackageJson(oldFileName: string) {
|
||||
return !endsWith(oldFileName, "/package.json") ? tryChange(oldFileName) : undefined;
|
||||
}
|
||||
|
||||
@@ -901,6 +901,7 @@ namespace ts.NavigationBar {
|
||||
return "<function>";
|
||||
}
|
||||
|
||||
// See also 'tryGetPropertyAccessOrIdentifierToString'
|
||||
function getCalledExpressionName(expr: Expression): string | undefined {
|
||||
if (isIdentifier(expr)) {
|
||||
return expr.text;
|
||||
|
||||
@@ -2066,7 +2066,7 @@ namespace ts {
|
||||
syntaxRequiresTrailingModuleBlockOrSemicolonOrASI,
|
||||
syntaxRequiresTrailingSemicolonOrASI);
|
||||
|
||||
export function isASICandidate(node: Node, sourceFile: SourceFileLike): boolean {
|
||||
function nodeIsASICandidate(node: Node, sourceFile: SourceFileLike): boolean {
|
||||
const lastToken = node.getLastToken(sourceFile);
|
||||
if (lastToken && lastToken.kind === SyntaxKind.SemicolonToken) {
|
||||
return false;
|
||||
@@ -2109,6 +2109,17 @@ namespace ts {
|
||||
return startLine !== endLine;
|
||||
}
|
||||
|
||||
export function positionIsASICandidate(pos: number, context: Node, sourceFile: SourceFileLike): boolean {
|
||||
const contextAncestor = findAncestor(context, ancestor => {
|
||||
if (ancestor.end !== pos) {
|
||||
return "quit";
|
||||
}
|
||||
return syntaxMayBeASICandidate(ancestor.kind);
|
||||
});
|
||||
|
||||
return !!contextAncestor && nodeIsASICandidate(contextAncestor, sourceFile);
|
||||
}
|
||||
|
||||
export function probablyUsesSemicolons(sourceFile: SourceFile): boolean {
|
||||
let withSemicolon = 0;
|
||||
let withoutSemicolon = 0;
|
||||
|
||||
@@ -112,6 +112,30 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
class CompilerTest {
|
||||
private static varyBy: readonly string[] = [
|
||||
"module",
|
||||
"target",
|
||||
"jsx",
|
||||
"removeComments",
|
||||
"importHelpers",
|
||||
"importHelpers",
|
||||
"downlevelIteration",
|
||||
"isolatedModules",
|
||||
"strict",
|
||||
"noImplicitAny",
|
||||
"strictNullChecks",
|
||||
"strictFunctionTypes",
|
||||
"strictBindCallApply",
|
||||
"strictPropertyInitialization",
|
||||
"noImplicitThis",
|
||||
"alwaysStrict",
|
||||
"allowSyntheticDefaultImports",
|
||||
"esModuleInterop",
|
||||
"emitDecoratorMetadata",
|
||||
"skipDefaultLibCheck",
|
||||
"preserveConstEnums",
|
||||
"skipLibCheck",
|
||||
];
|
||||
private fileName: string;
|
||||
private justName: string;
|
||||
private configuredName: string;
|
||||
@@ -220,7 +244,7 @@ class CompilerTest {
|
||||
// also see `parseCompilerTestConfigurations` in tests/webTestServer.ts
|
||||
const content = Harness.IO.readFile(file)!;
|
||||
const settings = Harness.TestCaseParser.extractCompilerSettings(content);
|
||||
const configurations = Harness.getFileBasedTestConfigurations(settings, /*varyBy*/ ["module", "target"]);
|
||||
const configurations = Harness.getFileBasedTestConfigurations(settings, CompilerTest.varyBy);
|
||||
return { file, configurations, content };
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ function stripRushStageNumbers(result: string): string {
|
||||
}
|
||||
|
||||
function stripWebpackHash(result: string): string {
|
||||
return result.replace(/Hash: \w+/g, "Hash: [redacted]")
|
||||
return result.replace(/Hash: \w+/g, "Hash: [redacted]");
|
||||
}
|
||||
|
||||
function sanitizeSizes(result: string): string {
|
||||
@@ -222,7 +222,8 @@ function sanitizeVersionSpecifiers(result: string): string {
|
||||
.replace(/\d+.\d+.\d+-insiders.\d\d\d\d\d\d\d\d/g, "X.X.X-insiders.xxxxxxxx")
|
||||
.replace(/Rush Multi-Project Build Tool (\d+)\.\d+\.\d+/g, "Rush Multi-Project Build Tool $1.X.X")
|
||||
.replace(/([@v\()])\d+\.\d+\.\d+/g, "$1X.X.X")
|
||||
.replace(/webpack \d+\.\d+\.\d+/g, "$1.X.X");
|
||||
.replace(/webpack (\d+)\.\d+\.\d+/g, "webpack $1.X.X")
|
||||
.replace(/Webpack version: (\d+)\.\d+\.\d+/g, "Webpack version: $1.X.X");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Harness.Parallel.Host {
|
||||
const isatty = tty.isatty(1) && tty.isatty(2);
|
||||
const path = require("path") as typeof import("path");
|
||||
const { fork } = require("child_process") as typeof import("child_process");
|
||||
const { statSync, readFileSync } = require("fs") as typeof import("fs");
|
||||
const { statSync } = require("fs") as typeof import("fs");
|
||||
|
||||
// NOTE: paths for module and types for FailedTestReporter _do not_ line up due to our use of --outFile for run.js
|
||||
const FailedTestReporter = require(path.resolve(__dirname, "../../scripts/failed-tests")) as typeof import("../../../scripts/failed-tests");
|
||||
@@ -186,31 +186,6 @@ namespace Harness.Parallel.Host {
|
||||
return `tsrunner-${runner}://${test}`;
|
||||
}
|
||||
|
||||
function skipCostlyTests(tasks: Task[]) {
|
||||
if (statSync("tests/.test-cost.json")) {
|
||||
const costs = JSON.parse(readFileSync("tests/.test-cost.json", "utf8")) as {
|
||||
totalTime: number,
|
||||
totalEdits: number,
|
||||
data: { name: string, time: number, edits: number, costs: number }[]
|
||||
};
|
||||
let skippedEdits = 0;
|
||||
let skippedTime = 0;
|
||||
const skippedTests = new Set<string>();
|
||||
let i = 0;
|
||||
for (; i < costs.data.length && (skippedEdits / costs.totalEdits) < (skipPercent / 100); i++) {
|
||||
skippedEdits += costs.data[i].edits;
|
||||
skippedTime += costs.data[i].time;
|
||||
skippedTests.add(costs.data[i].name);
|
||||
}
|
||||
console.log(`Skipped ${i} expensive tests; estimated time savings of ${(skippedTime / costs.totalTime * 100).toFixed(2)}% with --skipPercent=${skipPercent.toFixed(2)} chance of missing a test.`);
|
||||
return tasks.filter(t => !skippedTests.has(t.file));
|
||||
}
|
||||
else {
|
||||
console.log("No cost analysis discovered.");
|
||||
return tasks;
|
||||
}
|
||||
}
|
||||
|
||||
function startDelayed(perfData: { [testHash: string]: number } | undefined, totalCost: number) {
|
||||
console.log(`Discovered ${tasks.length} unittest suites` + (newTasks.length ? ` and ${newTasks.length} new suites.` : "."));
|
||||
console.log("Discovering runner-based tests...");
|
||||
@@ -250,7 +225,6 @@ namespace Harness.Parallel.Host {
|
||||
}
|
||||
tasks.sort((a, b) => a.size - b.size);
|
||||
tasks = tasks.concat(newTasks);
|
||||
tasks = skipCostlyTests(tasks);
|
||||
const batchCount = workerCount;
|
||||
const packfraction = 0.9;
|
||||
const chunkSize = 1000; // ~1KB or 1s for sending batches near the end of a test
|
||||
|
||||
@@ -67,7 +67,6 @@ let runUnitTests: boolean | undefined;
|
||||
let stackTraceLimit: number | "full" | undefined;
|
||||
let noColors = false;
|
||||
let keepFailed = false;
|
||||
let skipPercent = 5;
|
||||
|
||||
interface TestConfig {
|
||||
light?: boolean;
|
||||
@@ -81,7 +80,6 @@ interface TestConfig {
|
||||
noColors?: boolean;
|
||||
timeout?: number;
|
||||
keepFailed?: boolean;
|
||||
skipPercent?: number;
|
||||
shardId?: number;
|
||||
shards?: number;
|
||||
}
|
||||
@@ -115,9 +113,6 @@ function handleTestConfig() {
|
||||
if (testConfig.keepFailed) {
|
||||
keepFailed = true;
|
||||
}
|
||||
if (testConfig.skipPercent !== undefined) {
|
||||
skipPercent = testConfig.skipPercent;
|
||||
}
|
||||
if (testConfig.shardId) {
|
||||
shardId = testConfig.shardId;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,33 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
it("Handles 'did you mean?' for misspelt flags", () => {
|
||||
// --declarations --allowTS
|
||||
assertParseResult(["--declarations", "--allowTS"], {
|
||||
errors: [
|
||||
{
|
||||
messageText:"Unknown compiler option '--declarations'. Did you mean 'declaration'?",
|
||||
category: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1.category,
|
||||
code: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1.code,
|
||||
file: undefined,
|
||||
start: undefined,
|
||||
length: undefined
|
||||
},
|
||||
{
|
||||
messageText: "Unknown compiler option '--allowTS'. Did you mean 'allowJs'?",
|
||||
category: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1.category,
|
||||
code: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1.code,
|
||||
file: undefined,
|
||||
start: undefined,
|
||||
length: undefined
|
||||
}
|
||||
],
|
||||
fileNames: [],
|
||||
options: {}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it("Parse multiple options of library flags ", () => {
|
||||
// --lib es5,es2015.symbol.wellknown 0.ts
|
||||
assertParseResult(["--lib", "es5,es2015.symbol.wellknown", "0.ts"],
|
||||
@@ -556,4 +583,6 @@ namespace ts {
|
||||
verifyInvalidCombination("watch", "dry");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -111,8 +111,8 @@ namespace ts {
|
||||
},
|
||||
errors: [
|
||||
{
|
||||
category: Diagnostics.Unknown_type_acquisition_option_0.category,
|
||||
code: Diagnostics.Unknown_type_acquisition_option_0.code,
|
||||
category: Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1.category,
|
||||
code: Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1.code,
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
@@ -206,8 +206,8 @@ namespace ts {
|
||||
},
|
||||
errors: [
|
||||
{
|
||||
category: Diagnostics.Unknown_type_acquisition_option_0.category,
|
||||
code: Diagnostics.Unknown_type_acquisition_option_0.code,
|
||||
category: Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1.category,
|
||||
code: Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1.code,
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
|
||||
@@ -67,6 +67,17 @@ namespace ts {
|
||||
`class A extends B implements C implements D {}`,
|
||||
ScriptTarget.ES2017
|
||||
)));
|
||||
|
||||
// github #35093
|
||||
printsCorrectly("definiteAssignmentAssertions", {}, printer => printer.printFile(createSourceFile(
|
||||
"source.ts",
|
||||
`class A {
|
||||
prop!: string;
|
||||
}
|
||||
|
||||
let x!: string;`,
|
||||
ScriptTarget.ES2017
|
||||
)));
|
||||
});
|
||||
|
||||
describe("printBundle", () => {
|
||||
|
||||
@@ -97,6 +97,17 @@ namespace ts {
|
||||
]);
|
||||
});
|
||||
|
||||
testBaseline("transformDefiniteAssignmentAssertions", () => {
|
||||
return transformSourceFile(`let a!: () => void`, [
|
||||
context => file => visitNode(file, function visitor(node: Node): VisitResult<Node> {
|
||||
if (node.kind === SyntaxKind.VoidKeyword) {
|
||||
return createIdentifier("undefined");
|
||||
}
|
||||
return visitEachChild(node, visitor, context);
|
||||
})
|
||||
]);
|
||||
});
|
||||
|
||||
testBaseline("fromTranspileModule", () => {
|
||||
return transpileModule(`var oldName = undefined;`, {
|
||||
transformers: {
|
||||
|
||||
@@ -273,6 +273,11 @@ namespace ts.tscWatch {
|
||||
return getDiagnosticOfFile(program.getCompilerOptions().configFile!, configFile.content.indexOf(quotedOption), quotedOption.length, Diagnostics.Unknown_compiler_option_0, option);
|
||||
}
|
||||
|
||||
export function getUnknownDidYouMeanCompilerOption(program: Program, configFile: File, option: string, didYouMean: string) {
|
||||
const quotedOption = `"${option}"`;
|
||||
return getDiagnosticOfFile(program.getCompilerOptions().configFile!, configFile.content.indexOf(quotedOption), quotedOption.length, Diagnostics.Unknown_compiler_option_0_Did_you_mean_1, option, didYouMean);
|
||||
}
|
||||
|
||||
export function getDiagnosticModuleNotFoundOfFile(program: Program, file: File, moduleName: string) {
|
||||
const quotedModuleName = `"${moduleName}"`;
|
||||
return getDiagnosticOfFileFromProgram(program, file.path, file.content.indexOf(quotedModuleName), quotedModuleName.length, Diagnostics.Cannot_find_module_0, moduleName);
|
||||
|
||||
@@ -757,7 +757,7 @@ namespace ts.tscWatch {
|
||||
const watch = createWatchOfConfigFile(configFile.path, host);
|
||||
checkOutputErrorsInitial(host, [
|
||||
getUnknownCompilerOption(watch(), configFile, "foo"),
|
||||
getUnknownCompilerOption(watch(), configFile, "allowJS")
|
||||
getUnknownDidYouMeanCompilerOption(watch(), configFile, "allowJS", "allowJs")
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -496,14 +496,14 @@ declare module '@custom/plugin' {
|
||||
});
|
||||
|
||||
describe("unittests:: tsserver:: Project Errors for Configure file diagnostics events", () => {
|
||||
function getUnknownCompilerOptionDiagnostic(configFile: File, prop: string): ConfigFileDiagnostic {
|
||||
const d = Diagnostics.Unknown_compiler_option_0;
|
||||
function getUnknownCompilerOptionDiagnostic(configFile: File, prop: string, didYouMean?: string): ConfigFileDiagnostic {
|
||||
const d = didYouMean ? Diagnostics.Unknown_compiler_option_0_Did_you_mean_1 : Diagnostics.Unknown_compiler_option_0;
|
||||
const start = configFile.content.indexOf(prop) - 1; // start at "prop"
|
||||
return {
|
||||
fileName: configFile.path,
|
||||
start,
|
||||
length: prop.length + 2,
|
||||
messageText: formatStringFromArgs(d.message, [prop]),
|
||||
messageText: formatStringFromArgs(d.message, didYouMean ? [prop, didYouMean] : [prop]),
|
||||
category: d.category,
|
||||
code: d.code,
|
||||
reportsUnnecessary: undefined
|
||||
@@ -543,7 +543,7 @@ declare module '@custom/plugin' {
|
||||
openFilesForSession([file], serverEventManager.session);
|
||||
serverEventManager.checkSingleConfigFileDiagEvent(configFile.path, file.path, [
|
||||
getUnknownCompilerOptionDiagnostic(configFile, "foo"),
|
||||
getUnknownCompilerOptionDiagnostic(configFile, "allowJS")
|
||||
getUnknownCompilerOptionDiagnostic(configFile, "allowJS", "allowJs")
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -1131,6 +1131,62 @@ var x = 10;`
|
||||
checkProjectActualFiles(project, [file.path, libFile.path]);
|
||||
});
|
||||
|
||||
describe("dynamic file with projectRootPath", () => {
|
||||
const file: File = {
|
||||
path: "^walkThroughSnippet:/Users/UserName/projects/someProject/out/someFile#1.js",
|
||||
content: "var x = 10;"
|
||||
};
|
||||
const configFile: File = {
|
||||
path: `${projectRoot}/tsconfig.json`,
|
||||
content: "{}"
|
||||
};
|
||||
const configProjectFile: File = {
|
||||
path: `${projectRoot}/a.ts`,
|
||||
content: "let y = 10;"
|
||||
};
|
||||
it("with useInferredProjectPerProjectRoot", () => {
|
||||
const host = createServerHost([libFile, configFile, configProjectFile], { useCaseSensitiveFileNames: true });
|
||||
const session = createSession(host, { useInferredProjectPerProjectRoot: true });
|
||||
openFilesForSession([{ file: file.path, projectRootPath: projectRoot }], session);
|
||||
|
||||
const projectService = session.getProjectService();
|
||||
checkNumberOfProjects(projectService, { inferredProjects: 1 });
|
||||
checkProjectActualFiles(projectService.inferredProjects[0], [file.path, libFile.path]);
|
||||
|
||||
session.executeCommandSeq<protocol.OutliningSpansRequest>({
|
||||
command: protocol.CommandTypes.GetOutliningSpans,
|
||||
arguments: {
|
||||
file: file.path
|
||||
}
|
||||
});
|
||||
|
||||
// Without project root
|
||||
const file2Path = file.path.replace("#1", "#2");
|
||||
projectService.openClientFile(file2Path, file.content);
|
||||
checkNumberOfProjects(projectService, { inferredProjects: 2 });
|
||||
checkProjectActualFiles(projectService.inferredProjects[0], [file.path, libFile.path]);
|
||||
checkProjectActualFiles(projectService.inferredProjects[1], [file2Path, libFile.path]);
|
||||
});
|
||||
|
||||
it("fails when useInferredProjectPerProjectRoot is false", () => {
|
||||
const host = createServerHost([libFile, configFile, configProjectFile], { useCaseSensitiveFileNames: true });
|
||||
const projectService = createProjectService(host);
|
||||
try {
|
||||
projectService.openClientFile(file.path, file.content, /*scriptKind*/ undefined, projectRoot);
|
||||
}
|
||||
catch (e) {
|
||||
assert.strictEqual(
|
||||
e.message.replace(/\r?\n/, "\n"),
|
||||
`Debug Failure. False expression: \nVerbose Debug Information: {"fileName":"^walkThroughSnippet:/Users/UserName/projects/someProject/out/someFile#1.js","currentDirectory":"/user/username/projects/myproject","hostCurrentDirectory":"/","openKeys":[]}\nDynamic files must always be opened with service's current directory or service should support inferred project per projectRootPath.`
|
||||
);
|
||||
}
|
||||
const file2Path = file.path.replace("#1", "#2");
|
||||
projectService.openClientFile(file2Path, file.content);
|
||||
projectService.checkNumberOfProjects({ inferredProjects: 1 });
|
||||
checkProjectActualFiles(projectService.inferredProjects[0], [file2Path, libFile.path]);
|
||||
});
|
||||
});
|
||||
|
||||
it("files opened, closed affecting multiple projects", () => {
|
||||
const file: File = {
|
||||
path: "/a/b/projects/config/file.ts",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses.ts ===
|
||||
module A {
|
||||
>A : typeof A
|
||||
>A : typeof globalThis.A
|
||||
|
||||
export class A {
|
||||
>A : A
|
||||
|
||||
+9
-8
@@ -2500,12 +2500,13 @@ declare namespace ts {
|
||||
HomomorphicMappedType = 2,
|
||||
PartialHomomorphicMappedType = 4,
|
||||
MappedTypeConstraint = 8,
|
||||
ReturnType = 16,
|
||||
LiteralKeyof = 32,
|
||||
NoConstraints = 64,
|
||||
AlwaysStrict = 128,
|
||||
MaxValue = 256,
|
||||
PriorityImpliesCombination = 56,
|
||||
ContravariantConditional = 16,
|
||||
ReturnType = 32,
|
||||
LiteralKeyof = 64,
|
||||
NoConstraints = 128,
|
||||
AlwaysStrict = 256,
|
||||
MaxValue = 512,
|
||||
PriorityImpliesCombination = 104,
|
||||
Circularity = -1
|
||||
}
|
||||
/** @deprecated Use FileExtensionInfo instead. */
|
||||
@@ -3174,7 +3175,7 @@ declare namespace ts {
|
||||
readonly includeCompletionsForModuleExports?: boolean;
|
||||
readonly includeAutomaticOptionalChainCompletions?: boolean;
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
|
||||
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
|
||||
readonly importModuleSpecifierEnding?: "minimal" | "index" | "js";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
@@ -8304,7 +8305,7 @@ declare namespace ts.server.protocol {
|
||||
* values, with insertion text to replace preceding `.` tokens with `?.`.
|
||||
*/
|
||||
readonly includeAutomaticOptionalChainCompletions?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
readonly lazyConfiguredProjectsFromExternalProject?: boolean;
|
||||
readonly providePrefixAndSuffixTextForRename?: boolean;
|
||||
|
||||
+8
-7
@@ -2500,12 +2500,13 @@ declare namespace ts {
|
||||
HomomorphicMappedType = 2,
|
||||
PartialHomomorphicMappedType = 4,
|
||||
MappedTypeConstraint = 8,
|
||||
ReturnType = 16,
|
||||
LiteralKeyof = 32,
|
||||
NoConstraints = 64,
|
||||
AlwaysStrict = 128,
|
||||
MaxValue = 256,
|
||||
PriorityImpliesCombination = 56,
|
||||
ContravariantConditional = 16,
|
||||
ReturnType = 32,
|
||||
LiteralKeyof = 64,
|
||||
NoConstraints = 128,
|
||||
AlwaysStrict = 256,
|
||||
MaxValue = 512,
|
||||
PriorityImpliesCombination = 104,
|
||||
Circularity = -1
|
||||
}
|
||||
/** @deprecated Use FileExtensionInfo instead. */
|
||||
@@ -3174,7 +3175,7 @@ declare namespace ts {
|
||||
readonly includeCompletionsForModuleExports?: boolean;
|
||||
readonly includeAutomaticOptionalChainCompletions?: boolean;
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
|
||||
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
|
||||
readonly importModuleSpecifierEnding?: "minimal" | "index" | "js";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
|
||||
@@ -2,30 +2,30 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(15,12): erro
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(17,5): error TS2461: Type '{ 0: string; 1: number; length: 2; }' is not an array type.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(18,5): error TS2741: Property '2' is missing in type '[string, number]' but required in type '[number, number, number]'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(19,5): error TS2741: Property '2' is missing in type 'StrNum' but required in type '[number, number, number]'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(20,5): error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number, number, number]': 2, pop, push, concat, and 16 more.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(20,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number, number, number]'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(21,5): error TS2741: Property '2' is missing in type '[string, number]' but required in type '[string, number, number]'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(22,5): error TS2741: Property '2' is missing in type 'StrNum' but required in type '[string, number, number]'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(23,5): error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[string, number, number]': 2, pop, push, concat, and 16 more.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(23,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string, number, number]'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(24,5): error TS2322: Type '[string, number]' is not assignable to type '[number]'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(25,5): error TS2322: Type 'StrNum' is not assignable to type '[number]'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number]': pop, push, concat, join, and 15 more.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number]'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(27,5): error TS2322: Type '[string, number]' is not assignable to type '[string]'.
|
||||
Types of property 'length' are incompatible.
|
||||
Type '2' is not assignable to type '1'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(28,5): error TS2322: Type 'StrNum' is not assignable to type '[string]'.
|
||||
Types of property 'length' are incompatible.
|
||||
Type '2' is not assignable to type '1'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(29,5): error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[string]': pop, push, concat, join, and 15 more.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(29,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string]'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(31,5): error TS2322: Type 'StrNum' is not assignable to type '[number, string]'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number, string]': pop, push, concat, join, and 15 more.
|
||||
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number, string]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts (17 errors) ====
|
||||
@@ -58,7 +58,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error
|
||||
!!! error TS2741: Property '2' is missing in type 'StrNum' but required in type '[number, number, number]'.
|
||||
var j3: [number, number, number] = z;
|
||||
~~
|
||||
!!! error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number, number, number]': 2, pop, push, concat, and 16 more.
|
||||
!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number, number, number]'.
|
||||
var k1: [string, number, number] = x;
|
||||
~~
|
||||
!!! error TS2741: Property '2' is missing in type '[string, number]' but required in type '[string, number, number]'.
|
||||
@@ -67,7 +67,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error
|
||||
!!! error TS2741: Property '2' is missing in type 'StrNum' but required in type '[string, number, number]'.
|
||||
var k3: [string, number, number] = z;
|
||||
~~
|
||||
!!! error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[string, number, number]': 2, pop, push, concat, and 16 more.
|
||||
!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string, number, number]'.
|
||||
var l1: [number] = x;
|
||||
~~
|
||||
!!! error TS2322: Type '[string, number]' is not assignable to type '[number]'.
|
||||
@@ -80,7 +80,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
var l3: [number] = z;
|
||||
~~
|
||||
!!! error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number]': pop, push, concat, join, and 15 more.
|
||||
!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number]'.
|
||||
var m1: [string] = x;
|
||||
~~
|
||||
!!! error TS2322: Type '[string, number]' is not assignable to type '[string]'.
|
||||
@@ -93,7 +93,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error
|
||||
!!! error TS2322: Type '2' is not assignable to type '1'.
|
||||
var m3: [string] = z;
|
||||
~~
|
||||
!!! error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[string]': pop, push, concat, join, and 15 more.
|
||||
!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string]'.
|
||||
var n1: [number, string] = x;
|
||||
~~
|
||||
!!! error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
|
||||
@@ -105,7 +105,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
var n3: [number, string] = z;
|
||||
~~
|
||||
!!! error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number, string]': pop, push, concat, join, and 15 more.
|
||||
!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number, string]'.
|
||||
var o1: [string, number] = x;
|
||||
var o2: [string, number] = y;
|
||||
var o3: [string, number] = y;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
tests/cases/conformance/enums/awaitAndYield.ts(3,15): error TS1308: 'await' expression is only allowed within an async function.
|
||||
tests/cases/conformance/enums/awaitAndYield.ts(4,15): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
|
||||
|
||||
==== tests/cases/conformance/enums/awaitAndYield.ts (2 errors) ====
|
||||
async function* test(x: Promise<number>) {
|
||||
enum E {
|
||||
foo = await x,
|
||||
~~~~~
|
||||
!!! error TS1308: 'await' expression is only allowed within an async function.
|
||||
baz = yield 1,
|
||||
~~~~~
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [awaitAndYield.ts]
|
||||
async function* test(x: Promise<number>) {
|
||||
enum E {
|
||||
foo = await x,
|
||||
baz = yield 1,
|
||||
}
|
||||
}
|
||||
|
||||
//// [awaitAndYield.js]
|
||||
async function* test(x) {
|
||||
let E;
|
||||
(function (E) {
|
||||
E[E["foo"] = await x] = "foo";
|
||||
E[E["baz"] = yield 1] = "baz";
|
||||
})(E || (E = {}));
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(3,9): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(3,21): error TS1308: 'await' expression is only allowed within an async function.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(4,16): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(4,28): error TS1308: 'await' expression is only allowed within an async function.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(6,9): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(6,21): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(7,16): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(7,28): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(11,9): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(11,21): error TS1308: 'await' expression is only allowed within an async function.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(12,16): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(12,28): error TS1308: 'await' expression is only allowed within an async function.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(14,9): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(14,21): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(15,16): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
tests/cases/conformance/classes/awaitAndYieldInProperty.ts(15,28): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/awaitAndYieldInProperty.ts (16 errors) ====
|
||||
async function* test(x: Promise<string>) {
|
||||
class C {
|
||||
[await x] = await x;
|
||||
~~~~~~~~~
|
||||
!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
~~~~~
|
||||
!!! error TS1308: 'await' expression is only allowed within an async function.
|
||||
static [await x] = await x;
|
||||
~~~~~~~~~
|
||||
!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
~~~~~
|
||||
!!! error TS1308: 'await' expression is only allowed within an async function.
|
||||
|
||||
[yield 1] = yield 2;
|
||||
~~~~~~~~~
|
||||
!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
~~~~~
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
static [yield 3] = yield 4;
|
||||
~~~~~~~~~
|
||||
!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
~~~~~
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
}
|
||||
|
||||
return class {
|
||||
[await x] = await x;
|
||||
~~~~~~~~~
|
||||
!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
~~~~~
|
||||
!!! error TS1308: 'await' expression is only allowed within an async function.
|
||||
static [await x] = await x;
|
||||
~~~~~~~~~
|
||||
!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
~~~~~
|
||||
!!! error TS1308: 'await' expression is only allowed within an async function.
|
||||
|
||||
[yield 1] = yield 2;
|
||||
~~~~~~~~~
|
||||
!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
~~~~~
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
static [yield 3] = yield 4;
|
||||
~~~~~~~~~
|
||||
!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
|
||||
~~~~~
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
//// [awaitAndYieldInProperty.ts]
|
||||
async function* test(x: Promise<string>) {
|
||||
class C {
|
||||
[await x] = await x;
|
||||
static [await x] = await x;
|
||||
|
||||
[yield 1] = yield 2;
|
||||
static [yield 3] = yield 4;
|
||||
}
|
||||
|
||||
return class {
|
||||
[await x] = await x;
|
||||
static [await x] = await x;
|
||||
|
||||
[yield 1] = yield 2;
|
||||
static [yield 3] = yield 4;
|
||||
}
|
||||
}
|
||||
|
||||
//// [awaitAndYieldInProperty.js]
|
||||
async function* test(x) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
||||
class C {
|
||||
constructor() {
|
||||
this[_a] = await x;
|
||||
this[_c] = yield 2;
|
||||
}
|
||||
}
|
||||
_a = await x, _b = await x, _c = yield 1, _d = yield 3;
|
||||
C[_b] = await x;
|
||||
C[_d] = yield 4;
|
||||
return _j = class {
|
||||
constructor() {
|
||||
this[_e] = await x;
|
||||
this[_g] = yield 2;
|
||||
}
|
||||
},
|
||||
_e = await x,
|
||||
_f = await x,
|
||||
_g = yield 1,
|
||||
_h = yield 3,
|
||||
_j[_f] = await x,
|
||||
_j[_h] = yield 4,
|
||||
_j;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
tests/cases/compiler/awaitInClassInAsyncFunction.ts(9,15): error TS1308: 'await' expression is only allowed within an async function.
|
||||
|
||||
|
||||
==== tests/cases/compiler/awaitInClassInAsyncFunction.ts (1 errors) ====
|
||||
// https://github.com/microsoft/TypeScript/issues/34887
|
||||
|
||||
async function bar() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
async function foo() {
|
||||
return new class {
|
||||
baz = await bar();
|
||||
~~~~~
|
||||
!!! error TS1308: 'await' expression is only allowed within an async function.
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [awaitInClassInAsyncFunction.ts]
|
||||
// https://github.com/microsoft/TypeScript/issues/34887
|
||||
|
||||
async function bar() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
async function foo() {
|
||||
return new class {
|
||||
baz = await bar();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//// [awaitInClassInAsyncFunction.js]
|
||||
// https://github.com/microsoft/TypeScript/issues/34887
|
||||
async function bar() {
|
||||
return 2;
|
||||
}
|
||||
async function foo() {
|
||||
return new class {
|
||||
constructor() {
|
||||
this.baz = await bar();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/awaitInClassInAsyncFunction.ts ===
|
||||
// https://github.com/microsoft/TypeScript/issues/34887
|
||||
|
||||
async function bar() {
|
||||
>bar : Symbol(bar, Decl(awaitInClassInAsyncFunction.ts, 0, 0))
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
async function foo() {
|
||||
>foo : Symbol(foo, Decl(awaitInClassInAsyncFunction.ts, 4, 1))
|
||||
|
||||
return new class {
|
||||
baz = await bar();
|
||||
>baz : Symbol((Anonymous class).baz, Decl(awaitInClassInAsyncFunction.ts, 7, 22))
|
||||
>bar : Symbol(bar, Decl(awaitInClassInAsyncFunction.ts, 0, 0))
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
=== tests/cases/compiler/awaitInClassInAsyncFunction.ts ===
|
||||
// https://github.com/microsoft/TypeScript/issues/34887
|
||||
|
||||
async function bar() {
|
||||
>bar : () => Promise<number>
|
||||
|
||||
return 2;
|
||||
>2 : 2
|
||||
}
|
||||
|
||||
async function foo() {
|
||||
>foo : () => Promise<(Anonymous class)>
|
||||
|
||||
return new class {
|
||||
>new class { baz = await bar(); } : (Anonymous class)
|
||||
>class { baz = await bar(); } : typeof (Anonymous class)
|
||||
|
||||
baz = await bar();
|
||||
>baz : number
|
||||
>await bar() : number
|
||||
>bar() : Promise<number>
|
||||
>bar : () => Promise<number>
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ o3.b?.().c;
|
||||
|
||||
|
||||
//// [callChain.2.js]
|
||||
var _a, _b, _c, _d;
|
||||
(_a = o1) === null || _a === void 0 ? void 0 : _a();
|
||||
(_b = o2) === null || _b === void 0 ? void 0 : _b.b();
|
||||
(_d = (_c = o3).b) === null || _d === void 0 ? void 0 : _d.call(_c).c;
|
||||
var _a;
|
||||
o1 === null || o1 === void 0 ? void 0 : o1();
|
||||
o2 === null || o2 === void 0 ? void 0 : o2.b();
|
||||
(_a = o3.b) === null || _a === void 0 ? void 0 : _a.call(o3).c;
|
||||
|
||||
@@ -12,11 +12,11 @@ t1 = a!.m!({x: 12});
|
||||
|
||||
//// [callChain.3.js]
|
||||
"use strict";
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
||||
var n1 = (_c = (_a = a) === null || _a === void 0 ? void 0 : (_b = _a).m) === null || _c === void 0 ? void 0 : _c.call(_b, { x: 12 }); // should be an error (`undefined` is not assignable to `number`)
|
||||
var n2 = (_f = (_d = a) === null || _d === void 0 ? void 0 : (_e = _d).m) === null || _f === void 0 ? void 0 : _f.call(_e, { x: absorb() }); // likewise
|
||||
var n3 = (_j = (_g = a) === null || _g === void 0 ? void 0 : (_h = _g).m) === null || _j === void 0 ? void 0 : _j.call(_h, { x: 12 }); // should be ok
|
||||
var n4 = (_m = (_k = a) === null || _k === void 0 ? void 0 : (_l = _k).m) === null || _m === void 0 ? void 0 : _m.call(_l, { x: absorb() }); // likewise
|
||||
var _a, _b, _c, _d, _e;
|
||||
var n1 = (_a = a === null || a === void 0 ? void 0 : a.m) === null || _a === void 0 ? void 0 : _a.call(a, { x: 12 }); // should be an error (`undefined` is not assignable to `number`)
|
||||
var n2 = (_b = a === null || a === void 0 ? void 0 : a.m) === null || _b === void 0 ? void 0 : _b.call(a, { x: absorb() }); // likewise
|
||||
var n3 = (_c = a === null || a === void 0 ? void 0 : a.m) === null || _c === void 0 ? void 0 : _c.call(a, { x: 12 }); // should be ok
|
||||
var n4 = (_d = a === null || a === void 0 ? void 0 : a.m) === null || _d === void 0 ? void 0 : _d.call(a, { x: absorb() }); // likewise
|
||||
// Also a test showing `!` vs `?` for good measure
|
||||
var t1 = (_q = (_o = a) === null || _o === void 0 ? void 0 : (_p = _o).m) === null || _q === void 0 ? void 0 : _q.call(_p, { x: 12 });
|
||||
var t1 = (_e = a === null || a === void 0 ? void 0 : a.m) === null || _e === void 0 ? void 0 : _e.call(a, { x: 12 });
|
||||
t1 = a.m({ x: 12 });
|
||||
|
||||
@@ -46,30 +46,30 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
||||
(_a = o1) === null || _a === void 0 ? void 0 : _a();
|
||||
(_b = o1) === null || _b === void 0 ? void 0 : _b(1);
|
||||
(_c = o1) === null || _c === void 0 ? void 0 : _c.apply(void 0, [1, 2]);
|
||||
(_d = o1) === null || _d === void 0 ? void 0 : _d.apply(void 0, __spreadArrays([1], [2, 3], [4]));
|
||||
(_e = o2) === null || _e === void 0 ? void 0 : _e.b();
|
||||
(_f = o2) === null || _f === void 0 ? void 0 : _f.b(1);
|
||||
(_g = o2) === null || _g === void 0 ? void 0 : _g.b.apply(_g, [1, 2]);
|
||||
(_h = o2) === null || _h === void 0 ? void 0 : _h.b.apply(_h, __spreadArrays([1], [2, 3], [4]));
|
||||
(_j = o2) === null || _j === void 0 ? void 0 : _j["b"]();
|
||||
(_k = o2) === null || _k === void 0 ? void 0 : _k["b"](1);
|
||||
(_l = o2) === null || _l === void 0 ? void 0 : _l["b"].apply(_l, [1, 2]);
|
||||
(_m = o2) === null || _m === void 0 ? void 0 : _m["b"].apply(_m, __spreadArrays([1], [2, 3], [4]));
|
||||
(_p = (_o = o3).b) === null || _p === void 0 ? void 0 : _p.call(_o).c;
|
||||
(_r = (_q = o3).b) === null || _r === void 0 ? void 0 : _r.call(_q, 1).c;
|
||||
(_t = (_s = o3).b) === null || _t === void 0 ? void 0 : _t.call.apply(_t, __spreadArrays([_s], [1, 2])).c;
|
||||
(_v = (_u = o3).b) === null || _v === void 0 ? void 0 : _v.call.apply(_v, __spreadArrays([_u, 1], [2, 3], [4])).c;
|
||||
(_x = (_w = o3).b) === null || _x === void 0 ? void 0 : _x.call(_w)["c"];
|
||||
(_z = (_y = o3).b) === null || _z === void 0 ? void 0 : _z.call(_y, 1)["c"];
|
||||
(_1 = (_0 = o3).b) === null || _1 === void 0 ? void 0 : _1.call.apply(_1, __spreadArrays([_0], [1, 2]))["c"];
|
||||
(_3 = (_2 = o3).b) === null || _3 === void 0 ? void 0 : _3.call.apply(_3, __spreadArrays([_2, 1], [2, 3], [4]))["c"];
|
||||
(_5 = (_4 = o3)["b"]) === null || _5 === void 0 ? void 0 : _5.call(_4).c;
|
||||
(_7 = (_6 = o3)["b"]) === null || _7 === void 0 ? void 0 : _7.call(_6, 1).c;
|
||||
(_9 = (_8 = o3)["b"]) === null || _9 === void 0 ? void 0 : _9.call.apply(_9, __spreadArrays([_8], [1, 2])).c;
|
||||
(_11 = (_10 = o3)["b"]) === null || _11 === void 0 ? void 0 : _11.call.apply(_11, __spreadArrays([_10, 1], [2, 3], [4])).c;
|
||||
var v = (_12 = o4) === null || _12 === void 0 ? void 0 : _12(incr);
|
||||
(_13 = o5()) === null || _13 === void 0 ? void 0 : _13();
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
||||
o1 === null || o1 === void 0 ? void 0 : o1();
|
||||
o1 === null || o1 === void 0 ? void 0 : o1(1);
|
||||
o1 === null || o1 === void 0 ? void 0 : o1.apply(void 0, [1, 2]);
|
||||
o1 === null || o1 === void 0 ? void 0 : o1.apply(void 0, __spreadArrays([1], [2, 3], [4]));
|
||||
o2 === null || o2 === void 0 ? void 0 : o2.b();
|
||||
o2 === null || o2 === void 0 ? void 0 : o2.b(1);
|
||||
o2 === null || o2 === void 0 ? void 0 : o2.b.apply(o2, [1, 2]);
|
||||
o2 === null || o2 === void 0 ? void 0 : o2.b.apply(o2, __spreadArrays([1], [2, 3], [4]));
|
||||
o2 === null || o2 === void 0 ? void 0 : o2["b"]();
|
||||
o2 === null || o2 === void 0 ? void 0 : o2["b"](1);
|
||||
o2 === null || o2 === void 0 ? void 0 : o2["b"].apply(o2, [1, 2]);
|
||||
o2 === null || o2 === void 0 ? void 0 : o2["b"].apply(o2, __spreadArrays([1], [2, 3], [4]));
|
||||
(_a = o3.b) === null || _a === void 0 ? void 0 : _a.call(o3).c;
|
||||
(_b = o3.b) === null || _b === void 0 ? void 0 : _b.call(o3, 1).c;
|
||||
(_c = o3.b) === null || _c === void 0 ? void 0 : _c.call.apply(_c, __spreadArrays([o3], [1, 2])).c;
|
||||
(_d = o3.b) === null || _d === void 0 ? void 0 : _d.call.apply(_d, __spreadArrays([o3, 1], [2, 3], [4])).c;
|
||||
(_e = o3.b) === null || _e === void 0 ? void 0 : _e.call(o3)["c"];
|
||||
(_f = o3.b) === null || _f === void 0 ? void 0 : _f.call(o3, 1)["c"];
|
||||
(_g = o3.b) === null || _g === void 0 ? void 0 : _g.call.apply(_g, __spreadArrays([o3], [1, 2]))["c"];
|
||||
(_h = o3.b) === null || _h === void 0 ? void 0 : _h.call.apply(_h, __spreadArrays([o3, 1], [2, 3], [4]))["c"];
|
||||
(_j = o3["b"]) === null || _j === void 0 ? void 0 : _j.call(o3).c;
|
||||
(_k = o3["b"]) === null || _k === void 0 ? void 0 : _k.call(o3, 1).c;
|
||||
(_l = o3["b"]) === null || _l === void 0 ? void 0 : _l.call.apply(_l, __spreadArrays([o3], [1, 2])).c;
|
||||
(_m = o3["b"]) === null || _m === void 0 ? void 0 : _m.call.apply(_m, __spreadArrays([o3, 1], [2, 3], [4])).c;
|
||||
var v = o4 === null || o4 === void 0 ? void 0 : o4(incr);
|
||||
(_o = o5()) === null || _o === void 0 ? void 0 : _o();
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [callChainWithSuper.ts]
|
||||
// GH#34952
|
||||
class Base { method?() {} }
|
||||
class Derived extends Base {
|
||||
method1() { return super.method?.(); }
|
||||
method2() { return super["method"]?.(); }
|
||||
}
|
||||
|
||||
//// [callChainWithSuper.js]
|
||||
"use strict";
|
||||
// GH#34952
|
||||
class Base {
|
||||
method() { }
|
||||
}
|
||||
class Derived extends Base {
|
||||
method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [callChainWithSuper.ts]
|
||||
// GH#34952
|
||||
class Base { method?() {} }
|
||||
class Derived extends Base {
|
||||
method1() { return super.method?.(); }
|
||||
method2() { return super["method"]?.(); }
|
||||
}
|
||||
|
||||
//// [callChainWithSuper.js]
|
||||
"use strict";
|
||||
// GH#34952
|
||||
class Base {
|
||||
method() { }
|
||||
}
|
||||
class Derived extends Base {
|
||||
method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [callChainWithSuper.ts]
|
||||
// GH#34952
|
||||
class Base { method?() {} }
|
||||
class Derived extends Base {
|
||||
method1() { return super.method?.(); }
|
||||
method2() { return super["method"]?.(); }
|
||||
}
|
||||
|
||||
//// [callChainWithSuper.js]
|
||||
"use strict";
|
||||
// GH#34952
|
||||
class Base {
|
||||
method() { }
|
||||
}
|
||||
class Derived extends Base {
|
||||
method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [callChainWithSuper.ts]
|
||||
// GH#34952
|
||||
class Base { method?() {} }
|
||||
class Derived extends Base {
|
||||
method1() { return super.method?.(); }
|
||||
method2() { return super["method"]?.(); }
|
||||
}
|
||||
|
||||
//// [callChainWithSuper.js]
|
||||
"use strict";
|
||||
// GH#34952
|
||||
class Base {
|
||||
method() { }
|
||||
}
|
||||
class Derived extends Base {
|
||||
method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [callChainWithSuper.ts]
|
||||
// GH#34952
|
||||
class Base { method?() {} }
|
||||
class Derived extends Base {
|
||||
method1() { return super.method?.(); }
|
||||
method2() { return super["method"]?.(); }
|
||||
}
|
||||
|
||||
//// [callChainWithSuper.js]
|
||||
"use strict";
|
||||
// GH#34952
|
||||
class Base {
|
||||
method() { }
|
||||
}
|
||||
class Derived extends Base {
|
||||
method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
//// [callChainWithSuper.ts]
|
||||
// GH#34952
|
||||
class Base { method?() {} }
|
||||
class Derived extends Base {
|
||||
method1() { return super.method?.(); }
|
||||
method2() { return super["method"]?.(); }
|
||||
}
|
||||
|
||||
//// [callChainWithSuper.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
// GH#34952
|
||||
var Base = /** @class */ (function () {
|
||||
function Base() {
|
||||
}
|
||||
Base.prototype.method = function () { };
|
||||
return Base;
|
||||
}());
|
||||
var Derived = /** @class */ (function (_super) {
|
||||
__extends(Derived, _super);
|
||||
function Derived() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Derived.prototype.method1 = function () { var _a; return (_a = _super.prototype.method) === null || _a === void 0 ? void 0 : _a.call(this); };
|
||||
Derived.prototype.method2 = function () { var _a; return (_a = _super.prototype["method"]) === null || _a === void 0 ? void 0 : _a.call(this); };
|
||||
return Derived;
|
||||
}(Base));
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [callChainWithSuper.ts]
|
||||
// GH#34952
|
||||
class Base { method?() {} }
|
||||
class Derived extends Base {
|
||||
method1() { return super.method?.(); }
|
||||
method2() { return super["method"]?.(); }
|
||||
}
|
||||
|
||||
//// [callChainWithSuper.js]
|
||||
"use strict";
|
||||
// GH#34952
|
||||
class Base {
|
||||
method() { }
|
||||
}
|
||||
class Derived extends Base {
|
||||
method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [callChainWithSuper.ts]
|
||||
// GH#34952
|
||||
class Base { method?() {} }
|
||||
class Derived extends Base {
|
||||
method1() { return super.method?.(); }
|
||||
method2() { return super["method"]?.(); }
|
||||
}
|
||||
|
||||
//// [callChainWithSuper.js]
|
||||
"use strict";
|
||||
// GH#34952
|
||||
class Base {
|
||||
method() { }
|
||||
}
|
||||
class Derived extends Base {
|
||||
method1() { return super.method?.(); }
|
||||
method2() { return super["method"]?.(); }
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/collisionCodeGenModuleWithMemberClassConflict.ts ===
|
||||
module m1 {
|
||||
>m1 : typeof m1
|
||||
>m1 : typeof globalThis.m1
|
||||
|
||||
export class m1 {
|
||||
>m1 : m1
|
||||
@@ -14,7 +14,7 @@ var foo = new m1.m1();
|
||||
>m1 : typeof m1.m1
|
||||
|
||||
module m2 {
|
||||
>m2 : typeof m2
|
||||
>m2 : typeof globalThis.m2
|
||||
|
||||
export class m2 {
|
||||
>m2 : m2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/collisionCodeGenModuleWithMemberVariable.ts ===
|
||||
module m1 {
|
||||
>m1 : typeof m1
|
||||
>m1 : typeof globalThis.m1
|
||||
|
||||
export var m1 = 10;
|
||||
>m1 : number
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/collisionCodeGenModuleWithModuleReopening.ts ===
|
||||
module m1 {
|
||||
>m1 : typeof m1
|
||||
>m1 : typeof globalThis.m1
|
||||
|
||||
export class m1 {
|
||||
>m1 : m1
|
||||
@@ -14,7 +14,7 @@ var foo = new m1.m1();
|
||||
>m1 : typeof m1.m1
|
||||
|
||||
module m1 {
|
||||
>m1 : typeof m1
|
||||
>m1 : typeof globalThis.m1
|
||||
|
||||
export class c1 {
|
||||
>c1 : c1
|
||||
@@ -37,7 +37,7 @@ var foo2 = new m1.c1();
|
||||
>c1 : typeof m1.c1
|
||||
|
||||
module m2 {
|
||||
>m2 : typeof m2
|
||||
>m2 : typeof globalThis.m2
|
||||
|
||||
export class c1 {
|
||||
>c1 : c1
|
||||
@@ -59,7 +59,7 @@ var foo3 = new m2.c1();
|
||||
>c1 : typeof m2.c1
|
||||
|
||||
module m2 {
|
||||
>m2 : typeof m2
|
||||
>m2 : typeof globalThis.m2
|
||||
|
||||
export class m2 {
|
||||
>m2 : m2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/collisionCodeGenModuleWithPrivateMember.ts ===
|
||||
module m1 {
|
||||
>m1 : typeof m1
|
||||
>m1 : typeof globalThis.m1
|
||||
|
||||
class m1 {
|
||||
>m1 : m1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user