From 1ccc04fe0a892e0e3c416b08efb7281fc6518c24 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 16 Oct 2017 16:57:02 -0700 Subject: [PATCH] Update LKG --- lib/chs/diagnosticMessages.generated.json | 20 +- lib/cht/diagnosticMessages.generated.json | 20 +- lib/csy/diagnosticMessages.generated.json | 18 +- lib/enu/diagnosticMessages.generated.json.lcg | 16 +- lib/esn/diagnosticMessages.generated.json | 20 +- lib/fra/diagnosticMessages.generated.json | 18 +- lib/ita/diagnosticMessages.generated.json | 20 +- lib/jpn/diagnosticMessages.generated.json | 20 +- lib/kor/diagnosticMessages.generated.json | 20 +- lib/lib.d.ts | 12 +- lib/lib.dom.d.ts | 12 +- lib/lib.es2016.full.d.ts | 12 +- lib/lib.es2017.full.d.ts | 12 +- lib/lib.es6.d.ts | 12 +- lib/lib.esnext.full.d.ts | 12 +- lib/lib.webworker.d.ts | 2 +- lib/plk/diagnosticMessages.generated.json | 20 +- lib/ptb/diagnosticMessages.generated.json | 20 +- lib/rus/diagnosticMessages.generated.json | 20 +- lib/trk/diagnosticMessages.generated.json | 20 +- lib/tsc.js | 131 ++++-- lib/tsserver.js | 390 ++++++++++++++-- lib/tsserverlibrary.d.ts | 1 + lib/tsserverlibrary.js | 431 +++++++++++++++--- lib/typescript.js | 426 ++++++++++++++--- lib/typescriptServices.js | 426 ++++++++++++++--- lib/typingsInstaller.js | 51 ++- 27 files changed, 1796 insertions(+), 386 deletions(-) diff --git a/lib/chs/diagnosticMessages.generated.json b/lib/chs/diagnosticMessages.generated.json index b3f66f9f39d..7afaad352f7 100644 --- a/lib/chs/diagnosticMessages.generated.json +++ b/lib/chs/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "声明方法“{0}”。", "Declare_property_0_90016": "声明属性“{0}”。", "Declare_static_method_0_90024": "声明静态方法“{0}”。", + "Declare_static_property_0_90027": "声明静态属性 \"{0}\"。", "Decorators_are_not_valid_here_1206": "修饰器在此处无效。", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "不能向多个同名的 get/set 访问器应用修饰器。", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "模块的默认导出具有或正在使用专用名称“{0}”。", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "发出包含源映射而非包含单独文件的单个文件。", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "在单个文件内发出源以及源映射;需要设置 \"--inlineSourceMap\" 或 \"--sourceMap\"。", "Enable_all_strict_type_checking_options_6180": "启用所有严格类型检查选项。", + "Enable_strict_checking_of_function_types_6186": "对函数类型启用严格检查。", "Enable_strict_null_checks_6113": "启用严格的 NULL 检查。", "Enable_tracing_of_the_name_resolution_process_6085": "启用名称解析过程的跟踪。", "Enables_experimental_support_for_ES7_async_functions_6068": "对 ES7 异步函数启用实验支持。", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "表达式解析为编译器用于支持异步函数的变量声明“{0}”。", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "表达式解析为编辑器用于捕获 \"new.target\" 元属性引用的变量声明 \"_newTarget\"。", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "表达式解析为编译器用于捕获 \"this\" 引用的变量声明 \"_this\"。", - "Extract_function_95003": "提取函数", - "Extract_to_0_95004": "解压缩到 {0}", + "Extract_constant_95006": "解压缩常数", + "Extract_function_95005": "解压缩函数", + "Extract_symbol_95003": "解压缩符号", + "Extract_to_0_in_1_95004": "解压缩到 {1} 中的 {0}", + "Extract_to_0_in_1_scope_95008": "解压缩到 {1} 范围中的 {0}", + "Extract_to_0_in_enclosing_scope_95007": "解压缩到封闭范围中的 {0}", "FILE_6035": "文件", "FILE_OR_DIRECTORY_6040": "文件或目录", "Failed_to_parse_file_0_Colon_1_5014": "未能分析文件“{0}”: {1}。", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "严格模式下“{0}”的使用无效。", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "\"jsxFactory\" 的值无效。“{0}”不是有效的标识符或限定名称。", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "\"--reactNamespace\" 的值无效。“{0}”不是有效的标识符。", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "JSDoc \"@augments {0}\" 与“扩展 {1}”子句不匹配。", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "JSDoc \"@augments\" 未附加到类声明。", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "JSDoc \"@param\" 标记具有名称 \"{0}\",但不存在具有该名称的参数。", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc \"@typedef\" 标记应具有类型注释,或其后跟有 \"@property\" 或 \"@member\" 标记。", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc 类型只能在文档注释内部使用。", "JSX_attribute_expected_17003": "需要 JSX 属性。", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "只能为 JSX 属性分配非空“表达式”。", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "模块“{0}”使用 \"export =\" 且无法与 \"export *\" 一起使用。", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "模块“{0}”解析为“{1}”中声明的环境模块,因为未修改此文件。", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "模块“{0}”解析为文件“{1}”中本地声明的环境模块。", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "模块“{0}”已解析为“{1}”,但尚未设置 \"--allowJs\"。", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "模块“{0}”已解析为“{1}”,但尚未设置 \"--jsx\"。", "Module_Resolution_Options_6174": "模块分辨率选项", "Module_name_0_matched_pattern_1_6092": "模块名“{0}”,匹配的模式“{1}”。", @@ -656,7 +665,7 @@ "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015": "指定 ECMAScript 目标版本: \"ES3\"(默认)、\"ES5\"、\"ES2015\"、\"ES2016\"、\"ES2017\" 或 \"ESNEXT\"。", "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080": "指定 JSX 代码生成: \"preserve\"、\"react-native\" 或 \"react\"。", "Specify_library_files_to_be_included_in_the_compilation_Colon_6079": "指定要在编译中包括的库文件: ", - "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "指定模块代码生成: \"none\"、\"commonjs\"、\"amd\"、\"system\"、\"umd\"、\"es2015\" 或 \"ESNext\"。", + "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "指定模块代码生成: \"none\"、\"commonjs\"、\"amd\"、\"system\"、\"umd\"、\"es2015\"或 \"ESNext\"。", "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069": "指定模块解析策略: \"node\" (Node.js)或 \"classic\" (TypeScript pre-1.6)。", "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146": "指定在设定 \"react\" JSX 发出目标时要使用的 JSX 工厂函数,例如 \"react.createElement\" 或 \"h\"。", "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060": "指定发出文件时要使用的行序列结尾: \"CRLF\" (dos)或 \"LF\" (unix)。", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "ES3 和 ES5 中的异步函数或方法不能引用“参数”对象。请考虑使用标准函数或方法。", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "\"if\" 语句的正文不能为空语句。", "The_character_set_of_the_input_files_6163": "输入文件的字符集。", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "找到的配置文件 \"{0}\" 未包含任何源文件。", "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.", + "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": "承诺的 \"then\" 方法的第一个参数必须是回调。", "The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "全局类型 \"JSX.{0}\" 不可具有多个属性。", diff --git a/lib/cht/diagnosticMessages.generated.json b/lib/cht/diagnosticMessages.generated.json index 69d7915b983..b5dacb3b2a9 100644 --- a/lib/cht/diagnosticMessages.generated.json +++ b/lib/cht/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "宣告方法 '{0}'。", "Declare_property_0_90016": "宣告屬性 '{0}'。", "Declare_static_method_0_90024": "宣告靜態方法 '{0}'。", + "Declare_static_property_0_90027": "宣告靜態屬性 '{0}'。", "Decorators_are_not_valid_here_1206": "裝飾項目在此處無效。", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "無法將裝飾項目套用至多個同名的 get/set 存取子。", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "模組的預設匯出具有或正在使用私用名稱 '{0}'。", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "發出單一檔案包含來源對應,而不要使用個別的檔案。", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "使用單一檔案發出來源與來源對應。必須設定 '--inlineSourceMap' 或 '--sourceMap'。", "Enable_all_strict_type_checking_options_6180": "啟用所有 Strict 類型檢查選項。", + "Enable_strict_checking_of_function_types_6186": "啟用嚴格檢查函式類型。", "Enable_strict_null_checks_6113": "啟用嚴格 null 檢查。", "Enable_tracing_of_the_name_resolution_process_6085": "啟用名稱解析流程的追蹤。", "Enables_experimental_support_for_ES7_async_functions_6068": "啟用 ES7 非同步函式的實驗支援。", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "運算式會解析成變數宣告 '{0}',而編譯器會使用此宣告支援非同步函式。", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "運算式解析成編譯器用來擷取 'new.target' 中繼屬性參考的變數宣告 '_newTarget'。", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "運算式會解析成變數宣告 '_this',而編譯器會使用此宣告來擷取 'this' 參考 。", - "Extract_function_95003": "擷取函式", - "Extract_to_0_95004": "解壓縮至 {0}", + "Extract_constant_95006": "解壓縮常數", + "Extract_function_95005": "解壓縮函式", + "Extract_symbol_95003": "解壓縮符號", + "Extract_to_0_in_1_95004": "解壓縮至 {1} 中的 {0}", + "Extract_to_0_in_1_scope_95008": "解壓縮至 {1} 範圍中的 {0}", + "Extract_to_0_in_enclosing_scope_95007": "解壓縮至封閉式範圍中的 {0}", "FILE_6035": "檔案", "FILE_OR_DIRECTORY_6040": "檔案或目錄", "Failed_to_parse_file_0_Colon_1_5014": "無法剖析檔案 '{0}': {1}。", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "在 strict 模式中使用 '{0}' 無效。", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "'jsxFactory' 的值無效。'{0}' 不是有效的識別碼或限定名稱。", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "'--reactNamespace' 的值無效。'{0}' 不是有效的識別碼。", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "JSDoc '@augments {0}' 不符合 'extends {1}' 子句。", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "JSDoc '@augments' 未連結至類別宣告。", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "JSDoc '@param' 標記的名稱為 '{0}',但沒有為該名稱的參數。", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc '@typedef' 標記應具有類型註解,或者其後接著 '@property' 或 '@member' 標記。", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc 類型只能在文件註解中使用。", "JSX_attribute_expected_17003": "必須是 JSX 屬性。", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "只能將非空白的 'expression' 指派給 JSX 屬性。", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "模組 '{0}' 使用 'export =',因而無法以 'export *' 的方式使用。", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "此檔案未修改,因此模組 '{0}' 已解析為在 '{1}' 中所宣告的環境模組。", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "模組 '{0}' 在檔案 '{1}' 中已解析為本機宣告的環境模組。", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "模組 '{0}' 已解析為 '{1}',但未設定 '--allowJs'。", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "模組 '{0}' 已解析為 '{1}',但未設定 '--jsx'。", "Module_Resolution_Options_6174": "模組解析選項", "Module_name_0_matched_pattern_1_6092": "模組名稱 '{0}',符合的模式 '{1}'。", @@ -656,7 +665,7 @@ "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015": "指定 ECMAScript 目標版本: 'ES3' (預設)、'ES5'、'ES2015'、'ES2016'、'ES2017' 或 'ESNEXT'。", "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080": "指定 JSX 程式碼產生: 'preserve'、'react-native' 或 'react'。", "Specify_library_files_to_be_included_in_the_compilation_Colon_6079": "指定編譯內要包含的程式庫檔: ", - "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "指定模組程式碼產生: 'none'、commonjs'、'amd'、'system'、'umd'、'es2015' 或 'ESNext'。", + "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "指定模組程式碼產生: 'none'、'commonjs'、'amd'、'system'、'umd'、'es2015' 或 'ESNext'。", "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069": "指定模組解決方案策略: 'node' (Node.js) 或 'classic' (TypeScript 1.6 前)。", "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146": "請指定要在以 'react' JSX 發出為目標時使用的 JSX factory 函式。例如 'React.createElement' 或 'h'。", "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060": "指定發出檔案時要用的行尾順序: 'CRLF' (DOS) 或 'LF' (UNIX)。", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "在 ES3 與 ES5 的非同步函式或方法中,無法參考 'arguments' 物件。請考慮使用標準函式或方法。", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "'if' 陳述式的主體不能是空白陳述式。", "The_character_set_of_the_input_files_6163": "輸入檔的字元集。", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "找到的組態檔 '{0}' 不包含任何來源檔案。", "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.", + "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}' 的屬性不得超過一個。", diff --git a/lib/csy/diagnosticMessages.generated.json b/lib/csy/diagnosticMessages.generated.json index 8d373507926..948ce696aff 100644 --- a/lib/csy/diagnosticMessages.generated.json +++ b/lib/csy/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "Deklarujte metodu {0}.", "Declare_property_0_90016": "Deklarujte vlastnost {0}.", "Declare_static_method_0_90024": "Deklarujte statickou metodu {0}.", + "Declare_static_property_0_90027": "Deklarujte statickou vlastnost {0}.", "Decorators_are_not_valid_here_1206": "Dekorátory tady nejsou platné.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Dekorátory nejde použít na víc přístupových objektů get/set se stejným názvem.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Výchozí export modulu má nebo používá privátní název {0}.", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Vygeneruje jediný soubor se zdrojovými mapováními namísto samostatného souboru.", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Vygeneruje zdroj spolu se zdrojovými mapováními v jednom souboru. Vyžaduje, aby byla nastavená možnost --inlineSourceMap nebo --sourceMap.", "Enable_all_strict_type_checking_options_6180": "Povolí všechny možnosti striktní kontroly typů.", + "Enable_strict_checking_of_function_types_6186": "Povolte striktní kontrolu typů funkcí.", "Enable_strict_null_checks_6113": "Povolte striktní kontroly hodnot null.", "Enable_tracing_of_the_name_resolution_process_6085": "Povolte trasování procesu překladu IP adres.", "Enables_experimental_support_for_ES7_async_functions_6068": "Zapíná experimentální podporu asynchronních funkcí ES7.", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "Výraz se přeloží na deklaraci proměnné {0}, kterou kompilátor používá pro podporu asynchronních funkcí.", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "Výraz se vyhodnocuje na deklaraci proměnné _newTarget, kterou kompilátor používá k zachycení odkazu na metavlastnost new.target.", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "Výraz se přeloží na deklaraci proměnné _this, pomocí které kompilátor zaznamenává odkazy na příkaz this.", - "Extract_function_95003": "Extrahovat funkci", - "Extract_to_0_95004": "Extrahovat do {0}", + "Extract_constant_95006": "Extrahovat konstantu", + "Extract_function_95005": "Extrahovat funkci", + "Extract_symbol_95003": "Extrahovat symbol", + "Extract_to_0_in_1_95004": "Extrahovat do {0} v {1}", + "Extract_to_0_in_1_scope_95008": "Extrahovat do {0} v oboru {1}", + "Extract_to_0_in_enclosing_scope_95007": "Extrahovat do {0} v nadřazeném oboru", "FILE_6035": "SOUBOR", "FILE_OR_DIRECTORY_6040": "SOUBOR NEBO ADRESÁŘ", "Failed_to_parse_file_0_Colon_1_5014": "Nepovedlo se parsovat soubor {0}: {1}.", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "Neplatné použití {0} ve striktním režimu", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "Neplatná hodnota pro jsxFactory. {0} není platný identifikátor nebo kvalifikovaný název.", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "Neplatná hodnota --reactNamespace. {0} není platný identifikátor.", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "Značka JSDoc @augments {0} neodpovídá klauzuli extends {1}.", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "Značka JSDoc @augments není připojená k deklaraci třídy.", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "Značka JSDoc @param má název {0}, ale žádný parametr s tímto názvem neexistuje.", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "Značka JSDoc @typedef by měla mít anotaci typu nebo by za ní měla následovat značka @property nebo @member.", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Typy JSDoc se můžou používat jenom v dokumentačních komentářích.", "JSX_attribute_expected_17003": "Očekával se atribut JSX.", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Atributy JSX musí mít přiřazený neprázdný výraz.", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Modul {0} používá export = a nedá se použít s možností export *.", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "Modul {0} se převedl jako ambientní modul deklarovaný v {1}, protože tento soubor nebyl upraven.", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "Modul {0} se převedl jako lokálně deklarovaný ambientní modul v souboru {1}.", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "Modul {0} se přeložil na {1}, není ale nastavená možnost --allowJs.", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "Modul {0} se přeložil na {1}, není ale nastavená možnost --jsx.", "Module_Resolution_Options_6174": "Možnosti překladu modulů", "Module_name_0_matched_pattern_1_6092": "Název modulu {0}, odpovídající vzor {1}", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "V ES3 a ES5 se na objekt arguments nedá odkazovat v asynchronní funkci nebo metodě. Zvažte možnost použít standardní funkci nebo metodu.", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "Tělo příkazu if nemůže být prázdný příkaz.", "The_character_set_of_the_input_files_6163": "Znaková sada vstupních souborů", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "Nalezený konfigurační soubor {0} neobsahuje žádné zdrojové soubory.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Text obsahující funkce nebo modulu je pro analýzu toku řízení příliš dlouhý.", "The_current_host_does_not_support_the_0_option_5001": "Aktuální hostitel nepodporuje možnost {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.", + "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "Výraz přiřazení exportu musí být identifikátor nebo kvalifikovaný název v ambientním kontextu.", "The_files_list_in_config_file_0_is_empty_18002": "Seznam files v konfiguračním souboru {0} je prázdný.", "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060": "První parametr metody then příslibu musí být zpětné volání.", "The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "Globální typ JSX.{0} by neměl mít více než jednu vlastnost.", diff --git a/lib/enu/diagnosticMessages.generated.json.lcg b/lib/enu/diagnosticMessages.generated.json.lcg index 0eb14ef956f..9d493e74924 100644 --- a/lib/enu/diagnosticMessages.generated.json.lcg +++ b/lib/enu/diagnosticMessages.generated.json.lcg @@ -867,6 +867,18 @@ + + + + + + + + + + + + @@ -2481,13 +2493,13 @@ - + - + diff --git a/lib/esn/diagnosticMessages.generated.json b/lib/esn/diagnosticMessages.generated.json index bb134845fb1..dbf6bb1d5bd 100644 --- a/lib/esn/diagnosticMessages.generated.json +++ b/lib/esn/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "Declare el método \"{0}\".", "Declare_property_0_90016": "Declare la propiedad \"{0}\".", "Declare_static_method_0_90024": "Declare el método estático \"{0}\".", + "Declare_static_property_0_90027": "Declare la propiedad \"{0}\" estática.", "Decorators_are_not_valid_here_1206": "Los elementos Decorator no son válidos aquí.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "No se pueden aplicar elementos Decorator a varios descriptores de acceso get o set con el mismo nombre.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "La exportación predeterminada del módulo tiene o usa el nombre privado '{0}'.", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Emitir un solo archivo con mapas de origen en lugar de tener un archivo aparte.", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Emitir el origen junto a los mapas de origen en un solo archivo; requiere que se establezca \"--inlineSourceMap\" o \"--sourceMap\".", "Enable_all_strict_type_checking_options_6180": "Habilitar todas las opciones de comprobación de tipos estricta.", + "Enable_strict_checking_of_function_types_6186": "Habilite la comprobación estricta de los tipos de función.", "Enable_strict_null_checks_6113": "Habilitar comprobaciones estrictas de elementos nulos.", "Enable_tracing_of_the_name_resolution_process_6085": "Habilitar seguimiento del proceso de resolución de nombres.", "Enables_experimental_support_for_ES7_async_functions_6068": "Habilita la compatibilidad experimental con las funciones asincrónicas de ES7.", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "La expresión se resuelve en la declaración de variable '{0}' que el compilador usa para admitir funciones asincrónicas.", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "La expresión se resuelve en una declaración de variable \"_newTarget\" que el compilador usa para capturar la referencia de la propiedad Meta \"new.target\".", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "La expresión se resuelve en la declaración de variable \"_this\" que el compilador usa para capturar una referencia \"this\".", - "Extract_function_95003": "Extraer función", - "Extract_to_0_95004": "Extraer a {0}", + "Extract_constant_95006": "Extraer la constante", + "Extract_function_95005": "Extraer la función", + "Extract_symbol_95003": "Extraer el símbolo", + "Extract_to_0_in_1_95004": "Extraer a {0} en {1}", + "Extract_to_0_in_1_scope_95008": "Extraer a {0} en el ámbito {1}", + "Extract_to_0_in_enclosing_scope_95007": "Extraer a {0} en el ámbito de inclusión", "FILE_6035": "ARCHIVO", "FILE_OR_DIRECTORY_6040": "ARCHIVO O DIRECTORIO", "Failed_to_parse_file_0_Colon_1_5014": "Error al analizar el archivo '{0}': {1}.", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "Uso no válido de '{0}' en modo strict.", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "Valor no válido para \"jsxFactory\". \"{0}\" no es un nombre calificado o un identificador válido.", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "Valor no válido para '--reactNamespace'. '{0}' no es un identificador válido.", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "La etiqueta \"@augments {0}\" de JSDoc no coincide con la cláusula \"extends {1}\".", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "La etiqueta \"@augments\" de JSDoc no está asociada a una declaración de clase.", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "La etiqueta \"@param\" de JSDoc tiene el nombre \"{0}\", pero no hay ningún parámetro con ese nombre.", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "La etiqueta \"@typedef\" de JSDoc debe tener una anotación de tipo o ir seguida de las etiquetas \"@property\" o \"@member\".", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Los tipos JSDoc solo se pueden usar en los comentarios de la documentación.", "JSX_attribute_expected_17003": "Se esperaba un atributo JSX.", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "A los atributos JSX se les debe asignar únicamente un elemento \"expression\" que no esté vacío.", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "El módulo '{0}' usa \"export =\" y no se puede usar con \"export *\".", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "El módulo '{0}' se resolvió como un módulo de ambiente declarado en '{1}', porque este archivo no se había modificado.", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "El módulo '{0}' se resolvió como un módulo de ambiente declarado localmente en el archivo '{1}'.", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "El módulo '{0}' se resolvió en '{1}', pero \"--allowJs\" no está establecido.", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "El módulo '{0}' se resolvió en '{1}', pero \"--jsx\" no está establecido.", "Module_Resolution_Options_6174": "Opciones de resolución de módulo", "Module_name_0_matched_pattern_1_6092": "Nombre del módulo: '{0}', patrón coincidente: '{1}'.", @@ -656,7 +665,7 @@ "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015": "Especifique la versión de ECMAScript de destino: \"ES3\" (valor predeterminado), \"ES5\", \"ES2015\", \"ES2016\", \"ES2017\" o \"ESNEXT\".", "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080": "Especifique la generación de código JSX: \"preserve\", \"react-native\" o \"react\".", "Specify_library_files_to_be_included_in_the_compilation_Colon_6079": "Especifique archivos de biblioteca para incluirlos en la compilación: ", - "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Especifique la generación de código del módulo: \"none\", \"commonjs\", \"'amd\", \"system\", \"umd\", \"es2015\" o \"ESNext\".", + "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Especifique la generación de código del módulo: \"none\", \"commonjs\", \"amd\", \"system\", \"umd\", \"es2015\" o \"ESNext\".", "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069": "Especifique la estrategia de resolución de módulos: 'node' (Node.js) o 'classic' (TypeScript pre-1.6).", "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146": "Especifique la función de generador JSX que se usará cuando el destino sea la emisión de JSX \"react\"; por ejemplo, \"React.createElement\" o \"h\".", "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060": "Especifique la secuencia de final de línea que debe usarse para emitir archivos: 'CRLF' (Dos) o 'LF' (Unix).", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "No se puede hacer referencia al objeto \"arguments\" en una función o método asincrónico en ES3 ni ES5. Considere la posibilidad de usar un método o función estándar.", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "El cuerpo de una instrucción \"if\" no puede ser la instrucción vacía.", "The_character_set_of_the_input_files_6163": "Conjunto de caracteres de los archivos de entrada.", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "El archivo de configuración '{0}' encontrado no contiene archivos de código fuente.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "El cuerpo de la función o del módulo contenedor es demasiado grande para realizar un análisis de flujo de control.", "The_current_host_does_not_support_the_0_option_5001": "El host actual no admite la opción '{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.", + "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "La expresión de una asignación de exportación debe ser un identificador o un nombre completo en un contexto de ambiente.", "The_files_list_in_config_file_0_is_empty_18002": "La lista de archivos del archivo de configuración '{0}' está vacía.", "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060": "El primer parámetro del método \"then\" de una promesa debe ser una devolución de llamada.", "The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "El tipo \"JSX.{0}\" global no puede tener más de una propiedad.", diff --git a/lib/fra/diagnosticMessages.generated.json b/lib/fra/diagnosticMessages.generated.json index ca1a79fb2e6..437b261393a 100644 --- a/lib/fra/diagnosticMessages.generated.json +++ b/lib/fra/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "Déclarez la méthode '{0}'.", "Declare_property_0_90016": "Déclarez la propriété '{0}'.", "Declare_static_method_0_90024": "Déclarez la méthode statique '{0}'.", + "Declare_static_property_0_90027": "Déclarez la propriété statique '{0}'.", "Decorators_are_not_valid_here_1206": "Les éléments décoratifs ne sont pas valides ici.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Impossible d'appliquer des éléments décoratifs à plusieurs accesseurs get/set du même nom.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "L'exportation par défaut du module a utilisé ou utilise le nom privé '{0}'.", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Émettez un seul fichier avec des mappages de sources au lieu d'avoir un fichier distinct.", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Émettez la source aux côtés des mappages de sources dans un fichier unique. Nécessite la définition de '--inlineSourceMap' ou '--sourceMap'.", "Enable_all_strict_type_checking_options_6180": "Activez toutes les options de contrôle de type strict.", + "Enable_strict_checking_of_function_types_6186": "Activez la vérification stricte des types de fonction.", "Enable_strict_null_checks_6113": "Activez strict null checks.", "Enable_tracing_of_the_name_resolution_process_6085": "Activez le traçage du processus de résolution de noms.", "Enables_experimental_support_for_ES7_async_functions_6068": "Active la prise en charge expérimentale des fonctions async ES7.", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "L'expression correspond à la déclaration de variable '{0}' que le compilateur utilise pour prendre en charge les fonctions async.", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "L'expression génère une déclaration de variable '_newTarget' que le compilateur utilise pour capturer la référence de méta-propriété 'new.target'.", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "Expression résolue en déclaration de variable '_this' et utilisée par le compilateur pour capturer la référence 'this'.", - "Extract_function_95003": "Extraire la fonction", - "Extract_to_0_95004": "Extraire vers {0}", + "Extract_constant_95006": "Extraire la constante", + "Extract_function_95005": "Extraire la fonction", + "Extract_symbol_95003": "Extraire le symbole", + "Extract_to_0_in_1_95004": "Extraire vers {0} dans {1}", + "Extract_to_0_in_1_scope_95008": "Extraire vers {0} dans la portée {1}", + "Extract_to_0_in_enclosing_scope_95007": "Extraire vers {0} dans la portée englobante", "FILE_6035": "FICHIER", "FILE_OR_DIRECTORY_6040": "FICHIER OU RÉPERTOIRE", "Failed_to_parse_file_0_Colon_1_5014": "Échec de l'analyse du fichier '{0}' : {1}.", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "Utilisation non valide de '{0}' en mode strict.", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "Valeur non valide pour 'jsxFactory'. '{0}' n'est pas un identificateur valide ou un nom qualifié.", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "Valeur non valide pour '--reactNamespace'. '{0}' n'est pas un identificateur valide.", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "La balise JSDoc '@augments {0}' ne correspond pas à la clause 'extends {1}'.", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "La balise JSDoc '@augments' n'est pas attaché à une déclaration de classe.", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "La balise JSDoc '@param' se nomme '{0}', mais il n'existe aucun paramètre portant ce nom.", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "La balise JSDoc '@typedef' doit avoir une annotation de type ou être suivie des balises '@property' ou '@member'.", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Les types JSDoc peuvent uniquement être utilisés dans les commentaires de la documentation.", "JSX_attribute_expected_17003": "Attribut JSX attendu.", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Les attributs JSX doivent uniquement être attribués à une 'expression' non vide.", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Le module '{0}' utilise 'export =' et ne peut pas être utilisé avec 'export *'.", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "Le module '{0}' a été résolu en tant que module ambiant déclaré dans '{1}', car ce fichier n'a pas été modifié.", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "Le module '{0}' a été résolu en tant que module ambiant déclaré localement dans le fichier '{1}'.", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "Le module '{0}' a été résolu en '{1}' mais '--allowJs' n'est pas défini.", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "Le module '{0}' a été résolu en '{1}' mais '--jsx' n'est pas défini.", "Module_Resolution_Options_6174": "Options de résolution du module", "Module_name_0_matched_pattern_1_6092": "Nom de module '{0}', modèle correspondant '{1}'.", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "Les objets 'arguments' ne peuvent pas être référencés dans une fonction ou méthode async en ES3 et ES5. Utilisez une fonction ou méthode standard.", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "Le corps d'une instruction 'if' ne peut pas être l'instruction vide.", "The_character_set_of_the_input_files_6163": "Jeu de caractères des fichiers d'entrée.", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "Le fichier config '{0}' trouvé ne contient pas de fichiers sources.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Le corps de la fonction ou du module conteneur est trop grand pour l'analyse du flux de contrôle.", "The_current_host_does_not_support_the_0_option_5001": "L'hôte actuel ne prend pas en charge l'option '{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.", + "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "L'expression d'une assignation d'exportation doit être un identificateur ou un nom qualifié dans un contexte ambiant.", "The_files_list_in_config_file_0_is_empty_18002": "La liste 'files' du fichier config '{0}' est vide.", "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060": "Le premier paramètre de la méthode 'then' d'une promesse doit être un rappel.", "The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "Le type global 'JSX.{0}' ne peut pas avoir plusieurs propriétés.", diff --git a/lib/ita/diagnosticMessages.generated.json b/lib/ita/diagnosticMessages.generated.json index b75ba21fb52..f3a0f9c0a0d 100644 --- a/lib/ita/diagnosticMessages.generated.json +++ b/lib/ita/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "Dichiarare il metodo '{0}'.", "Declare_property_0_90016": "Dichiarare la proprietà '{0}'.", "Declare_static_method_0_90024": "Dichiarare il metodo statico '{0}'.", + "Declare_static_property_0_90027": "Dichiarare la proprietà statica '{0}'.", "Decorators_are_not_valid_here_1206": "In questo punto le espressioni Decorator non sono valide.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Non è possibile applicare le espressioni Decorator a più funzioni di accesso get/set con lo stesso nome.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "L'esportazione predefinita del modulo contiene o usa il nome privato '{0}'.", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Crea un unico file con i mapping d origine invece di file separati.", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Crea l'origine unitamente alle mappe di origine all'interno di un unico file. Richiede l'impostazione di '--inlineSourceMap' o '--sourceMap'.", "Enable_all_strict_type_checking_options_6180": "Abilita tutte le opzioni per i controlli del tipo strict.", + "Enable_strict_checking_of_function_types_6186": "Abilitare il controllo tassativo dei tipi funzione.", "Enable_strict_null_checks_6113": "Abilita i controlli strict Null.", "Enable_tracing_of_the_name_resolution_process_6085": "Abilita la traccia del processo di risoluzione dei nomi.", "Enables_experimental_support_for_ES7_async_functions_6068": "Abilita il supporto sperimentale per le funzioni asincrone di ES7.", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "L'espressione viene risolta nella dichiarazione di variabile '{0}', che è usata dal compilatore per supportare le funzioni asincrone.", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "L'espressione viene risolta nella dichiarazione di variabile '_newTarget', che è usata dal compilatore per acquisire il riferimento alla metaproprietà 'new.target'.", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "L'espressione viene risolta nella dichiarazione di variabile '_this', che è usata dal compilatore per acquisire il riferimento 'this'.", - "Extract_function_95003": "Estrai funzione", - "Extract_to_0_95004": "Estrai in {0}", + "Extract_constant_95006": "Estrarre la costante", + "Extract_function_95005": "Estrarre la funzione", + "Extract_symbol_95003": "Estrarre il simbolo", + "Extract_to_0_in_1_95004": "Estrarre in {0} in {1}", + "Extract_to_0_in_1_scope_95008": "Estrarre in {0} nell'ambito {1}", + "Extract_to_0_in_enclosing_scope_95007": "Estrarre in {0} nell'ambito che lo contiene", "FILE_6035": "FILE", "FILE_OR_DIRECTORY_6040": "FILE O DIRECTORY", "Failed_to_parse_file_0_Colon_1_5014": "Non è stato possibile analizzare il file '{0}': {1}.", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "Uso non valido di '{0}' in modalità strict.", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "Il valore non è valido per 'jsxFactory'. '{0}' non è un identificatore o un nome qualificato valido.", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "Il valore di '--reactNamespace' non è valido. '{0}' non è un identificatore valido", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "Il tag '@augments {0}' di JSDoc non corrisponde alla clausola 'extends {1}'.", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "Il tag '@augments' di JSDoc non è collegato a una dichiarazione di classe.", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "Il nome del tag '@param' di JSDoc è '{0}', ma non esiste alcun parametro con questo nome.", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "Il tag '@typedef' di JSDoc deve contenere un'annotazione di tipo o essere seguito dal tag '@property' o '@member'.", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "I tipi JSDoc possono essere usati solo nei commenti della documentazione.", "JSX_attribute_expected_17003": "È previsto l'attributo JSX.", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Agli attributi JSX deve essere assegnato solo un elemento 'expression' non vuoto.", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Il modulo '{0}' usa 'export =' e non può essere usato con 'export *'.", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "Il modulo '{0}' è stato risolto come modulo di ambiente dichiarato in '{1}' dal momento che questo file non è stato modificato.", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "Il modulo '{0}' è stato risolto come modulo di ambiente dichiarato in locale nel file '{1}'.", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "Il modulo '{0}' è stato risolto in '{1}', ma '--allowJs' non è impostato.", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "Il modulo '{0}' è stato risolto in '{1}', ma '--jsx' non è impostato.", "Module_Resolution_Options_6174": "Opzioni di risoluzione moduli", "Module_name_0_matched_pattern_1_6092": "Nome del modulo: '{0}'. Criterio corrispondente: '{1}'.", @@ -656,7 +665,7 @@ "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015": "Specifica la versione di destinazione di ECMAScript: 'ES3' (predefinita), 'ES5', 'ES2015', 'ES2016', 'ES2017' o 'ESNEXT'.", "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080": "Specifica la generazione del codice JSX: 'preserve', 'react-native' o 'react'.", "Specify_library_files_to_be_included_in_the_compilation_Colon_6079": "Specifica i file di libreria da includere nella compilazione: ", - "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Specificare il tipo di generazione del codice del modulo: 'none', commonjs', 'amd', 'system', 'umd', 'es2015' o 'ESNext'.", + "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Consente di specificare il tipo di generazione del codice del modulo, ovvero 'none', commonjs', 'amd', 'system', 'umd', 'es2015' o 'ESNext'.", "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069": "Specifica la strategia di risoluzione del modulo: 'node' (Node.js) o 'classic' (TypeScript prima della versione 1.6).", "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146": "Consente di specificare la funzione della factory JSX da usare quando la destinazione è la creazione JSX 'react', ad esempio 'React.createElement' o 'h'.", "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060": "Specifica la sequenza di fine riga da usare per la creazione dei file, ovvero 'CRLF' (in DOS) o 'LF' (in UNIX).", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "Non è possibile fare riferimento all'oggetto 'arguments' in un metodo o una funzione asincrona in ES3 e ES5. Provare a usare un metodo o una funzione standard.", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "Il corpo di un'istruzione 'if' non può essere l'istruzione vuota.", "The_character_set_of_the_input_files_6163": "Set di caratteri dei file di input.", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "Il file config trovato '{0}' non contiene file di origine.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Il corpo del modulo o la funzione che contiene è troppo grande per l'analisi del flusso di controllo.", "The_current_host_does_not_support_the_0_option_5001": "L'host corrente non supporta l'opzione '{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.", + "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "L'espressione di un'assegnazione di esportazione deve essere un identificatore o un nome completo in un contesto di ambiente.", "The_files_list_in_config_file_0_is_empty_18002": "L'elenco 'files' nel file config '{0}' è vuoto.", "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060": "Il primo parametro del metodo 'then' di una promessa deve essere un callback.", "The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "Il tipo globale 'JSX.{0}' non può contenere più di una proprietà.", diff --git a/lib/jpn/diagnosticMessages.generated.json b/lib/jpn/diagnosticMessages.generated.json index 80464d7a262..b6f3e2e6559 100644 --- a/lib/jpn/diagnosticMessages.generated.json +++ b/lib/jpn/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "メソッド '{0}' を宣言します。", "Declare_property_0_90016": "プロパティ '{0}' を宣言します。", "Declare_static_method_0_90024": "静的メソッド '{0}' を宣言します。", + "Declare_static_property_0_90027": "静的プロパティ '{0}' を宣言します。", "Decorators_are_not_valid_here_1206": "デコレーターはここでは無効です。", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "デコレーターを同じ名前の複数の get/set アクセサーに適用することはできません。", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "モジュールの既定エクスポートがプライベート名 '{0}' を使用しています。", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "個々のファイルを持つ代わりに、複数のソース マップを含む単一ファイルを生成します。", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "単一ファイル内で sourcemap と共にソースを生成します。'--inlineSourceMap' または '--sourceMap' を設定する必要があります。", "Enable_all_strict_type_checking_options_6180": "strict 型チェックのオプションをすべて有効にします。", + "Enable_strict_checking_of_function_types_6186": "関数の型の厳密なチェックを有効にします。", "Enable_strict_null_checks_6113": "厳格な null チェックを有効にします。", "Enable_tracing_of_the_name_resolution_process_6085": "名前解決の処理のトレースを有効にします。", "Enables_experimental_support_for_ES7_async_functions_6068": "ES7 非同期関数用の実験的なサポートを有効にします。", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "式は、コンパイラが非同期関数をサポートするために使用する変数宣言 '{0}' に解決されます。", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "式は、コンパイラが 'new.target' メタプロパティの参照をキャプチャするために使用する変数宣言 '_newTarget' に解決されます。", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "式は、コンパイラが 'this' の参照をキャプチャするために使用する変数宣言 '_this' に解決されます。", - "Extract_function_95003": "関数を抽出する", - "Extract_to_0_95004": "{0} への抽出", + "Extract_constant_95006": "定数の抽出", + "Extract_function_95005": "関数の抽出", + "Extract_symbol_95003": "シンボルの抽出", + "Extract_to_0_in_1_95004": "{1} 内の {0} に抽出する", + "Extract_to_0_in_1_scope_95008": "{1} スコープ内の {0} に抽出する", + "Extract_to_0_in_enclosing_scope_95007": "外側のスコープ内の {0} に抽出する", "FILE_6035": "ファイル", "FILE_OR_DIRECTORY_6040": "ファイルまたはディレクトリ", "Failed_to_parse_file_0_Colon_1_5014": "ファイル '{0}' を解析できませんでした。{1}。", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "厳格モードでは '{0}' の使用は無効です。", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "'jsxFactory' の値が無効です。'{0}' が有効な識別子または修飾名ではありません。", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "'--reactNamespace' の値が無効です。'{0}' は有効な識別子ではありません。", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "JSDoc '@augments {0}' は 'extends {1}' 句と一致しません。", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "JSDoc '@augments' はクラス宣言にアタッチされていません。", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "JSDoc '@param' タグの名前は '{0}' ですが、その名前のパラメーターはありません。", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc '@typedef' タグには、型の注釈を指定するか、後に '@property' タグや '@member' タグを付ける必要があります。", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc の種類は、ドキュメント コメント内でのみ使用できます。", "JSX_attribute_expected_17003": "JSX 属性が必要です。", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "JSX 属性は、空ではない '式' にのみ割り当てる必要があります。", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "モジュール '{0}' には 'export =' が使用されているため、'export *' は併用できません。", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "このファイルが変更されなかったため、モジュール '{0}' は '{1}' で宣言されたアンビエント モジュールとして解決されました。", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "モジュール '{0}' は、ファイル '{1}' のローカルで宣言されたアンビエント モジュールとして解決されました。", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "モジュール '{0}' は '{1}' に解決されましたが、'--allowJs' が設定されていません。", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "モジュール '{0}' は '{1}' に解決されましたが、'--jsx' が設定されていません。", "Module_Resolution_Options_6174": "モジュール解決のオプション", "Module_name_0_matched_pattern_1_6092": "モジュール名 '{0}'、照合されたパターン '{1}'。", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "'arguments' オブジェクトは、ES3 および ES5 の非同期関数またはメソッドで参照することはできません。標準の関数またはメソッドを使用することを検討してください。", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "'if' ステートメントの本文を空のステートメントにすることはできません。", "The_character_set_of_the_input_files_6163": "入力ファイルの文字セット。", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "検出された構成ファイル '{0}' にはソース ファイルが含まれていません。", "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.", + "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}' には複数のプロパティが含まれていない可能性があります。", @@ -830,7 +838,7 @@ "Watch_input_files_6005": "入力ファイルを監視します。", "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "標準の TypeScript ライブラリで定義された要素の名前を変更することはできません。", "You_cannot_rename_this_element_8000": "この要素の名前を変更することはできません。", - "_0_are_specified_twice_The_attribute_named_0_will_be_overwritten_2710": "'{0}' are specified twice. The attribute named '{0}' will be overwritten.", + "_0_are_specified_twice_The_attribute_named_0_will_be_overwritten_2710": "'{0}' は 2 回指定されています。'{0}' という名前の属性は上書きされます。", "_0_can_only_be_used_in_a_ts_file_8009": "'{0}' を使用できるのは .ts ファイル内のみです。", "_0_expected_1005": "'{0}' が必要です。", "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023": "'{0}' は、戻り値の型の注釈がなく、いずれかの return 式で直接的にまたは間接的に参照されているため、戻り値の型は暗黙的に 'any' になります。", diff --git a/lib/kor/diagnosticMessages.generated.json b/lib/kor/diagnosticMessages.generated.json index 5a318530410..d1837c5a7fa 100644 --- a/lib/kor/diagnosticMessages.generated.json +++ b/lib/kor/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "'{0}' 메서드를 선언합니다.", "Declare_property_0_90016": "'{0}' 속성을 선언합니다.", "Declare_static_method_0_90024": "'{0}' 정적 메서드를 선언합니다.", + "Declare_static_property_0_90027": "정적 속성 '{0}'을(를) 선언합니다.", "Decorators_are_not_valid_here_1206": "데코레이터는 여기에 사용할 수 없습니다.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "동일한 이름의 여러 get/set 접근자에 데코레이터를 적용할 수 없습니다.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "모듈의 기본 내보내기에서 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "별도의 파일을 사용하는 대신 소스 맵과 함께 단일 파일을 내보냅니다.", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "단일 파일 내에서 소스 맵과 함께 소스를 내보냅니다. '--inlineSourceMap' 또는 '--sourceMap'을 설정해야 합니다.", "Enable_all_strict_type_checking_options_6180": "엄격한 형식 검사 옵션을 모두 사용하도록 설정합니다.", + "Enable_strict_checking_of_function_types_6186": "함수 형식에 대한 엄격한 검사를 사용하도록 설정합니다.", "Enable_strict_null_checks_6113": "엄격한 null 검사를 사용하도록 설정하세요.", "Enable_tracing_of_the_name_resolution_process_6085": "이름 확인 프로세스 추적을 사용하도록 설정하세요.", "Enables_experimental_support_for_ES7_async_functions_6068": "ES7 비동기 함수에 대해 실험적 지원을 사용합니다.", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "컴파일러가 비동기 함수를 지원하기 위해 사용하는 변수 선언 '{0}'(으)로 식이 확인됩니다.", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "컴파일러가 'new.target' 메타 속성 참조를 캡처하기 위해 사용하는 변수 선언 '_newTarget'으로 식이 확인됩니다.", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "컴파일러가 'this' 참조를 캡처하기 위해 사용하는 변수 선언 '_this'로 식이 확인됩니다.", - "Extract_function_95003": "함수 추출", - "Extract_to_0_95004": "{0}(으)로 추출", + "Extract_constant_95006": "상수 추출", + "Extract_function_95005": "함수 추출", + "Extract_symbol_95003": "기호 추출", + "Extract_to_0_in_1_95004": "{1}의 {0}(으)로 추출", + "Extract_to_0_in_1_scope_95008": "{1} 범위의 {0}(으)로 추출", + "Extract_to_0_in_enclosing_scope_95007": "바깥쪽 범위의 {0}(으)로 추출", "FILE_6035": "파일", "FILE_OR_DIRECTORY_6040": "파일 또는 디렉터리", "Failed_to_parse_file_0_Colon_1_5014": "'{0}' 파일 구문 분석 실패: {1}.", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "strict 모드에서 '{0}'을(를) 잘못 사용했습니다.", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "'jsxFactory'에 대한 값이 잘못되었습니다. '{0}'이(가) 올바른 식별자 또는 정규화된 이름이 아닙니다.", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "'--reactNamespace'의 값이 잘못되었습니다. '{0}'은(는) 올바른 식별자가 아닙니다.", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "JSDoc '@augments {0}'이(가) 'extends {1}' 절과 일치하지 않습니다.", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "JSDoc '@augments'가 클래스 선언에 연결되어 있지 않습니다.", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "JSDoc '@param' 태그의 이름이 '{0}'인데 해당 이름의 매개 변수가 없습니다.", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc '@typedef' 태그는 형식 주석을 포함하거나, '@property' 또는 '@member' 태그 앞에 와야 합니다.", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc 유형은 문서 주석 내에서만 사용될 수 있습니다.", "JSX_attribute_expected_17003": "JSX 특성이 필요합니다.", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "JSX 특성에는 비어 있지 않은 '식'만 할당할 수 있습니다.", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "모듈 '{0}'은(는) 'export ='을 사용하며 'export *'와 함께 사용할 수 없습니다.", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "이 파일은 수정되지 않았으므로 '{0}' 모듈은 '{1}'에서 선언된 앰비언트 모듈로 확인되었습니다.", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "'{0}' 모듈은 '{1}'에서 지역으로 선언된 앰비언트 모듈로 확인되었습니다.", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "모듈 '{0}'이(가) '{1}'(으)로 확인되었지만 '--allowJs'가 설정되지 않았습니다.", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "모듈 '{0}'이(가) '{1}'(으)로 확인되었지만 '--jsx'가 설정되지 않았습니다.", "Module_Resolution_Options_6174": "모듈 확인 옵션", "Module_name_0_matched_pattern_1_6092": "모듈 이름: '{0}', 일치하는 패턴: '{1}'", @@ -656,7 +665,7 @@ "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015": "ECMAScript 대상 버전을 'ES3'(기본값), 'ES5', 'ES2015', 'ES2016', 'ES2017' 또는 'ESNEXT'로 지정합니다.", "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080": "JSX 코드 생성 'preserve', 'react-native' 또는 'react'를 지정합니다.", "Specify_library_files_to_be_included_in_the_compilation_Colon_6079": "컴파일에 포함할 라이브러리 파일 지정: ", - "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "모듈 코드 생성을 'none', commonjs', 'amd', 'system', 'umd', 'es2015' 또는 'ESNext'로 지정합니다.", + "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "모듈 코드 생성을 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015' 또는 'ESNext'로 지정합니다.", "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069": "모듈 확인 전략 지정: 'node'(Node.js) 또는 'classic'(TypeScript 1.6 이전).", "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146": "'react' JSX 내보내기를 대상으로 하는 경우 사용할 JSX 팩터리 함수를 지정합니다(예: 'React.createElement' 또는 'h').", "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060": "파일을 내보낼 때 사용할 줄 시퀀스의 끝 지정: 'CRLF'(dos) 또는 'LF'(unix).", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "'arguments' 개체는 ES3 및 ES5의 비동기 함수 또는 메서드에서 참조할 수 없습니다. 표준 함수 또는 메서드를 사용해 보세요.", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "'if' 문의 본문이 빈 문이면 안 됩니다.", "The_character_set_of_the_input_files_6163": "입력 파일의 문자 집합입니다.", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "찾은 구성 파일 '{0}'에 소스 파일이 없습니다.", "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.", + "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}' 구성 파일의 '파일' 목록이 비어 있습니다.", "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060": "프라미스에서 'then' 메서드의 첫 번째 매개 변수는 콜백이어야 합니다.", "The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "전역 형식 'JSX.{0}'에 속성이 둘 이상 있을 수 없습니다.", diff --git a/lib/lib.d.ts b/lib/lib.d.ts index 788fa2613c7..3d8166be5da 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -8939,6 +8939,7 @@ interface HTMLFormElement extends HTMLElement { * Fires when a FORM is about to be submitted. */ submit(): void; + reportValidity(): boolean; addEventListener(type: K, listener: (this: HTMLFormElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; @@ -9067,9 +9068,6 @@ interface HTMLFrameSetElement extends HTMLElement { onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object receives focus. - */ onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; onoffline: (this: HTMLFrameSetElement, ev: Event) => any; @@ -9214,7 +9212,6 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the user can resize the frame. */ noResize: boolean; - readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. @@ -12311,6 +12308,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte readonly pointerEnabled: boolean; readonly serviceWorker: ServiceWorkerContainer; readonly webdriver: boolean; + readonly doNotTrack: string | null; readonly hardwareConcurrency: number; readonly languages: string[]; getGamepads(): Gamepad[]; @@ -17363,7 +17361,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; + open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; prompt(message?: string, _default?: string): string | null; @@ -18112,7 +18110,7 @@ interface EcKeyAlgorithm extends KeyAlgorithm { typedCurve: string; } -interface EcKeyImportParams { +interface EcKeyImportParams extends Algorithm { namedCurve: string; } @@ -18763,7 +18761,7 @@ declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; declare function prompt(message?: string, _default?: string): string | null; diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index ff734ffd1dc..84a85b499ba 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -4853,6 +4853,7 @@ interface HTMLFormElement extends HTMLElement { * Fires when a FORM is about to be submitted. */ submit(): void; + reportValidity(): boolean; addEventListener(type: K, listener: (this: HTMLFormElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; @@ -4981,9 +4982,6 @@ interface HTMLFrameSetElement extends HTMLElement { onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object receives focus. - */ onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; onoffline: (this: HTMLFrameSetElement, ev: Event) => any; @@ -5128,7 +5126,6 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the user can resize the frame. */ noResize: boolean; - readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. @@ -8225,6 +8222,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte readonly pointerEnabled: boolean; readonly serviceWorker: ServiceWorkerContainer; readonly webdriver: boolean; + readonly doNotTrack: string | null; readonly hardwareConcurrency: number; readonly languages: string[]; getGamepads(): Gamepad[]; @@ -13277,7 +13275,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; + open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; prompt(message?: string, _default?: string): string | null; @@ -14026,7 +14024,7 @@ interface EcKeyAlgorithm extends KeyAlgorithm { typedCurve: string; } -interface EcKeyImportParams { +interface EcKeyImportParams extends Algorithm { namedCurve: string; } @@ -14677,7 +14675,7 @@ declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; declare function prompt(message?: string, _default?: string): string | null; diff --git a/lib/lib.es2016.full.d.ts b/lib/lib.es2016.full.d.ts index 84f127028d1..c2b26749980 100644 --- a/lib/lib.es2016.full.d.ts +++ b/lib/lib.es2016.full.d.ts @@ -4856,6 +4856,7 @@ interface HTMLFormElement extends HTMLElement { * Fires when a FORM is about to be submitted. */ submit(): void; + reportValidity(): boolean; addEventListener(type: K, listener: (this: HTMLFormElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; @@ -4984,9 +4985,6 @@ interface HTMLFrameSetElement extends HTMLElement { onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object receives focus. - */ onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; onoffline: (this: HTMLFrameSetElement, ev: Event) => any; @@ -5131,7 +5129,6 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the user can resize the frame. */ noResize: boolean; - readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. @@ -8228,6 +8225,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte readonly pointerEnabled: boolean; readonly serviceWorker: ServiceWorkerContainer; readonly webdriver: boolean; + readonly doNotTrack: string | null; readonly hardwareConcurrency: number; readonly languages: string[]; getGamepads(): Gamepad[]; @@ -13280,7 +13278,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; + open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; prompt(message?: string, _default?: string): string | null; @@ -14029,7 +14027,7 @@ interface EcKeyAlgorithm extends KeyAlgorithm { typedCurve: string; } -interface EcKeyImportParams { +interface EcKeyImportParams extends Algorithm { namedCurve: string; } @@ -14680,7 +14678,7 @@ declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; declare function prompt(message?: string, _default?: string): string | null; diff --git a/lib/lib.es2017.full.d.ts b/lib/lib.es2017.full.d.ts index 1f1064f750a..900947f84a7 100644 --- a/lib/lib.es2017.full.d.ts +++ b/lib/lib.es2017.full.d.ts @@ -4860,6 +4860,7 @@ interface HTMLFormElement extends HTMLElement { * Fires when a FORM is about to be submitted. */ submit(): void; + reportValidity(): boolean; addEventListener(type: K, listener: (this: HTMLFormElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; @@ -4988,9 +4989,6 @@ interface HTMLFrameSetElement extends HTMLElement { onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object receives focus. - */ onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; onoffline: (this: HTMLFrameSetElement, ev: Event) => any; @@ -5135,7 +5133,6 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the user can resize the frame. */ noResize: boolean; - readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. @@ -8232,6 +8229,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte readonly pointerEnabled: boolean; readonly serviceWorker: ServiceWorkerContainer; readonly webdriver: boolean; + readonly doNotTrack: string | null; readonly hardwareConcurrency: number; readonly languages: string[]; getGamepads(): Gamepad[]; @@ -13284,7 +13282,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; + open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; prompt(message?: string, _default?: string): string | null; @@ -14033,7 +14031,7 @@ interface EcKeyAlgorithm extends KeyAlgorithm { typedCurve: string; } -interface EcKeyImportParams { +interface EcKeyImportParams extends Algorithm { namedCurve: string; } @@ -14684,7 +14682,7 @@ declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; declare function prompt(message?: string, _default?: string): string | null; diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index ccd9acef948..61a12dece0d 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -10626,6 +10626,7 @@ interface HTMLFormElement extends HTMLElement { * Fires when a FORM is about to be submitted. */ submit(): void; + reportValidity(): boolean; addEventListener(type: K, listener: (this: HTMLFormElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; @@ -10754,9 +10755,6 @@ interface HTMLFrameSetElement extends HTMLElement { onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object receives focus. - */ onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; onoffline: (this: HTMLFrameSetElement, ev: Event) => any; @@ -10901,7 +10899,6 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the user can resize the frame. */ noResize: boolean; - readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. @@ -13998,6 +13995,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte readonly pointerEnabled: boolean; readonly serviceWorker: ServiceWorkerContainer; readonly webdriver: boolean; + readonly doNotTrack: string | null; readonly hardwareConcurrency: number; readonly languages: string[]; getGamepads(): Gamepad[]; @@ -19050,7 +19048,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; + open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; prompt(message?: string, _default?: string): string | null; @@ -19799,7 +19797,7 @@ interface EcKeyAlgorithm extends KeyAlgorithm { typedCurve: string; } -interface EcKeyImportParams { +interface EcKeyImportParams extends Algorithm { namedCurve: string; } @@ -20450,7 +20448,7 @@ declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; declare function prompt(message?: string, _default?: string): string | null; diff --git a/lib/lib.esnext.full.d.ts b/lib/lib.esnext.full.d.ts index 851de8100ab..5149739ec18 100644 --- a/lib/lib.esnext.full.d.ts +++ b/lib/lib.esnext.full.d.ts @@ -4857,6 +4857,7 @@ interface HTMLFormElement extends HTMLElement { * Fires when a FORM is about to be submitted. */ submit(): void; + reportValidity(): boolean; addEventListener(type: K, listener: (this: HTMLFormElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; @@ -4985,9 +4986,6 @@ interface HTMLFrameSetElement extends HTMLElement { onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object receives focus. - */ onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; onoffline: (this: HTMLFrameSetElement, ev: Event) => any; @@ -5132,7 +5130,6 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the user can resize the frame. */ noResize: boolean; - readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. @@ -8229,6 +8226,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte readonly pointerEnabled: boolean; readonly serviceWorker: ServiceWorkerContainer; readonly webdriver: boolean; + readonly doNotTrack: string | null; readonly hardwareConcurrency: number; readonly languages: string[]; getGamepads(): Gamepad[]; @@ -13281,7 +13279,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; + open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; prompt(message?: string, _default?: string): string | null; @@ -14030,7 +14028,7 @@ interface EcKeyAlgorithm extends KeyAlgorithm { typedCurve: string; } -interface EcKeyImportParams { +interface EcKeyImportParams extends Algorithm { namedCurve: string; } @@ -14681,7 +14679,7 @@ declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window | null; declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; declare function prompt(message?: string, _default?: string): string | null; diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index f87d32110a6..62145f39fdf 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -1662,7 +1662,7 @@ interface EcKeyAlgorithm extends KeyAlgorithm { typedCurve: string; } -interface EcKeyImportParams { +interface EcKeyImportParams extends Algorithm { namedCurve: string; } diff --git a/lib/plk/diagnosticMessages.generated.json b/lib/plk/diagnosticMessages.generated.json index 6d247b6ecab..eea1271578f 100644 --- a/lib/plk/diagnosticMessages.generated.json +++ b/lib/plk/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "Zadeklaruj metodę „{0}”.", "Declare_property_0_90016": "Zadeklaruj właściwość „{0}”.", "Declare_static_method_0_90024": "Zadeklaruj metodę statyczną „{0}”.", + "Declare_static_property_0_90027": "Zadeklaruj właściwość statyczną „{0}”.", "Decorators_are_not_valid_here_1206": "Elementy Decorator nie są tutaj prawidłowe.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Nie można stosować elementów Decorator do wielu metod dostępu pobierania/ustawiania o takiej samej nazwie.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Domyślny eksport modułu ma nazwę prywatną „{0}” lub używa tej nazwy.", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Emituj pojedynczy plik z mapami źródeł zamiast oddzielnego pliku.", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Emituj źródło razem z mapami źródłowymi w pojedynczym pliku; wymaga ustawienia opcji „--inlineSourceMap” lub „--sourceMap”.", "Enable_all_strict_type_checking_options_6180": "Włącz wszystkie opcje ścisłego sprawdzania typów.", + "Enable_strict_checking_of_function_types_6186": "Włącz dokładne sprawdzanie typów funkcji.", "Enable_strict_null_checks_6113": "Włącz dokładne sprawdzanie wartości null.", "Enable_tracing_of_the_name_resolution_process_6085": "Włącz śledzenie procesu rozpoznawania nazw.", "Enables_experimental_support_for_ES7_async_functions_6068": "Umożliwia obsługę eksperymentalną funkcji asynchronicznych języka ES7.", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "Wynikiem rozpoznania wyrażenia jest deklaracja zmiennej „{0}” używana przez kompilator do obsługi funkcji asynchronicznych.", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "Wynikiem rozpoznania wyrażenia jest deklaracja zmiennej „_newTarget” używana przez kompilator do przechwytywania odwołania do metawłaściwości „new.target”.", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "Wynikiem rozpoznania wyrażenia jest deklaracja zmiennej „_this” używana przez kompilator do przechwycenia odwołania do elementu „this”.", - "Extract_function_95003": "Wyodrębnij funkcję", - "Extract_to_0_95004": "Wyodrębnij do: {0}", + "Extract_constant_95006": "Wyodrębnij stałą", + "Extract_function_95005": "Wyodrębnij funkcję", + "Extract_symbol_95003": "Wyodrębnij symbol", + "Extract_to_0_in_1_95004": "Wyodrębnij do {0} w {1}", + "Extract_to_0_in_1_scope_95008": "Wyodrębnij do {0} w zakresie {1}", + "Extract_to_0_in_enclosing_scope_95007": "Wyodrębnij do {0} w zakresie otaczającym", "FILE_6035": "PLIK", "FILE_OR_DIRECTORY_6040": "PLIK LUB KATALOG", "Failed_to_parse_file_0_Colon_1_5014": "Nie można przeanalizować pliku „{0}”: {1}.", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "Nieprawidłowe użycie elementu „{0}” w trybie z ograniczeniami.", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "Nieprawidłowa wartość elementu „jsxFactory”. „{0}” to nie jest prawidłowy identyfikator ani kwalifikowana nazwa.", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "Nieprawidłowa wartość opcji „--reactNamespace”. Element „{0}” nie jest prawidłowym identyfikatorem.", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "Element JSDoc „@augments {0}” jest niezgodny z klauzulą „extends {1}”.", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "Element JSDoc „@augments” nie został dołączony do deklaracji klasy.", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "Tag JSDoc „@param” tag ma nazwę „{0}”, ale nie ma parametru o tej nazwie.", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "Tag JSDoc „@typedef” powinien mieć adnotację typu albo powinien następować po nim tag „@property” lub „@member”.", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Typy JSDoc mogą być używane wyłącznie w komentarzach dokumentacji.", "JSX_attribute_expected_17003": "Oczekiwano atrybutu JSX.", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Atrybuty JSX muszą mieć przypisane wyrażenie, które nie jest puste.", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Moduł „{0}” używa elementu „export =” i nie może być używany z elementem „export *”.", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "Moduł „{0}” został rozpoznany jako otaczający moduł zadeklarowany w elemencie „{1}”, ponieważ nie zmodyfikowano tego pliku.", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "Moduł „{0}” został rozpoznany jako otaczający moduł zadeklarowany lokalnie w pliku „{1}”.", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "Moduł „{0}” został rozpoznany jako „{1}”, ale nie jest ustawiona opcja „--allowJs”.", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "Moduł „{0}” został rozpoznany jako „{1}”, ale nie jest ustawiona opcja „--jsx”.", "Module_Resolution_Options_6174": "Opcje rozpoznawania modułu", "Module_name_0_matched_pattern_1_6092": "Nazwa modułu: „{0}”, dopasowany wzorzec: „{1}”.", @@ -656,7 +665,7 @@ "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015": "Podaj wersję docelową języka ECMAScript: „ES3” (domyślna), „ES5”, „ES2015”, „ES2016”, „ES2017” lub „ESNEXT”.", "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080": "Wybierz sposób generowania kodu JSX: „preserve”, „react-native” lub „react”.", "Specify_library_files_to_be_included_in_the_compilation_Colon_6079": "Określ pliki biblioteki do uwzględnienia w kompilacji: ", - "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Wybierz sposób generowania kodu modułu: „none”, „commonjs”, „amd”, „system”, „umd”, „es2015” lub „ESNext”.", + "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Określ sposób generowania kodu modułu: „none”, „commonjs”, „amd”, „system”, „umd”, „es2015” lub „ESNext”.", "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069": "Określ strategię rozpoznawania modułów: „node” (Node.js) lub „classic” (TypeScript w wersji wcześniejszej niż 1.6).", "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146": "Określ funkcję fabryki JSX do użycia, gdy elementem docelowym jest emisja elementu JSX „react”, np. „React.createElement” lub „h”.", "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060": "Określ sekwencję końca wiersza, która ma być używana podczas emitowania plików: „CRLF” (dos) lub „LF” (unix).", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "Obiekt „arguments” nie może być przywoływany w asynchronicznej funkcji lub metodzie w języku ES3 i ES5. Rozważ użycie standardowej funkcji lub metody.", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "Treść instrukcji „if” nie może być pustą instrukcją.", "The_character_set_of_the_input_files_6163": "Zestaw znaków plików wejściowych.", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "Znaleziony plik konfiguracji „{0}” nie zawiera żadnych plików źródłowych.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Treść zawierającej funkcji lub modułu jest za duża do analizy przepływu sterowania.", "The_current_host_does_not_support_the_0_option_5001": "Bieżący host nie obsługuje opcji „{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.", + "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "Wyrażenie przypisania eksportu musi być identyfikatorem lub kwalifikowaną nazwą w otaczającym kontekście.", "The_files_list_in_config_file_0_is_empty_18002": "Lista „files” w pliku konfiguracji „{0}” jest pusta.", "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060": "Pierwszym parametrem metody „then” obietnicy musi być wywołanie zwrotne.", "The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "Dla typu globalnego „JSX.{0}” nie można określić więcej niż jednej właściwości.", diff --git a/lib/ptb/diagnosticMessages.generated.json b/lib/ptb/diagnosticMessages.generated.json index 7554551ca9f..0336fa640b8 100644 --- a/lib/ptb/diagnosticMessages.generated.json +++ b/lib/ptb/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "Declare o método '{0}'.", "Declare_property_0_90016": "Declare a propriedade '{0}'.", "Declare_static_method_0_90024": "Declare o método estático '{0}'.", + "Declare_static_property_0_90027": "Declare a propriedade estática \"{0}\".", "Decorators_are_not_valid_here_1206": "Os decoradores não são válidos aqui.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Os decoradores não podem ser aplicados a vários acessadores get/set de mesmo nome.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "A exportação padrão do módulo tem ou está usando o nome particular '{0}'.", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Emitir um arquivo único com os mapas de origem em vez de arquivos separados.", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Emitir a origem ao lado dos sourcemaps em um arquivo único; a definição requer '--inlineSourceMap' ou '--sourceMap'.", "Enable_all_strict_type_checking_options_6180": "Habilitar todas as opções estritas de verificação de tipo.", + "Enable_strict_checking_of_function_types_6186": "Habilitar verificação estrita de tipos de função.", "Enable_strict_null_checks_6113": "Habilite verificações nulas estritas.", "Enable_tracing_of_the_name_resolution_process_6085": "Habilite o rastreio do processo de resolução de nome.", "Enables_experimental_support_for_ES7_async_functions_6068": "Habilita o suporte experimental para funções assíncronas de ES7.", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "A expressão é resolvida como uma declaração de variável '{0}' que o compilador usa para dar suporte a funções assíncronas.", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "A expressão é resolvida para a declaração de variável '_newTarget' que o compilador usa para capturar a referência de metapropriedade 'new.target'.", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "A expressão é resolvida como a declaração de variável '_this' que o compilador utiliza para capturar a referência 'this'.", - "Extract_function_95003": "Extrair função", - "Extract_to_0_95004": "Extrair em {0}", + "Extract_constant_95006": "Extrair constante", + "Extract_function_95005": "Extrair função", + "Extract_symbol_95003": "Extrair símbolo", + "Extract_to_0_in_1_95004": "Extrair para {0} em {1}", + "Extract_to_0_in_1_scope_95008": "Extrair para {0} no escopo {1}", + "Extract_to_0_in_enclosing_scope_95007": "Extrair para {0} no escopo de delimitação", "FILE_6035": "ARQUIVO", "FILE_OR_DIRECTORY_6040": "ARQUIVO OU DIRETÓRIO", "Failed_to_parse_file_0_Colon_1_5014": "Falha ao analisar arquivo '{0}': {1}.", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "Uso inválido de '{0}' no modo estrito.", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "Valor inválido para 'jsxFactory'. '{0}' não é um identificador válido ou nome qualificado.", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "Valor inválido para '--reactNamespace'. '{0}' não é um identificador válido.", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "JSDoc \"@augments {0}\" não corresponde à cláusula \"extends {1}\".", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "JSDoc \"@augments\" não está anexado à declaração de classe.", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "A marcação do JSDoc \"@param\" tem o nome \"{0}\", mas não há nenhum parâmetro com esse nome.", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "A marca JSDoc \"@typedef\" deve ter uma anotação de tipo ou ser seguida pelas marcas \"@property\" or \"@member\".", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Os tipos de JSDoc podem ser usados somente dentro dos comentários de documentação.", "JSX_attribute_expected_17003": "Atributo JSX esperado.", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Os atributos JSX só devem ser atribuídos a 'expressões' que não estejam vazias.", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "O módulo '{0}' usa 'export =' e não pode ser usado com 'export *'.", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "O módulo '{0}' foi resolvido como um módulo de ambiente declarado em '{1}', já que este arquivo não foi modificado.", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "O módulo '{0}' foi resolvido como módulo de ambiente declarado localmente no arquivo '{1}'.", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "O módulo '{0}' foi resolvido para '{1}', mas '--allowJs' não está configurado.", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "O módulo '{0}' foi resolvido para '{1}', mas '--jsx' não está configurado.", "Module_Resolution_Options_6174": "Opções da Resolução de Módulo", "Module_name_0_matched_pattern_1_6092": "Nome do módulo '{0}', padrão correspondido '{1}'.", @@ -656,7 +665,7 @@ "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015": "Especifique a versão de destino do ECMAScript: 'ES3' (padrão), 'ES5', 'ES2015', 'ES2016', 'ES2017' ou 'ESNEXT'.", "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080": "Especifique a geração de código JSX: 'preserve', 'react-native' ou 'react'.", "Specify_library_files_to_be_included_in_the_compilation_Colon_6079": "Especifique os arquivos de biblioteca a serem incluídos na compilação: ", - "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Especifique a geração de código de módulo: 'none', commonjs', 'amd', 'system', 'umd', 'es2015' ou 'ESNext'.", + "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Especifique a geração de código de módulo: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015' ou 'ESNext'.", "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069": "Especifique a estratégia de resolução de módulo: 'node' (Node.js) ou 'classic' (TypeScript pré-1.6).", "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146": "Especifique a função de fábrica JSX a ser usada ao direcionar a emissão 'react' do JSX, por ex., 'React.createElement' ou 'h'.", "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060": "Especifique o fim da sequência de linha a ser usado ao emitir arquivos: 'CRLF' (dos) ou 'LF' (unix).", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "O objeto 'arguments' não pode ser referenciado em uma função assíncrona ou o método no ES3 e ES5. Considere usar uma função ou um método padrão.", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "O corpo de uma instrução 'if' não pode ser uma instrução vazia.", "The_character_set_of_the_input_files_6163": "O conjunto de caracteres dos arquivos de entrada.", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "O arquivo de configuração '{0}' encontrado não contém nenhum arquivo de origem.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "O corpo da função ou do módulo contido é muito grande para a análise de fluxo de controle.", "The_current_host_does_not_support_the_0_option_5001": "O host atual não dá suporte à opção '{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.", + "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "A expressão de uma atribuição de exportação deve ser um identificador ou nome qualificado em um contexto de ambiente.", "The_files_list_in_config_file_0_is_empty_18002": "A lista de 'arquivos' no arquivo de configuração '{0}' está vazia.", "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060": "O primeiro parâmetro do método 'then' de uma promessa deve ser um retorno de chamada.", "The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "O tipo global 'JSX.{0}' não pode ter mais de uma propriedade.", diff --git a/lib/rus/diagnosticMessages.generated.json b/lib/rus/diagnosticMessages.generated.json index bc563f95315..5da79e4c3ff 100644 --- a/lib/rus/diagnosticMessages.generated.json +++ b/lib/rus/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "Объявите метод \"{0}\".", "Declare_property_0_90016": "Объявите свойство \"{0}\".", "Declare_static_method_0_90024": "Объявите статический метод \"{0}\".", + "Declare_static_property_0_90027": "Объявление статического свойства \"{0}\".", "Decorators_are_not_valid_here_1206": "Декораторы здесь недопустимы.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Декораторы нельзя применять к множественным методам доступа get или set с совпадающим именем.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Экспорт модуля по умолчанию использует или имеет закрытое имя \"{0}\".", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Порождать один файл с сопоставлениями источников, а не создавать отдельный файл.", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Порождать источник вместе с sourcemap в одном файле (нужно задать параметр --inlineSourceMap или --sourceMap).", "Enable_all_strict_type_checking_options_6180": "Включить все параметры строгой проверки типов.", + "Enable_strict_checking_of_function_types_6186": "Включение строгой проверки типов функций.", "Enable_strict_null_checks_6113": "Включить строгие проверки NULL.", "Enable_tracing_of_the_name_resolution_process_6085": "Включить трассировку процесса разрешения имен.", "Enables_experimental_support_for_ES7_async_functions_6068": "Включает экспериментальную поддержку для асинхронных функций ES7.", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "Разрешение выражения дает объявление переменной \"{0}\", которое используется компилятором для поддержки асинхронных функций.", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "Выражение разрешается в объявление переменной \"_newTarget\", которое компилятор использует для получения ссылки на метасвойство \"new.target\".", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "Разрешение выражения дает объявление переменной \"_this\", которое используется компилятором для получения ссылки this.", - "Extract_function_95003": "Извлечь функцию", - "Extract_to_0_95004": "Извлечь в {0}", + "Extract_constant_95006": "Извлечь константу", + "Extract_function_95005": "Извлечь функцию", + "Extract_symbol_95003": "Извлечь символ", + "Extract_to_0_in_1_95004": "Извлечь в {0} в {1}", + "Extract_to_0_in_1_scope_95008": "Извлечь в {0} в области {1}", + "Extract_to_0_in_enclosing_scope_95007": "Извлечь в {0} во включающей области", "FILE_6035": "ФАЙЛ", "FILE_OR_DIRECTORY_6040": "Файл или каталог", "Failed_to_parse_file_0_Colon_1_5014": "Не удалось проанализировать файл \"{0}\": {1}.", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "Недопустимое использование \"{0}\" в строгом режиме.", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "Недопустимое значение для jsxFactory. \"{0}\" не является допустимым идентификатором или полным именем.", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "Недопустимое значение для \"--reactNamespace\". \"{0}\" не является допустимым идентификатором.", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "Параметр \"@augments {0}\" JSDoc не соответствует предложению \"extends {1}\".", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "Параметр \"@augments\" JSDoc не связан с объявлением класса.", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "У тега \"@param\" JSDoc есть имя \"{0}\", но параметр с таким именем отсутствует.", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "У тега \"@typedef\" JSDoc должна быть аннотация типа, или после него должны стоять теги \"@property\" или \"@member\".", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Типы JSDoc можно использовать только в комментариях в документации.", "JSX_attribute_expected_17003": "Ожидался атрибут JSX.", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Атрибутам JSX должно назначаться только непустое \"expression\".", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Модуль \"{0}\" использует параметр \"export =\" и не может использоваться с параметром \"export *\".", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "Модуль \"{0}\" был разрешен в окружающий модуль, объявленный в \"{1}\", так как этот файл не был изменен.", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "Модуль \"{0}\" был разрешен как локально объявленный окружающий модуль в файле \"{1}\".", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "Модуль \"{0}\" был разрешен как \"{1}\", но параметр \"--allowJs\" не задан.", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "Модуль \"{0}\" был разрешен как \"{1}\", но параметр \"--jsx\" не задан.", "Module_Resolution_Options_6174": "Параметры разрешения модулей", "Module_name_0_matched_pattern_1_6092": "Имя модуля \"{0}\", соответствующий шаблон \"{1}\".", @@ -656,7 +665,7 @@ "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015": "Укажите целевую версию ECMAScript: \"ES3\" (по умолчанию), \"ES5\", \"ES2015\", \"ES2016\", \"ES2017\" или \"ESNEXT\".", "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080": "Укажите вариант создания кода JSX: \"preserve\", \"react-native\" или \"react\".", "Specify_library_files_to_be_included_in_the_compilation_Colon_6079": "Укажите файлы библиотеки для включения в компиляцию: ", - "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Укажите вариант создания кода модуля: \"none\", commonjs\", \"amd\", \"system\", \"umd\", \"es2015\" или \"ESNext\".", + "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Укажите вариант создания кода модуля: \"none\", \"commonjs\", \"amd\", \"system\", \"umd\", \"es2015\", или \"ESNext\".", "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069": "Укажите стратегию разрешения модуля: node (Node.js) или classic (TypeScript pre-1.6).", "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146": "Укажите функцию фабрики JSX, используемую при нацеливании на вывод JSX \"react\", например \"React.createElement\" или \"h\".", "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060": "Укажите окончание последовательности строки для использования при порождении файлов: CRLF (DOS) или LF (UNIX).", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "На объект arguments невозможно указать ссылку в асинхронной функции или методе в ES3 и ES5. Попробуйте использовать стандартную функцию или метод.", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "Текст оператора if не может быть пустым.", "The_character_set_of_the_input_files_6163": "Кодировка входных файлов.", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "Найденный файл конфигурации \"{0}\" не содержит исходных файлов.", "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.", + "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}\" не может иметь больше одного свойства.", diff --git a/lib/trk/diagnosticMessages.generated.json b/lib/trk/diagnosticMessages.generated.json index 02fcf23073c..749cc944206 100644 --- a/lib/trk/diagnosticMessages.generated.json +++ b/lib/trk/diagnosticMessages.generated.json @@ -246,6 +246,7 @@ "Declare_method_0_90023": "'{0}' metodunu bildirin.", "Declare_property_0_90016": "'{0}' özelliğini bildirin.", "Declare_static_method_0_90024": "'{0}' statik metodunu bildirin.", + "Declare_static_property_0_90027": "'{0}' statik özelliğini bildirin.", "Decorators_are_not_valid_here_1206": "Buradaki dekoratörler geçerli değil.", "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Dekoratörler aynı ada sahip birden fazla get/set erişimcisine uygulanamaz.", "Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Modülün varsayılan dışarı aktarımı '{0}' özel adına sahip veya bu adı kullanıyor.", @@ -293,6 +294,7 @@ "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Ayrı bir dosya oluşturmak yerine, kaynak eşlemeleri içeren tek bir dosya gösterin.", "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Kaynağı, kaynak eşlemeleri ile birlikte tek bir dosya içinde gösterin; '--inlineSourceMap' veya '--sourceMap' öğesinin ayarlanmasını gerektirir.", "Enable_all_strict_type_checking_options_6180": "Tüm katı tür denetleme seçeneklerini etkinleştirin.", + "Enable_strict_checking_of_function_types_6186": "İşlev türleri üzerinde katı denetimi etkinleştirin.", "Enable_strict_null_checks_6113": "Katı null denetimlerini etkinleştir.", "Enable_tracing_of_the_name_resolution_process_6085": "Ad çözümleme işlemini izlemeyi etkinleştir.", "Enables_experimental_support_for_ES7_async_functions_6068": "Zaman uyumsuz ES7 işlevleri için deneysel desteği etkinleştirir.", @@ -333,8 +335,12 @@ "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521": "İfade, derleyicinin zaman uyumsuz işlevleri desteklemek için kullandığı '{0}' değişken bildirimi olarak çözümleniyor.", "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544": "İfade, derleyicinin 'new.target' meta-özellik başvurusu yakalamak için kullandığı '_newTarget' değişken bildirimi olarak çözümleniyor.", "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400": "İfade, derleyicinin 'this' başvurusunu yakalamak için kullandığı '_this' değişken bildirimi olarak çözümleniyor.", - "Extract_function_95003": "İşlevi ayıkla", - "Extract_to_0_95004": "{0} konumuna ayıkla", + "Extract_constant_95006": "Sabiti ayıkla", + "Extract_function_95005": "İşlevi ayıkla", + "Extract_symbol_95003": "Sembolü ayıkla", + "Extract_to_0_in_1_95004": "{1} içindeki {0} konumuna ayıkla", + "Extract_to_0_in_1_scope_95008": "{1} kapsamındaki {0} konumuna ayıkla", + "Extract_to_0_in_enclosing_scope_95007": "Çevreleyen kapsamdaki {0} konumuna ayıkla", "FILE_6035": "DOSYA", "FILE_OR_DIRECTORY_6040": "DOSYA VEYA DİZİN", "Failed_to_parse_file_0_Colon_1_5014": "'{0}' dosyası ayrıştırılamadı: {1}.", @@ -424,6 +430,10 @@ "Invalid_use_of_0_in_strict_mode_1100": "Katı modda geçersiz '{0}' kullanımı.", "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067": "'jsxFactory' değeri geçersiz. '{0}' geçerli bir tanımlayıcı veya tam ad değil.", "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059": "'--reactNamespace' için geçersiz değer. '{0}' geçerli bir tanımlayıcı değil.", + "JSDoc_augments_0_does_not_match_the_extends_1_clause_8023": "JSDoc '@augments {0}', 'extends {1}' yan tümcesiyle eşleşmiyor.", + "JSDoc_augments_is_not_attached_to_a_class_declaration_8022": "JSDoc '@augments', bir sınıf bildirimine eklenmemiş.", + "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "JSDoc '@param' etiketinin adı '{0}' ancak bu ada sahip bir parametre yok.", + "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc '@typedef' etiketi bir tür ek açıklamasına sahip olmalıdır veya sonrasında '@property' ya da '@member' etiketlerinden biri gelmelidir.", "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc türleri yalnızca belge açıklamalarının içinde kullanılabilir.", "JSX_attribute_expected_17003": "JSX özniteliği bekleniyor.", "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "JSX özniteliklerine yalnızca boş olmayan 'expression' ifadesi atanabilir.", @@ -468,7 +478,6 @@ "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "'{0}' modülü 'export =' kullanıyor ve 'export *' ile birlikte kullanılamaz.", "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145": "'{1}' dosyası değiştirilmediğinden '{0}' modülü, bu dosyada bildirilen çevresel modül olarak çözümlendi.", "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144": "'{0}' modülü, '{1}' dosyasında yerel olarak bildirilmiş çevresel modül olarak çözümlendi.", - "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143": "'{0}' modülü '{1}' olarak çözümlendi ancak '--allowJs' ayarlanmadı.", "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142": "'{0}' modülü '{1}' olarak çözüldü ancak '--jsx' ayarlanmadı.", "Module_Resolution_Options_6174": "Modül Çözünürlüğü Seçenekleri", "Module_name_0_matched_pattern_1_6092": "Modül adı: '{0}', eşleşen desen: '{1}'.", @@ -656,7 +665,7 @@ "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015": "ECMAScript hedef sürümünü belirleyin: 'ES3' (varsayılan), 'ES5', 'ES2015', 'ES2016', 'ES2017' ya da 'ESNEXT'.", "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080": "JSX kod oluşturma seçeneğini belirtin: 'preserve', 'react-native' veya 'react'.", "Specify_library_files_to_be_included_in_the_compilation_Colon_6079": "Derlemeye dahil edilecek kitaplık dosyalarını belirtin: ", - "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Modül kodu oluşturma seçeneğini belirtin: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015' veya 'ESNext'.", + "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016": "Modül kodu oluşturmayı belirtin: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015' veya 'ESNext'.", "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069": "Modül çözümleme stratejisini belirtin: 'Node' (Node.js) veya 'classic' (TypeScript pre-1.6).", "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146": "'React.createElement' veya 'h' gibi 'react' JSX emit hedeflerken kullanılacak JSX fabrika işlevini belirtin.", "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060": "Dosyalar gösterilirken kullanılacak satır sonu dizisini belirtin: 'CRLF' (dos) veya 'LF' (unix).", @@ -691,10 +700,9 @@ "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522": "ES3 ve ES5'te 'arguments' nesnesine zaman uyumsuz bir işlev veya metot içinde başvurulamaz. Standart bir işlev veya metot kullanmayı düşünün.", "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313": "'if' deyiminin gövdesi boş deyim olamaz.", "The_character_set_of_the_input_files_6163": "Girdi dosyalarının karakter kümesi.", - "The_config_file_0_found_doesn_t_contain_any_source_files_6129": "Bulunan '{0}' yapılandırma dosyasında herhangi bir kaynak dosya yok.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "İçeren işlev veya modül gövdesi, denetim akışı analizi için çok büyük.", "The_current_host_does_not_support_the_0_option_5001": "Mevcut ana bilgisayar '{0}' seçeneğini desteklemiyor.", - "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.", + "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714": "Bir dışarı aktarma ataması ifadesi, çevresel bağlamda bir tanımlayıcı veya tam ad olmalıdır.", "The_files_list_in_config_file_0_is_empty_18002": "'{0}' yapılandırma dosyasındaki 'dosyalar' listesi boş.", "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060": "Promise'in 'then' metodunun ilk parametresi, bir geri arama parametresi olmalıdır.", "The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "'JSX.{0}' genel türü birden fazla özelliğe sahip olamaz.", diff --git a/lib/tsc.js b/lib/tsc.js index 23c5e182860..3eccc63708f 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -3798,8 +3798,10 @@ var ts; Extract_constant: diag(95006, ts.DiagnosticCategory.Message, "Extract_constant_95006", "Extract constant"), Extract_to_0_in_enclosing_scope: diag(95007, ts.DiagnosticCategory.Message, "Extract_to_0_in_enclosing_scope_95007", "Extract to {0} in enclosing scope"), Extract_to_0_in_1_scope: diag(95008, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_scope_95008", "Extract to {0} in {1} scope"), - Infer_type_of_0_from_usage: diag(95009, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95009", "Infer type of '{0}' from usage."), - Infer_parameter_types_from_usage: diag(95010, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95010", "Infer parameter types from usage."), + Annotate_with_type_from_JSDoc: diag(95009, ts.DiagnosticCategory.Message, "Annotate_with_type_from_JSDoc_95009", "Annotate with type from JSDoc"), + Annotate_with_types_from_JSDoc: diag(95010, ts.DiagnosticCategory.Message, "Annotate_with_types_from_JSDoc_95010", "Annotate with types from JSDoc"), + Infer_type_of_0_from_usage: diag(95011, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95011", "Infer type of '{0}' from usage."), + Infer_parameter_types_from_usage: diag(95012, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95012", "Infer parameter types from usage."), }; })(ts || (ts = {})); var ts; @@ -7685,37 +7687,37 @@ var ts; }; } ts.getAllAccessorDeclarations = getAllAccessorDeclarations; - function getEffectiveTypeAnnotationNode(node) { + function getEffectiveTypeAnnotationNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocType(node); } } ts.getEffectiveTypeAnnotationNode = getEffectiveTypeAnnotationNode; - function getEffectiveReturnTypeNode(node) { + function getEffectiveReturnTypeNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocReturnType(node); } } ts.getEffectiveReturnTypeNode = getEffectiveReturnTypeNode; - function getEffectiveTypeParameterDeclarations(node) { + function getEffectiveTypeParameterDeclarations(node, checkJSDoc) { if (node.typeParameters) { return node.typeParameters; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { var templateTag = ts.getJSDocTemplateTag(node); return templateTag && templateTag.typeParameters; } } ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations; - function getEffectiveSetAccessorTypeAnnotationNode(node) { + function getEffectiveSetAccessorTypeAnnotationNode(node, checkJSDoc) { var parameter = getSetAccessorValueParameter(node); - return parameter && getEffectiveTypeAnnotationNode(parameter); + return parameter && getEffectiveTypeAnnotationNode(parameter, checkJSDoc); } ts.getEffectiveSetAccessorTypeAnnotationNode = getEffectiveSetAccessorTypeAnnotationNode; function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { @@ -9598,7 +9600,14 @@ var ts; || kind === 139 || kind === 95 || kind === 130 - || kind === 201; + || kind === 201 + || kind === 268 + || kind === 269 + || kind === 270 + || kind === 271 + || kind === 272 + || kind === 273 + || kind === 274; } function isTypeNode(node) { return isTypeNodeKind(node.kind); @@ -18710,14 +18719,14 @@ var ts; var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string" ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version } : undefined; - return { packageJsonContent: packageJsonContent, packageId: packageId }; + return { found: true, packageJsonContent: packageJsonContent, packageId: packageId }; } else { if (directoryExists && traceEnabled) { trace(host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } failedLookupLocations.push(packageJsonPath); - return { packageJsonContent: undefined, packageId: undefined }; + return { found: false, packageJsonContent: undefined, packageId: undefined }; } } function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) { @@ -18761,10 +18770,20 @@ var ts; return ts.combinePaths(directory, "package.json"); } function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { - var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; - var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); - var _b = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state), packageJsonContent = _b.packageJsonContent, packageId = _b.packageId; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + var packageJsonContent; + var packageId; + var packageInfo = getPackageJsonInfo(candidate, "", failedLookupLocations, !nodeModulesFolderExists, state); + if (packageInfo.found) { + (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId); + } + else { + var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; + if (rest !== "") { + var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); + packageId = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state).packageId; + } + } var pathAndExtension = loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state, packageJsonContent); return withPackageId(packageId, pathAndExtension); @@ -21512,7 +21531,7 @@ var ts; else if (flags & 16384 && type.symbol.valueDeclaration && type.symbol.valueDeclaration.kind === 199) { - writeAnonymousType(getDeclaredTypeOfClassOrInterface(type.symbol), flags); + writeAnonymousType(type, flags); } else { var outerTypeParameters = type.target.outerTypeParameters; @@ -23503,7 +23522,7 @@ var ts; var propertySymbol = _a[_i]; addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); } - if (getIndexInfoOfType(modifiersType, 0)) { + if (modifiersType.flags & 1 || getIndexInfoOfType(modifiersType, 0)) { addMemberForKeyType(stringType); } } @@ -23535,7 +23554,7 @@ var ts; prop.syntheticLiteralTypeOrigin = t; members.set(propName, prop); } - else if (t.flags & 2) { + else if (t.flags & (1 | 2)) { stringIndexInfo = createIndexInfo(propType, templateReadonly); } } @@ -25630,7 +25649,7 @@ var ts; return instantiateAnonymousType(type, mapper); } function isMappableType(type) { - return type.flags & (16384 | 32768 | 131072 | 524288); + return type.flags & (1 | 16384 | 32768 | 131072 | 524288); } function instantiateAnonymousType(type, mapper) { var result = createObjectType(type.objectFlags | 64, type.symbol); @@ -29431,6 +29450,10 @@ var ts; var funcHasRestParameters = ts.hasRestParameter(func); var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (ts.getThisParameter(func) !== undefined && !contextualSignature.thisParameter) { + ts.Debug.assert(indexOfParameter !== 0); + indexOfParameter -= 1; + } if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } @@ -31910,9 +31933,10 @@ var ts; declaration.kind !== 156 && declaration.kind !== 161 && !ts.isJSDocConstructSignature(declaration)) { - var funcSymbol = node.expression.kind === 71 ? - getResolvedSymbol(node.expression) : - checkExpression(node.expression).symbol; + var funcSymbol = checkExpression(node.expression).symbol; + if (!funcSymbol && node.expression.kind === 71) { + funcSymbol = getResolvedSymbol(node.expression); + } var type = funcSymbol && getJavaScriptClassType(funcSymbol); if (type) { return type; @@ -34133,7 +34157,7 @@ var ts; if (!types) { return undefined; } - return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, true); + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types); } var promisedType = getPromisedTypeOfPromise(type); if (promisedType) { @@ -45372,7 +45396,7 @@ var ts; function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { context.requestEmitHelper(awaiterHelper); var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(39), undefined, undefined, [], undefined, body); - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144; + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 | 524288; return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ ts.createThis(), hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), @@ -48116,7 +48140,8 @@ var ts; } var helperCall = createTemplateObjectHelper(context, ts.createArrayLiteral(cookedStrings), ts.createArrayLiteral(rawStrings)); if (ts.isExternalModule(currentSourceFile)) { - var tempVar = ts.createTempVariable(recordTaggedTemplateString); + var tempVar = ts.createUniqueName("templateObject"); + recordTaggedTemplateString(tempVar); templateArguments[0] = ts.createLogicalOr(tempVar, ts.createAssignment(tempVar, helperCall)); } else { @@ -51164,7 +51189,7 @@ var ts; var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; return ts.isBindingPattern(node.name) ? ts.flattenDestructuringAssignment(node, destructuringAndImportCallVisitor, context, 0, false, createAssignment) - : createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)); + : node.initializer ? createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)) : node.name; } function createExportedVariableAssignment(name, value, location) { return createVariableAssignment(name, value, location, true); @@ -51391,6 +51416,9 @@ var ts; for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; expressions = ts.append(expressions, transformInitializedVariable(variable, false)); + if (!variable.initializer) { + hoistBindingElement(variable); + } } return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); } @@ -54539,6 +54567,8 @@ var ts; return emitTypeReference(node); case 160: return emitFunctionType(node); + case 273: + return emitJSDocFunctionType(node); case 161: return emitConstructorType(node); case 162: @@ -54567,6 +54597,20 @@ var ts; return emitMappedType(node); case 173: return emitLiteralType(node); + case 268: + write("*"); + return; + case 269: + write("?"); + return; + case 270: + return emitJSDocNullableType(node); + case 271: + return emitJSDocNonNullableType(node); + case 272: + return emitJSDocOptionalType(node); + case 274: + return emitJSDocVariadicType(node); case 174: return emitObjectBindingPattern(node); case 175: @@ -54835,9 +54879,16 @@ var ts; emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); emitIfPresent(node.dotDotDotToken); - emit(node.name); + if (node.name) { + emit(node.name); + } emitIfPresent(node.questionToken); - emitWithPrefix(": ", node.type); + if (node.parent && node.parent.kind === 273 && !node.name) { + emit(node.type); + } + else { + emitWithPrefix(": ", node.type); + } emitExpressionWithPrefix(" = ", node.initializer); } function emitDecorator(decorator) { @@ -54933,6 +54984,24 @@ var ts; write(" => "); emit(node.type); } + function emitJSDocFunctionType(node) { + write("function"); + emitParameters(node, node.parameters); + write(":"); + emit(node.type); + } + function emitJSDocNullableType(node) { + write("?"); + emit(node.type); + } + function emitJSDocNonNullableType(node) { + write("!"); + emit(node.type); + } + function emitJSDocOptionalType(node) { + emit(node.type); + write("="); + } function emitConstructorType(node) { write("new "); emitTypeParameters(node, node.typeParameters); @@ -54954,6 +55023,10 @@ var ts; emit(node.elementType); write("[]"); } + function emitJSDocVariadicType(node) { + write("..."); + emit(node.type); + } function emitTupleType(node) { write("["); emitList(node, node.elementTypes, 336); diff --git a/lib/tsserver.js b/lib/tsserver.js index f6e28be89c5..ae65dfcde71 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -4848,8 +4848,10 @@ var ts; Extract_constant: diag(95006, ts.DiagnosticCategory.Message, "Extract_constant_95006", "Extract constant"), Extract_to_0_in_enclosing_scope: diag(95007, ts.DiagnosticCategory.Message, "Extract_to_0_in_enclosing_scope_95007", "Extract to {0} in enclosing scope"), Extract_to_0_in_1_scope: diag(95008, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_scope_95008", "Extract to {0} in {1} scope"), - Infer_type_of_0_from_usage: diag(95009, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95009", "Infer type of '{0}' from usage."), - Infer_parameter_types_from_usage: diag(95010, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95010", "Infer parameter types from usage."), + Annotate_with_type_from_JSDoc: diag(95009, ts.DiagnosticCategory.Message, "Annotate_with_type_from_JSDoc_95009", "Annotate with type from JSDoc"), + Annotate_with_types_from_JSDoc: diag(95010, ts.DiagnosticCategory.Message, "Annotate_with_types_from_JSDoc_95010", "Annotate with types from JSDoc"), + Infer_type_of_0_from_usage: diag(95011, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95011", "Infer type of '{0}' from usage."), + Infer_parameter_types_from_usage: diag(95012, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95012", "Infer parameter types from usage."), }; })(ts || (ts = {})); var ts; @@ -5471,14 +5473,14 @@ var ts; var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string" ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version } : undefined; - return { packageJsonContent: packageJsonContent, packageId: packageId }; + return { found: true, packageJsonContent: packageJsonContent, packageId: packageId }; } else { if (directoryExists && traceEnabled) { trace(host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } failedLookupLocations.push(packageJsonPath); - return { packageJsonContent: undefined, packageId: undefined }; + return { found: false, packageJsonContent: undefined, packageId: undefined }; } } function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) { @@ -5522,10 +5524,20 @@ var ts; return ts.combinePaths(directory, "package.json"); } function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { - var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; - var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); - var _b = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state), packageJsonContent = _b.packageJsonContent, packageId = _b.packageId; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + var packageJsonContent; + var packageId; + var packageInfo = getPackageJsonInfo(candidate, "", failedLookupLocations, !nodeModulesFolderExists, state); + if (packageInfo.found) { + (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId); + } + else { + var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; + if (rest !== "") { + var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); + packageId = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state).packageId; + } + } var pathAndExtension = loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state, packageJsonContent); return withPackageId(packageId, pathAndExtension); @@ -7962,37 +7974,37 @@ var ts; }; } ts.getAllAccessorDeclarations = getAllAccessorDeclarations; - function getEffectiveTypeAnnotationNode(node) { + function getEffectiveTypeAnnotationNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocType(node); } } ts.getEffectiveTypeAnnotationNode = getEffectiveTypeAnnotationNode; - function getEffectiveReturnTypeNode(node) { + function getEffectiveReturnTypeNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocReturnType(node); } } ts.getEffectiveReturnTypeNode = getEffectiveReturnTypeNode; - function getEffectiveTypeParameterDeclarations(node) { + function getEffectiveTypeParameterDeclarations(node, checkJSDoc) { if (node.typeParameters) { return node.typeParameters; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { var templateTag = ts.getJSDocTemplateTag(node); return templateTag && templateTag.typeParameters; } } ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations; - function getEffectiveSetAccessorTypeAnnotationNode(node) { + function getEffectiveSetAccessorTypeAnnotationNode(node, checkJSDoc) { var parameter = getSetAccessorValueParameter(node); - return parameter && getEffectiveTypeAnnotationNode(parameter); + return parameter && getEffectiveTypeAnnotationNode(parameter, checkJSDoc); } ts.getEffectiveSetAccessorTypeAnnotationNode = getEffectiveSetAccessorTypeAnnotationNode; function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { @@ -9881,7 +9893,14 @@ var ts; || kind === 139 || kind === 95 || kind === 130 - || kind === 201; + || kind === 201 + || kind === 268 + || kind === 269 + || kind === 270 + || kind === 271 + || kind === 272 + || kind === 273 + || kind === 274; } function isTypeNode(node) { return isTypeNodeKind(node.kind); @@ -22747,7 +22766,7 @@ var ts; else if (flags & 16384 && type.symbol.valueDeclaration && type.symbol.valueDeclaration.kind === 199) { - writeAnonymousType(getDeclaredTypeOfClassOrInterface(type.symbol), flags); + writeAnonymousType(type, flags); } else { var outerTypeParameters = type.target.outerTypeParameters; @@ -24738,7 +24757,7 @@ var ts; var propertySymbol = _a[_i]; addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); } - if (getIndexInfoOfType(modifiersType, 0)) { + if (modifiersType.flags & 1 || getIndexInfoOfType(modifiersType, 0)) { addMemberForKeyType(stringType); } } @@ -24770,7 +24789,7 @@ var ts; prop.syntheticLiteralTypeOrigin = t; members.set(propName, prop); } - else if (t.flags & 2) { + else if (t.flags & (1 | 2)) { stringIndexInfo = createIndexInfo(propType, templateReadonly); } } @@ -26865,7 +26884,7 @@ var ts; return instantiateAnonymousType(type, mapper); } function isMappableType(type) { - return type.flags & (16384 | 32768 | 131072 | 524288); + return type.flags & (1 | 16384 | 32768 | 131072 | 524288); } function instantiateAnonymousType(type, mapper) { var result = createObjectType(type.objectFlags | 64, type.symbol); @@ -30673,6 +30692,10 @@ var ts; var funcHasRestParameters = ts.hasRestParameter(func); var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (ts.getThisParameter(func) !== undefined && !contextualSignature.thisParameter) { + ts.Debug.assert(indexOfParameter !== 0); + indexOfParameter -= 1; + } if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } @@ -33152,9 +33175,10 @@ var ts; declaration.kind !== 156 && declaration.kind !== 161 && !ts.isJSDocConstructSignature(declaration)) { - var funcSymbol = node.expression.kind === 71 ? - getResolvedSymbol(node.expression) : - checkExpression(node.expression).symbol; + var funcSymbol = checkExpression(node.expression).symbol; + if (!funcSymbol && node.expression.kind === 71) { + funcSymbol = getResolvedSymbol(node.expression); + } var type = funcSymbol && getJavaScriptClassType(funcSymbol); if (type) { return type; @@ -35389,7 +35413,7 @@ var ts; if (!types) { return undefined; } - return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, true); + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types); } var promisedType = getPromisedTypeOfPromise(type); if (promisedType) { @@ -46666,7 +46690,7 @@ var ts; function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { context.requestEmitHelper(awaiterHelper); var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(39), undefined, undefined, [], undefined, body); - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144; + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 | 524288; return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ ts.createThis(), hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), @@ -49483,7 +49507,8 @@ var ts; } var helperCall = createTemplateObjectHelper(context, ts.createArrayLiteral(cookedStrings), ts.createArrayLiteral(rawStrings)); if (ts.isExternalModule(currentSourceFile)) { - var tempVar = ts.createTempVariable(recordTaggedTemplateString); + var tempVar = ts.createUniqueName("templateObject"); + recordTaggedTemplateString(tempVar); templateArguments[0] = ts.createLogicalOr(tempVar, ts.createAssignment(tempVar, helperCall)); } else { @@ -52576,7 +52601,7 @@ var ts; var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; return ts.isBindingPattern(node.name) ? ts.flattenDestructuringAssignment(node, destructuringAndImportCallVisitor, context, 0, false, createAssignment) - : createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)); + : node.initializer ? createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)) : node.name; } function createExportedVariableAssignment(name, value, location) { return createVariableAssignment(name, value, location, true); @@ -52803,6 +52828,9 @@ var ts; for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; expressions = ts.append(expressions, transformInitializedVariable(variable, false)); + if (!variable.initializer) { + hoistBindingElement(variable); + } } return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); } @@ -55963,6 +55991,8 @@ var ts; return emitTypeReference(node); case 160: return emitFunctionType(node); + case 273: + return emitJSDocFunctionType(node); case 161: return emitConstructorType(node); case 162: @@ -55991,6 +56021,20 @@ var ts; return emitMappedType(node); case 173: return emitLiteralType(node); + case 268: + write("*"); + return; + case 269: + write("?"); + return; + case 270: + return emitJSDocNullableType(node); + case 271: + return emitJSDocNonNullableType(node); + case 272: + return emitJSDocOptionalType(node); + case 274: + return emitJSDocVariadicType(node); case 174: return emitObjectBindingPattern(node); case 175: @@ -56259,9 +56303,16 @@ var ts; emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); emitIfPresent(node.dotDotDotToken); - emit(node.name); + if (node.name) { + emit(node.name); + } emitIfPresent(node.questionToken); - emitWithPrefix(": ", node.type); + if (node.parent && node.parent.kind === 273 && !node.name) { + emit(node.type); + } + else { + emitWithPrefix(": ", node.type); + } emitExpressionWithPrefix(" = ", node.initializer); } function emitDecorator(decorator) { @@ -56357,6 +56408,24 @@ var ts; write(" => "); emit(node.type); } + function emitJSDocFunctionType(node) { + write("function"); + emitParameters(node, node.parameters); + write(":"); + emit(node.type); + } + function emitJSDocNullableType(node) { + write("?"); + emit(node.type); + } + function emitJSDocNonNullableType(node) { + write("!"); + emit(node.type); + } + function emitJSDocOptionalType(node) { + emit(node.type); + write("="); + } function emitConstructorType(node) { write("new "); emitTypeParameters(node, node.typeParameters); @@ -56378,6 +56447,10 @@ var ts; emit(node.elementType); write("[]"); } + function emitJSDocVariadicType(node) { + write("..."); + emit(node.type); + } function emitTupleType(node) { write("["); emitList(node, node.elementTypes, 336); @@ -62460,7 +62533,7 @@ var ts; } ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; function positionBelongsToNode(candidate, position, sourceFile) { - return candidate.end > position || !isCompletedNode(candidate, sourceFile); + return position < candidate.end || !isCompletedNode(candidate, sourceFile); } ts.positionBelongsToNode = positionBelongsToNode; function isCompletedNode(n, sourceFile) { @@ -73788,7 +73861,7 @@ var ts; SmartIndenter.getBaseIndentation = getBaseIndentation; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { var parent = current.parent; - var parentStart; + var containingListOrParentStart; while (parent) { var useActualIndentation = true; if (ignoreActualIndentationRange) { @@ -73801,8 +73874,8 @@ var ts; return actualIndentation + indentationDelta; } } - parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || + containingListOrParentStart = getContainingListOrParentStart(parent, current, sourceFile); + var parentAndChildShareLine = containingListOrParentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); @@ -73817,18 +73890,17 @@ var ts; if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { indentationDelta += options.indentSize; } + var useTrueStart = isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, current, currentStart.line, sourceFile); current = parent; - currentStart = parentStart; parent = current.parent; + currentStart = useTrueStart ? sourceFile.getLineAndCharacterOfPosition(current.getStart()) : containingListOrParentStart; } return indentationDelta + getBaseIndentation(options); } - function getParentStart(parent, child, sourceFile) { + function getContainingListOrParentStart(parent, child, sourceFile) { var containingList = getContainingList(child, sourceFile); - if (containingList) { - return sourceFile.getLineAndCharacterOfPosition(containingList.pos); - } - return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); + var startPos = containingList ? containingList.pos : parent.getStart(sourceFile); + return sourceFile.getLineAndCharacterOfPosition(startPos); } function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { var commaItemInfo = ts.findListItemInfo(commaToken); @@ -73870,6 +73942,15 @@ var ts; function getStartLineAndCharacterForNode(n, sourceFile) { return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } + function isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, child, childStartLine, sourceFile) { + if (!(ts.isCallExpression(parent) && ts.contains(parent.arguments, child))) { + return false; + } + var expressionOfCallExpressionEnd = parent.expression.getEnd(); + var expressionOfCallExpressionEndLine = ts.getLineAndCharacterOfPosition(sourceFile, expressionOfCallExpressionEnd).line; + return expressionOfCallExpressionEndLine === childStartLine; + } + SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { if (parent.kind === 211 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 82, sourceFile); @@ -76676,6 +76757,211 @@ var ts; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var refactor; + (function (refactor_2) { + var annotateWithTypeFromJSDoc; + (function (annotateWithTypeFromJSDoc) { + var actionName = "annotate"; + var annotateTypeFromJSDoc = { + name: "Annotate with type from JSDoc", + description: ts.Diagnostics.Annotate_with_type_from_JSDoc.message, + getEditsForAction: getEditsForAnnotation, + getAvailableActions: getAvailableActions + }; + var annotateFunctionFromJSDoc = { + name: "Annotate with types from JSDoc", + description: ts.Diagnostics.Annotate_with_types_from_JSDoc.message, + getEditsForAction: getEditsForFunctionAnnotation, + getAvailableActions: getAvailableActions + }; + refactor_2.registerRefactor(annotateTypeFromJSDoc); + refactor_2.registerRefactor(annotateFunctionFromJSDoc); + function getAvailableActions(context) { + if (ts.isInJavaScriptFile(context.file)) { + return undefined; + } + var node = ts.getTokenAtPosition(context.file, context.startPosition, false); + var decl = ts.findAncestor(node, isDeclarationWithType); + if (!decl || decl.type) { + return undefined; + } + var jsdocType = ts.getJSDocType(decl); + var isFunctionWithJSDoc = ts.isFunctionLikeDeclaration(decl) && (ts.getJSDocReturnType(decl) || decl.parameters.some(function (p) { return !!ts.getJSDocType(p); })); + var refactor = (isFunctionWithJSDoc || jsdocType && decl.kind === 146) ? annotateFunctionFromJSDoc : + jsdocType ? annotateTypeFromJSDoc : + undefined; + if (refactor) { + return [{ + name: refactor.name, + description: refactor.description, + actions: [ + { + description: refactor.description, + name: actionName + } + ] + }]; + } + } + function getEditsForAnnotation(context, action) { + if (actionName !== action) { + return ts.Debug.fail("actionName !== action: " + actionName + " !== " + action); + } + var sourceFile = context.file; + var token = ts.getTokenAtPosition(sourceFile, context.startPosition, false); + var decl = ts.findAncestor(token, isDeclarationWithType); + var jsdocType = ts.getJSDocType(decl); + if (!decl || !jsdocType || decl.type) { + return ts.Debug.fail("!decl || !jsdocType || decl.type: !" + decl + " || !" + jsdocType + " || " + decl.type); + } + var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); + var declarationWithType = addType(decl, transformJSDocType(jsdocType)); + ts.suppressLeadingAndTrailingTrivia(declarationWithType); + changeTracker.replaceRange(sourceFile, { pos: decl.getStart(), end: decl.end }, declarationWithType); + return { + edits: changeTracker.getChanges(), + renameFilename: undefined, + renameLocation: undefined + }; + } + function getEditsForFunctionAnnotation(context, action) { + if (actionName !== action) { + return ts.Debug.fail("actionName !== action: " + actionName + " !== " + action); + } + var sourceFile = context.file; + var token = ts.getTokenAtPosition(sourceFile, context.startPosition, false); + var decl = ts.findAncestor(token, ts.isFunctionLikeDeclaration); + var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); + var functionWithType = addTypesToFunctionLike(decl); + ts.suppressLeadingAndTrailingTrivia(functionWithType); + changeTracker.replaceRange(sourceFile, { pos: decl.getStart(), end: decl.end }, functionWithType); + return { + edits: changeTracker.getChanges(), + renameFilename: undefined, + renameLocation: undefined + }; + } + function isDeclarationWithType(node) { + return ts.isFunctionLikeDeclaration(node) || + node.kind === 226 || + node.kind === 146 || + node.kind === 148 || + node.kind === 149; + } + function addTypesToFunctionLike(decl) { + var typeParameters = ts.getEffectiveTypeParameterDeclarations(decl, true); + var parameters = decl.parameters.map(function (p) { return ts.createParameter(p.decorators, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, transformJSDocType(ts.getEffectiveTypeAnnotationNode(p, true)), p.initializer); }); + var returnType = transformJSDocType(ts.getEffectiveReturnTypeNode(decl, true)); + switch (decl.kind) { + case 228: + return ts.createFunctionDeclaration(decl.decorators, decl.modifiers, decl.asteriskToken, decl.name, typeParameters, parameters, returnType, decl.body); + case 152: + return ts.createConstructor(decl.decorators, decl.modifiers, parameters, decl.body); + case 186: + return ts.createFunctionExpression(decl.modifiers, decl.asteriskToken, decl.name, typeParameters, parameters, returnType, decl.body); + case 187: + return ts.createArrowFunction(decl.modifiers, typeParameters, parameters, returnType, decl.equalsGreaterThanToken, decl.body); + case 151: + return ts.createMethod(decl.decorators, decl.modifiers, decl.asteriskToken, decl.name, decl.questionToken, typeParameters, parameters, returnType, decl.body); + case 153: + return ts.createGetAccessor(decl.decorators, decl.modifiers, decl.name, decl.parameters, returnType, decl.body); + case 154: + return ts.createSetAccessor(decl.decorators, decl.modifiers, decl.name, parameters, decl.body); + default: + return ts.Debug.assertNever(decl, "Unexpected SyntaxKind: " + decl.kind); + } + } + function addType(decl, jsdocType) { + switch (decl.kind) { + case 226: + return ts.createVariableDeclaration(decl.name, jsdocType, decl.initializer); + case 148: + return ts.createPropertySignature(decl.modifiers, decl.name, decl.questionToken, jsdocType, decl.initializer); + case 149: + return ts.createProperty(decl.decorators, decl.modifiers, decl.name, decl.questionToken, jsdocType, decl.initializer); + default: + return ts.Debug.fail("Unexpected SyntaxKind: " + decl.kind); + } + } + function transformJSDocType(node) { + if (node === undefined) { + return undefined; + } + switch (node.kind) { + case 268: + case 269: + return ts.createTypeReferenceNode("any", ts.emptyArray); + case 272: + return transformJSDocOptionalType(node); + case 271: + return transformJSDocType(node.type); + case 270: + return transformJSDocNullableType(node); + case 274: + return transformJSDocVariadicType(node); + case 273: + return transformJSDocFunctionType(node); + case 146: + return transformJSDocParameter(node); + case 159: + return transformJSDocTypeReference(node); + default: + return ts.visitEachChild(node, transformJSDocType, undefined); + } + } + function transformJSDocOptionalType(node) { + return ts.createUnionTypeNode([ts.visitNode(node.type, transformJSDocType), ts.createTypeReferenceNode("undefined", ts.emptyArray)]); + } + function transformJSDocNullableType(node) { + return ts.createUnionTypeNode([ts.visitNode(node.type, transformJSDocType), ts.createTypeReferenceNode("null", ts.emptyArray)]); + } + function transformJSDocVariadicType(node) { + return ts.createArrayTypeNode(ts.visitNode(node.type, transformJSDocType)); + } + function transformJSDocFunctionType(node) { + var parameters = node.parameters && node.parameters.map(transformJSDocType); + return ts.createFunctionTypeNode(ts.emptyArray, parameters, node.type); + } + function transformJSDocParameter(node) { + var index = node.parent.parameters.indexOf(node); + var isRest = node.type.kind === 274 && index === node.parent.parameters.length - 1; + var name = node.name || (isRest ? "rest" : "arg" + index); + var dotdotdot = isRest ? ts.createToken(24) : node.dotDotDotToken; + return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); + } + function transformJSDocTypeReference(node) { + var name = node.typeName; + var args = node.typeArguments; + if (ts.isIdentifier(node.typeName)) { + var text = node.typeName.text; + switch (node.typeName.text) { + case "String": + case "Boolean": + case "Object": + case "Number": + text = text.toLowerCase(); + break; + case "array": + case "date": + case "promise": + text = text[0].toUpperCase() + text.slice(1); + break; + } + name = ts.createIdentifier(text); + if ((text === "Array" || text === "Promise") && !node.typeArguments) { + args = ts.createNodeArray([ts.createTypeReferenceNode("any", ts.emptyArray)]); + } + else { + args = ts.visitNodes(node.typeArguments, transformJSDocType); + } + } + return ts.createTypeReferenceNode(name, args); + } + })(annotateWithTypeFromJSDoc = refactor_2.annotateWithTypeFromJSDoc || (refactor_2.annotateWithTypeFromJSDoc = {})); + })(refactor = ts.refactor || (ts.refactor = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var refactor; (function (refactor) { @@ -76693,14 +76979,14 @@ var ts; if (!ts.isInJavaScriptFile(context.file)) { return undefined; } - var start = context.startPosition; - var node = ts.getTokenAtPosition(context.file, start, false); - var checker = context.program.getTypeChecker(); - var symbol = checker.getSymbolAtLocation(node); - if (symbol && ts.isDeclarationOfFunctionOrClassExpression(symbol)) { + var symbol = getConstructorSymbol(context); + if (!symbol) { + return undefined; + } + if (ts.isDeclarationOfFunctionOrClassExpression(symbol)) { symbol = symbol.valueDeclaration.initializer.symbol; } - if (symbol && (symbol.flags & 16) && symbol.members && (symbol.members.size > 0)) { + if ((symbol.flags & 16) && symbol.members && (symbol.members.size > 0)) { return [ { name: convertFunctionToES6Class.name, @@ -76719,11 +77005,8 @@ var ts; if (actionName !== action) { return undefined; } - var start = context.startPosition; var sourceFile = context.file; - var checker = context.program.getTypeChecker(); - var token = ts.getTokenAtPosition(sourceFile, start, false); - var ctorSymbol = checker.getSymbolAtLocation(token); + var ctorSymbol = getConstructorSymbol(context); var newLine = context.rulesProvider.getFormatOptions().newLineCharacter; var deletedNodes = []; var deletes = []; @@ -76890,6 +77173,12 @@ var ts; return ts.filter(source.modifiers, function (modifier) { return modifier.kind === kind; }); } } + function getConstructorSymbol(_a) { + var startPosition = _a.startPosition, file = _a.file, program = _a.program; + var checker = program.getTypeChecker(); + var token = ts.getTokenAtPosition(file, startPosition, false); + return checker.getSymbolAtLocation(token); + } })(convertFunctionToES6Class = refactor.convertFunctionToES6Class || (refactor.convertFunctionToES6Class = {})); })(refactor = ts.refactor || (ts.refactor = {})); })(ts || (ts = {})); @@ -81857,6 +82146,9 @@ var ts; Project.prototype.getCompilationSettings = function () { return this.compilerOptions; }; + Project.prototype.getCompilerOptions = function () { + return this.getCompilationSettings(); + }; Project.prototype.getNewLine = function () { return this.directoryStructureHost.newLine; }; diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index 151c948602d..e983ac73b15 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -7109,6 +7109,7 @@ declare namespace ts.server { getCachedUnresolvedImportsPerFile_TestOnly(): UnresolvedImportsMap; static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {}; getCompilationSettings(): CompilerOptions; + getCompilerOptions(): CompilerOptions; getNewLine(): string; getProjectVersion(): string; getScriptFileNames(): string[]; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 9983c5e6e64..4454ca3c8a4 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -5386,8 +5386,10 @@ var ts; Extract_constant: diag(95006, ts.DiagnosticCategory.Message, "Extract_constant_95006", "Extract constant"), Extract_to_0_in_enclosing_scope: diag(95007, ts.DiagnosticCategory.Message, "Extract_to_0_in_enclosing_scope_95007", "Extract to {0} in enclosing scope"), Extract_to_0_in_1_scope: diag(95008, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_scope_95008", "Extract to {0} in {1} scope"), - Infer_type_of_0_from_usage: diag(95009, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95009", "Infer type of '{0}' from usage."), - Infer_parameter_types_from_usage: diag(95010, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95010", "Infer parameter types from usage."), + Annotate_with_type_from_JSDoc: diag(95009, ts.DiagnosticCategory.Message, "Annotate_with_type_from_JSDoc_95009", "Annotate with type from JSDoc"), + Annotate_with_types_from_JSDoc: diag(95010, ts.DiagnosticCategory.Message, "Annotate_with_types_from_JSDoc_95010", "Annotate with types from JSDoc"), + Infer_type_of_0_from_usage: diag(95011, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95011", "Infer type of '{0}' from usage."), + Infer_parameter_types_from_usage: diag(95012, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95012", "Infer parameter types from usage."), }; })(ts || (ts = {})); /// @@ -7934,11 +7936,11 @@ var ts; * Gets the effective type annotation of a variable, parameter, or property. If the node was * parsed in a JavaScript file, gets the type annotation from JSDoc. */ - function getEffectiveTypeAnnotationNode(node) { + function getEffectiveTypeAnnotationNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocType(node); } } @@ -7947,11 +7949,11 @@ var ts; * Gets the effective return type annotation of a signature. If the node was parsed in a * JavaScript file, gets the return type annotation from JSDoc. */ - function getEffectiveReturnTypeNode(node) { + function getEffectiveReturnTypeNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocReturnType(node); } } @@ -7960,11 +7962,11 @@ var ts; * Gets the effective type parameters. If the node was parsed in a * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. */ - function getEffectiveTypeParameterDeclarations(node) { + function getEffectiveTypeParameterDeclarations(node, checkJSDoc) { if (node.typeParameters) { return node.typeParameters; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { var templateTag = ts.getJSDocTemplateTag(node); return templateTag && templateTag.typeParameters; } @@ -7974,9 +7976,9 @@ var ts; * Gets the effective type annotation of the value parameter of a set accessor. If the node * was parsed in a JavaScript file, gets the type annotation from JSDoc. */ - function getEffectiveSetAccessorTypeAnnotationNode(node) { + function getEffectiveSetAccessorTypeAnnotationNode(node, checkJSDoc) { var parameter = getSetAccessorValueParameter(node); - return parameter && getEffectiveTypeAnnotationNode(parameter); + return parameter && getEffectiveTypeAnnotationNode(parameter, checkJSDoc); } ts.getEffectiveSetAccessorTypeAnnotationNode = getEffectiveSetAccessorTypeAnnotationNode; function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { @@ -10208,7 +10210,14 @@ var ts; || kind === 139 /* UndefinedKeyword */ || kind === 95 /* NullKeyword */ || kind === 130 /* NeverKeyword */ - || kind === 201 /* ExpressionWithTypeArguments */; + || kind === 201 /* ExpressionWithTypeArguments */ + || kind === 268 /* JSDocAllType */ + || kind === 269 /* JSDocUnknownType */ + || kind === 270 /* JSDocNullableType */ + || kind === 271 /* JSDocNonNullableType */ + || kind === 272 /* JSDocOptionalType */ + || kind === 273 /* JSDocFunctionType */ + || kind === 274 /* JSDocVariadicType */; } /** * Node test that determines whether a node is a valid type node. @@ -21900,7 +21909,7 @@ var ts; var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string" ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version } : undefined; - return { packageJsonContent: packageJsonContent, packageId: packageId }; + return { found: true, packageJsonContent: packageJsonContent, packageId: packageId }; } else { if (directoryExists && traceEnabled) { @@ -21908,7 +21917,7 @@ var ts; } // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results failedLookupLocations.push(packageJsonPath); - return { packageJsonContent: undefined, packageId: undefined }; + return { found: false, packageJsonContent: undefined, packageId: undefined }; } } function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) { @@ -21957,10 +21966,22 @@ var ts; return ts.combinePaths(directory, "package.json"); } function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { - var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; - var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); - var _b = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state), packageJsonContent = _b.packageJsonContent, packageId = _b.packageId; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. + var packageJsonContent; + var packageId; + var packageInfo = getPackageJsonInfo(candidate, "", failedLookupLocations, /*onlyRecordFailures*/ !nodeModulesFolderExists, state); + if (packageInfo.found) { + (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId); + } + else { + var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; + if (rest !== "") { + var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); + // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId. + packageId = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state).packageId; + } + } var pathAndExtension = loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state, packageJsonContent); return withPackageId(packageId, pathAndExtension); @@ -28516,7 +28537,7 @@ var ts; else if (flags & 16384 /* WriteClassExpressionAsTypeLiteral */ && type.symbol.valueDeclaration && type.symbol.valueDeclaration.kind === 199 /* ClassExpression */) { - writeAnonymousType(getDeclaredTypeOfClassOrInterface(type.symbol), flags); + writeAnonymousType(type, flags); } else { // Write the type reference in the format f.g.C where A and B are type arguments @@ -30743,7 +30764,7 @@ var ts; var propertySymbol = _a[_i]; addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); } - if (getIndexInfoOfType(modifiersType, 0 /* String */)) { + if (modifiersType.flags & 1 /* Any */ || getIndexInfoOfType(modifiersType, 0 /* String */)) { addMemberForKeyType(stringType); } } @@ -30786,7 +30807,7 @@ var ts; prop.syntheticLiteralTypeOrigin = t; members.set(propName, prop); } - else if (t.flags & 2 /* String */) { + else if (t.flags & (1 /* Any */ | 2 /* String */)) { stringIndexInfo = createIndexInfo(propType, templateReadonly); } } @@ -33124,7 +33145,7 @@ var ts; return instantiateAnonymousType(type, mapper); } function isMappableType(type) { - return type.flags & (16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */); + return type.flags & (1 /* Any */ | 16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */); } function instantiateAnonymousType(type, mapper) { var result = createObjectType(type.objectFlags | 64 /* Instantiated */, type.symbol); @@ -37605,6 +37626,10 @@ var ts; var funcHasRestParameters = ts.hasRestParameter(func); var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (ts.getThisParameter(func) !== undefined && !contextualSignature.thisParameter) { + ts.Debug.assert(indexOfParameter !== 0); // Otherwise we should not have called `getContextuallyTypedParameterType`. + indexOfParameter -= 1; + } if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } @@ -40887,9 +40912,10 @@ var ts; // in a JS file // Note:JS inferred classes might come from a variable declaration instead of a function declaration. // In this case, using getResolvedSymbol directly is required to avoid losing the members from the declaration. - var funcSymbol = node.expression.kind === 71 /* Identifier */ ? - getResolvedSymbol(node.expression) : - checkExpression(node.expression).symbol; + var funcSymbol = checkExpression(node.expression).symbol; + if (!funcSymbol && node.expression.kind === 71 /* Identifier */) { + funcSymbol = getResolvedSymbol(node.expression); + } var type = funcSymbol && getJavaScriptClassType(funcSymbol); if (type) { return type; @@ -43444,7 +43470,7 @@ var ts; if (!types) { return undefined; } - return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, /*subtypeReduction*/ true); + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types); } var promisedType = getPromisedTypeOfPromise(type); if (promisedType) { @@ -57543,7 +57569,7 @@ var ts; /*parameters*/ [], /*type*/ undefined, body); // Mark this node as originally an async function - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */; + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */ | 524288 /* ReuseTempVariableScope */; return ts.createCall(ts.getHelperName("__awaiter"), /*typeArguments*/ undefined, [ ts.createThis(), @@ -61401,7 +61427,8 @@ var ts; // Do not do this in the global scope, as any variable we currently generate could conflict with // variables from outside of the current compilation. In the future, we can revisit this behavior. if (ts.isExternalModule(currentSourceFile)) { - var tempVar = ts.createTempVariable(recordTaggedTemplateString); + var tempVar = ts.createUniqueName("templateObject"); + recordTaggedTemplateString(tempVar); templateArguments[0] = ts.createLogicalOr(tempVar, ts.createAssignment(tempVar, helperCall)); } else { @@ -66361,7 +66388,7 @@ var ts; return ts.isBindingPattern(node.name) ? ts.flattenDestructuringAssignment(node, destructuringAndImportCallVisitor, context, 0 /* All */, /*needsValue*/ false, createAssignment) - : createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)); + : node.initializer ? createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)) : node.name; } /** * Creates an assignment expression for an exported variable declaration. @@ -66752,6 +66779,9 @@ var ts; for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; expressions = ts.append(expressions, transformInitializedVariable(variable, /*isExportedDeclaration*/ false)); + if (!variable.initializer) { + hoistBindingElement(variable); + } } return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); } @@ -70512,6 +70542,8 @@ var ts; return emitTypeReference(node); case 160 /* FunctionType */: return emitFunctionType(node); + case 273 /* JSDocFunctionType */: + return emitJSDocFunctionType(node); case 161 /* ConstructorType */: return emitConstructorType(node); case 162 /* TypeQuery */: @@ -70540,6 +70572,20 @@ var ts; return emitMappedType(node); case 173 /* LiteralType */: return emitLiteralType(node); + case 268 /* JSDocAllType */: + write("*"); + return; + case 269 /* JSDocUnknownType */: + write("?"); + return; + case 270 /* JSDocNullableType */: + return emitJSDocNullableType(node); + case 271 /* JSDocNonNullableType */: + return emitJSDocNonNullableType(node); + case 272 /* JSDocOptionalType */: + return emitJSDocOptionalType(node); + case 274 /* JSDocVariadicType */: + return emitJSDocVariadicType(node); // Binding patterns case 174 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); @@ -70844,9 +70890,16 @@ var ts; emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); emitIfPresent(node.dotDotDotToken); - emit(node.name); + if (node.name) { + emit(node.name); + } emitIfPresent(node.questionToken); - emitWithPrefix(": ", node.type); + if (node.parent && node.parent.kind === 273 /* JSDocFunctionType */ && !node.name) { + emit(node.type); + } + else { + emitWithPrefix(": ", node.type); + } emitExpressionWithPrefix(" = ", node.initializer); } function emitDecorator(decorator) { @@ -70948,6 +71001,24 @@ var ts; write(" => "); emit(node.type); } + function emitJSDocFunctionType(node) { + write("function"); + emitParameters(node, node.parameters); + write(":"); + emit(node.type); + } + function emitJSDocNullableType(node) { + write("?"); + emit(node.type); + } + function emitJSDocNonNullableType(node) { + write("!"); + emit(node.type); + } + function emitJSDocOptionalType(node) { + emit(node.type); + write("="); + } function emitConstructorType(node) { write("new "); emitTypeParameters(node, node.typeParameters); @@ -70969,6 +71040,10 @@ var ts; emit(node.elementType); write("[]"); } + function emitJSDocVariadicType(node) { + write("..."); + emit(node.type); + } function emitTupleType(node) { write("["); emitList(node, node.elementTypes, 336 /* TupleTypeElements */); @@ -75862,8 +75937,11 @@ var ts; return start < end; } ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; + /** + * Assumes `candidate.start <= position` holds. + */ function positionBelongsToNode(candidate, position, sourceFile) { - return candidate.end > position || !isCompletedNode(candidate, sourceFile); + return position < candidate.end || !isCompletedNode(candidate, sourceFile); } ts.positionBelongsToNode = positionBelongsToNode; function isCompletedNode(n, sourceFile) { @@ -89245,16 +89323,19 @@ var ts; Value[Value["Unknown"] = -1] = "Unknown"; })(Value || (Value = {})); /** - * Computed indentation for a given position in source file - * @param position - position in file - * @param sourceFile - target source file - * @param options - set of editor options that control indentation - * @param assumeNewLineBeforeCloseBrace - false when getIndentation is called on the text from the real source file. - * true - when we need to assume that position is on the newline. This is usefult for codefixes, i.e. + * @param assumeNewLineBeforeCloseBrace + * `false` when called on text from a real source file. + * `true` when we need to assume `position` is on a newline. + * + * This is useful for codefixes. Consider + * ``` * function f() { * |} - * when inserting some text after open brace we would like to get the value of indentation as if newline was already there. - * However by default indentation at position | will be 0 so 'assumeNewLineBeforeCloseBrace' allows to override this behavior, + * ``` + * with `position` at `|`. + * + * When inserting some text after an open brace, we would like to get indentation as if a newline was already there. + * By default indentation at `position` will be 0 so 'assumeNewLineBeforeCloseBrace' overrides this behavior. */ function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { if (assumeNewLineBeforeCloseBrace === void 0) { assumeNewLineBeforeCloseBrace = false; } @@ -89365,9 +89446,10 @@ var ts; SmartIndenter.getBaseIndentation = getBaseIndentation; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { var parent = current.parent; - var parentStart; - // walk upwards and collect indentations for pairs of parent-child nodes - // indentation is not added if parent and child nodes start on the same line or if parent is IfStatement and child starts on the same line with 'else clause' + var containingListOrParentStart; + // Walk up the tree and collect indentation for parent-child node pairs. Indentation is not added if + // * parent and child nodes start on the same line, or + // * parent is an IfStatement and child starts on the same line as an 'else clause'. while (parent) { var useActualIndentation = true; if (ignoreActualIndentationRange) { @@ -89381,8 +89463,8 @@ var ts; return actualIndentation + indentationDelta; } } - parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || + containingListOrParentStart = getContainingListOrParentStart(parent, current, sourceFile); + var parentAndChildShareLine = containingListOrParentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { // try to fetch actual indentation for current node from source text @@ -89399,18 +89481,25 @@ var ts; if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { indentationDelta += options.indentSize; } + // In our AST, a call argument's `parent` is the call-expression, not the argument list. + // We would like to increase indentation based on the relationship between an argument and its argument-list, + // so we spoof the starting position of the (parent) call-expression to match the (non-parent) argument-list. + // But, the spoofed start-value could then cause a problem when comparing the start position of the call-expression + // to *its* parent (in the case of an iife, an expression statement), adding an extra level of indentation. + // + // Instead, when at an argument, we unspoof the starting position of the enclosing call expression + // *after* applying indentation for the argument. + var useTrueStart = isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, current, currentStart.line, sourceFile); current = parent; - currentStart = parentStart; parent = current.parent; + currentStart = useTrueStart ? sourceFile.getLineAndCharacterOfPosition(current.getStart()) : containingListOrParentStart; } return indentationDelta + getBaseIndentation(options); } - function getParentStart(parent, child, sourceFile) { + function getContainingListOrParentStart(parent, child, sourceFile) { var containingList = getContainingList(child, sourceFile); - if (containingList) { - return sourceFile.getLineAndCharacterOfPosition(containingList.pos); - } - return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); + var startPos = containingList ? containingList.pos : parent.getStart(sourceFile); + return sourceFile.getLineAndCharacterOfPosition(startPos); } /* * Function returns Value.Unknown if indentation cannot be determined @@ -89472,6 +89561,15 @@ var ts; function getStartLineAndCharacterForNode(n, sourceFile) { return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } + function isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, child, childStartLine, sourceFile) { + if (!(ts.isCallExpression(parent) && ts.contains(parent.arguments, child))) { + return false; + } + var expressionOfCallExpressionEnd = parent.expression.getEnd(); + var expressionOfCallExpressionEndLine = ts.getLineAndCharacterOfPosition(sourceFile, expressionOfCallExpressionEnd).line; + return expressionOfCallExpressionEndLine === childStartLine; + } + SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { if (parent.kind === 211 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 82 /* ElseKeyword */, sourceFile); @@ -92622,6 +92720,212 @@ var ts; /// /* @internal */ var ts; +(function (ts) { + var refactor; + (function (refactor_2) { + var annotateWithTypeFromJSDoc; + (function (annotateWithTypeFromJSDoc) { + var actionName = "annotate"; + var annotateTypeFromJSDoc = { + name: "Annotate with type from JSDoc", + description: ts.Diagnostics.Annotate_with_type_from_JSDoc.message, + getEditsForAction: getEditsForAnnotation, + getAvailableActions: getAvailableActions + }; + var annotateFunctionFromJSDoc = { + name: "Annotate with types from JSDoc", + description: ts.Diagnostics.Annotate_with_types_from_JSDoc.message, + getEditsForAction: getEditsForFunctionAnnotation, + getAvailableActions: getAvailableActions + }; + refactor_2.registerRefactor(annotateTypeFromJSDoc); + refactor_2.registerRefactor(annotateFunctionFromJSDoc); + function getAvailableActions(context) { + if (ts.isInJavaScriptFile(context.file)) { + return undefined; + } + var node = ts.getTokenAtPosition(context.file, context.startPosition, /*includeJsDocComment*/ false); + var decl = ts.findAncestor(node, isDeclarationWithType); + if (!decl || decl.type) { + return undefined; + } + var jsdocType = ts.getJSDocType(decl); + var isFunctionWithJSDoc = ts.isFunctionLikeDeclaration(decl) && (ts.getJSDocReturnType(decl) || decl.parameters.some(function (p) { return !!ts.getJSDocType(p); })); + var refactor = (isFunctionWithJSDoc || jsdocType && decl.kind === 146 /* Parameter */) ? annotateFunctionFromJSDoc : + jsdocType ? annotateTypeFromJSDoc : + undefined; + if (refactor) { + return [{ + name: refactor.name, + description: refactor.description, + actions: [ + { + description: refactor.description, + name: actionName + } + ] + }]; + } + } + function getEditsForAnnotation(context, action) { + if (actionName !== action) { + return ts.Debug.fail("actionName !== action: " + actionName + " !== " + action); + } + var sourceFile = context.file; + var token = ts.getTokenAtPosition(sourceFile, context.startPosition, /*includeJsDocComment*/ false); + var decl = ts.findAncestor(token, isDeclarationWithType); + var jsdocType = ts.getJSDocType(decl); + if (!decl || !jsdocType || decl.type) { + return ts.Debug.fail("!decl || !jsdocType || decl.type: !" + decl + " || !" + jsdocType + " || " + decl.type); + } + var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); + var declarationWithType = addType(decl, transformJSDocType(jsdocType)); + ts.suppressLeadingAndTrailingTrivia(declarationWithType); + changeTracker.replaceRange(sourceFile, { pos: decl.getStart(), end: decl.end }, declarationWithType); + return { + edits: changeTracker.getChanges(), + renameFilename: undefined, + renameLocation: undefined + }; + } + function getEditsForFunctionAnnotation(context, action) { + if (actionName !== action) { + return ts.Debug.fail("actionName !== action: " + actionName + " !== " + action); + } + var sourceFile = context.file; + var token = ts.getTokenAtPosition(sourceFile, context.startPosition, /*includeJsDocComment*/ false); + var decl = ts.findAncestor(token, ts.isFunctionLikeDeclaration); + var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); + var functionWithType = addTypesToFunctionLike(decl); + ts.suppressLeadingAndTrailingTrivia(functionWithType); + changeTracker.replaceRange(sourceFile, { pos: decl.getStart(), end: decl.end }, functionWithType); + return { + edits: changeTracker.getChanges(), + renameFilename: undefined, + renameLocation: undefined + }; + } + function isDeclarationWithType(node) { + return ts.isFunctionLikeDeclaration(node) || + node.kind === 226 /* VariableDeclaration */ || + node.kind === 146 /* Parameter */ || + node.kind === 148 /* PropertySignature */ || + node.kind === 149 /* PropertyDeclaration */; + } + function addTypesToFunctionLike(decl) { + var typeParameters = ts.getEffectiveTypeParameterDeclarations(decl, /*checkJSDoc*/ true); + var parameters = decl.parameters.map(function (p) { return ts.createParameter(p.decorators, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, transformJSDocType(ts.getEffectiveTypeAnnotationNode(p, /*checkJSDoc*/ true)), p.initializer); }); + var returnType = transformJSDocType(ts.getEffectiveReturnTypeNode(decl, /*checkJSDoc*/ true)); + switch (decl.kind) { + case 228 /* FunctionDeclaration */: + return ts.createFunctionDeclaration(decl.decorators, decl.modifiers, decl.asteriskToken, decl.name, typeParameters, parameters, returnType, decl.body); + case 152 /* Constructor */: + return ts.createConstructor(decl.decorators, decl.modifiers, parameters, decl.body); + case 186 /* FunctionExpression */: + return ts.createFunctionExpression(decl.modifiers, decl.asteriskToken, decl.name, typeParameters, parameters, returnType, decl.body); + case 187 /* ArrowFunction */: + return ts.createArrowFunction(decl.modifiers, typeParameters, parameters, returnType, decl.equalsGreaterThanToken, decl.body); + case 151 /* MethodDeclaration */: + return ts.createMethod(decl.decorators, decl.modifiers, decl.asteriskToken, decl.name, decl.questionToken, typeParameters, parameters, returnType, decl.body); + case 153 /* GetAccessor */: + return ts.createGetAccessor(decl.decorators, decl.modifiers, decl.name, decl.parameters, returnType, decl.body); + case 154 /* SetAccessor */: + return ts.createSetAccessor(decl.decorators, decl.modifiers, decl.name, parameters, decl.body); + default: + return ts.Debug.assertNever(decl, "Unexpected SyntaxKind: " + decl.kind); + } + } + function addType(decl, jsdocType) { + switch (decl.kind) { + case 226 /* VariableDeclaration */: + return ts.createVariableDeclaration(decl.name, jsdocType, decl.initializer); + case 148 /* PropertySignature */: + return ts.createPropertySignature(decl.modifiers, decl.name, decl.questionToken, jsdocType, decl.initializer); + case 149 /* PropertyDeclaration */: + return ts.createProperty(decl.decorators, decl.modifiers, decl.name, decl.questionToken, jsdocType, decl.initializer); + default: + return ts.Debug.fail("Unexpected SyntaxKind: " + decl.kind); + } + } + function transformJSDocType(node) { + if (node === undefined) { + return undefined; + } + switch (node.kind) { + case 268 /* JSDocAllType */: + case 269 /* JSDocUnknownType */: + return ts.createTypeReferenceNode("any", ts.emptyArray); + case 272 /* JSDocOptionalType */: + return transformJSDocOptionalType(node); + case 271 /* JSDocNonNullableType */: + return transformJSDocType(node.type); + case 270 /* JSDocNullableType */: + return transformJSDocNullableType(node); + case 274 /* JSDocVariadicType */: + return transformJSDocVariadicType(node); + case 273 /* JSDocFunctionType */: + return transformJSDocFunctionType(node); + case 146 /* Parameter */: + return transformJSDocParameter(node); + case 159 /* TypeReference */: + return transformJSDocTypeReference(node); + default: + return ts.visitEachChild(node, transformJSDocType, /*context*/ undefined); + } + } + function transformJSDocOptionalType(node) { + return ts.createUnionTypeNode([ts.visitNode(node.type, transformJSDocType), ts.createTypeReferenceNode("undefined", ts.emptyArray)]); + } + function transformJSDocNullableType(node) { + return ts.createUnionTypeNode([ts.visitNode(node.type, transformJSDocType), ts.createTypeReferenceNode("null", ts.emptyArray)]); + } + function transformJSDocVariadicType(node) { + return ts.createArrayTypeNode(ts.visitNode(node.type, transformJSDocType)); + } + function transformJSDocFunctionType(node) { + var parameters = node.parameters && node.parameters.map(transformJSDocType); + return ts.createFunctionTypeNode(ts.emptyArray, parameters, node.type); + } + function transformJSDocParameter(node) { + var index = node.parent.parameters.indexOf(node); + var isRest = node.type.kind === 274 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + var name = node.name || (isRest ? "rest" : "arg" + index); + var dotdotdot = isRest ? ts.createToken(24 /* DotDotDotToken */) : node.dotDotDotToken; + return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); + } + function transformJSDocTypeReference(node) { + var name = node.typeName; + var args = node.typeArguments; + if (ts.isIdentifier(node.typeName)) { + var text = node.typeName.text; + switch (node.typeName.text) { + case "String": + case "Boolean": + case "Object": + case "Number": + text = text.toLowerCase(); + break; + case "array": + case "date": + case "promise": + text = text[0].toUpperCase() + text.slice(1); + break; + } + name = ts.createIdentifier(text); + if ((text === "Array" || text === "Promise") && !node.typeArguments) { + args = ts.createNodeArray([ts.createTypeReferenceNode("any", ts.emptyArray)]); + } + else { + args = ts.visitNodes(node.typeArguments, transformJSDocType); + } + } + return ts.createTypeReferenceNode(name, args); + } + })(annotateWithTypeFromJSDoc = refactor_2.annotateWithTypeFromJSDoc || (refactor_2.annotateWithTypeFromJSDoc = {})); + })(refactor = ts.refactor || (ts.refactor = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var refactor; (function (refactor) { @@ -92639,14 +92943,14 @@ var ts; if (!ts.isInJavaScriptFile(context.file)) { return undefined; } - var start = context.startPosition; - var node = ts.getTokenAtPosition(context.file, start, /*includeJsDocComment*/ false); - var checker = context.program.getTypeChecker(); - var symbol = checker.getSymbolAtLocation(node); - if (symbol && ts.isDeclarationOfFunctionOrClassExpression(symbol)) { + var symbol = getConstructorSymbol(context); + if (!symbol) { + return undefined; + } + if (ts.isDeclarationOfFunctionOrClassExpression(symbol)) { symbol = symbol.valueDeclaration.initializer.symbol; } - if (symbol && (symbol.flags & 16 /* Function */) && symbol.members && (symbol.members.size > 0)) { + if ((symbol.flags & 16 /* Function */) && symbol.members && (symbol.members.size > 0)) { return [ { name: convertFunctionToES6Class.name, @@ -92666,11 +92970,8 @@ var ts; if (actionName !== action) { return undefined; } - var start = context.startPosition; var sourceFile = context.file; - var checker = context.program.getTypeChecker(); - var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false); - var ctorSymbol = checker.getSymbolAtLocation(token); + var ctorSymbol = getConstructorSymbol(context); var newLine = context.rulesProvider.getFormatOptions().newLineCharacter; var deletedNodes = []; var deletes = []; @@ -92858,6 +93159,12 @@ var ts; return ts.filter(source.modifiers, function (modifier) { return modifier.kind === kind; }); } } + function getConstructorSymbol(_a) { + var startPosition = _a.startPosition, file = _a.file, program = _a.program; + var checker = program.getTypeChecker(); + var token = ts.getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false); + return checker.getSymbolAtLocation(token); + } })(convertFunctionToES6Class = refactor.convertFunctionToES6Class || (refactor.convertFunctionToES6Class = {})); })(refactor = ts.refactor || (ts.refactor = {})); })(ts || (ts = {})); @@ -94410,6 +94717,7 @@ var ts; })(extractSymbol = refactor.extractSymbol || (refactor.extractSymbol = {})); })(refactor = ts.refactor || (ts.refactor = {})); })(ts || (ts = {})); +/// /// /// /// @@ -100359,9 +100667,14 @@ var ts; } return result.module; }; + // Method of LanguageServiceHost Project.prototype.getCompilationSettings = function () { return this.compilerOptions; }; + // Method to support public API + Project.prototype.getCompilerOptions = function () { + return this.getCompilationSettings(); + }; Project.prototype.getNewLine = function () { return this.directoryStructureHost.newLine; }; diff --git a/lib/typescript.js b/lib/typescript.js index ca24c94ce30..654b1d2a53b 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -5386,8 +5386,10 @@ var ts; Extract_constant: diag(95006, ts.DiagnosticCategory.Message, "Extract_constant_95006", "Extract constant"), Extract_to_0_in_enclosing_scope: diag(95007, ts.DiagnosticCategory.Message, "Extract_to_0_in_enclosing_scope_95007", "Extract to {0} in enclosing scope"), Extract_to_0_in_1_scope: diag(95008, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_scope_95008", "Extract to {0} in {1} scope"), - Infer_type_of_0_from_usage: diag(95009, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95009", "Infer type of '{0}' from usage."), - Infer_parameter_types_from_usage: diag(95010, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95010", "Infer parameter types from usage."), + Annotate_with_type_from_JSDoc: diag(95009, ts.DiagnosticCategory.Message, "Annotate_with_type_from_JSDoc_95009", "Annotate with type from JSDoc"), + Annotate_with_types_from_JSDoc: diag(95010, ts.DiagnosticCategory.Message, "Annotate_with_types_from_JSDoc_95010", "Annotate with types from JSDoc"), + Infer_type_of_0_from_usage: diag(95011, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95011", "Infer type of '{0}' from usage."), + Infer_parameter_types_from_usage: diag(95012, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95012", "Infer parameter types from usage."), }; })(ts || (ts = {})); /// @@ -9721,11 +9723,11 @@ var ts; * Gets the effective type annotation of a variable, parameter, or property. If the node was * parsed in a JavaScript file, gets the type annotation from JSDoc. */ - function getEffectiveTypeAnnotationNode(node) { + function getEffectiveTypeAnnotationNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocType(node); } } @@ -9734,11 +9736,11 @@ var ts; * Gets the effective return type annotation of a signature. If the node was parsed in a * JavaScript file, gets the return type annotation from JSDoc. */ - function getEffectiveReturnTypeNode(node) { + function getEffectiveReturnTypeNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocReturnType(node); } } @@ -9747,11 +9749,11 @@ var ts; * Gets the effective type parameters. If the node was parsed in a * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. */ - function getEffectiveTypeParameterDeclarations(node) { + function getEffectiveTypeParameterDeclarations(node, checkJSDoc) { if (node.typeParameters) { return node.typeParameters; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { var templateTag = ts.getJSDocTemplateTag(node); return templateTag && templateTag.typeParameters; } @@ -9761,9 +9763,9 @@ var ts; * Gets the effective type annotation of the value parameter of a set accessor. If the node * was parsed in a JavaScript file, gets the type annotation from JSDoc. */ - function getEffectiveSetAccessorTypeAnnotationNode(node) { + function getEffectiveSetAccessorTypeAnnotationNode(node, checkJSDoc) { var parameter = getSetAccessorValueParameter(node); - return parameter && getEffectiveTypeAnnotationNode(parameter); + return parameter && getEffectiveTypeAnnotationNode(parameter, checkJSDoc); } ts.getEffectiveSetAccessorTypeAnnotationNode = getEffectiveSetAccessorTypeAnnotationNode; function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { @@ -11995,7 +11997,14 @@ var ts; || kind === 139 /* UndefinedKeyword */ || kind === 95 /* NullKeyword */ || kind === 130 /* NeverKeyword */ - || kind === 201 /* ExpressionWithTypeArguments */; + || kind === 201 /* ExpressionWithTypeArguments */ + || kind === 268 /* JSDocAllType */ + || kind === 269 /* JSDocUnknownType */ + || kind === 270 /* JSDocNullableType */ + || kind === 271 /* JSDocNonNullableType */ + || kind === 272 /* JSDocOptionalType */ + || kind === 273 /* JSDocFunctionType */ + || kind === 274 /* JSDocVariadicType */; } /** * Node test that determines whether a node is a valid type node. @@ -23200,7 +23209,7 @@ var ts; var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string" ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version } : undefined; - return { packageJsonContent: packageJsonContent, packageId: packageId }; + return { found: true, packageJsonContent: packageJsonContent, packageId: packageId }; } else { if (directoryExists && traceEnabled) { @@ -23208,7 +23217,7 @@ var ts; } // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results failedLookupLocations.push(packageJsonPath); - return { packageJsonContent: undefined, packageId: undefined }; + return { found: false, packageJsonContent: undefined, packageId: undefined }; } } function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) { @@ -23257,10 +23266,22 @@ var ts; return ts.combinePaths(directory, "package.json"); } function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { - var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; - var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); - var _b = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state), packageJsonContent = _b.packageJsonContent, packageId = _b.packageId; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. + var packageJsonContent; + var packageId; + var packageInfo = getPackageJsonInfo(candidate, "", failedLookupLocations, /*onlyRecordFailures*/ !nodeModulesFolderExists, state); + if (packageInfo.found) { + (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId); + } + else { + var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; + if (rest !== "") { + var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); + // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId. + packageId = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state).packageId; + } + } var pathAndExtension = loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state, packageJsonContent); return withPackageId(packageId, pathAndExtension); @@ -26483,7 +26504,7 @@ var ts; else if (flags & 16384 /* WriteClassExpressionAsTypeLiteral */ && type.symbol.valueDeclaration && type.symbol.valueDeclaration.kind === 199 /* ClassExpression */) { - writeAnonymousType(getDeclaredTypeOfClassOrInterface(type.symbol), flags); + writeAnonymousType(type, flags); } else { // Write the type reference in the format f.g.C where A and B are type arguments @@ -28710,7 +28731,7 @@ var ts; var propertySymbol = _a[_i]; addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); } - if (getIndexInfoOfType(modifiersType, 0 /* String */)) { + if (modifiersType.flags & 1 /* Any */ || getIndexInfoOfType(modifiersType, 0 /* String */)) { addMemberForKeyType(stringType); } } @@ -28753,7 +28774,7 @@ var ts; prop.syntheticLiteralTypeOrigin = t; members.set(propName, prop); } - else if (t.flags & 2 /* String */) { + else if (t.flags & (1 /* Any */ | 2 /* String */)) { stringIndexInfo = createIndexInfo(propType, templateReadonly); } } @@ -31091,7 +31112,7 @@ var ts; return instantiateAnonymousType(type, mapper); } function isMappableType(type) { - return type.flags & (16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */); + return type.flags & (1 /* Any */ | 16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */); } function instantiateAnonymousType(type, mapper) { var result = createObjectType(type.objectFlags | 64 /* Instantiated */, type.symbol); @@ -35572,6 +35593,10 @@ var ts; var funcHasRestParameters = ts.hasRestParameter(func); var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (ts.getThisParameter(func) !== undefined && !contextualSignature.thisParameter) { + ts.Debug.assert(indexOfParameter !== 0); // Otherwise we should not have called `getContextuallyTypedParameterType`. + indexOfParameter -= 1; + } if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } @@ -38854,9 +38879,10 @@ var ts; // in a JS file // Note:JS inferred classes might come from a variable declaration instead of a function declaration. // In this case, using getResolvedSymbol directly is required to avoid losing the members from the declaration. - var funcSymbol = node.expression.kind === 71 /* Identifier */ ? - getResolvedSymbol(node.expression) : - checkExpression(node.expression).symbol; + var funcSymbol = checkExpression(node.expression).symbol; + if (!funcSymbol && node.expression.kind === 71 /* Identifier */) { + funcSymbol = getResolvedSymbol(node.expression); + } var type = funcSymbol && getJavaScriptClassType(funcSymbol); if (type) { return type; @@ -41411,7 +41437,7 @@ var ts; if (!types) { return undefined; } - return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, /*subtypeReduction*/ true); + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types); } var promisedType = getPromisedTypeOfPromise(type); if (promisedType) { @@ -55510,7 +55536,7 @@ var ts; /*parameters*/ [], /*type*/ undefined, body); // Mark this node as originally an async function - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */; + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */ | 524288 /* ReuseTempVariableScope */; return ts.createCall(ts.getHelperName("__awaiter"), /*typeArguments*/ undefined, [ ts.createThis(), @@ -59368,7 +59394,8 @@ var ts; // Do not do this in the global scope, as any variable we currently generate could conflict with // variables from outside of the current compilation. In the future, we can revisit this behavior. if (ts.isExternalModule(currentSourceFile)) { - var tempVar = ts.createTempVariable(recordTaggedTemplateString); + var tempVar = ts.createUniqueName("templateObject"); + recordTaggedTemplateString(tempVar); templateArguments[0] = ts.createLogicalOr(tempVar, ts.createAssignment(tempVar, helperCall)); } else { @@ -64328,7 +64355,7 @@ var ts; return ts.isBindingPattern(node.name) ? ts.flattenDestructuringAssignment(node, destructuringAndImportCallVisitor, context, 0 /* All */, /*needsValue*/ false, createAssignment) - : createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)); + : node.initializer ? createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)) : node.name; } /** * Creates an assignment expression for an exported variable declaration. @@ -64719,6 +64746,9 @@ var ts; for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; expressions = ts.append(expressions, transformInitializedVariable(variable, /*isExportedDeclaration*/ false)); + if (!variable.initializer) { + hoistBindingElement(variable); + } } return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); } @@ -68479,6 +68509,8 @@ var ts; return emitTypeReference(node); case 160 /* FunctionType */: return emitFunctionType(node); + case 273 /* JSDocFunctionType */: + return emitJSDocFunctionType(node); case 161 /* ConstructorType */: return emitConstructorType(node); case 162 /* TypeQuery */: @@ -68507,6 +68539,20 @@ var ts; return emitMappedType(node); case 173 /* LiteralType */: return emitLiteralType(node); + case 268 /* JSDocAllType */: + write("*"); + return; + case 269 /* JSDocUnknownType */: + write("?"); + return; + case 270 /* JSDocNullableType */: + return emitJSDocNullableType(node); + case 271 /* JSDocNonNullableType */: + return emitJSDocNonNullableType(node); + case 272 /* JSDocOptionalType */: + return emitJSDocOptionalType(node); + case 274 /* JSDocVariadicType */: + return emitJSDocVariadicType(node); // Binding patterns case 174 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); @@ -68811,9 +68857,16 @@ var ts; emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); emitIfPresent(node.dotDotDotToken); - emit(node.name); + if (node.name) { + emit(node.name); + } emitIfPresent(node.questionToken); - emitWithPrefix(": ", node.type); + if (node.parent && node.parent.kind === 273 /* JSDocFunctionType */ && !node.name) { + emit(node.type); + } + else { + emitWithPrefix(": ", node.type); + } emitExpressionWithPrefix(" = ", node.initializer); } function emitDecorator(decorator) { @@ -68915,6 +68968,24 @@ var ts; write(" => "); emit(node.type); } + function emitJSDocFunctionType(node) { + write("function"); + emitParameters(node, node.parameters); + write(":"); + emit(node.type); + } + function emitJSDocNullableType(node) { + write("?"); + emit(node.type); + } + function emitJSDocNonNullableType(node) { + write("!"); + emit(node.type); + } + function emitJSDocOptionalType(node) { + emit(node.type); + write("="); + } function emitConstructorType(node) { write("new "); emitTypeParameters(node, node.typeParameters); @@ -68936,6 +69007,10 @@ var ts; emit(node.elementType); write("[]"); } + function emitJSDocVariadicType(node) { + write("..."); + emit(node.type); + } function emitTupleType(node) { write("["); emitList(node, node.elementTypes, 336 /* TupleTypeElements */); @@ -75862,8 +75937,11 @@ var ts; return start < end; } ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; + /** + * Assumes `candidate.start <= position` holds. + */ function positionBelongsToNode(candidate, position, sourceFile) { - return candidate.end > position || !isCompletedNode(candidate, sourceFile); + return position < candidate.end || !isCompletedNode(candidate, sourceFile); } ts.positionBelongsToNode = positionBelongsToNode; function isCompletedNode(n, sourceFile) { @@ -88641,16 +88719,19 @@ var ts; Value[Value["Unknown"] = -1] = "Unknown"; })(Value || (Value = {})); /** - * Computed indentation for a given position in source file - * @param position - position in file - * @param sourceFile - target source file - * @param options - set of editor options that control indentation - * @param assumeNewLineBeforeCloseBrace - false when getIndentation is called on the text from the real source file. - * true - when we need to assume that position is on the newline. This is usefult for codefixes, i.e. + * @param assumeNewLineBeforeCloseBrace + * `false` when called on text from a real source file. + * `true` when we need to assume `position` is on a newline. + * + * This is useful for codefixes. Consider + * ``` * function f() { * |} - * when inserting some text after open brace we would like to get the value of indentation as if newline was already there. - * However by default indentation at position | will be 0 so 'assumeNewLineBeforeCloseBrace' allows to override this behavior, + * ``` + * with `position` at `|`. + * + * When inserting some text after an open brace, we would like to get indentation as if a newline was already there. + * By default indentation at `position` will be 0 so 'assumeNewLineBeforeCloseBrace' overrides this behavior. */ function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { if (assumeNewLineBeforeCloseBrace === void 0) { assumeNewLineBeforeCloseBrace = false; } @@ -88761,9 +88842,10 @@ var ts; SmartIndenter.getBaseIndentation = getBaseIndentation; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { var parent = current.parent; - var parentStart; - // walk upwards and collect indentations for pairs of parent-child nodes - // indentation is not added if parent and child nodes start on the same line or if parent is IfStatement and child starts on the same line with 'else clause' + var containingListOrParentStart; + // Walk up the tree and collect indentation for parent-child node pairs. Indentation is not added if + // * parent and child nodes start on the same line, or + // * parent is an IfStatement and child starts on the same line as an 'else clause'. while (parent) { var useActualIndentation = true; if (ignoreActualIndentationRange) { @@ -88777,8 +88859,8 @@ var ts; return actualIndentation + indentationDelta; } } - parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || + containingListOrParentStart = getContainingListOrParentStart(parent, current, sourceFile); + var parentAndChildShareLine = containingListOrParentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { // try to fetch actual indentation for current node from source text @@ -88795,18 +88877,25 @@ var ts; if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { indentationDelta += options.indentSize; } + // In our AST, a call argument's `parent` is the call-expression, not the argument list. + // We would like to increase indentation based on the relationship between an argument and its argument-list, + // so we spoof the starting position of the (parent) call-expression to match the (non-parent) argument-list. + // But, the spoofed start-value could then cause a problem when comparing the start position of the call-expression + // to *its* parent (in the case of an iife, an expression statement), adding an extra level of indentation. + // + // Instead, when at an argument, we unspoof the starting position of the enclosing call expression + // *after* applying indentation for the argument. + var useTrueStart = isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, current, currentStart.line, sourceFile); current = parent; - currentStart = parentStart; parent = current.parent; + currentStart = useTrueStart ? sourceFile.getLineAndCharacterOfPosition(current.getStart()) : containingListOrParentStart; } return indentationDelta + getBaseIndentation(options); } - function getParentStart(parent, child, sourceFile) { + function getContainingListOrParentStart(parent, child, sourceFile) { var containingList = getContainingList(child, sourceFile); - if (containingList) { - return sourceFile.getLineAndCharacterOfPosition(containingList.pos); - } - return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); + var startPos = containingList ? containingList.pos : parent.getStart(sourceFile); + return sourceFile.getLineAndCharacterOfPosition(startPos); } /* * Function returns Value.Unknown if indentation cannot be determined @@ -88868,6 +88957,15 @@ var ts; function getStartLineAndCharacterForNode(n, sourceFile) { return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } + function isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, child, childStartLine, sourceFile) { + if (!(ts.isCallExpression(parent) && ts.contains(parent.arguments, child))) { + return false; + } + var expressionOfCallExpressionEnd = parent.expression.getEnd(); + var expressionOfCallExpressionEndLine = ts.getLineAndCharacterOfPosition(sourceFile, expressionOfCallExpressionEnd).line; + return expressionOfCallExpressionEndLine === childStartLine; + } + SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { if (parent.kind === 211 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 82 /* ElseKeyword */, sourceFile); @@ -92018,6 +92116,212 @@ var ts; /// /* @internal */ var ts; +(function (ts) { + var refactor; + (function (refactor_2) { + var annotateWithTypeFromJSDoc; + (function (annotateWithTypeFromJSDoc) { + var actionName = "annotate"; + var annotateTypeFromJSDoc = { + name: "Annotate with type from JSDoc", + description: ts.Diagnostics.Annotate_with_type_from_JSDoc.message, + getEditsForAction: getEditsForAnnotation, + getAvailableActions: getAvailableActions + }; + var annotateFunctionFromJSDoc = { + name: "Annotate with types from JSDoc", + description: ts.Diagnostics.Annotate_with_types_from_JSDoc.message, + getEditsForAction: getEditsForFunctionAnnotation, + getAvailableActions: getAvailableActions + }; + refactor_2.registerRefactor(annotateTypeFromJSDoc); + refactor_2.registerRefactor(annotateFunctionFromJSDoc); + function getAvailableActions(context) { + if (ts.isInJavaScriptFile(context.file)) { + return undefined; + } + var node = ts.getTokenAtPosition(context.file, context.startPosition, /*includeJsDocComment*/ false); + var decl = ts.findAncestor(node, isDeclarationWithType); + if (!decl || decl.type) { + return undefined; + } + var jsdocType = ts.getJSDocType(decl); + var isFunctionWithJSDoc = ts.isFunctionLikeDeclaration(decl) && (ts.getJSDocReturnType(decl) || decl.parameters.some(function (p) { return !!ts.getJSDocType(p); })); + var refactor = (isFunctionWithJSDoc || jsdocType && decl.kind === 146 /* Parameter */) ? annotateFunctionFromJSDoc : + jsdocType ? annotateTypeFromJSDoc : + undefined; + if (refactor) { + return [{ + name: refactor.name, + description: refactor.description, + actions: [ + { + description: refactor.description, + name: actionName + } + ] + }]; + } + } + function getEditsForAnnotation(context, action) { + if (actionName !== action) { + return ts.Debug.fail("actionName !== action: " + actionName + " !== " + action); + } + var sourceFile = context.file; + var token = ts.getTokenAtPosition(sourceFile, context.startPosition, /*includeJsDocComment*/ false); + var decl = ts.findAncestor(token, isDeclarationWithType); + var jsdocType = ts.getJSDocType(decl); + if (!decl || !jsdocType || decl.type) { + return ts.Debug.fail("!decl || !jsdocType || decl.type: !" + decl + " || !" + jsdocType + " || " + decl.type); + } + var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); + var declarationWithType = addType(decl, transformJSDocType(jsdocType)); + ts.suppressLeadingAndTrailingTrivia(declarationWithType); + changeTracker.replaceRange(sourceFile, { pos: decl.getStart(), end: decl.end }, declarationWithType); + return { + edits: changeTracker.getChanges(), + renameFilename: undefined, + renameLocation: undefined + }; + } + function getEditsForFunctionAnnotation(context, action) { + if (actionName !== action) { + return ts.Debug.fail("actionName !== action: " + actionName + " !== " + action); + } + var sourceFile = context.file; + var token = ts.getTokenAtPosition(sourceFile, context.startPosition, /*includeJsDocComment*/ false); + var decl = ts.findAncestor(token, ts.isFunctionLikeDeclaration); + var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); + var functionWithType = addTypesToFunctionLike(decl); + ts.suppressLeadingAndTrailingTrivia(functionWithType); + changeTracker.replaceRange(sourceFile, { pos: decl.getStart(), end: decl.end }, functionWithType); + return { + edits: changeTracker.getChanges(), + renameFilename: undefined, + renameLocation: undefined + }; + } + function isDeclarationWithType(node) { + return ts.isFunctionLikeDeclaration(node) || + node.kind === 226 /* VariableDeclaration */ || + node.kind === 146 /* Parameter */ || + node.kind === 148 /* PropertySignature */ || + node.kind === 149 /* PropertyDeclaration */; + } + function addTypesToFunctionLike(decl) { + var typeParameters = ts.getEffectiveTypeParameterDeclarations(decl, /*checkJSDoc*/ true); + var parameters = decl.parameters.map(function (p) { return ts.createParameter(p.decorators, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, transformJSDocType(ts.getEffectiveTypeAnnotationNode(p, /*checkJSDoc*/ true)), p.initializer); }); + var returnType = transformJSDocType(ts.getEffectiveReturnTypeNode(decl, /*checkJSDoc*/ true)); + switch (decl.kind) { + case 228 /* FunctionDeclaration */: + return ts.createFunctionDeclaration(decl.decorators, decl.modifiers, decl.asteriskToken, decl.name, typeParameters, parameters, returnType, decl.body); + case 152 /* Constructor */: + return ts.createConstructor(decl.decorators, decl.modifiers, parameters, decl.body); + case 186 /* FunctionExpression */: + return ts.createFunctionExpression(decl.modifiers, decl.asteriskToken, decl.name, typeParameters, parameters, returnType, decl.body); + case 187 /* ArrowFunction */: + return ts.createArrowFunction(decl.modifiers, typeParameters, parameters, returnType, decl.equalsGreaterThanToken, decl.body); + case 151 /* MethodDeclaration */: + return ts.createMethod(decl.decorators, decl.modifiers, decl.asteriskToken, decl.name, decl.questionToken, typeParameters, parameters, returnType, decl.body); + case 153 /* GetAccessor */: + return ts.createGetAccessor(decl.decorators, decl.modifiers, decl.name, decl.parameters, returnType, decl.body); + case 154 /* SetAccessor */: + return ts.createSetAccessor(decl.decorators, decl.modifiers, decl.name, parameters, decl.body); + default: + return ts.Debug.assertNever(decl, "Unexpected SyntaxKind: " + decl.kind); + } + } + function addType(decl, jsdocType) { + switch (decl.kind) { + case 226 /* VariableDeclaration */: + return ts.createVariableDeclaration(decl.name, jsdocType, decl.initializer); + case 148 /* PropertySignature */: + return ts.createPropertySignature(decl.modifiers, decl.name, decl.questionToken, jsdocType, decl.initializer); + case 149 /* PropertyDeclaration */: + return ts.createProperty(decl.decorators, decl.modifiers, decl.name, decl.questionToken, jsdocType, decl.initializer); + default: + return ts.Debug.fail("Unexpected SyntaxKind: " + decl.kind); + } + } + function transformJSDocType(node) { + if (node === undefined) { + return undefined; + } + switch (node.kind) { + case 268 /* JSDocAllType */: + case 269 /* JSDocUnknownType */: + return ts.createTypeReferenceNode("any", ts.emptyArray); + case 272 /* JSDocOptionalType */: + return transformJSDocOptionalType(node); + case 271 /* JSDocNonNullableType */: + return transformJSDocType(node.type); + case 270 /* JSDocNullableType */: + return transformJSDocNullableType(node); + case 274 /* JSDocVariadicType */: + return transformJSDocVariadicType(node); + case 273 /* JSDocFunctionType */: + return transformJSDocFunctionType(node); + case 146 /* Parameter */: + return transformJSDocParameter(node); + case 159 /* TypeReference */: + return transformJSDocTypeReference(node); + default: + return ts.visitEachChild(node, transformJSDocType, /*context*/ undefined); + } + } + function transformJSDocOptionalType(node) { + return ts.createUnionTypeNode([ts.visitNode(node.type, transformJSDocType), ts.createTypeReferenceNode("undefined", ts.emptyArray)]); + } + function transformJSDocNullableType(node) { + return ts.createUnionTypeNode([ts.visitNode(node.type, transformJSDocType), ts.createTypeReferenceNode("null", ts.emptyArray)]); + } + function transformJSDocVariadicType(node) { + return ts.createArrayTypeNode(ts.visitNode(node.type, transformJSDocType)); + } + function transformJSDocFunctionType(node) { + var parameters = node.parameters && node.parameters.map(transformJSDocType); + return ts.createFunctionTypeNode(ts.emptyArray, parameters, node.type); + } + function transformJSDocParameter(node) { + var index = node.parent.parameters.indexOf(node); + var isRest = node.type.kind === 274 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + var name = node.name || (isRest ? "rest" : "arg" + index); + var dotdotdot = isRest ? ts.createToken(24 /* DotDotDotToken */) : node.dotDotDotToken; + return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); + } + function transformJSDocTypeReference(node) { + var name = node.typeName; + var args = node.typeArguments; + if (ts.isIdentifier(node.typeName)) { + var text = node.typeName.text; + switch (node.typeName.text) { + case "String": + case "Boolean": + case "Object": + case "Number": + text = text.toLowerCase(); + break; + case "array": + case "date": + case "promise": + text = text[0].toUpperCase() + text.slice(1); + break; + } + name = ts.createIdentifier(text); + if ((text === "Array" || text === "Promise") && !node.typeArguments) { + args = ts.createNodeArray([ts.createTypeReferenceNode("any", ts.emptyArray)]); + } + else { + args = ts.visitNodes(node.typeArguments, transformJSDocType); + } + } + return ts.createTypeReferenceNode(name, args); + } + })(annotateWithTypeFromJSDoc = refactor_2.annotateWithTypeFromJSDoc || (refactor_2.annotateWithTypeFromJSDoc = {})); + })(refactor = ts.refactor || (ts.refactor = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var refactor; (function (refactor) { @@ -92035,14 +92339,14 @@ var ts; if (!ts.isInJavaScriptFile(context.file)) { return undefined; } - var start = context.startPosition; - var node = ts.getTokenAtPosition(context.file, start, /*includeJsDocComment*/ false); - var checker = context.program.getTypeChecker(); - var symbol = checker.getSymbolAtLocation(node); - if (symbol && ts.isDeclarationOfFunctionOrClassExpression(symbol)) { + var symbol = getConstructorSymbol(context); + if (!symbol) { + return undefined; + } + if (ts.isDeclarationOfFunctionOrClassExpression(symbol)) { symbol = symbol.valueDeclaration.initializer.symbol; } - if (symbol && (symbol.flags & 16 /* Function */) && symbol.members && (symbol.members.size > 0)) { + if ((symbol.flags & 16 /* Function */) && symbol.members && (symbol.members.size > 0)) { return [ { name: convertFunctionToES6Class.name, @@ -92062,11 +92366,8 @@ var ts; if (actionName !== action) { return undefined; } - var start = context.startPosition; var sourceFile = context.file; - var checker = context.program.getTypeChecker(); - var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false); - var ctorSymbol = checker.getSymbolAtLocation(token); + var ctorSymbol = getConstructorSymbol(context); var newLine = context.rulesProvider.getFormatOptions().newLineCharacter; var deletedNodes = []; var deletes = []; @@ -92254,6 +92555,12 @@ var ts; return ts.filter(source.modifiers, function (modifier) { return modifier.kind === kind; }); } } + function getConstructorSymbol(_a) { + var startPosition = _a.startPosition, file = _a.file, program = _a.program; + var checker = program.getTypeChecker(); + var token = ts.getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false); + return checker.getSymbolAtLocation(token); + } })(convertFunctionToES6Class = refactor.convertFunctionToES6Class || (refactor.convertFunctionToES6Class = {})); })(refactor = ts.refactor || (ts.refactor = {})); })(ts || (ts = {})); @@ -93806,6 +94113,7 @@ var ts; })(extractSymbol = refactor.extractSymbol || (refactor.extractSymbol = {})); })(refactor = ts.refactor || (ts.refactor = {})); })(ts || (ts = {})); +/// /// /// /// diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index ca24c94ce30..654b1d2a53b 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -5386,8 +5386,10 @@ var ts; Extract_constant: diag(95006, ts.DiagnosticCategory.Message, "Extract_constant_95006", "Extract constant"), Extract_to_0_in_enclosing_scope: diag(95007, ts.DiagnosticCategory.Message, "Extract_to_0_in_enclosing_scope_95007", "Extract to {0} in enclosing scope"), Extract_to_0_in_1_scope: diag(95008, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_scope_95008", "Extract to {0} in {1} scope"), - Infer_type_of_0_from_usage: diag(95009, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95009", "Infer type of '{0}' from usage."), - Infer_parameter_types_from_usage: diag(95010, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95010", "Infer parameter types from usage."), + Annotate_with_type_from_JSDoc: diag(95009, ts.DiagnosticCategory.Message, "Annotate_with_type_from_JSDoc_95009", "Annotate with type from JSDoc"), + Annotate_with_types_from_JSDoc: diag(95010, ts.DiagnosticCategory.Message, "Annotate_with_types_from_JSDoc_95010", "Annotate with types from JSDoc"), + Infer_type_of_0_from_usage: diag(95011, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95011", "Infer type of '{0}' from usage."), + Infer_parameter_types_from_usage: diag(95012, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95012", "Infer parameter types from usage."), }; })(ts || (ts = {})); /// @@ -9721,11 +9723,11 @@ var ts; * Gets the effective type annotation of a variable, parameter, or property. If the node was * parsed in a JavaScript file, gets the type annotation from JSDoc. */ - function getEffectiveTypeAnnotationNode(node) { + function getEffectiveTypeAnnotationNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocType(node); } } @@ -9734,11 +9736,11 @@ var ts; * Gets the effective return type annotation of a signature. If the node was parsed in a * JavaScript file, gets the return type annotation from JSDoc. */ - function getEffectiveReturnTypeNode(node) { + function getEffectiveReturnTypeNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocReturnType(node); } } @@ -9747,11 +9749,11 @@ var ts; * Gets the effective type parameters. If the node was parsed in a * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. */ - function getEffectiveTypeParameterDeclarations(node) { + function getEffectiveTypeParameterDeclarations(node, checkJSDoc) { if (node.typeParameters) { return node.typeParameters; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { var templateTag = ts.getJSDocTemplateTag(node); return templateTag && templateTag.typeParameters; } @@ -9761,9 +9763,9 @@ var ts; * Gets the effective type annotation of the value parameter of a set accessor. If the node * was parsed in a JavaScript file, gets the type annotation from JSDoc. */ - function getEffectiveSetAccessorTypeAnnotationNode(node) { + function getEffectiveSetAccessorTypeAnnotationNode(node, checkJSDoc) { var parameter = getSetAccessorValueParameter(node); - return parameter && getEffectiveTypeAnnotationNode(parameter); + return parameter && getEffectiveTypeAnnotationNode(parameter, checkJSDoc); } ts.getEffectiveSetAccessorTypeAnnotationNode = getEffectiveSetAccessorTypeAnnotationNode; function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { @@ -11995,7 +11997,14 @@ var ts; || kind === 139 /* UndefinedKeyword */ || kind === 95 /* NullKeyword */ || kind === 130 /* NeverKeyword */ - || kind === 201 /* ExpressionWithTypeArguments */; + || kind === 201 /* ExpressionWithTypeArguments */ + || kind === 268 /* JSDocAllType */ + || kind === 269 /* JSDocUnknownType */ + || kind === 270 /* JSDocNullableType */ + || kind === 271 /* JSDocNonNullableType */ + || kind === 272 /* JSDocOptionalType */ + || kind === 273 /* JSDocFunctionType */ + || kind === 274 /* JSDocVariadicType */; } /** * Node test that determines whether a node is a valid type node. @@ -23200,7 +23209,7 @@ var ts; var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string" ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version } : undefined; - return { packageJsonContent: packageJsonContent, packageId: packageId }; + return { found: true, packageJsonContent: packageJsonContent, packageId: packageId }; } else { if (directoryExists && traceEnabled) { @@ -23208,7 +23217,7 @@ var ts; } // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results failedLookupLocations.push(packageJsonPath); - return { packageJsonContent: undefined, packageId: undefined }; + return { found: false, packageJsonContent: undefined, packageId: undefined }; } } function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) { @@ -23257,10 +23266,22 @@ var ts; return ts.combinePaths(directory, "package.json"); } function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { - var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; - var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); - var _b = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state), packageJsonContent = _b.packageJsonContent, packageId = _b.packageId; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. + var packageJsonContent; + var packageId; + var packageInfo = getPackageJsonInfo(candidate, "", failedLookupLocations, /*onlyRecordFailures*/ !nodeModulesFolderExists, state); + if (packageInfo.found) { + (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId); + } + else { + var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; + if (rest !== "") { + var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); + // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId. + packageId = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state).packageId; + } + } var pathAndExtension = loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state, packageJsonContent); return withPackageId(packageId, pathAndExtension); @@ -26483,7 +26504,7 @@ var ts; else if (flags & 16384 /* WriteClassExpressionAsTypeLiteral */ && type.symbol.valueDeclaration && type.symbol.valueDeclaration.kind === 199 /* ClassExpression */) { - writeAnonymousType(getDeclaredTypeOfClassOrInterface(type.symbol), flags); + writeAnonymousType(type, flags); } else { // Write the type reference in the format f.g.C where A and B are type arguments @@ -28710,7 +28731,7 @@ var ts; var propertySymbol = _a[_i]; addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); } - if (getIndexInfoOfType(modifiersType, 0 /* String */)) { + if (modifiersType.flags & 1 /* Any */ || getIndexInfoOfType(modifiersType, 0 /* String */)) { addMemberForKeyType(stringType); } } @@ -28753,7 +28774,7 @@ var ts; prop.syntheticLiteralTypeOrigin = t; members.set(propName, prop); } - else if (t.flags & 2 /* String */) { + else if (t.flags & (1 /* Any */ | 2 /* String */)) { stringIndexInfo = createIndexInfo(propType, templateReadonly); } } @@ -31091,7 +31112,7 @@ var ts; return instantiateAnonymousType(type, mapper); } function isMappableType(type) { - return type.flags & (16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */); + return type.flags & (1 /* Any */ | 16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */); } function instantiateAnonymousType(type, mapper) { var result = createObjectType(type.objectFlags | 64 /* Instantiated */, type.symbol); @@ -35572,6 +35593,10 @@ var ts; var funcHasRestParameters = ts.hasRestParameter(func); var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (ts.getThisParameter(func) !== undefined && !contextualSignature.thisParameter) { + ts.Debug.assert(indexOfParameter !== 0); // Otherwise we should not have called `getContextuallyTypedParameterType`. + indexOfParameter -= 1; + } if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } @@ -38854,9 +38879,10 @@ var ts; // in a JS file // Note:JS inferred classes might come from a variable declaration instead of a function declaration. // In this case, using getResolvedSymbol directly is required to avoid losing the members from the declaration. - var funcSymbol = node.expression.kind === 71 /* Identifier */ ? - getResolvedSymbol(node.expression) : - checkExpression(node.expression).symbol; + var funcSymbol = checkExpression(node.expression).symbol; + if (!funcSymbol && node.expression.kind === 71 /* Identifier */) { + funcSymbol = getResolvedSymbol(node.expression); + } var type = funcSymbol && getJavaScriptClassType(funcSymbol); if (type) { return type; @@ -41411,7 +41437,7 @@ var ts; if (!types) { return undefined; } - return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, /*subtypeReduction*/ true); + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types); } var promisedType = getPromisedTypeOfPromise(type); if (promisedType) { @@ -55510,7 +55536,7 @@ var ts; /*parameters*/ [], /*type*/ undefined, body); // Mark this node as originally an async function - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */; + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */ | 524288 /* ReuseTempVariableScope */; return ts.createCall(ts.getHelperName("__awaiter"), /*typeArguments*/ undefined, [ ts.createThis(), @@ -59368,7 +59394,8 @@ var ts; // Do not do this in the global scope, as any variable we currently generate could conflict with // variables from outside of the current compilation. In the future, we can revisit this behavior. if (ts.isExternalModule(currentSourceFile)) { - var tempVar = ts.createTempVariable(recordTaggedTemplateString); + var tempVar = ts.createUniqueName("templateObject"); + recordTaggedTemplateString(tempVar); templateArguments[0] = ts.createLogicalOr(tempVar, ts.createAssignment(tempVar, helperCall)); } else { @@ -64328,7 +64355,7 @@ var ts; return ts.isBindingPattern(node.name) ? ts.flattenDestructuringAssignment(node, destructuringAndImportCallVisitor, context, 0 /* All */, /*needsValue*/ false, createAssignment) - : createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)); + : node.initializer ? createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)) : node.name; } /** * Creates an assignment expression for an exported variable declaration. @@ -64719,6 +64746,9 @@ var ts; for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; expressions = ts.append(expressions, transformInitializedVariable(variable, /*isExportedDeclaration*/ false)); + if (!variable.initializer) { + hoistBindingElement(variable); + } } return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); } @@ -68479,6 +68509,8 @@ var ts; return emitTypeReference(node); case 160 /* FunctionType */: return emitFunctionType(node); + case 273 /* JSDocFunctionType */: + return emitJSDocFunctionType(node); case 161 /* ConstructorType */: return emitConstructorType(node); case 162 /* TypeQuery */: @@ -68507,6 +68539,20 @@ var ts; return emitMappedType(node); case 173 /* LiteralType */: return emitLiteralType(node); + case 268 /* JSDocAllType */: + write("*"); + return; + case 269 /* JSDocUnknownType */: + write("?"); + return; + case 270 /* JSDocNullableType */: + return emitJSDocNullableType(node); + case 271 /* JSDocNonNullableType */: + return emitJSDocNonNullableType(node); + case 272 /* JSDocOptionalType */: + return emitJSDocOptionalType(node); + case 274 /* JSDocVariadicType */: + return emitJSDocVariadicType(node); // Binding patterns case 174 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); @@ -68811,9 +68857,16 @@ var ts; emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); emitIfPresent(node.dotDotDotToken); - emit(node.name); + if (node.name) { + emit(node.name); + } emitIfPresent(node.questionToken); - emitWithPrefix(": ", node.type); + if (node.parent && node.parent.kind === 273 /* JSDocFunctionType */ && !node.name) { + emit(node.type); + } + else { + emitWithPrefix(": ", node.type); + } emitExpressionWithPrefix(" = ", node.initializer); } function emitDecorator(decorator) { @@ -68915,6 +68968,24 @@ var ts; write(" => "); emit(node.type); } + function emitJSDocFunctionType(node) { + write("function"); + emitParameters(node, node.parameters); + write(":"); + emit(node.type); + } + function emitJSDocNullableType(node) { + write("?"); + emit(node.type); + } + function emitJSDocNonNullableType(node) { + write("!"); + emit(node.type); + } + function emitJSDocOptionalType(node) { + emit(node.type); + write("="); + } function emitConstructorType(node) { write("new "); emitTypeParameters(node, node.typeParameters); @@ -68936,6 +69007,10 @@ var ts; emit(node.elementType); write("[]"); } + function emitJSDocVariadicType(node) { + write("..."); + emit(node.type); + } function emitTupleType(node) { write("["); emitList(node, node.elementTypes, 336 /* TupleTypeElements */); @@ -75862,8 +75937,11 @@ var ts; return start < end; } ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; + /** + * Assumes `candidate.start <= position` holds. + */ function positionBelongsToNode(candidate, position, sourceFile) { - return candidate.end > position || !isCompletedNode(candidate, sourceFile); + return position < candidate.end || !isCompletedNode(candidate, sourceFile); } ts.positionBelongsToNode = positionBelongsToNode; function isCompletedNode(n, sourceFile) { @@ -88641,16 +88719,19 @@ var ts; Value[Value["Unknown"] = -1] = "Unknown"; })(Value || (Value = {})); /** - * Computed indentation for a given position in source file - * @param position - position in file - * @param sourceFile - target source file - * @param options - set of editor options that control indentation - * @param assumeNewLineBeforeCloseBrace - false when getIndentation is called on the text from the real source file. - * true - when we need to assume that position is on the newline. This is usefult for codefixes, i.e. + * @param assumeNewLineBeforeCloseBrace + * `false` when called on text from a real source file. + * `true` when we need to assume `position` is on a newline. + * + * This is useful for codefixes. Consider + * ``` * function f() { * |} - * when inserting some text after open brace we would like to get the value of indentation as if newline was already there. - * However by default indentation at position | will be 0 so 'assumeNewLineBeforeCloseBrace' allows to override this behavior, + * ``` + * with `position` at `|`. + * + * When inserting some text after an open brace, we would like to get indentation as if a newline was already there. + * By default indentation at `position` will be 0 so 'assumeNewLineBeforeCloseBrace' overrides this behavior. */ function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { if (assumeNewLineBeforeCloseBrace === void 0) { assumeNewLineBeforeCloseBrace = false; } @@ -88761,9 +88842,10 @@ var ts; SmartIndenter.getBaseIndentation = getBaseIndentation; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { var parent = current.parent; - var parentStart; - // walk upwards and collect indentations for pairs of parent-child nodes - // indentation is not added if parent and child nodes start on the same line or if parent is IfStatement and child starts on the same line with 'else clause' + var containingListOrParentStart; + // Walk up the tree and collect indentation for parent-child node pairs. Indentation is not added if + // * parent and child nodes start on the same line, or + // * parent is an IfStatement and child starts on the same line as an 'else clause'. while (parent) { var useActualIndentation = true; if (ignoreActualIndentationRange) { @@ -88777,8 +88859,8 @@ var ts; return actualIndentation + indentationDelta; } } - parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || + containingListOrParentStart = getContainingListOrParentStart(parent, current, sourceFile); + var parentAndChildShareLine = containingListOrParentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { // try to fetch actual indentation for current node from source text @@ -88795,18 +88877,25 @@ var ts; if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { indentationDelta += options.indentSize; } + // In our AST, a call argument's `parent` is the call-expression, not the argument list. + // We would like to increase indentation based on the relationship between an argument and its argument-list, + // so we spoof the starting position of the (parent) call-expression to match the (non-parent) argument-list. + // But, the spoofed start-value could then cause a problem when comparing the start position of the call-expression + // to *its* parent (in the case of an iife, an expression statement), adding an extra level of indentation. + // + // Instead, when at an argument, we unspoof the starting position of the enclosing call expression + // *after* applying indentation for the argument. + var useTrueStart = isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, current, currentStart.line, sourceFile); current = parent; - currentStart = parentStart; parent = current.parent; + currentStart = useTrueStart ? sourceFile.getLineAndCharacterOfPosition(current.getStart()) : containingListOrParentStart; } return indentationDelta + getBaseIndentation(options); } - function getParentStart(parent, child, sourceFile) { + function getContainingListOrParentStart(parent, child, sourceFile) { var containingList = getContainingList(child, sourceFile); - if (containingList) { - return sourceFile.getLineAndCharacterOfPosition(containingList.pos); - } - return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); + var startPos = containingList ? containingList.pos : parent.getStart(sourceFile); + return sourceFile.getLineAndCharacterOfPosition(startPos); } /* * Function returns Value.Unknown if indentation cannot be determined @@ -88868,6 +88957,15 @@ var ts; function getStartLineAndCharacterForNode(n, sourceFile) { return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } + function isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, child, childStartLine, sourceFile) { + if (!(ts.isCallExpression(parent) && ts.contains(parent.arguments, child))) { + return false; + } + var expressionOfCallExpressionEnd = parent.expression.getEnd(); + var expressionOfCallExpressionEndLine = ts.getLineAndCharacterOfPosition(sourceFile, expressionOfCallExpressionEnd).line; + return expressionOfCallExpressionEndLine === childStartLine; + } + SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { if (parent.kind === 211 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 82 /* ElseKeyword */, sourceFile); @@ -92018,6 +92116,212 @@ var ts; /// /* @internal */ var ts; +(function (ts) { + var refactor; + (function (refactor_2) { + var annotateWithTypeFromJSDoc; + (function (annotateWithTypeFromJSDoc) { + var actionName = "annotate"; + var annotateTypeFromJSDoc = { + name: "Annotate with type from JSDoc", + description: ts.Diagnostics.Annotate_with_type_from_JSDoc.message, + getEditsForAction: getEditsForAnnotation, + getAvailableActions: getAvailableActions + }; + var annotateFunctionFromJSDoc = { + name: "Annotate with types from JSDoc", + description: ts.Diagnostics.Annotate_with_types_from_JSDoc.message, + getEditsForAction: getEditsForFunctionAnnotation, + getAvailableActions: getAvailableActions + }; + refactor_2.registerRefactor(annotateTypeFromJSDoc); + refactor_2.registerRefactor(annotateFunctionFromJSDoc); + function getAvailableActions(context) { + if (ts.isInJavaScriptFile(context.file)) { + return undefined; + } + var node = ts.getTokenAtPosition(context.file, context.startPosition, /*includeJsDocComment*/ false); + var decl = ts.findAncestor(node, isDeclarationWithType); + if (!decl || decl.type) { + return undefined; + } + var jsdocType = ts.getJSDocType(decl); + var isFunctionWithJSDoc = ts.isFunctionLikeDeclaration(decl) && (ts.getJSDocReturnType(decl) || decl.parameters.some(function (p) { return !!ts.getJSDocType(p); })); + var refactor = (isFunctionWithJSDoc || jsdocType && decl.kind === 146 /* Parameter */) ? annotateFunctionFromJSDoc : + jsdocType ? annotateTypeFromJSDoc : + undefined; + if (refactor) { + return [{ + name: refactor.name, + description: refactor.description, + actions: [ + { + description: refactor.description, + name: actionName + } + ] + }]; + } + } + function getEditsForAnnotation(context, action) { + if (actionName !== action) { + return ts.Debug.fail("actionName !== action: " + actionName + " !== " + action); + } + var sourceFile = context.file; + var token = ts.getTokenAtPosition(sourceFile, context.startPosition, /*includeJsDocComment*/ false); + var decl = ts.findAncestor(token, isDeclarationWithType); + var jsdocType = ts.getJSDocType(decl); + if (!decl || !jsdocType || decl.type) { + return ts.Debug.fail("!decl || !jsdocType || decl.type: !" + decl + " || !" + jsdocType + " || " + decl.type); + } + var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); + var declarationWithType = addType(decl, transformJSDocType(jsdocType)); + ts.suppressLeadingAndTrailingTrivia(declarationWithType); + changeTracker.replaceRange(sourceFile, { pos: decl.getStart(), end: decl.end }, declarationWithType); + return { + edits: changeTracker.getChanges(), + renameFilename: undefined, + renameLocation: undefined + }; + } + function getEditsForFunctionAnnotation(context, action) { + if (actionName !== action) { + return ts.Debug.fail("actionName !== action: " + actionName + " !== " + action); + } + var sourceFile = context.file; + var token = ts.getTokenAtPosition(sourceFile, context.startPosition, /*includeJsDocComment*/ false); + var decl = ts.findAncestor(token, ts.isFunctionLikeDeclaration); + var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); + var functionWithType = addTypesToFunctionLike(decl); + ts.suppressLeadingAndTrailingTrivia(functionWithType); + changeTracker.replaceRange(sourceFile, { pos: decl.getStart(), end: decl.end }, functionWithType); + return { + edits: changeTracker.getChanges(), + renameFilename: undefined, + renameLocation: undefined + }; + } + function isDeclarationWithType(node) { + return ts.isFunctionLikeDeclaration(node) || + node.kind === 226 /* VariableDeclaration */ || + node.kind === 146 /* Parameter */ || + node.kind === 148 /* PropertySignature */ || + node.kind === 149 /* PropertyDeclaration */; + } + function addTypesToFunctionLike(decl) { + var typeParameters = ts.getEffectiveTypeParameterDeclarations(decl, /*checkJSDoc*/ true); + var parameters = decl.parameters.map(function (p) { return ts.createParameter(p.decorators, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, transformJSDocType(ts.getEffectiveTypeAnnotationNode(p, /*checkJSDoc*/ true)), p.initializer); }); + var returnType = transformJSDocType(ts.getEffectiveReturnTypeNode(decl, /*checkJSDoc*/ true)); + switch (decl.kind) { + case 228 /* FunctionDeclaration */: + return ts.createFunctionDeclaration(decl.decorators, decl.modifiers, decl.asteriskToken, decl.name, typeParameters, parameters, returnType, decl.body); + case 152 /* Constructor */: + return ts.createConstructor(decl.decorators, decl.modifiers, parameters, decl.body); + case 186 /* FunctionExpression */: + return ts.createFunctionExpression(decl.modifiers, decl.asteriskToken, decl.name, typeParameters, parameters, returnType, decl.body); + case 187 /* ArrowFunction */: + return ts.createArrowFunction(decl.modifiers, typeParameters, parameters, returnType, decl.equalsGreaterThanToken, decl.body); + case 151 /* MethodDeclaration */: + return ts.createMethod(decl.decorators, decl.modifiers, decl.asteriskToken, decl.name, decl.questionToken, typeParameters, parameters, returnType, decl.body); + case 153 /* GetAccessor */: + return ts.createGetAccessor(decl.decorators, decl.modifiers, decl.name, decl.parameters, returnType, decl.body); + case 154 /* SetAccessor */: + return ts.createSetAccessor(decl.decorators, decl.modifiers, decl.name, parameters, decl.body); + default: + return ts.Debug.assertNever(decl, "Unexpected SyntaxKind: " + decl.kind); + } + } + function addType(decl, jsdocType) { + switch (decl.kind) { + case 226 /* VariableDeclaration */: + return ts.createVariableDeclaration(decl.name, jsdocType, decl.initializer); + case 148 /* PropertySignature */: + return ts.createPropertySignature(decl.modifiers, decl.name, decl.questionToken, jsdocType, decl.initializer); + case 149 /* PropertyDeclaration */: + return ts.createProperty(decl.decorators, decl.modifiers, decl.name, decl.questionToken, jsdocType, decl.initializer); + default: + return ts.Debug.fail("Unexpected SyntaxKind: " + decl.kind); + } + } + function transformJSDocType(node) { + if (node === undefined) { + return undefined; + } + switch (node.kind) { + case 268 /* JSDocAllType */: + case 269 /* JSDocUnknownType */: + return ts.createTypeReferenceNode("any", ts.emptyArray); + case 272 /* JSDocOptionalType */: + return transformJSDocOptionalType(node); + case 271 /* JSDocNonNullableType */: + return transformJSDocType(node.type); + case 270 /* JSDocNullableType */: + return transformJSDocNullableType(node); + case 274 /* JSDocVariadicType */: + return transformJSDocVariadicType(node); + case 273 /* JSDocFunctionType */: + return transformJSDocFunctionType(node); + case 146 /* Parameter */: + return transformJSDocParameter(node); + case 159 /* TypeReference */: + return transformJSDocTypeReference(node); + default: + return ts.visitEachChild(node, transformJSDocType, /*context*/ undefined); + } + } + function transformJSDocOptionalType(node) { + return ts.createUnionTypeNode([ts.visitNode(node.type, transformJSDocType), ts.createTypeReferenceNode("undefined", ts.emptyArray)]); + } + function transformJSDocNullableType(node) { + return ts.createUnionTypeNode([ts.visitNode(node.type, transformJSDocType), ts.createTypeReferenceNode("null", ts.emptyArray)]); + } + function transformJSDocVariadicType(node) { + return ts.createArrayTypeNode(ts.visitNode(node.type, transformJSDocType)); + } + function transformJSDocFunctionType(node) { + var parameters = node.parameters && node.parameters.map(transformJSDocType); + return ts.createFunctionTypeNode(ts.emptyArray, parameters, node.type); + } + function transformJSDocParameter(node) { + var index = node.parent.parameters.indexOf(node); + var isRest = node.type.kind === 274 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + var name = node.name || (isRest ? "rest" : "arg" + index); + var dotdotdot = isRest ? ts.createToken(24 /* DotDotDotToken */) : node.dotDotDotToken; + return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); + } + function transformJSDocTypeReference(node) { + var name = node.typeName; + var args = node.typeArguments; + if (ts.isIdentifier(node.typeName)) { + var text = node.typeName.text; + switch (node.typeName.text) { + case "String": + case "Boolean": + case "Object": + case "Number": + text = text.toLowerCase(); + break; + case "array": + case "date": + case "promise": + text = text[0].toUpperCase() + text.slice(1); + break; + } + name = ts.createIdentifier(text); + if ((text === "Array" || text === "Promise") && !node.typeArguments) { + args = ts.createNodeArray([ts.createTypeReferenceNode("any", ts.emptyArray)]); + } + else { + args = ts.visitNodes(node.typeArguments, transformJSDocType); + } + } + return ts.createTypeReferenceNode(name, args); + } + })(annotateWithTypeFromJSDoc = refactor_2.annotateWithTypeFromJSDoc || (refactor_2.annotateWithTypeFromJSDoc = {})); + })(refactor = ts.refactor || (ts.refactor = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var refactor; (function (refactor) { @@ -92035,14 +92339,14 @@ var ts; if (!ts.isInJavaScriptFile(context.file)) { return undefined; } - var start = context.startPosition; - var node = ts.getTokenAtPosition(context.file, start, /*includeJsDocComment*/ false); - var checker = context.program.getTypeChecker(); - var symbol = checker.getSymbolAtLocation(node); - if (symbol && ts.isDeclarationOfFunctionOrClassExpression(symbol)) { + var symbol = getConstructorSymbol(context); + if (!symbol) { + return undefined; + } + if (ts.isDeclarationOfFunctionOrClassExpression(symbol)) { symbol = symbol.valueDeclaration.initializer.symbol; } - if (symbol && (symbol.flags & 16 /* Function */) && symbol.members && (symbol.members.size > 0)) { + if ((symbol.flags & 16 /* Function */) && symbol.members && (symbol.members.size > 0)) { return [ { name: convertFunctionToES6Class.name, @@ -92062,11 +92366,8 @@ var ts; if (actionName !== action) { return undefined; } - var start = context.startPosition; var sourceFile = context.file; - var checker = context.program.getTypeChecker(); - var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false); - var ctorSymbol = checker.getSymbolAtLocation(token); + var ctorSymbol = getConstructorSymbol(context); var newLine = context.rulesProvider.getFormatOptions().newLineCharacter; var deletedNodes = []; var deletes = []; @@ -92254,6 +92555,12 @@ var ts; return ts.filter(source.modifiers, function (modifier) { return modifier.kind === kind; }); } } + function getConstructorSymbol(_a) { + var startPosition = _a.startPosition, file = _a.file, program = _a.program; + var checker = program.getTypeChecker(); + var token = ts.getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false); + return checker.getSymbolAtLocation(token); + } })(convertFunctionToES6Class = refactor.convertFunctionToES6Class || (refactor.convertFunctionToES6Class = {})); })(refactor = ts.refactor || (ts.refactor = {})); })(ts || (ts = {})); @@ -93806,6 +94113,7 @@ var ts; })(extractSymbol = refactor.extractSymbol || (refactor.extractSymbol = {})); })(refactor = ts.refactor || (ts.refactor = {})); })(ts || (ts = {})); +/// /// /// /// diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 4b897eb3548..44f1e9cd7a3 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -3808,8 +3808,10 @@ var ts; Extract_constant: diag(95006, ts.DiagnosticCategory.Message, "Extract_constant_95006", "Extract constant"), Extract_to_0_in_enclosing_scope: diag(95007, ts.DiagnosticCategory.Message, "Extract_to_0_in_enclosing_scope_95007", "Extract to {0} in enclosing scope"), Extract_to_0_in_1_scope: diag(95008, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_scope_95008", "Extract to {0} in {1} scope"), - Infer_type_of_0_from_usage: diag(95009, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95009", "Infer type of '{0}' from usage."), - Infer_parameter_types_from_usage: diag(95010, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95010", "Infer parameter types from usage."), + Annotate_with_type_from_JSDoc: diag(95009, ts.DiagnosticCategory.Message, "Annotate_with_type_from_JSDoc_95009", "Annotate with type from JSDoc"), + Annotate_with_types_from_JSDoc: diag(95010, ts.DiagnosticCategory.Message, "Annotate_with_types_from_JSDoc_95010", "Annotate with types from JSDoc"), + Infer_type_of_0_from_usage: diag(95011, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95011", "Infer type of '{0}' from usage."), + Infer_parameter_types_from_usage: diag(95012, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95012", "Infer parameter types from usage."), }; })(ts || (ts = {})); var ts; @@ -6093,37 +6095,37 @@ var ts; }; } ts.getAllAccessorDeclarations = getAllAccessorDeclarations; - function getEffectiveTypeAnnotationNode(node) { + function getEffectiveTypeAnnotationNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocType(node); } } ts.getEffectiveTypeAnnotationNode = getEffectiveTypeAnnotationNode; - function getEffectiveReturnTypeNode(node) { + function getEffectiveReturnTypeNode(node, checkJSDoc) { if (node.type) { return node.type; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { return ts.getJSDocReturnType(node); } } ts.getEffectiveReturnTypeNode = getEffectiveReturnTypeNode; - function getEffectiveTypeParameterDeclarations(node) { + function getEffectiveTypeParameterDeclarations(node, checkJSDoc) { if (node.typeParameters) { return node.typeParameters; } - if (isInJavaScriptFile(node)) { + if (checkJSDoc || isInJavaScriptFile(node)) { var templateTag = ts.getJSDocTemplateTag(node); return templateTag && templateTag.typeParameters; } } ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations; - function getEffectiveSetAccessorTypeAnnotationNode(node) { + function getEffectiveSetAccessorTypeAnnotationNode(node, checkJSDoc) { var parameter = getSetAccessorValueParameter(node); - return parameter && getEffectiveTypeAnnotationNode(parameter); + return parameter && getEffectiveTypeAnnotationNode(parameter, checkJSDoc); } ts.getEffectiveSetAccessorTypeAnnotationNode = getEffectiveSetAccessorTypeAnnotationNode; function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { @@ -8006,7 +8008,14 @@ var ts; || kind === 139 || kind === 95 || kind === 130 - || kind === 201; + || kind === 201 + || kind === 268 + || kind === 269 + || kind === 270 + || kind === 271 + || kind === 272 + || kind === 273 + || kind === 274; } function isTypeNode(node) { return isTypeNodeKind(node.kind); @@ -17872,14 +17881,14 @@ var ts; var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string" ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version } : undefined; - return { packageJsonContent: packageJsonContent, packageId: packageId }; + return { found: true, packageJsonContent: packageJsonContent, packageId: packageId }; } else { if (directoryExists && traceEnabled) { trace(host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } failedLookupLocations.push(packageJsonPath); - return { packageJsonContent: undefined, packageId: undefined }; + return { found: false, packageJsonContent: undefined, packageId: undefined }; } } function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) { @@ -17923,10 +17932,20 @@ var ts; return ts.combinePaths(directory, "package.json"); } function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { - var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; - var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); - var _b = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state), packageJsonContent = _b.packageJsonContent, packageId = _b.packageId; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + var packageJsonContent; + var packageId; + var packageInfo = getPackageJsonInfo(candidate, "", failedLookupLocations, !nodeModulesFolderExists, state); + if (packageInfo.found) { + (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId); + } + else { + var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; + if (rest !== "") { + var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); + packageId = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state).packageId; + } + } var pathAndExtension = loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state, packageJsonContent); return withPackageId(packageId, pathAndExtension);