mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update LKG
This commit is contained in:
@@ -332,7 +332,7 @@
|
||||
"Duplicate_number_index_signature_2375": "Duplicitní podpis číselného indexu",
|
||||
"Duplicate_string_index_signature_2374": "Duplicitní signatury řetězcového indexu",
|
||||
"Dynamic_import_cannot_have_type_arguments_1326": "Dynamický import nemůže mít argumenty typu.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Dynamický import se podporuje jenom tehdy, když je příznak --module nastavený na commonjs nebo esNext.",
|
||||
"Dynamic_import_must_have_one_specifier_as_an_argument_1324": "Dynamický import musí mít jako argument jeden specifikátor.",
|
||||
"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "Specifikátor dynamického importu musí být typu string, ale tady má typ {0}.",
|
||||
"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015": "Element má implicitně typ any, protože indexový výraz není typu number.",
|
||||
@@ -567,7 +567,7 @@
|
||||
"Module_name_0_was_successfully_resolved_to_1_6089": "======== Název modulu {0} byl úspěšně přeložen na {1}. ========",
|
||||
"Module_resolution_kind_is_not_specified_using_0_6088": "Druh překladu modulu nebyl určen, použije se {0}.",
|
||||
"Module_resolution_using_rootDirs_has_failed_6111": "Překlad modulu pomocí rootDirs se nepovedl.",
|
||||
"Move_to_a_new_file_95049": "Move to a new file",
|
||||
"Move_to_a_new_file_95049": "Přesunout do nového souboru",
|
||||
"Multiple_consecutive_numeric_separators_are_not_permitted_6189": "Více po sobě jdoucích číselných oddělovačů se nepovoluje.",
|
||||
"Multiple_constructor_implementations_are_not_allowed_2392": "Víc implementací konstruktoru se nepovoluje.",
|
||||
"NEWLINE_6061": "NOVÝ ŘÁDEK",
|
||||
@@ -707,9 +707,11 @@
|
||||
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "Vyvolá chybu u výrazů this s implikovaným typem any.",
|
||||
"Redirect_output_structure_to_the_directory_6006": "Přesměrování výstupní struktury do adresáře",
|
||||
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Odkazovaný projekt {0} musí mít nastavení \"composite\": true.",
|
||||
"Remove_all_unreachable_code_95051": "Odebrat veškerý nedosažitelný kód",
|
||||
"Remove_declaration_for_Colon_0_90004": "Odebrat deklaraci pro {0}",
|
||||
"Remove_destructuring_90009": "Odebrat destrukci",
|
||||
"Remove_import_from_0_90005": "Odebrat import z {0}",
|
||||
"Remove_unreachable_code_95050": "Odebrat nedosažitelný kód",
|
||||
"Replace_import_with_0_95015": "Nahradí import použitím: {0}.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Oznámí se chyba, když některé cesty kódu ve funkci nevracejí hodnotu.",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Oznámí se chyby v případech fallthrough v příkazu switch.",
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
"Duplicate_number_index_signature_2375": "Signature d'index de nombre dupliquée.",
|
||||
"Duplicate_string_index_signature_2374": "Signature d'index de chaîne dupliquée.",
|
||||
"Dynamic_import_cannot_have_type_arguments_1326": "L'importation dynamique ne peut pas avoir d'arguments de type",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "L'importation dynamique est prise en charge uniquement quand l'indicateur '--module' a la valeur 'commonjs' ou 'esNext'.",
|
||||
"Dynamic_import_must_have_one_specifier_as_an_argument_1324": "L'importation dynamique doit avoir un seul spécificateur comme argument.",
|
||||
"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "Le spécificateur de l'importation dynamique doit être de type 'string', mais ici il est de type '{0}'.",
|
||||
"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015": "L'élément possède implicitement un type 'any', car l'expression d'index n'est pas de type 'number'.",
|
||||
@@ -567,7 +567,7 @@
|
||||
"Module_name_0_was_successfully_resolved_to_1_6089": "======== Le nom de module '{0}' a été correctement résolu en '{1}'. ========",
|
||||
"Module_resolution_kind_is_not_specified_using_0_6088": "Le genre de résolution de module n'est pas spécifié. Utilisation de '{0}'.",
|
||||
"Module_resolution_using_rootDirs_has_failed_6111": "Échec de la résolution de module à l'aide de 'rootDirs'.",
|
||||
"Move_to_a_new_file_95049": "Move to a new file",
|
||||
"Move_to_a_new_file_95049": "Déplacer vers un nouveau fichier",
|
||||
"Multiple_consecutive_numeric_separators_are_not_permitted_6189": "Les séparateurs numériques consécutifs multiples ne sont pas autorisés.",
|
||||
"Multiple_constructor_implementations_are_not_allowed_2392": "Les implémentations de plusieurs constructeurs ne sont pas autorisées.",
|
||||
"NEWLINE_6061": "NOUVELLE LIGNE",
|
||||
@@ -707,9 +707,11 @@
|
||||
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "Déclenche une erreur sur les expressions 'this' avec un type 'any' implicite.",
|
||||
"Redirect_output_structure_to_the_directory_6006": "Rediriger la structure de sortie vers le répertoire.",
|
||||
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Le projet référencé '{0}' doit avoir le paramètre \"composite\" avec la valeur true.",
|
||||
"Remove_all_unreachable_code_95051": "Supprimer tout le code inaccessible",
|
||||
"Remove_declaration_for_Colon_0_90004": "Supprimer la déclaration pour : '{0}'",
|
||||
"Remove_destructuring_90009": "Supprimer la déstructuration",
|
||||
"Remove_import_from_0_90005": "Supprimer l'importation de '{0}'",
|
||||
"Remove_unreachable_code_95050": "Supprimer le code inaccessible",
|
||||
"Replace_import_with_0_95015": "Remplacez l'importation par '{0}'.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Signalez une erreur quand les chemins de code de la fonction ne retournent pas tous une valeur.",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Signalez les erreurs pour les case avec fallthrough dans une instruction switch.",
|
||||
|
||||
@@ -331,8 +331,8 @@
|
||||
"Duplicate_label_0_1114": "Etichetta '{0}' duplicata.",
|
||||
"Duplicate_number_index_signature_2375": "La firma dell'indice di tipo number è duplicata.",
|
||||
"Duplicate_string_index_signature_2374": "La firma dell'indice di tipo string è duplicata.",
|
||||
"Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules_1323": "Non è possibile usare l'importazione dinamica quando come destinazione si impostano moduli ECMAScript 2015.",
|
||||
"Dynamic_import_cannot_have_type_arguments_1326": "Nell'importazione dinamica non possono essere presenti argomenti tipo",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "L'importazione dinamica è supportata solo quando il valore del flag '--module' è 'commonjs' o 'esNext'.",
|
||||
"Dynamic_import_must_have_one_specifier_as_an_argument_1324": "Come argomento dell'importazione dinamica si può indicare un solo identificatore.",
|
||||
"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "L'identificatore dell'importazione dinamica deve essere di tipo 'string', ma il tipo specificato qui è '{0}'.",
|
||||
"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015": "L'elemento contiene implicitamente un tipo 'any' perché l'espressione di indice non è di tipo 'number'.",
|
||||
@@ -567,6 +567,7 @@
|
||||
"Module_name_0_was_successfully_resolved_to_1_6089": "======== Il nome del modulo '{0}' è stato risolto in '{1}'. ========",
|
||||
"Module_resolution_kind_is_not_specified_using_0_6088": "Il tipo di risoluzione del modulo non è specificato. Verrà usato '{0}'.",
|
||||
"Module_resolution_using_rootDirs_has_failed_6111": "La risoluzione del modulo con 'rootDirs' non è riuscita.",
|
||||
"Move_to_a_new_file_95049": "Passare a un nuovo file",
|
||||
"Multiple_consecutive_numeric_separators_are_not_permitted_6189": "Non sono consentiti più separatori numerici consecutivi.",
|
||||
"Multiple_constructor_implementations_are_not_allowed_2392": "Non è possibile usare più implementazioni di costruttore.",
|
||||
"NEWLINE_6061": "NUOVA RIGA",
|
||||
@@ -706,9 +707,11 @@
|
||||
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "Genera un errore in caso di espressioni 'this con un tipo 'any' implicito.",
|
||||
"Redirect_output_structure_to_the_directory_6006": "Reindirizza la struttura di output alla directory.",
|
||||
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Il progetto di riferimento '{0}' deve includere l'impostazione \"composite\": true.",
|
||||
"Remove_all_unreachable_code_95051": "Rimuovere tutto il codice non eseguibile",
|
||||
"Remove_declaration_for_Colon_0_90004": "Rimuovere la dichiarazione per '{0}'",
|
||||
"Remove_destructuring_90009": "Rimuovere la destrutturazione",
|
||||
"Remove_import_from_0_90005": "Rimuovere l'importazione da '{0}'",
|
||||
"Remove_unreachable_code_95050": "Rimuovere il codice non eseguibile",
|
||||
"Replace_import_with_0_95015": "Sostituire l'importazione con '{0}'.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Segnala l'errore quando non tutti i percorsi del codice nella funzione restituiscono un valore.",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Segnala errori per i casi di fallthrough nell'istruzione switch.",
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
"Duplicate_number_index_signature_2375": "number インデックス シグネチャが重複しています。",
|
||||
"Duplicate_string_index_signature_2374": "string インデックス シグネチャが重複しています。",
|
||||
"Dynamic_import_cannot_have_type_arguments_1326": "動的インポートには型引数を指定することはできません",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "動的インポートがサポートされるのは、'--module' フラグが 'commonjs' または 'esNext' の場合のみです。",
|
||||
"Dynamic_import_must_have_one_specifier_as_an_argument_1324": "動的インポートには、引数として 1 つの指定子を指定する必要があります。",
|
||||
"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "動的インポートの指定子の型は 'string' である必要がありますが、ここでは型 '{0}' が指定されています。",
|
||||
"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015": "インデックス式が型 'number' ではないため、要素に 'any' 型が暗黙的に指定されます。",
|
||||
@@ -567,7 +567,7 @@
|
||||
"Module_name_0_was_successfully_resolved_to_1_6089": "======== モジュール名 '{0}' が正常に '{1}' に解決されました。========",
|
||||
"Module_resolution_kind_is_not_specified_using_0_6088": "モジュール解決の種類が '{0}' を使用して指定されていません。",
|
||||
"Module_resolution_using_rootDirs_has_failed_6111": "'rootDirs' を使用したモジュール解決が失敗しました。",
|
||||
"Move_to_a_new_file_95049": "Move to a new file",
|
||||
"Move_to_a_new_file_95049": "新しいファイルへ移動します",
|
||||
"Multiple_consecutive_numeric_separators_are_not_permitted_6189": "複数の連続した数値区切り記号を指定することはできません。",
|
||||
"Multiple_constructor_implementations_are_not_allowed_2392": "コンストラクターを複数実装することはできません。",
|
||||
"NEWLINE_6061": "改行",
|
||||
@@ -707,9 +707,11 @@
|
||||
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "暗黙的な 'any' 型を持つ 'this' 式でエラーが発生します。",
|
||||
"Redirect_output_structure_to_the_directory_6006": "ディレクトリへ出力構造をリダイレクトします。",
|
||||
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "参照されているプロジェクト '{0}' には、設定 \"composite\": true が必要です。",
|
||||
"Remove_all_unreachable_code_95051": "到達できないコードをすべて削除します",
|
||||
"Remove_declaration_for_Colon_0_90004": "次に対する宣言を削除する: '{0}'",
|
||||
"Remove_destructuring_90009": "非構造化を削除します",
|
||||
"Remove_import_from_0_90005": "'{0}' からのインポートを削除",
|
||||
"Remove_unreachable_code_95050": "到達できないコードを削除します",
|
||||
"Replace_import_with_0_95015": "インポートを '{0}' に置換します。",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "関数の一部のコード パスが値を返さない場合にエラーを報告します。",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "switch ステートメントに case のフォールスルーがある場合にエラーを報告します。",
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
"Duplicate_number_index_signature_2375": "중복 숫자 인덱스 시그니처입니다.",
|
||||
"Duplicate_string_index_signature_2374": "중복 문자열 인덱스 시그니처입니다.",
|
||||
"Dynamic_import_cannot_have_type_arguments_1326": "동적 가져오기에는 형식 인수를 사용할 수 없습니다.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "동적 가져오기는 '--module' 플래그가 'commonjs' 또는 'esNext'인 경우에만 지원됩니다.",
|
||||
"Dynamic_import_must_have_one_specifier_as_an_argument_1324": "동적 가져오기에는 지정자 하나를 인수로 사용해야 합니다.",
|
||||
"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "동적 가져오기의 지정자는 'string' 형식이어야 하지만 여기에서 형식은 '{0}'입니다.",
|
||||
"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015": "인덱스 식이 'number' 형식이 아니므로 요소에 암시적으로 'any' 형식이 있습니다.",
|
||||
@@ -567,7 +567,7 @@
|
||||
"Module_name_0_was_successfully_resolved_to_1_6089": "======== 모듈 이름 '{0}'이(가) '{1}'(으)로 확인되었습니다. ========",
|
||||
"Module_resolution_kind_is_not_specified_using_0_6088": "모듈 확인 종류가 지정되지 않았습니다. '{0}'을(를) 사용합니다.",
|
||||
"Module_resolution_using_rootDirs_has_failed_6111": "'rootDirs'를 사용한 모듈 확인에 실패했습니다.",
|
||||
"Move_to_a_new_file_95049": "Move to a new file",
|
||||
"Move_to_a_new_file_95049": "새 파일로 이동",
|
||||
"Multiple_consecutive_numeric_separators_are_not_permitted_6189": "여러 개의 연속된 숫자 구분 기호는 허용되지 않습니다.",
|
||||
"Multiple_constructor_implementations_are_not_allowed_2392": "여러 생성자 구현은 허용되지 않습니다.",
|
||||
"NEWLINE_6061": "줄 바꿈",
|
||||
@@ -707,9 +707,11 @@
|
||||
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "암시된 'any' 형식이 있는 'this' 식에서 오류를 발생합니다.",
|
||||
"Redirect_output_structure_to_the_directory_6006": "출력 구조를 디렉터리로 리디렉션합니다.",
|
||||
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "참조되는 프로젝트 '{0}'에는 \"composite\": true 설정이 있어야 합니다.",
|
||||
"Remove_all_unreachable_code_95051": "접근할 수 없는 코드 모두 제거",
|
||||
"Remove_declaration_for_Colon_0_90004": "'{0}'에 대한 선언 제거",
|
||||
"Remove_destructuring_90009": "구조 파괴 제거",
|
||||
"Remove_import_from_0_90005": "'{0}'에서 가져오기 제거",
|
||||
"Remove_unreachable_code_95050": "접근할 수 없는 코드 제거",
|
||||
"Replace_import_with_0_95015": "가져오기를 '{0}'(으)로 바꿉니다.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "함수의 일부 코드 경로가 값을 반환하지 않는 경우 오류를 보고합니다.",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "switch 문의 fallthrough case에 대한 오류를 보고합니다.",
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
"Duplicate_number_index_signature_2375": "Zduplikowana sygnatura indeksu liczbowego.",
|
||||
"Duplicate_string_index_signature_2374": "Zduplikowana sygnatura indeksu ciągu.",
|
||||
"Dynamic_import_cannot_have_type_arguments_1326": "Dynamiczne importowanie nie może mieć argumentów typu",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Import dynamiczny jest obsługiwany tylko wtedy, gdy flaga „--module” to „commonjs” lub „esNext”.",
|
||||
"Dynamic_import_must_have_one_specifier_as_an_argument_1324": "Dynamiczne importowanie musi mieć jeden specyfikator jako argument.",
|
||||
"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "Specyfikator dynamicznego importowania musi być typu „string”, ale określono typ „{0}”.",
|
||||
"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015": "Element niejawnie przyjmuje typ „any”, ponieważ wyrażenie indeksu ma typ inny niż „number”.",
|
||||
@@ -567,6 +567,7 @@
|
||||
"Module_name_0_was_successfully_resolved_to_1_6089": "======== Nazwa modułu „{0}” została pomyślnie rozpoznana jako „{1}”. ========",
|
||||
"Module_resolution_kind_is_not_specified_using_0_6088": "Rodzaj rozpoznawania modułów nie został podany. Zostanie użyty rodzaj „{0}”.",
|
||||
"Module_resolution_using_rootDirs_has_failed_6111": "Nie można rozpoznać modułów przy użyciu opcji „rootDirs”.",
|
||||
"Move_to_a_new_file_95049": "Przenieś do nowego pliku",
|
||||
"Multiple_consecutive_numeric_separators_are_not_permitted_6189": "Kolejne następujące po sobie separatory liczbowe nie są dozwolone.",
|
||||
"Multiple_constructor_implementations_are_not_allowed_2392": "Konstruktor nie może mieć wielu implementacji.",
|
||||
"NEWLINE_6061": "NOWY WIERSZ",
|
||||
@@ -706,9 +707,11 @@
|
||||
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "Zgłaszaj błąd w przypadku wyrażeń „this” z niejawnym typem „any”.",
|
||||
"Redirect_output_structure_to_the_directory_6006": "Przekieruj strukturę wyjściową do katalogu.",
|
||||
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Przywoływany projekt „{0}” musi mieć ustawienie „composite” o wartości true.",
|
||||
"Remove_all_unreachable_code_95051": "Usuń cały nieosiągalny kod",
|
||||
"Remove_declaration_for_Colon_0_90004": "Usuń deklarację dla: „{0}”",
|
||||
"Remove_destructuring_90009": "Usuń usuwanie struktury",
|
||||
"Remove_import_from_0_90005": "Usuń import z „{0}”",
|
||||
"Remove_unreachable_code_95050": "Usuń nieosiągalny kod",
|
||||
"Replace_import_with_0_95015": "Zamień import na element „{0}”.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Zgłoś błąd, gdy nie wszystkie ścieżki kodu zwracają wartość.",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Zgłoś błędy dla przepuszczających klauzul case w instrukcji switch.",
|
||||
|
||||
Vendored
+1
@@ -2112,6 +2112,7 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
}
|
||||
interface CompilerOptions {
|
||||
allowJs?: boolean;
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
"Duplicate_number_index_signature_2375": "Assinatura de índice de número duplicado.",
|
||||
"Duplicate_string_index_signature_2374": "Assinatura de índice de cadeia de caracteres duplicada.",
|
||||
"Dynamic_import_cannot_have_type_arguments_1326": "A importação dinâmica não pode ter argumentos de tipo",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Só há suporte para importação dinâmica quando o sinalizador '--module' é 'commonjs' ou 'esNext'.",
|
||||
"Dynamic_import_must_have_one_specifier_as_an_argument_1324": "A importação dinâmica deve ter um especificador como um argumento.",
|
||||
"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "O especificador da importação dinâmica deve ser do tipo 'string', mas aqui tem o tipo '{0}'.",
|
||||
"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015": "O elemento implicitamente tem um tipo 'any' porque a expressão de índice não é do tipo 'number'.",
|
||||
@@ -567,6 +567,7 @@
|
||||
"Module_name_0_was_successfully_resolved_to_1_6089": "======== Nome do módulo '{0}' foi resolvido com sucesso '{1}'. ========",
|
||||
"Module_resolution_kind_is_not_specified_using_0_6088": "Resolução de tipo não foi especificado, usando '{0}'.",
|
||||
"Module_resolution_using_rootDirs_has_failed_6111": "Falha na resolução de módulo usando 'rootDirs'.",
|
||||
"Move_to_a_new_file_95049": "Mover para um novo arquivo",
|
||||
"Multiple_consecutive_numeric_separators_are_not_permitted_6189": "Não são permitidos vários separadores numéricos consecutivos.",
|
||||
"Multiple_constructor_implementations_are_not_allowed_2392": "Não são permitidas várias implementações de construtor.",
|
||||
"NEWLINE_6061": "NEWLINE",
|
||||
@@ -706,9 +707,11 @@
|
||||
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "Gerar erro em expressões 'this' com um tipo 'any' implícito.",
|
||||
"Redirect_output_structure_to_the_directory_6006": "Redirecione a estrutura de saída para o diretório.",
|
||||
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "O projeto referenciado '{0}' deve ter a configuração de \"composite\": true.",
|
||||
"Remove_all_unreachable_code_95051": "Remover todo o código inacessível",
|
||||
"Remove_declaration_for_Colon_0_90004": "Remover declaração para: '{0}'",
|
||||
"Remove_destructuring_90009": "Remover desestruturação",
|
||||
"Remove_import_from_0_90005": "Remover importação do '{0}'",
|
||||
"Remove_unreachable_code_95050": "Remover código inacessível",
|
||||
"Replace_import_with_0_95015": "Substitua a importação com '{0}'.",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Relate erro quando nem todos os caminhos de código na função retornarem um valor.",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Relate erros para casos de fallthrough na instrução switch.",
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
"Duplicate_number_index_signature_2375": "Повторяющаяся сигнатура числового индекса.",
|
||||
"Duplicate_string_index_signature_2374": "Повторяющаяся сигнатура строкового индекса.",
|
||||
"Dynamic_import_cannot_have_type_arguments_1326": "При динамическом импорте не могут использоваться аргументы типов",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Динамический импорт поддерживается, только если флаг \"--module\" имеет значение \"commonjs\" или \"esNext\".",
|
||||
"Dynamic_import_must_have_one_specifier_as_an_argument_1324": "При динамическом импорте необходимо указать один описатель в качестве аргумента.",
|
||||
"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "Описатель динамического импорта должен иметь тип \"string\", но имеет тип \"{0}\".",
|
||||
"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015": "Элемент неявно содержит тип any, так как выражение индекса не имеет тип number.",
|
||||
@@ -567,7 +567,7 @@
|
||||
"Module_name_0_was_successfully_resolved_to_1_6089": "======== Имя модуля \"{0}\" было успешно разрешено в \"{1}\". ========",
|
||||
"Module_resolution_kind_is_not_specified_using_0_6088": "Тип разрешения модуля не указан, используется \"{0}\".",
|
||||
"Module_resolution_using_rootDirs_has_failed_6111": "Произошел сбой при разрешении модуля с помощью \"rootDirs\".",
|
||||
"Move_to_a_new_file_95049": "Move to a new file",
|
||||
"Move_to_a_new_file_95049": "Переместить в новый файл",
|
||||
"Multiple_consecutive_numeric_separators_are_not_permitted_6189": "Использовать несколько последовательных числовых разделителей запрещено.",
|
||||
"Multiple_constructor_implementations_are_not_allowed_2392": "Не разрешается использование нескольких реализаций конструкторов.",
|
||||
"NEWLINE_6061": "НОВАЯ СТРОКА",
|
||||
@@ -707,9 +707,11 @@
|
||||
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "Вызвать ошибку в выражениях this с неявным типом any.",
|
||||
"Redirect_output_structure_to_the_directory_6006": "Перенаправить структуру вывода в каталог.",
|
||||
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Указанный в ссылке проект \"{0}\" должен иметь следующее значение параметра composite: true.",
|
||||
"Remove_all_unreachable_code_95051": "Удалить весь недостижимый код",
|
||||
"Remove_declaration_for_Colon_0_90004": "Удалите объявление: \"{0}\"",
|
||||
"Remove_destructuring_90009": "Удалить деструктурирование",
|
||||
"Remove_import_from_0_90005": "Удалить импорт из \"{0}\"",
|
||||
"Remove_unreachable_code_95050": "Удалить недостижимый код",
|
||||
"Replace_import_with_0_95015": "Замена импорта на \"{0}\".",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Сообщать об ошибке, если не все пути кода в функции возвращают значение.",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Сообщать об ошибках для случаев передачи управления в операторе switch.",
|
||||
|
||||
+145
-61
@@ -174,7 +174,7 @@ var ts;
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.versionMajorMinor = "2.9";
|
||||
ts.version = ts.versionMajorMinor + ".0-dev";
|
||||
ts.version = ts.versionMajorMinor + ".1";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
@@ -3157,6 +3157,7 @@ var ts;
|
||||
readDirectory: readDirectory,
|
||||
getModifiedTime: getModifiedTime,
|
||||
createHash: _crypto ? createMD5HashUsingNativeCrypto : generateDjb2Hash,
|
||||
createSHA256Hash: _crypto ? createSHA256Hash : undefined,
|
||||
getMemoryUsage: function () {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
@@ -3529,6 +3530,11 @@ var ts;
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
function createSHA256Hash(data) {
|
||||
var hash = _crypto.createHash("sha256");
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -7925,9 +7931,9 @@ var ts;
|
||||
node.body.kind === 238 &&
|
||||
node.body;
|
||||
}
|
||||
function getJSDocCommentsAndTags(node) {
|
||||
function getJSDocCommentsAndTags(hostNode) {
|
||||
var result;
|
||||
getJSDocCommentsAndTagsWorker(node);
|
||||
getJSDocCommentsAndTagsWorker(hostNode);
|
||||
return result || ts.emptyArray;
|
||||
function getJSDocCommentsAndTagsWorker(node) {
|
||||
var parent = node.parent;
|
||||
@@ -7937,7 +7943,7 @@ var ts;
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
if (parent.parent &&
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node || getSourceOfAssignment(parent.parent))) {
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node)) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent);
|
||||
}
|
||||
if (parent.parent && parent.parent.parent &&
|
||||
@@ -7946,15 +7952,15 @@ var ts;
|
||||
getSourceOfDefaultedAssignment(parent.parent.parent))) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent.parent);
|
||||
}
|
||||
if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 ||
|
||||
ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 ||
|
||||
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 58 ||
|
||||
ts.isBinaryExpression(parent) && parent.operatorToken.kind === 58 ||
|
||||
node.kind === 184 && node.parent && node.parent.kind === 215) {
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
if (node.kind === 148) {
|
||||
result = ts.addRange(result, ts.getJSDocParameterTags(node));
|
||||
}
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && ts.hasJSDocNodes(node.initializer)) {
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && node.initializer !== hostNode && ts.hasJSDocNodes(node.initializer)) {
|
||||
result = ts.addRange(result, node.initializer.jsDoc);
|
||||
}
|
||||
if (ts.hasJSDocNodes(node)) {
|
||||
@@ -8975,7 +8981,9 @@ var ts;
|
||||
}
|
||||
ts.getEffectiveReturnTypeNode = getEffectiveReturnTypeNode;
|
||||
function getEffectiveTypeParameterDeclarations(node) {
|
||||
return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
return ts.isJSDocTypedefTag(node)
|
||||
? getJSDocTypeParameterDeclarations(node)
|
||||
: node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
}
|
||||
ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations;
|
||||
function getJSDocTypeParameterDeclarations(node) {
|
||||
@@ -10207,7 +10215,9 @@ var ts;
|
||||
function getJSDocTags(node) {
|
||||
var tags = node.jsDocCache;
|
||||
if (tags === undefined) {
|
||||
node.jsDocCache = tags = ts.flatMap(ts.getJSDocCommentsAndTags(node), function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
var comments = ts.getJSDocCommentsAndTags(node);
|
||||
ts.Debug.assert(comments.length < 2 || comments[0] !== comments[1]);
|
||||
node.jsDocCache = tags = ts.flatMap(comments, function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
@@ -13386,10 +13396,11 @@ var ts;
|
||||
signature.typeParameters = parseTypeParameters();
|
||||
}
|
||||
signature.parameters = parseParameterList(flags);
|
||||
signature.type = parseReturnType(returnToken, !!(flags & 4));
|
||||
}
|
||||
function parseReturnType(returnToken, isType) {
|
||||
return shouldParseReturnType(returnToken, isType) ? parseTypeOrTypePredicate() : undefined;
|
||||
if (shouldParseReturnType(returnToken, !!(flags & 4))) {
|
||||
signature.type = parseTypeOrTypePredicate();
|
||||
return signature.type !== undefined;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function shouldParseReturnType(returnToken, isType) {
|
||||
if (returnToken === 36) {
|
||||
@@ -13611,6 +13622,9 @@ var ts;
|
||||
var node = createNode(172);
|
||||
parseExpected(19);
|
||||
node.type = parseType();
|
||||
if (!node.type) {
|
||||
return undefined;
|
||||
}
|
||||
parseExpected(20);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -13619,7 +13633,12 @@ var ts;
|
||||
if (kind === 163) {
|
||||
parseExpected(94);
|
||||
}
|
||||
fillSignature(36, 4, node);
|
||||
if (!fillSignature(36, 4 | (sourceFile.languageVariant === 1 ? 8 : 0), node)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
}
|
||||
return finishNode(node);
|
||||
}
|
||||
function parseKeywordAndNoDot() {
|
||||
@@ -14219,7 +14238,9 @@ var ts;
|
||||
var node = createNodeWithJSDoc(192);
|
||||
node.modifiers = parseModifiersForArrowFunction();
|
||||
var isAsync = ts.hasModifier(node, 256) ? 2 : 0;
|
||||
fillSignature(56, isAsync | (allowAmbiguity ? 0 : 8), node);
|
||||
if (!fillSignature(56, isAsync | (allowAmbiguity ? 0 : 8), node)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -20928,8 +20949,11 @@ var ts;
|
||||
}
|
||||
else {
|
||||
var jsPath = tryReadPackageJsonFields(false, packageJsonContent, nodeModuleDirectory, state);
|
||||
if (typeof jsPath === "string") {
|
||||
subModuleName = ts.removeExtension(ts.removeExtension(jsPath.substring(nodeModuleDirectory.length + 1), ".js"), ".jsx") + ".d.ts";
|
||||
if (typeof jsPath === "string" && jsPath.length > nodeModuleDirectory.length) {
|
||||
var potentialSubModule_1 = jsPath.substring(nodeModuleDirectory.length + 1);
|
||||
subModuleName = (ts.forEach(ts.supportedJavascriptExtensions, function (extension) {
|
||||
return ts.tryRemoveExtension(potentialSubModule_1, extension);
|
||||
}) || potentialSubModule_1) + ".d.ts";
|
||||
}
|
||||
else {
|
||||
subModuleName = "index.d.ts";
|
||||
@@ -20963,7 +20987,15 @@ var ts;
|
||||
function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) {
|
||||
var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript && extensions !== Extensions.Json, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
if (extensions === Extensions.TypeScript) {
|
||||
file = tryReadPackageJsonFields(false, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host);
|
||||
var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state);
|
||||
@@ -21513,6 +21545,7 @@ var ts;
|
||||
var unknownSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, unknownType, undefined, 0, false, false);
|
||||
var resolvingSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, anyType, undefined, 0, false, false);
|
||||
var silentNeverSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, silentNeverType, undefined, 0, false, false);
|
||||
var resolvingSignaturesArray = [resolvingSignature];
|
||||
var enumNumberIndexInfo = createIndexInfo(stringType, true);
|
||||
var jsObjectLiteralIndexInfo = createIndexInfo(anyType, false);
|
||||
var globals = ts.createSymbolTable();
|
||||
@@ -21870,6 +21903,7 @@ var ts;
|
||||
function mergeSymbol(target, source) {
|
||||
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
|
||||
(source.flags | target.flags) & 67108864) {
|
||||
var targetValueDeclaration = target.valueDeclaration;
|
||||
ts.Debug.assert(!!(target.flags & 33554432));
|
||||
if (source.flags & 512 && target.flags & 512 && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
|
||||
target.constEnumOnlyModule = false;
|
||||
@@ -21893,12 +21927,13 @@ var ts;
|
||||
}
|
||||
if ((source.flags | target.flags) & 67108864) {
|
||||
var sourceInitializer = ts.getJSInitializerSymbol(source);
|
||||
var targetInitializer = ts.getJSInitializerSymbol(target);
|
||||
var init = ts.getDeclaredJavascriptInitializer(targetValueDeclaration) || ts.getAssignedJavascriptInitializer(targetValueDeclaration);
|
||||
var targetInitializer = init && init.symbol ? init.symbol : target;
|
||||
if (!(targetInitializer.flags & 33554432)) {
|
||||
var mergedInitializer = getMergedSymbol(targetInitializer);
|
||||
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
|
||||
}
|
||||
if (sourceInitializer !== source || targetInitializer !== target) {
|
||||
if (!(targetInitializer.flags & 33554432)) {
|
||||
var mergedInitializer = getMergedSymbol(targetInitializer);
|
||||
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
|
||||
}
|
||||
mergeSymbol(targetInitializer, sourceInitializer);
|
||||
}
|
||||
}
|
||||
@@ -24359,6 +24394,8 @@ var ts;
|
||||
return false;
|
||||
function determineIfDeclarationIsVisible() {
|
||||
switch (node.kind) {
|
||||
case 294:
|
||||
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
|
||||
case 181:
|
||||
return isDeclarationVisible(node.parent.parent);
|
||||
case 231:
|
||||
@@ -25278,7 +25315,7 @@ var ts;
|
||||
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
if (node.kind === 235 || node.kind === 234 ||
|
||||
node.kind === 204 || node.kind === 236) {
|
||||
node.kind === 204 || node.kind === 236 || node.kind === 294) {
|
||||
var declaration = node;
|
||||
var typeParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
|
||||
if (typeParameters) {
|
||||
@@ -28123,6 +28160,10 @@ var ts;
|
||||
return type.flags & 1048576 ? getSimplifiedIndexedAccessType(type) : type;
|
||||
}
|
||||
function getSimplifiedIndexedAccessType(type) {
|
||||
if (type.simplified) {
|
||||
return type.simplified === circularConstraintType ? type : type.simplified;
|
||||
}
|
||||
type.simplified = circularConstraintType;
|
||||
var objectType = type.objectType;
|
||||
if (objectType.flags & 262144 && isGenericObjectType(objectType)) {
|
||||
if (ts.some(objectType.types, isStringIndexOnlyType)) {
|
||||
@@ -28137,26 +28178,26 @@ var ts;
|
||||
regularTypes.push(t);
|
||||
}
|
||||
}
|
||||
return getUnionType([
|
||||
return type.simplified = getUnionType([
|
||||
getSimplifiedType(getIndexedAccessType(getIntersectionType(regularTypes), type.indexType)),
|
||||
getIntersectionType(stringIndexTypes)
|
||||
]);
|
||||
}
|
||||
if (ts.some(objectType.types, isMappedTypeToNever)) {
|
||||
var nonNeverTypes = ts.filter(objectType.types, function (t) { return !isMappedTypeToNever(t); });
|
||||
return getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
return type.simplified = getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
}
|
||||
}
|
||||
if (isGenericMappedType(objectType)) {
|
||||
return substituteIndexedMappedType(objectType, type);
|
||||
return type.simplified = substituteIndexedMappedType(objectType, type);
|
||||
}
|
||||
if (objectType.flags & 32768) {
|
||||
var constraint = getConstraintFromTypeParameter(objectType);
|
||||
if (constraint && isGenericMappedType(constraint)) {
|
||||
return substituteIndexedMappedType(constraint, type);
|
||||
return type.simplified = substituteIndexedMappedType(constraint, type);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, type) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
@@ -28414,7 +28455,7 @@ var ts;
|
||||
return links.resolvedType;
|
||||
}
|
||||
function getAliasSymbolForTypeNode(node) {
|
||||
return node.parent.kind === 236 ? getSymbolOfNode(node.parent) : undefined;
|
||||
return (node.parent.kind === 236 || node.parent.kind === 294) ? getSymbolOfNode(node.parent) : undefined;
|
||||
}
|
||||
function getAliasTypeArgumentsForTypeNode(node) {
|
||||
var symbol = getAliasSymbolForTypeNode(node);
|
||||
@@ -33441,8 +33482,17 @@ var ts;
|
||||
return unknownType;
|
||||
}
|
||||
}
|
||||
if (context.typeArguments) {
|
||||
signatures = ts.mapDefined(signatures, function (s) { return getJsxSignatureTypeArgumentInstantiation(s, context, isJs); });
|
||||
var links = getNodeLinks(context);
|
||||
if (!links.resolvedSignatures) {
|
||||
links.resolvedSignatures = ts.createMap();
|
||||
}
|
||||
var cacheKey = "" + getTypeId(valueType);
|
||||
if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) !== resolvingSignaturesArray) {
|
||||
signatures = links.resolvedSignatures.get(cacheKey);
|
||||
}
|
||||
else if (!links.resolvedSignatures.get(cacheKey)) {
|
||||
links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray);
|
||||
links.resolvedSignatures.set(cacheKey, signatures = instantiateJsxSignatures(context, signatures));
|
||||
}
|
||||
return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, false); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0);
|
||||
}
|
||||
@@ -34183,6 +34233,33 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getInstantiatedJsxSignatures(openingLikeElement, elementType, reportErrors) {
|
||||
var links = getNodeLinks(openingLikeElement);
|
||||
if (!links.resolvedSignatures) {
|
||||
links.resolvedSignatures = ts.createMap();
|
||||
}
|
||||
var cacheKey = "" + getTypeId(elementType);
|
||||
if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) === resolvingSignaturesArray) {
|
||||
return;
|
||||
}
|
||||
else if (links.resolvedSignatures.get(cacheKey)) {
|
||||
return links.resolvedSignatures.get(cacheKey);
|
||||
}
|
||||
links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray);
|
||||
var signatures = getSignaturesOfType(elementType, 1);
|
||||
if (signatures.length === 0) {
|
||||
signatures = getSignaturesOfType(elementType, 0);
|
||||
if (signatures.length === 0) {
|
||||
if (reportErrors) {
|
||||
error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
var results = instantiateJsxSignatures(openingLikeElement, signatures);
|
||||
links.resolvedSignatures.set(cacheKey, results);
|
||||
return results;
|
||||
}
|
||||
function resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, elementType, elementClassType) {
|
||||
if (elementType.flags & 131072) {
|
||||
var types = elementType.types;
|
||||
@@ -34212,15 +34289,10 @@ var ts;
|
||||
}
|
||||
return anyType;
|
||||
}
|
||||
var signatures = getSignaturesOfType(elementType, 1);
|
||||
if (signatures.length === 0) {
|
||||
signatures = getSignaturesOfType(elementType, 0);
|
||||
if (signatures.length === 0) {
|
||||
error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName));
|
||||
return unknownType;
|
||||
}
|
||||
var instantiatedSignatures = getInstantiatedJsxSignatures(openingLikeElement, elementType, true);
|
||||
if (!ts.length(instantiatedSignatures)) {
|
||||
return unknownType;
|
||||
}
|
||||
var instantiatedSignatures = instantiateJsxSignatures(openingLikeElement, signatures);
|
||||
var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2);
|
||||
var statelessAttributesType = shouldIncludeAllStatelessAttributesType ?
|
||||
tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) :
|
||||
@@ -35352,9 +35424,9 @@ var ts;
|
||||
var isDecorator = node.kind === 149;
|
||||
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
||||
var typeArguments;
|
||||
if (!isDecorator && !isJsxOpeningOrSelfClosingElement) {
|
||||
if (!isDecorator) {
|
||||
typeArguments = node.typeArguments;
|
||||
if (isTaggedTemplate || node.expression.kind !== 97) {
|
||||
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 97) {
|
||||
ts.forEach(typeArguments, checkSourceElement);
|
||||
}
|
||||
}
|
||||
@@ -35743,18 +35815,6 @@ var ts;
|
||||
}
|
||||
function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) {
|
||||
ts.Debug.assert(!(elementType.flags & 131072));
|
||||
return resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray);
|
||||
}
|
||||
function resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray) {
|
||||
if (elementType.flags & 131072) {
|
||||
var types = elementType.types;
|
||||
var result = void 0;
|
||||
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
||||
var type = types_16[_i];
|
||||
result = result || resolveStatelessJsxOpeningLikeElement(openingLikeElement, type, candidatesOutArray);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var callSignatures = elementType && getSignaturesOfType(elementType, 0);
|
||||
if (callSignatures && callSignatures.length > 0) {
|
||||
return resolveCall(openingLikeElement, callSignatures, candidatesOutArray);
|
||||
@@ -35773,7 +35833,18 @@ var ts;
|
||||
return resolveDecorator(node, candidatesOutArray);
|
||||
case 256:
|
||||
case 255:
|
||||
return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray) || unknownSignature;
|
||||
var exprTypes = checkExpression(node.tagName);
|
||||
return forEachType(exprTypes, function (exprType) {
|
||||
var sfcResult = getResolvedJsxStatelessFunctionSignature(node, exprType, candidatesOutArray);
|
||||
if (sfcResult && sfcResult !== unknownSignature) {
|
||||
return sfcResult;
|
||||
}
|
||||
var sigs = getInstantiatedJsxSignatures(node, exprType);
|
||||
if (candidatesOutArray && ts.length(sigs)) {
|
||||
candidatesOutArray.push.apply(candidatesOutArray, sigs);
|
||||
}
|
||||
return ts.length(sigs) ? sigs[0] : unknownSignature;
|
||||
}) || unknownSignature;
|
||||
}
|
||||
ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
|
||||
}
|
||||
@@ -36545,8 +36616,8 @@ var ts;
|
||||
}
|
||||
if (type.flags & 393216) {
|
||||
var types = type.types;
|
||||
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
||||
var t = types_17[_i];
|
||||
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
||||
var t = types_16[_i];
|
||||
if (maybeTypeOfKind(t, kind)) {
|
||||
return true;
|
||||
}
|
||||
@@ -38759,11 +38830,11 @@ var ts;
|
||||
if (!bindingPattern.elements.every(function (e) { return ts.contains(bindingElements, e); })) {
|
||||
for (var _i = 0, bindingElements_1 = bindingElements; _i < bindingElements_1.length; _i++) {
|
||||
var e = bindingElements_1[_i];
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, getBindingElementNameText(e)));
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(e.name, ts.isIdentifier))));
|
||||
}
|
||||
}
|
||||
else if (bindingElements.length === 1) {
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, getBindingElementNameText(ts.first(bindingElements))));
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(ts.first(bindingElements).name, ts.isIdentifier))));
|
||||
}
|
||||
else {
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics.All_destructured_elements_are_unused));
|
||||
@@ -45663,6 +45734,15 @@ var ts;
|
||||
return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text }));
|
||||
}
|
||||
ts.addSyntheticTrailingComment = addSyntheticTrailingComment;
|
||||
function moveSyntheticComments(node, original) {
|
||||
setSyntheticLeadingComments(node, getSyntheticLeadingComments(original));
|
||||
setSyntheticTrailingComments(node, getSyntheticTrailingComments(original));
|
||||
var emit = getOrCreateEmitNode(original);
|
||||
emit.leadingComments = undefined;
|
||||
emit.trailingComments = undefined;
|
||||
return node;
|
||||
}
|
||||
ts.moveSyntheticComments = moveSyntheticComments;
|
||||
function getConstantValue(node) {
|
||||
var emitNode = node.emitNode;
|
||||
return emitNode && emitNode.constantValue;
|
||||
@@ -49492,6 +49572,9 @@ var ts;
|
||||
var innerExpression = ts.skipOuterExpressions(node.expression, ~2);
|
||||
if (ts.isAssertionExpression(innerExpression)) {
|
||||
var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
|
||||
if (ts.length(ts.getLeadingCommentRangesOfNode(expression, currentSourceFile))) {
|
||||
return ts.updateParen(node, expression);
|
||||
}
|
||||
return ts.createPartiallyEmittedExpression(expression, node);
|
||||
}
|
||||
return ts.visitEachChild(node, visitor, context);
|
||||
@@ -52290,6 +52373,7 @@ var ts;
|
||||
var expression = ts.visitNode(body, visitor, ts.isExpression);
|
||||
var returnStatement = ts.createReturn(expression);
|
||||
ts.setTextRange(returnStatement, body);
|
||||
ts.moveSyntheticComments(returnStatement, body);
|
||||
ts.setEmitFlags(returnStatement, 384 | 32 | 1024);
|
||||
statements.push(returnStatement);
|
||||
closeBraceLocation = body;
|
||||
@@ -61249,8 +61333,8 @@ var ts;
|
||||
write("/// <reference path=\"" + directive.fileName + "\" />");
|
||||
writeLine();
|
||||
}
|
||||
for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
|
||||
var directive = types_18[_d];
|
||||
for (var _d = 0, types_17 = types; _d < types_17.length; _d++) {
|
||||
var directive = types_17[_d];
|
||||
write("/// <reference types=\"" + directive.fileName + "\" />");
|
||||
writeLine();
|
||||
}
|
||||
|
||||
+293
-108
@@ -1382,7 +1382,7 @@ var ts;
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.versionMajorMinor = "2.9";
|
||||
ts.version = ts.versionMajorMinor + ".0-dev";
|
||||
ts.version = ts.versionMajorMinor + ".1";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
@@ -4384,6 +4384,7 @@ var ts;
|
||||
readDirectory: readDirectory,
|
||||
getModifiedTime: getModifiedTime,
|
||||
createHash: _crypto ? createMD5HashUsingNativeCrypto : generateDjb2Hash,
|
||||
createSHA256Hash: _crypto ? createSHA256Hash : undefined,
|
||||
getMemoryUsage: function () {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
@@ -4756,6 +4757,11 @@ var ts;
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
function createSHA256Hash(data) {
|
||||
var hash = _crypto.createHash("sha256");
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -9152,9 +9158,9 @@ var ts;
|
||||
node.body.kind === 238 &&
|
||||
node.body;
|
||||
}
|
||||
function getJSDocCommentsAndTags(node) {
|
||||
function getJSDocCommentsAndTags(hostNode) {
|
||||
var result;
|
||||
getJSDocCommentsAndTagsWorker(node);
|
||||
getJSDocCommentsAndTagsWorker(hostNode);
|
||||
return result || ts.emptyArray;
|
||||
function getJSDocCommentsAndTagsWorker(node) {
|
||||
var parent = node.parent;
|
||||
@@ -9164,7 +9170,7 @@ var ts;
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
if (parent.parent &&
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node || getSourceOfAssignment(parent.parent))) {
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node)) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent);
|
||||
}
|
||||
if (parent.parent && parent.parent.parent &&
|
||||
@@ -9173,15 +9179,15 @@ var ts;
|
||||
getSourceOfDefaultedAssignment(parent.parent.parent))) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent.parent);
|
||||
}
|
||||
if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 ||
|
||||
ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 ||
|
||||
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 58 ||
|
||||
ts.isBinaryExpression(parent) && parent.operatorToken.kind === 58 ||
|
||||
node.kind === 184 && node.parent && node.parent.kind === 215) {
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
if (node.kind === 148) {
|
||||
result = ts.addRange(result, ts.getJSDocParameterTags(node));
|
||||
}
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && ts.hasJSDocNodes(node.initializer)) {
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && node.initializer !== hostNode && ts.hasJSDocNodes(node.initializer)) {
|
||||
result = ts.addRange(result, node.initializer.jsDoc);
|
||||
}
|
||||
if (ts.hasJSDocNodes(node)) {
|
||||
@@ -10221,7 +10227,9 @@ var ts;
|
||||
}
|
||||
ts.getEffectiveReturnTypeNode = getEffectiveReturnTypeNode;
|
||||
function getEffectiveTypeParameterDeclarations(node) {
|
||||
return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
return ts.isJSDocTypedefTag(node)
|
||||
? getJSDocTypeParameterDeclarations(node)
|
||||
: node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
}
|
||||
ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations;
|
||||
function getJSDocTypeParameterDeclarations(node) {
|
||||
@@ -11459,7 +11467,9 @@ var ts;
|
||||
function getJSDocTags(node) {
|
||||
var tags = node.jsDocCache;
|
||||
if (tags === undefined) {
|
||||
node.jsDocCache = tags = ts.flatMap(ts.getJSDocCommentsAndTags(node), function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
var comments = ts.getJSDocCommentsAndTags(node);
|
||||
ts.Debug.assert(comments.length < 2 || comments[0] !== comments[1]);
|
||||
node.jsDocCache = tags = ts.flatMap(comments, function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
@@ -14648,10 +14658,11 @@ var ts;
|
||||
signature.typeParameters = parseTypeParameters();
|
||||
}
|
||||
signature.parameters = parseParameterList(flags);
|
||||
signature.type = parseReturnType(returnToken, !!(flags & 4));
|
||||
}
|
||||
function parseReturnType(returnToken, isType) {
|
||||
return shouldParseReturnType(returnToken, isType) ? parseTypeOrTypePredicate() : undefined;
|
||||
if (shouldParseReturnType(returnToken, !!(flags & 4))) {
|
||||
signature.type = parseTypeOrTypePredicate();
|
||||
return signature.type !== undefined;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function shouldParseReturnType(returnToken, isType) {
|
||||
if (returnToken === 36) {
|
||||
@@ -14873,6 +14884,9 @@ var ts;
|
||||
var node = createNode(172);
|
||||
parseExpected(19);
|
||||
node.type = parseType();
|
||||
if (!node.type) {
|
||||
return undefined;
|
||||
}
|
||||
parseExpected(20);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -14881,7 +14895,12 @@ var ts;
|
||||
if (kind === 163) {
|
||||
parseExpected(94);
|
||||
}
|
||||
fillSignature(36, 4, node);
|
||||
if (!fillSignature(36, 4 | (sourceFile.languageVariant === 1 ? 8 : 0), node)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
}
|
||||
return finishNode(node);
|
||||
}
|
||||
function parseKeywordAndNoDot() {
|
||||
@@ -15481,7 +15500,9 @@ var ts;
|
||||
var node = createNodeWithJSDoc(192);
|
||||
node.modifiers = parseModifiersForArrowFunction();
|
||||
var isAsync = ts.hasModifier(node, 256) ? 2 : 0;
|
||||
fillSignature(56, isAsync | (allowAmbiguity ? 0 : 8), node);
|
||||
if (!fillSignature(56, isAsync | (allowAmbiguity ? 0 : 8), node)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -22261,8 +22282,11 @@ var ts;
|
||||
}
|
||||
else {
|
||||
var jsPath = tryReadPackageJsonFields(false, packageJsonContent, nodeModuleDirectory, state);
|
||||
if (typeof jsPath === "string") {
|
||||
subModuleName = ts.removeExtension(ts.removeExtension(jsPath.substring(nodeModuleDirectory.length + 1), ".js"), ".jsx") + ".d.ts";
|
||||
if (typeof jsPath === "string" && jsPath.length > nodeModuleDirectory.length) {
|
||||
var potentialSubModule_1 = jsPath.substring(nodeModuleDirectory.length + 1);
|
||||
subModuleName = (ts.forEach(ts.supportedJavascriptExtensions, function (extension) {
|
||||
return ts.tryRemoveExtension(potentialSubModule_1, extension);
|
||||
}) || potentialSubModule_1) + ".d.ts";
|
||||
}
|
||||
else {
|
||||
subModuleName = "index.d.ts";
|
||||
@@ -22296,7 +22320,15 @@ var ts;
|
||||
function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) {
|
||||
var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript && extensions !== Extensions.Json, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
if (extensions === Extensions.TypeScript) {
|
||||
file = tryReadPackageJsonFields(false, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host);
|
||||
var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state);
|
||||
@@ -22846,6 +22878,7 @@ var ts;
|
||||
var unknownSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, unknownType, undefined, 0, false, false);
|
||||
var resolvingSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, anyType, undefined, 0, false, false);
|
||||
var silentNeverSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, silentNeverType, undefined, 0, false, false);
|
||||
var resolvingSignaturesArray = [resolvingSignature];
|
||||
var enumNumberIndexInfo = createIndexInfo(stringType, true);
|
||||
var jsObjectLiteralIndexInfo = createIndexInfo(anyType, false);
|
||||
var globals = ts.createSymbolTable();
|
||||
@@ -23307,6 +23340,7 @@ var ts;
|
||||
function mergeSymbol(target, source) {
|
||||
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
|
||||
(source.flags | target.flags) & 67108864) {
|
||||
var targetValueDeclaration = target.valueDeclaration;
|
||||
ts.Debug.assert(!!(target.flags & 33554432));
|
||||
if (source.flags & 512 && target.flags & 512 && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
|
||||
target.constEnumOnlyModule = false;
|
||||
@@ -23330,12 +23364,13 @@ var ts;
|
||||
}
|
||||
if ((source.flags | target.flags) & 67108864) {
|
||||
var sourceInitializer = ts.getJSInitializerSymbol(source);
|
||||
var targetInitializer = ts.getJSInitializerSymbol(target);
|
||||
var init = ts.getDeclaredJavascriptInitializer(targetValueDeclaration) || ts.getAssignedJavascriptInitializer(targetValueDeclaration);
|
||||
var targetInitializer = init && init.symbol ? init.symbol : target;
|
||||
if (!(targetInitializer.flags & 33554432)) {
|
||||
var mergedInitializer = getMergedSymbol(targetInitializer);
|
||||
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
|
||||
}
|
||||
if (sourceInitializer !== source || targetInitializer !== target) {
|
||||
if (!(targetInitializer.flags & 33554432)) {
|
||||
var mergedInitializer = getMergedSymbol(targetInitializer);
|
||||
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
|
||||
}
|
||||
mergeSymbol(targetInitializer, sourceInitializer);
|
||||
}
|
||||
}
|
||||
@@ -25796,6 +25831,8 @@ var ts;
|
||||
return false;
|
||||
function determineIfDeclarationIsVisible() {
|
||||
switch (node.kind) {
|
||||
case 294:
|
||||
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
|
||||
case 181:
|
||||
return isDeclarationVisible(node.parent.parent);
|
||||
case 231:
|
||||
@@ -26715,7 +26752,7 @@ var ts;
|
||||
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
if (node.kind === 235 || node.kind === 234 ||
|
||||
node.kind === 204 || node.kind === 236) {
|
||||
node.kind === 204 || node.kind === 236 || node.kind === 294) {
|
||||
var declaration = node;
|
||||
var typeParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
|
||||
if (typeParameters) {
|
||||
@@ -29560,6 +29597,10 @@ var ts;
|
||||
return type.flags & 1048576 ? getSimplifiedIndexedAccessType(type) : type;
|
||||
}
|
||||
function getSimplifiedIndexedAccessType(type) {
|
||||
if (type.simplified) {
|
||||
return type.simplified === circularConstraintType ? type : type.simplified;
|
||||
}
|
||||
type.simplified = circularConstraintType;
|
||||
var objectType = type.objectType;
|
||||
if (objectType.flags & 262144 && isGenericObjectType(objectType)) {
|
||||
if (ts.some(objectType.types, isStringIndexOnlyType)) {
|
||||
@@ -29574,26 +29615,26 @@ var ts;
|
||||
regularTypes.push(t);
|
||||
}
|
||||
}
|
||||
return getUnionType([
|
||||
return type.simplified = getUnionType([
|
||||
getSimplifiedType(getIndexedAccessType(getIntersectionType(regularTypes), type.indexType)),
|
||||
getIntersectionType(stringIndexTypes)
|
||||
]);
|
||||
}
|
||||
if (ts.some(objectType.types, isMappedTypeToNever)) {
|
||||
var nonNeverTypes = ts.filter(objectType.types, function (t) { return !isMappedTypeToNever(t); });
|
||||
return getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
return type.simplified = getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
}
|
||||
}
|
||||
if (isGenericMappedType(objectType)) {
|
||||
return substituteIndexedMappedType(objectType, type);
|
||||
return type.simplified = substituteIndexedMappedType(objectType, type);
|
||||
}
|
||||
if (objectType.flags & 32768) {
|
||||
var constraint = getConstraintFromTypeParameter(objectType);
|
||||
if (constraint && isGenericMappedType(constraint)) {
|
||||
return substituteIndexedMappedType(constraint, type);
|
||||
return type.simplified = substituteIndexedMappedType(constraint, type);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, type) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
@@ -29851,7 +29892,7 @@ var ts;
|
||||
return links.resolvedType;
|
||||
}
|
||||
function getAliasSymbolForTypeNode(node) {
|
||||
return node.parent.kind === 236 ? getSymbolOfNode(node.parent) : undefined;
|
||||
return (node.parent.kind === 236 || node.parent.kind === 294) ? getSymbolOfNode(node.parent) : undefined;
|
||||
}
|
||||
function getAliasTypeArgumentsForTypeNode(node) {
|
||||
var symbol = getAliasSymbolForTypeNode(node);
|
||||
@@ -34878,8 +34919,17 @@ var ts;
|
||||
return unknownType;
|
||||
}
|
||||
}
|
||||
if (context.typeArguments) {
|
||||
signatures = ts.mapDefined(signatures, function (s) { return getJsxSignatureTypeArgumentInstantiation(s, context, isJs); });
|
||||
var links = getNodeLinks(context);
|
||||
if (!links.resolvedSignatures) {
|
||||
links.resolvedSignatures = ts.createMap();
|
||||
}
|
||||
var cacheKey = "" + getTypeId(valueType);
|
||||
if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) !== resolvingSignaturesArray) {
|
||||
signatures = links.resolvedSignatures.get(cacheKey);
|
||||
}
|
||||
else if (!links.resolvedSignatures.get(cacheKey)) {
|
||||
links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray);
|
||||
links.resolvedSignatures.set(cacheKey, signatures = instantiateJsxSignatures(context, signatures));
|
||||
}
|
||||
return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, false); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0);
|
||||
}
|
||||
@@ -35620,6 +35670,33 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getInstantiatedJsxSignatures(openingLikeElement, elementType, reportErrors) {
|
||||
var links = getNodeLinks(openingLikeElement);
|
||||
if (!links.resolvedSignatures) {
|
||||
links.resolvedSignatures = ts.createMap();
|
||||
}
|
||||
var cacheKey = "" + getTypeId(elementType);
|
||||
if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) === resolvingSignaturesArray) {
|
||||
return;
|
||||
}
|
||||
else if (links.resolvedSignatures.get(cacheKey)) {
|
||||
return links.resolvedSignatures.get(cacheKey);
|
||||
}
|
||||
links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray);
|
||||
var signatures = getSignaturesOfType(elementType, 1);
|
||||
if (signatures.length === 0) {
|
||||
signatures = getSignaturesOfType(elementType, 0);
|
||||
if (signatures.length === 0) {
|
||||
if (reportErrors) {
|
||||
error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
var results = instantiateJsxSignatures(openingLikeElement, signatures);
|
||||
links.resolvedSignatures.set(cacheKey, results);
|
||||
return results;
|
||||
}
|
||||
function resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, elementType, elementClassType) {
|
||||
if (elementType.flags & 131072) {
|
||||
var types = elementType.types;
|
||||
@@ -35649,15 +35726,10 @@ var ts;
|
||||
}
|
||||
return anyType;
|
||||
}
|
||||
var signatures = getSignaturesOfType(elementType, 1);
|
||||
if (signatures.length === 0) {
|
||||
signatures = getSignaturesOfType(elementType, 0);
|
||||
if (signatures.length === 0) {
|
||||
error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName));
|
||||
return unknownType;
|
||||
}
|
||||
var instantiatedSignatures = getInstantiatedJsxSignatures(openingLikeElement, elementType, true);
|
||||
if (!ts.length(instantiatedSignatures)) {
|
||||
return unknownType;
|
||||
}
|
||||
var instantiatedSignatures = instantiateJsxSignatures(openingLikeElement, signatures);
|
||||
var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2);
|
||||
var statelessAttributesType = shouldIncludeAllStatelessAttributesType ?
|
||||
tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) :
|
||||
@@ -36789,9 +36861,9 @@ var ts;
|
||||
var isDecorator = node.kind === 149;
|
||||
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
||||
var typeArguments;
|
||||
if (!isDecorator && !isJsxOpeningOrSelfClosingElement) {
|
||||
if (!isDecorator) {
|
||||
typeArguments = node.typeArguments;
|
||||
if (isTaggedTemplate || node.expression.kind !== 97) {
|
||||
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 97) {
|
||||
ts.forEach(typeArguments, checkSourceElement);
|
||||
}
|
||||
}
|
||||
@@ -37180,18 +37252,6 @@ var ts;
|
||||
}
|
||||
function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) {
|
||||
ts.Debug.assert(!(elementType.flags & 131072));
|
||||
return resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray);
|
||||
}
|
||||
function resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray) {
|
||||
if (elementType.flags & 131072) {
|
||||
var types = elementType.types;
|
||||
var result = void 0;
|
||||
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
||||
var type = types_16[_i];
|
||||
result = result || resolveStatelessJsxOpeningLikeElement(openingLikeElement, type, candidatesOutArray);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var callSignatures = elementType && getSignaturesOfType(elementType, 0);
|
||||
if (callSignatures && callSignatures.length > 0) {
|
||||
return resolveCall(openingLikeElement, callSignatures, candidatesOutArray);
|
||||
@@ -37210,7 +37270,18 @@ var ts;
|
||||
return resolveDecorator(node, candidatesOutArray);
|
||||
case 256:
|
||||
case 255:
|
||||
return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray) || unknownSignature;
|
||||
var exprTypes = checkExpression(node.tagName);
|
||||
return forEachType(exprTypes, function (exprType) {
|
||||
var sfcResult = getResolvedJsxStatelessFunctionSignature(node, exprType, candidatesOutArray);
|
||||
if (sfcResult && sfcResult !== unknownSignature) {
|
||||
return sfcResult;
|
||||
}
|
||||
var sigs = getInstantiatedJsxSignatures(node, exprType);
|
||||
if (candidatesOutArray && ts.length(sigs)) {
|
||||
candidatesOutArray.push.apply(candidatesOutArray, sigs);
|
||||
}
|
||||
return ts.length(sigs) ? sigs[0] : unknownSignature;
|
||||
}) || unknownSignature;
|
||||
}
|
||||
ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
|
||||
}
|
||||
@@ -37982,8 +38053,8 @@ var ts;
|
||||
}
|
||||
if (type.flags & 393216) {
|
||||
var types = type.types;
|
||||
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
||||
var t = types_17[_i];
|
||||
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
||||
var t = types_16[_i];
|
||||
if (maybeTypeOfKind(t, kind)) {
|
||||
return true;
|
||||
}
|
||||
@@ -40210,11 +40281,11 @@ var ts;
|
||||
if (!bindingPattern.elements.every(function (e) { return ts.contains(bindingElements, e); })) {
|
||||
for (var _i = 0, bindingElements_1 = bindingElements; _i < bindingElements_1.length; _i++) {
|
||||
var e = bindingElements_1[_i];
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, getBindingElementNameText(e)));
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(e.name, ts.isIdentifier))));
|
||||
}
|
||||
}
|
||||
else if (bindingElements.length === 1) {
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, getBindingElementNameText(ts.first(bindingElements))));
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(ts.first(bindingElements).name, ts.isIdentifier))));
|
||||
}
|
||||
else {
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics.All_destructured_elements_are_unused));
|
||||
@@ -47121,6 +47192,15 @@ var ts;
|
||||
return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text }));
|
||||
}
|
||||
ts.addSyntheticTrailingComment = addSyntheticTrailingComment;
|
||||
function moveSyntheticComments(node, original) {
|
||||
setSyntheticLeadingComments(node, getSyntheticLeadingComments(original));
|
||||
setSyntheticTrailingComments(node, getSyntheticTrailingComments(original));
|
||||
var emit = getOrCreateEmitNode(original);
|
||||
emit.leadingComments = undefined;
|
||||
emit.trailingComments = undefined;
|
||||
return node;
|
||||
}
|
||||
ts.moveSyntheticComments = moveSyntheticComments;
|
||||
function getConstantValue(node) {
|
||||
var emitNode = node.emitNode;
|
||||
return emitNode && emitNode.constantValue;
|
||||
@@ -50984,6 +51064,9 @@ var ts;
|
||||
var innerExpression = ts.skipOuterExpressions(node.expression, ~2);
|
||||
if (ts.isAssertionExpression(innerExpression)) {
|
||||
var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
|
||||
if (ts.length(ts.getLeadingCommentRangesOfNode(expression, currentSourceFile))) {
|
||||
return ts.updateParen(node, expression);
|
||||
}
|
||||
return ts.createPartiallyEmittedExpression(expression, node);
|
||||
}
|
||||
return ts.visitEachChild(node, visitor, context);
|
||||
@@ -53859,6 +53942,7 @@ var ts;
|
||||
var expression = ts.visitNode(body, visitor, ts.isExpression);
|
||||
var returnStatement = ts.createReturn(expression);
|
||||
ts.setTextRange(returnStatement, body);
|
||||
ts.moveSyntheticComments(returnStatement, body);
|
||||
ts.setEmitFlags(returnStatement, 384 | 32 | 1024);
|
||||
statements.push(returnStatement);
|
||||
closeBraceLocation = body;
|
||||
@@ -62882,8 +62966,8 @@ var ts;
|
||||
write("/// <reference path=\"" + directive.fileName + "\" />");
|
||||
writeLine();
|
||||
}
|
||||
for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
|
||||
var directive = types_18[_d];
|
||||
for (var _d = 0, types_17 = types; _d < types_17.length; _d++) {
|
||||
var directive = types_17[_d];
|
||||
write("/// <reference types=\"" + directive.fileName + "\" />");
|
||||
writeLine();
|
||||
}
|
||||
@@ -76529,12 +76613,42 @@ var ts;
|
||||
}
|
||||
JsTyping.isTypingUpToDate = isTypingUpToDate;
|
||||
JsTyping.nodeCoreModuleList = [
|
||||
"buffer", "querystring", "events", "http", "cluster",
|
||||
"zlib", "os", "https", "punycode", "repl", "readline",
|
||||
"vm", "child_process", "url", "dns", "net",
|
||||
"dgram", "fs", "path", "string_decoder", "tls",
|
||||
"crypto", "stream", "util", "assert", "tty", "domain",
|
||||
"constants", "process", "v8", "timers", "console"
|
||||
"assert",
|
||||
"async_hooks",
|
||||
"buffer",
|
||||
"child_process",
|
||||
"cluster",
|
||||
"console",
|
||||
"constants",
|
||||
"crypto",
|
||||
"dgram",
|
||||
"dns",
|
||||
"domain",
|
||||
"events",
|
||||
"fs",
|
||||
"http",
|
||||
"https",
|
||||
"http2",
|
||||
"inspector",
|
||||
"net",
|
||||
"os",
|
||||
"path",
|
||||
"perf_hooks",
|
||||
"process",
|
||||
"punycode",
|
||||
"querystring",
|
||||
"readline",
|
||||
"repl",
|
||||
"stream",
|
||||
"string_decoder",
|
||||
"timers",
|
||||
"tls",
|
||||
"tty",
|
||||
"url",
|
||||
"util",
|
||||
"v8",
|
||||
"vm",
|
||||
"zlib"
|
||||
];
|
||||
JsTyping.nodeCoreModules = ts.arrayToSet(JsTyping.nodeCoreModuleList);
|
||||
function loadSafeList(host, safeListPath) {
|
||||
@@ -78879,7 +78993,9 @@ var ts;
|
||||
program.getSemanticDiagnostics(sourceFile);
|
||||
var checker = program.getDiagnosticsProducingTypeChecker();
|
||||
var diags = [];
|
||||
if (sourceFile.commonJsModuleIndicator && (ts.programContainsEs6Modules(program) || ts.compilerOptionsIndicateEs6Modules(program.getCompilerOptions()))) {
|
||||
if (sourceFile.commonJsModuleIndicator &&
|
||||
(ts.programContainsEs6Modules(program) || ts.compilerOptionsIndicateEs6Modules(program.getCompilerOptions())) &&
|
||||
containsTopLevelCommonjs(sourceFile)) {
|
||||
diags.push(ts.createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), ts.Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module));
|
||||
}
|
||||
var isJsFile = ts.isSourceFileJavaScript(sourceFile);
|
||||
@@ -78931,6 +79047,28 @@ var ts;
|
||||
return diags.concat(checker.getSuggestionDiagnostics(sourceFile));
|
||||
}
|
||||
ts.computeSuggestionDiagnostics = computeSuggestionDiagnostics;
|
||||
function containsTopLevelCommonjs(sourceFile) {
|
||||
return sourceFile.statements.some(function (statement) {
|
||||
switch (statement.kind) {
|
||||
case 213:
|
||||
return statement.declarationList.declarations.some(function (decl) {
|
||||
return ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), true);
|
||||
});
|
||||
case 215: {
|
||||
var expression = statement.expression;
|
||||
if (!ts.isBinaryExpression(expression))
|
||||
return ts.isRequireCall(expression, true);
|
||||
var kind = ts.getSpecialPropertyAssignmentKind(expression);
|
||||
return kind === 1 || kind === 2;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function propertyAccessLeftHandSide(node) {
|
||||
return ts.isPropertyAccessExpression(node) ? propertyAccessLeftHandSide(node.expression) : node;
|
||||
}
|
||||
function importNameForConvertToDefaultImport(node) {
|
||||
switch (node.kind) {
|
||||
case 243:
|
||||
@@ -82037,10 +82175,13 @@ var ts;
|
||||
if (options === void 0) { options = textChanges_3.useNonAdjustedPositions; }
|
||||
return this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options);
|
||||
};
|
||||
ChangeTracker.prototype.nextCommaToken = function (sourceFile, node) {
|
||||
var next = ts.findNextToken(node, node.parent, sourceFile);
|
||||
return next && next.kind === 26 ? next : undefined;
|
||||
};
|
||||
ChangeTracker.prototype.replacePropertyAssignment = function (sourceFile, oldNode, newNode) {
|
||||
return this.replaceNode(sourceFile, oldNode, newNode, {
|
||||
suffix: "," + this.newLineCharacter
|
||||
});
|
||||
var suffix = this.nextCommaToken(sourceFile, oldNode) ? "" : ("," + this.newLineCharacter);
|
||||
return this.replaceNode(sourceFile, oldNode, newNode, { suffix: suffix });
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
@@ -82070,7 +82211,8 @@ var ts;
|
||||
var startPosition = ts.getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition);
|
||||
var insertAtLineStart = isValidLocationToAddComment(sourceFile, startPosition);
|
||||
var token = ts.getTouchingToken(sourceFile, insertAtLineStart ? startPosition : position, false);
|
||||
var text = "" + (insertAtLineStart ? "" : this.newLineCharacter) + sourceFile.text.slice(lineStartPosition, startPosition) + "//" + commentText + this.newLineCharacter;
|
||||
var indent = sourceFile.text.slice(lineStartPosition, startPosition);
|
||||
var text = (insertAtLineStart ? "" : this.newLineCharacter) + "//" + commentText + this.newLineCharacter + indent;
|
||||
this.insertText(sourceFile, token.getStart(sourceFile), text);
|
||||
};
|
||||
ChangeTracker.prototype.replaceRangeWithText = function (sourceFile, range, text) {
|
||||
@@ -82158,6 +82300,10 @@ var ts;
|
||||
return { prefix: this.newLineCharacter, suffix: "" };
|
||||
}
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
|
||||
var endPosition = this.insertNodeAfterWorker(sourceFile, this.nextCommaToken(sourceFile, after) || after, newNode);
|
||||
this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after));
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
|
||||
var endPosition = this.insertNodeAfterWorker(sourceFile, after, newNode);
|
||||
this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after));
|
||||
@@ -82335,7 +82481,7 @@ var ts;
|
||||
changesToText.getTextChangesFromChanges = getTextChangesFromChanges;
|
||||
function newFileChanges(oldFile, fileName, statements, newLineCharacter) {
|
||||
var text = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
|
||||
return { fileName: fileName, textChanges: [ts.createTextChange(ts.createTextSpan(0, 0), text)] };
|
||||
return { fileName: fileName, textChanges: [ts.createTextChange(ts.createTextSpan(0, 0), text)], isNewFile: true };
|
||||
}
|
||||
changesToText.newFileChanges = newFileChanges;
|
||||
function computeNewText(change, sourceFile, newLineCharacter, formatContext, validate) {
|
||||
@@ -83222,7 +83368,7 @@ var ts;
|
||||
ts.Debug.assertNever(prop);
|
||||
}
|
||||
});
|
||||
return statements && [statements, true];
|
||||
return statements && [statements, false];
|
||||
}
|
||||
function convertNamedExport(sourceFile, assignment, changes, exports) {
|
||||
var text = assignment.left.name.text;
|
||||
@@ -85076,16 +85222,16 @@ var ts;
|
||||
}
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var declaration;
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken); });
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken, ts.returnTrue); });
|
||||
return changes.length === 0 ? undefined
|
||||
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts.getNameOfDeclaration(declaration).getText(sourceFile)], fixId, ts.Diagnostics.Infer_all_types_from_usage)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile, program = context.program, cancellationToken = context.cancellationToken;
|
||||
var seenFunctions = ts.createMap();
|
||||
var markSeen = ts.nodeSeenTracker();
|
||||
return codefix.codeFixAll(context, errorCodes, function (changes, err) {
|
||||
doChange(changes, sourceFile, ts.getTokenAtPosition(err.file, err.start, false), err.code, program, cancellationToken, seenFunctions);
|
||||
doChange(changes, sourceFile, ts.getTokenAtPosition(err.file, err.start, false), err.code, program, cancellationToken, markSeen);
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -85099,7 +85245,7 @@ var ts;
|
||||
return ts.Diagnostics.Infer_type_of_0_from_usage;
|
||||
}
|
||||
}
|
||||
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, seenFunctions) {
|
||||
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen) {
|
||||
if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 71 && token.kind !== 24) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -85107,17 +85253,18 @@ var ts;
|
||||
switch (errorCode) {
|
||||
case ts.Diagnostics.Member_0_implicitly_has_an_1_type.code:
|
||||
case ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code:
|
||||
if (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent)) {
|
||||
if ((ts.isVariableDeclaration(parent) && markSeen(parent)) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent)) {
|
||||
annotateVariableDeclaration(changes, sourceFile, parent, program, cancellationToken);
|
||||
return parent;
|
||||
}
|
||||
return undefined;
|
||||
case ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code: {
|
||||
var symbol = program.getTypeChecker().getSymbolAtLocation(token);
|
||||
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration)) {
|
||||
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) {
|
||||
annotateVariableDeclaration(changes, sourceFile, symbol.valueDeclaration, program, cancellationToken);
|
||||
return symbol.valueDeclaration;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var containingFunction = ts.getContainingFunction(token);
|
||||
@@ -85131,7 +85278,7 @@ var ts;
|
||||
return containingFunction;
|
||||
}
|
||||
case ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
|
||||
if (!seenFunctions || ts.addToSeen(seenFunctions, ts.getNodeId(containingFunction))) {
|
||||
if (markSeen(containingFunction)) {
|
||||
var param = ts.cast(parent, ts.isParameter);
|
||||
annotateParameters(changes, param, containingFunction, sourceFile, program, cancellationToken);
|
||||
return param;
|
||||
@@ -85319,6 +85466,15 @@ var ts;
|
||||
case 185:
|
||||
inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext);
|
||||
break;
|
||||
case 231: {
|
||||
var _a = node.parent, name = _a.name, initializer = _a.initializer;
|
||||
if (node === name) {
|
||||
if (initializer) {
|
||||
addCandidateType(usageContext, checker.getTypeAtLocation(initializer));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
return inferTypeFromContextualType(node, checker, usageContext);
|
||||
}
|
||||
@@ -85476,7 +85632,7 @@ var ts;
|
||||
return checker.getStringType();
|
||||
}
|
||||
else if (usageContext.candidateTypes) {
|
||||
return checker.getWidenedType(checker.getUnionType(ts.map(usageContext.candidateTypes, function (t) { return checker.getBaseTypeOfLiteralType(t); }), 2));
|
||||
return checker.getWidenedType(checker.getUnionType(usageContext.candidateTypes.map(function (t) { return checker.getBaseTypeOfLiteralType(t); }), 2));
|
||||
}
|
||||
else if (usageContext.properties && hasCallContext(usageContext.properties.get("then"))) {
|
||||
var paramType = getParameterTypeFromCallContexts(0, usageContext.properties.get("then").callContexts, false, checker);
|
||||
@@ -87367,7 +87523,7 @@ var ts;
|
||||
return undefined;
|
||||
var isJS = ts.isSourceFileJavaScript(file);
|
||||
var changeTracker = ts.textChanges.ChangeTracker.fromContext(context);
|
||||
var isStatic = fieldInfo.isStatic, isReadonly = fieldInfo.isReadonly, fieldName = fieldInfo.fieldName, accessorName = fieldInfo.accessorName, originalName = fieldInfo.originalName, type = fieldInfo.type, container = fieldInfo.container, declaration = fieldInfo.declaration;
|
||||
var isStatic = fieldInfo.isStatic, isReadonly = fieldInfo.isReadonly, fieldName = fieldInfo.fieldName, accessorName = fieldInfo.accessorName, originalName = fieldInfo.originalName, type = fieldInfo.type, container = fieldInfo.container, declaration = fieldInfo.declaration, renameAccessor = fieldInfo.renameAccessor;
|
||||
ts.suppressLeadingAndTrailingTrivia(fieldName);
|
||||
ts.suppressLeadingAndTrailingTrivia(declaration);
|
||||
ts.suppressLeadingAndTrailingTrivia(container);
|
||||
@@ -87396,8 +87552,9 @@ var ts;
|
||||
}
|
||||
var edits = changeTracker.getChanges();
|
||||
var renameFilename = file.fileName;
|
||||
var renameLocationOffset = ts.isIdentifier(fieldName) ? 0 : -1;
|
||||
var renameLocation = renameLocationOffset + ts.getRenameLocation(edits, renameFilename, fieldName.text, ts.isParameter(declaration));
|
||||
var nameNeedRename = renameAccessor ? accessorName : fieldName;
|
||||
var renameLocationOffset = ts.isIdentifier(nameNeedRename) ? 0 : -1;
|
||||
var renameLocation = renameLocationOffset + ts.getRenameLocation(edits, renameFilename, nameNeedRename.text, ts.isParameter(declaration));
|
||||
return { renameFilename: renameFilename, renameLocation: renameLocation, edits: edits };
|
||||
}
|
||||
function isConvertableName(name) {
|
||||
@@ -87417,14 +87574,19 @@ var ts;
|
||||
var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(115) : undefined);
|
||||
return modifiers && ts.createNodeArray(modifiers);
|
||||
}
|
||||
function startsWithUnderscore(name) {
|
||||
return name.charCodeAt(0) === 95;
|
||||
}
|
||||
function getConvertibleFieldAtPosition(file, startPosition) {
|
||||
var node = ts.getTokenAtPosition(file, startPosition, false);
|
||||
var declaration = ts.findAncestor(node.parent, isAcceptedDeclaration);
|
||||
var meaning = 28 | 32 | 64;
|
||||
if (!declaration || !isConvertableName(declaration.name) || (ts.getModifierFlags(declaration) | meaning) !== meaning)
|
||||
return undefined;
|
||||
var fieldName = createPropertyName(ts.getUniqueName("_" + declaration.name.text, file.text), declaration.name);
|
||||
var accessorName = createPropertyName(declaration.name.text, declaration.name);
|
||||
var name = declaration.name.text;
|
||||
var startWithUnderscore = startsWithUnderscore(name);
|
||||
var fieldName = createPropertyName(startWithUnderscore ? name : ts.getUniqueName("_" + name, file.text), declaration.name);
|
||||
var accessorName = createPropertyName(startWithUnderscore ? ts.getUniqueName(name.substring(1), file.text) : name, declaration.name);
|
||||
return {
|
||||
isStatic: ts.hasStaticModifier(declaration),
|
||||
isReadonly: ts.hasReadonlyModifier(declaration),
|
||||
@@ -87434,6 +87596,7 @@ var ts;
|
||||
declaration: declaration,
|
||||
fieldName: fieldName,
|
||||
accessorName: accessorName,
|
||||
renameAccessor: startWithUnderscore
|
||||
};
|
||||
}
|
||||
function generateGetAccessor(fieldName, accessorName, type, modifiers, isStatic, container) {
|
||||
@@ -87468,7 +87631,9 @@ var ts;
|
||||
function insertAccessor(changeTracker, file, accessor, declaration, container) {
|
||||
ts.isParameterPropertyDeclaration(declaration)
|
||||
? changeTracker.insertNodeAtClassStart(file, container, accessor)
|
||||
: changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
: ts.isPropertyAssignment(declaration)
|
||||
? changeTracker.insertNodeAfterComma(file, declaration, accessor)
|
||||
: changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
}
|
||||
function updateReadonlyPropertyInitializerStatementConstructor(changeTracker, context, constructor, fieldName, originalName) {
|
||||
if (!constructor.body)
|
||||
@@ -89399,7 +89564,8 @@ var ts;
|
||||
}
|
||||
function makeGetTargetOfMappedPosition(extract, create) {
|
||||
return getTargetOfMappedPosition;
|
||||
function getTargetOfMappedPosition(input) {
|
||||
function getTargetOfMappedPosition(input, original) {
|
||||
if (original === void 0) { original = input; }
|
||||
var info = extract(input);
|
||||
if (ts.endsWith(info.fileName, ".d.ts")) {
|
||||
var file = program.getSourceFile(info.fileName);
|
||||
@@ -89414,12 +89580,12 @@ var ts;
|
||||
var newLoc = mapper.getOriginalPosition(info);
|
||||
if (newLoc === info)
|
||||
return input;
|
||||
return getTargetOfMappedPosition(create(newLoc, input));
|
||||
return getTargetOfMappedPosition(create(newLoc, input, original), original);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
}
|
||||
var getTargetOfMappedDeclarationInfo = makeGetTargetOfMappedPosition(function (info) { return ({ fileName: info.fileName, position: info.textSpan.start }); }, function (newLoc, info) { return ({
|
||||
var getTargetOfMappedDeclarationInfo = makeGetTargetOfMappedPosition(function (info) { return ({ fileName: info.fileName, position: info.textSpan.start }); }, function (newLoc, info, original) { return ({
|
||||
containerKind: info.containerKind,
|
||||
containerName: info.containerName,
|
||||
fileName: newLoc.fileName,
|
||||
@@ -89428,10 +89594,12 @@ var ts;
|
||||
textSpan: {
|
||||
start: newLoc.position,
|
||||
length: info.textSpan.length
|
||||
}
|
||||
},
|
||||
originalFileName: original.fileName,
|
||||
originalTextSpan: original.textSpan
|
||||
}); });
|
||||
function getTargetOfMappedDeclarationFiles(infos) {
|
||||
return ts.map(infos, getTargetOfMappedDeclarationInfo);
|
||||
return ts.map(infos, function (d) { return getTargetOfMappedDeclarationInfo(d); });
|
||||
}
|
||||
function getDefinitionAtPosition(fileName, position) {
|
||||
synchronizeHostData();
|
||||
@@ -89462,10 +89630,12 @@ var ts;
|
||||
textSpan: {
|
||||
start: newLoc.position,
|
||||
length: info.textSpan.length
|
||||
}
|
||||
},
|
||||
originalFileName: info.fileName,
|
||||
originalTextSpan: info.textSpan
|
||||
}); });
|
||||
function getTargetOfMappedImplementationLocations(infos) {
|
||||
return ts.map(infos, getTargetOfMappedImplementationLocation);
|
||||
return ts.map(infos, function (d) { return getTargetOfMappedImplementationLocation(d); });
|
||||
}
|
||||
function getImplementationAtPosition(fileName, position) {
|
||||
synchronizeHostData();
|
||||
@@ -93913,11 +94083,11 @@ var ts;
|
||||
return;
|
||||
}
|
||||
this.seenProjects.set(projectKey, true);
|
||||
if (!this.eventHandler) {
|
||||
if (!this.eventHandler || !this.host.createSHA256Hash) {
|
||||
return;
|
||||
}
|
||||
var data = {
|
||||
projectId: this.host.createHash(projectKey),
|
||||
projectId: this.host.createSHA256Hash(projectKey),
|
||||
fileStats: server.countEachFileTypes(project.getScriptInfos()),
|
||||
compilerOptions: ts.convertCompilerOptionsForTelemetry(project.getCompilationSettings()),
|
||||
typeAcquisition: convertTypeAcquisition(project.getTypeAcquisition()),
|
||||
@@ -95481,9 +95651,7 @@ var ts;
|
||||
if (simplifiedResult) {
|
||||
return this.mapDefinitionInfo(definitions, project);
|
||||
}
|
||||
else {
|
||||
return definitions;
|
||||
}
|
||||
return definitions.map(Session.mapToOriginalLocation);
|
||||
};
|
||||
Session.prototype.getDefinitionAndBoundSpan = function (args, simplifiedResult) {
|
||||
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
||||
@@ -95502,12 +95670,19 @@ var ts;
|
||||
textSpan: this.toLocationTextSpan(definitionAndBoundSpan.textSpan, scriptInfo)
|
||||
};
|
||||
}
|
||||
return definitionAndBoundSpan;
|
||||
return __assign({}, definitionAndBoundSpan, { definitions: definitionAndBoundSpan.definitions.map(Session.mapToOriginalLocation) });
|
||||
};
|
||||
Session.prototype.mapDefinitionInfo = function (definitions, project) {
|
||||
var _this = this;
|
||||
return definitions.map(function (def) { return _this.toFileSpan(def.fileName, def.textSpan, project); });
|
||||
};
|
||||
Session.mapToOriginalLocation = function (def) {
|
||||
if (def.originalFileName) {
|
||||
ts.Debug.assert(def.originalTextSpan !== undefined, "originalTextSpan should be present if originalFileName is");
|
||||
return __assign({}, def, { fileName: def.originalFileName, textSpan: def.originalTextSpan, targetFileName: def.fileName, targetTextSpan: def.textSpan });
|
||||
}
|
||||
return def;
|
||||
};
|
||||
Session.prototype.toFileSpan = function (fileName, textSpan, project) {
|
||||
var ls = project.getLanguageService();
|
||||
var start = ls.toLineColumnOffset(fileName, textSpan.start);
|
||||
@@ -95541,9 +95716,7 @@ var ts;
|
||||
return _this.toFileSpan(fileName, textSpan, project);
|
||||
});
|
||||
}
|
||||
else {
|
||||
return implementations;
|
||||
}
|
||||
return implementations.map(Session.mapToOriginalLocation);
|
||||
};
|
||||
Session.prototype.getOccurrences = function (args) {
|
||||
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
||||
@@ -96376,10 +96549,16 @@ var ts;
|
||||
};
|
||||
Session.prototype.mapTextChangesToCodeEditsUsingScriptinfo = function (textChanges, scriptInfo) {
|
||||
var _this = this;
|
||||
return {
|
||||
fileName: textChanges.fileName,
|
||||
textChanges: textChanges.textChanges.map(function (textChange) { return _this.convertTextChangeToCodeEdit(textChange, scriptInfo); })
|
||||
};
|
||||
ts.Debug.assert(!!textChanges.isNewFile === !scriptInfo);
|
||||
if (scriptInfo) {
|
||||
return {
|
||||
fileName: textChanges.fileName,
|
||||
textChanges: textChanges.textChanges.map(function (textChange) { return _this.convertTextChangeToCodeEdit(textChange, scriptInfo); })
|
||||
};
|
||||
}
|
||||
else {
|
||||
return this.convertNewFileTextChangeToCodeEdit(textChanges);
|
||||
}
|
||||
};
|
||||
Session.prototype.convertTextChangeToCodeEdit = function (change, scriptInfo) {
|
||||
return {
|
||||
@@ -96388,6 +96567,12 @@ var ts;
|
||||
newText: change.newText ? change.newText : ""
|
||||
};
|
||||
};
|
||||
Session.prototype.convertNewFileTextChangeToCodeEdit = function (textChanges) {
|
||||
ts.Debug.assert(textChanges.textChanges.length === 1);
|
||||
var change = ts.first(textChanges.textChanges);
|
||||
ts.Debug.assert(change.span.start === 0 && change.span.length === 0);
|
||||
return { fileName: textChanges.fileName, textChanges: [{ start: { line: 0, offset: 0 }, end: { line: 0, offset: 0 }, newText: change.newText }] };
|
||||
};
|
||||
Session.prototype.getBraceMatching = function (args, simplifiedResult) {
|
||||
var _this = this;
|
||||
var _a = this.getFileAndLanguageServiceForSyntacticOperation(args), file = _a.file, languageService = _a.languageService;
|
||||
|
||||
Vendored
+16
-5
@@ -2248,6 +2248,7 @@ declare namespace ts {
|
||||
objectType: Type;
|
||||
indexType: Type;
|
||||
constraint?: Type;
|
||||
simplified?: Type;
|
||||
}
|
||||
type TypeVariable = TypeParameter | IndexedAccessType;
|
||||
interface IndexType extends InstantiableType {
|
||||
@@ -2980,10 +2981,11 @@ declare namespace ts {
|
||||
readDirectory(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
|
||||
getModifiedTime?(path: string): Date;
|
||||
/**
|
||||
* This should be cryptographically secure.
|
||||
* A good implementation is node.js' `crypto.createHash`. (https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm)
|
||||
*/
|
||||
createHash?(data: string): string;
|
||||
/** This must be cryptographically secure. Only implement this method using `crypto.createHash("sha256")`. */
|
||||
createSHA256Hash?(data: string): string;
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
realpath?(path: string): string;
|
||||
@@ -3858,6 +3860,7 @@ declare namespace ts {
|
||||
function getSyntheticTrailingComments(node: Node): SynthesizedComment[] | undefined;
|
||||
function setSyntheticTrailingComments<T extends Node>(node: T, comments: SynthesizedComment[]): T;
|
||||
function addSyntheticTrailingComment<T extends Node>(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T;
|
||||
function moveSyntheticComments<T extends Node>(node: T, original: Node): T;
|
||||
/**
|
||||
* Gets the constant value to emit for an expression.
|
||||
*/
|
||||
@@ -4615,6 +4618,7 @@ declare namespace ts {
|
||||
interface FileTextChanges {
|
||||
fileName: string;
|
||||
textChanges: TextChange[];
|
||||
isNewFile?: boolean;
|
||||
}
|
||||
interface CodeAction {
|
||||
/** Description of the code action to display in the UI of the editor */
|
||||
@@ -4701,6 +4705,12 @@ declare namespace ts {
|
||||
interface DocumentSpan {
|
||||
textSpan: TextSpan;
|
||||
fileName: string;
|
||||
/**
|
||||
* If the span represents a location that was remapped (e.g. via a .d.ts.map file),
|
||||
* then the original filename and span will be specified here
|
||||
*/
|
||||
originalTextSpan?: TextSpan;
|
||||
originalFileName?: string;
|
||||
}
|
||||
interface RenameLocation extends DocumentSpan {
|
||||
}
|
||||
@@ -4798,9 +4808,7 @@ declare namespace ts {
|
||||
insertSpaceBeforeTypeAnnotation?: boolean;
|
||||
indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean;
|
||||
}
|
||||
interface DefinitionInfo {
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
interface DefinitionInfo extends DocumentSpan {
|
||||
kind: ScriptElementKind;
|
||||
name: string;
|
||||
containerKind: ScriptElementKind;
|
||||
@@ -7573,6 +7581,7 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
}
|
||||
interface CompilerOptions {
|
||||
allowJs?: boolean;
|
||||
@@ -7890,7 +7899,7 @@ declare namespace ts.server {
|
||||
private detachScriptInfoFromProject;
|
||||
private addMissingFileWatcher;
|
||||
private isWatchedMissingFile;
|
||||
getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo;
|
||||
getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined;
|
||||
getScriptInfo(uncheckedFileName: string): ScriptInfo;
|
||||
filesToString(writeProjectFileNames: boolean): string;
|
||||
setCompilerOptions(compilerOptions: CompilerOptions): void;
|
||||
@@ -8410,6 +8419,7 @@ declare namespace ts.server {
|
||||
private getDefinition;
|
||||
private getDefinitionAndBoundSpan;
|
||||
private mapDefinitionInfo;
|
||||
private static mapToOriginalLocation;
|
||||
private toFileSpan;
|
||||
private getTypeDefinition;
|
||||
private getImplementation;
|
||||
@@ -8483,6 +8493,7 @@ declare namespace ts.server {
|
||||
private mapTextChangesToCodeEdits;
|
||||
private mapTextChangesToCodeEditsUsingScriptinfo;
|
||||
private convertTextChangeToCodeEdit;
|
||||
private convertNewFileTextChangeToCodeEdit;
|
||||
private getBraceMatching;
|
||||
private getDiagnosticsForProject;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
|
||||
+314
-123
@@ -1629,7 +1629,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "2.9";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".0-dev";
|
||||
ts.version = ts.versionMajorMinor + ".1";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
@@ -5151,6 +5151,7 @@ var ts;
|
||||
readDirectory: readDirectory,
|
||||
getModifiedTime: getModifiedTime,
|
||||
createHash: _crypto ? createMD5HashUsingNativeCrypto : generateDjb2Hash,
|
||||
createSHA256Hash: _crypto ? createSHA256Hash : undefined,
|
||||
getMemoryUsage: function () {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
@@ -5589,6 +5590,11 @@ var ts;
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
function createSHA256Hash(data) {
|
||||
var hash = _crypto.createHash("sha256");
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -10382,9 +10388,9 @@ var ts;
|
||||
node.body.kind === 238 /* ModuleDeclaration */ &&
|
||||
node.body;
|
||||
}
|
||||
function getJSDocCommentsAndTags(node) {
|
||||
function getJSDocCommentsAndTags(hostNode) {
|
||||
var result;
|
||||
getJSDocCommentsAndTagsWorker(node);
|
||||
getJSDocCommentsAndTagsWorker(hostNode);
|
||||
return result || ts.emptyArray;
|
||||
function getJSDocCommentsAndTagsWorker(node) {
|
||||
var parent = node.parent;
|
||||
@@ -10400,7 +10406,7 @@ var ts;
|
||||
// */
|
||||
// var x = function(name) { return name.length; }
|
||||
if (parent.parent &&
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node || getSourceOfAssignment(parent.parent))) {
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node)) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent);
|
||||
}
|
||||
if (parent.parent && parent.parent.parent &&
|
||||
@@ -10409,8 +10415,8 @@ var ts;
|
||||
getSourceOfDefaultedAssignment(parent.parent.parent))) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent.parent);
|
||||
}
|
||||
if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 /* None */ ||
|
||||
ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 /* None */ ||
|
||||
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 58 /* EqualsToken */ ||
|
||||
ts.isBinaryExpression(parent) && parent.operatorToken.kind === 58 /* EqualsToken */ ||
|
||||
node.kind === 184 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 215 /* ExpressionStatement */) {
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
@@ -10418,7 +10424,7 @@ var ts;
|
||||
if (node.kind === 148 /* Parameter */) {
|
||||
result = ts.addRange(result, ts.getJSDocParameterTags(node));
|
||||
}
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && ts.hasJSDocNodes(node.initializer)) {
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && node.initializer !== hostNode && ts.hasJSDocNodes(node.initializer)) {
|
||||
result = ts.addRange(result, node.initializer.jsDoc);
|
||||
}
|
||||
if (ts.hasJSDocNodes(node)) {
|
||||
@@ -11546,7 +11552,9 @@ var ts;
|
||||
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
||||
*/
|
||||
function getEffectiveTypeParameterDeclarations(node) {
|
||||
return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
return ts.isJSDocTypedefTag(node)
|
||||
? getJSDocTypeParameterDeclarations(node)
|
||||
: node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
}
|
||||
ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations;
|
||||
function getJSDocTypeParameterDeclarations(node) {
|
||||
@@ -13092,7 +13100,9 @@ var ts;
|
||||
var tags = node.jsDocCache;
|
||||
// If cache is 'null', that means we did the work of searching for JSDoc tags and came up with nothing.
|
||||
if (tags === undefined) {
|
||||
node.jsDocCache = tags = ts.flatMap(ts.getJSDocCommentsAndTags(node), function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
var comments = ts.getJSDocCommentsAndTags(node);
|
||||
ts.Debug.assert(comments.length < 2 || comments[0] !== comments[1]);
|
||||
node.jsDocCache = tags = ts.flatMap(comments, function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
@@ -16824,15 +16834,19 @@ var ts;
|
||||
node.initializer = parseInitializer();
|
||||
return finishNode(node);
|
||||
}
|
||||
/**
|
||||
* @returns If return type parsing succeeds
|
||||
*/
|
||||
function fillSignature(returnToken, flags, signature) {
|
||||
if (!(flags & 32 /* JSDoc */)) {
|
||||
signature.typeParameters = parseTypeParameters();
|
||||
}
|
||||
signature.parameters = parseParameterList(flags);
|
||||
signature.type = parseReturnType(returnToken, !!(flags & 4 /* Type */));
|
||||
}
|
||||
function parseReturnType(returnToken, isType) {
|
||||
return shouldParseReturnType(returnToken, isType) ? parseTypeOrTypePredicate() : undefined;
|
||||
if (shouldParseReturnType(returnToken, !!(flags & 4 /* Type */))) {
|
||||
signature.type = parseTypeOrTypePredicate();
|
||||
return signature.type !== undefined;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function shouldParseReturnType(returnToken, isType) {
|
||||
if (returnToken === 36 /* EqualsGreaterThanToken */) {
|
||||
@@ -17111,6 +17125,9 @@ var ts;
|
||||
var node = createNode(172 /* ParenthesizedType */);
|
||||
parseExpected(19 /* OpenParenToken */);
|
||||
node.type = parseType();
|
||||
if (!node.type) {
|
||||
return undefined;
|
||||
}
|
||||
parseExpected(20 /* CloseParenToken */);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -17119,7 +17136,12 @@ var ts;
|
||||
if (kind === 163 /* ConstructorType */) {
|
||||
parseExpected(94 /* NewKeyword */);
|
||||
}
|
||||
fillSignature(36 /* EqualsGreaterThanToken */, 4 /* Type */, node);
|
||||
if (!fillSignature(36 /* EqualsGreaterThanToken */, 4 /* Type */ | (sourceFile.languageVariant === 1 /* JSX */ ? 8 /* RequireCompleteParameterList */ : 0), node)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
}
|
||||
return finishNode(node);
|
||||
}
|
||||
function parseKeywordAndNoDot() {
|
||||
@@ -17870,7 +17892,9 @@ var ts;
|
||||
// a => (b => c)
|
||||
// And think that "(b =>" was actually a parenthesized arrow function with a missing
|
||||
// close paren.
|
||||
fillSignature(56 /* ColonToken */, isAsync | (allowAmbiguity ? 0 /* None */ : 8 /* RequireCompleteParameterList */), node);
|
||||
if (!fillSignature(56 /* ColonToken */, isAsync | (allowAmbiguity ? 0 /* None */ : 8 /* RequireCompleteParameterList */), node)) {
|
||||
return undefined;
|
||||
}
|
||||
// If we couldn't get parameters, we definitely could not parse out an arrow function.
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
@@ -26005,8 +26029,11 @@ var ts;
|
||||
}
|
||||
else {
|
||||
var jsPath = tryReadPackageJsonFields(/*readTypes*/ false, packageJsonContent, nodeModuleDirectory, state);
|
||||
if (typeof jsPath === "string") {
|
||||
subModuleName = ts.removeExtension(ts.removeExtension(jsPath.substring(nodeModuleDirectory.length + 1), ".js" /* Js */), ".jsx" /* Jsx */) + ".d.ts" /* Dts */;
|
||||
if (typeof jsPath === "string" && jsPath.length > nodeModuleDirectory.length) {
|
||||
var potentialSubModule_1 = jsPath.substring(nodeModuleDirectory.length + 1);
|
||||
subModuleName = (ts.forEach(ts.supportedJavascriptExtensions, function (extension) {
|
||||
return ts.tryRemoveExtension(potentialSubModule_1, extension);
|
||||
}) || potentialSubModule_1) + ".d.ts" /* Dts */;
|
||||
}
|
||||
else {
|
||||
subModuleName = "index.d.ts";
|
||||
@@ -26041,7 +26068,16 @@ var ts;
|
||||
function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) {
|
||||
var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript && extensions !== Extensions.Json, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
if (extensions === Extensions.TypeScript) {
|
||||
// When resolving typescript modules, try resolving using main field as well
|
||||
file = tryReadPackageJsonFields(/*readTypes*/ false, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host);
|
||||
var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state);
|
||||
@@ -26641,6 +26677,7 @@ var ts;
|
||||
var unknownSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, unknownType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var resolvingSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, anyType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var silentNeverSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, silentNeverType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var resolvingSignaturesArray = [resolvingSignature];
|
||||
var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true);
|
||||
var jsObjectLiteralIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false);
|
||||
var globals = ts.createSymbolTable();
|
||||
@@ -27119,6 +27156,7 @@ var ts;
|
||||
function mergeSymbol(target, source) {
|
||||
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
|
||||
(source.flags | target.flags) & 67108864 /* JSContainer */) {
|
||||
var targetValueDeclaration = target.valueDeclaration;
|
||||
ts.Debug.assert(!!(target.flags & 33554432 /* Transient */));
|
||||
// Javascript static-property-assignment declarations always merge, even though they are also values
|
||||
if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
|
||||
@@ -27145,12 +27183,13 @@ var ts;
|
||||
}
|
||||
if ((source.flags | target.flags) & 67108864 /* JSContainer */) {
|
||||
var sourceInitializer = ts.getJSInitializerSymbol(source);
|
||||
var targetInitializer = ts.getJSInitializerSymbol(target);
|
||||
var init = ts.getDeclaredJavascriptInitializer(targetValueDeclaration) || ts.getAssignedJavascriptInitializer(targetValueDeclaration);
|
||||
var targetInitializer = init && init.symbol ? init.symbol : target;
|
||||
if (!(targetInitializer.flags & 33554432 /* Transient */)) {
|
||||
var mergedInitializer = getMergedSymbol(targetInitializer);
|
||||
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
|
||||
}
|
||||
if (sourceInitializer !== source || targetInitializer !== target) {
|
||||
if (!(targetInitializer.flags & 33554432 /* Transient */)) {
|
||||
var mergedInitializer = getMergedSymbol(targetInitializer);
|
||||
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
|
||||
}
|
||||
mergeSymbol(targetInitializer, sourceInitializer);
|
||||
}
|
||||
}
|
||||
@@ -29947,6 +29986,10 @@ var ts;
|
||||
return false;
|
||||
function determineIfDeclarationIsVisible() {
|
||||
switch (node.kind) {
|
||||
case 294 /* JSDocTypedefTag */:
|
||||
// Top-level jsdoc typedefs are considered exported
|
||||
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
|
||||
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
|
||||
case 181 /* BindingElement */:
|
||||
return isDeclarationVisible(node.parent.parent);
|
||||
case 231 /* VariableDeclaration */:
|
||||
@@ -31000,7 +31043,7 @@ var ts;
|
||||
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
if (node.kind === 235 /* InterfaceDeclaration */ || node.kind === 234 /* ClassDeclaration */ ||
|
||||
node.kind === 204 /* ClassExpression */ || node.kind === 236 /* TypeAliasDeclaration */) {
|
||||
node.kind === 204 /* ClassExpression */ || node.kind === 236 /* TypeAliasDeclaration */ || node.kind === 294 /* JSDocTypedefTag */) {
|
||||
var declaration = node;
|
||||
var typeParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
|
||||
if (typeParameters) {
|
||||
@@ -34267,6 +34310,10 @@ var ts;
|
||||
// Transform an indexed access to a simpler form, if possible. Return the simpler form, or return
|
||||
// the type itself if no transformation is possible.
|
||||
function getSimplifiedIndexedAccessType(type) {
|
||||
if (type.simplified) {
|
||||
return type.simplified === circularConstraintType ? type : type.simplified;
|
||||
}
|
||||
type.simplified = circularConstraintType;
|
||||
var objectType = type.objectType;
|
||||
if (objectType.flags & 262144 /* Intersection */ && isGenericObjectType(objectType)) {
|
||||
// Given an indexed access type T[K], if T is an intersection containing one or more generic types and one or
|
||||
@@ -34285,7 +34332,7 @@ var ts;
|
||||
regularTypes.push(t);
|
||||
}
|
||||
}
|
||||
return getUnionType([
|
||||
return type.simplified = getUnionType([
|
||||
getSimplifiedType(getIndexedAccessType(getIntersectionType(regularTypes), type.indexType)),
|
||||
getIntersectionType(stringIndexTypes)
|
||||
]);
|
||||
@@ -34296,7 +34343,7 @@ var ts;
|
||||
// eventually anyway, but it easier to reason about.
|
||||
if (ts.some(objectType.types, isMappedTypeToNever)) {
|
||||
var nonNeverTypes = ts.filter(objectType.types, function (t) { return !isMappedTypeToNever(t); });
|
||||
return getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
return type.simplified = getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
}
|
||||
}
|
||||
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
|
||||
@@ -34304,15 +34351,15 @@ var ts;
|
||||
// construct the type Box<T[X]>. We do not further simplify the result because mapped types can be recursive
|
||||
// and we might never terminate.
|
||||
if (isGenericMappedType(objectType)) {
|
||||
return substituteIndexedMappedType(objectType, type);
|
||||
return type.simplified = substituteIndexedMappedType(objectType, type);
|
||||
}
|
||||
if (objectType.flags & 32768 /* TypeParameter */) {
|
||||
var constraint = getConstraintFromTypeParameter(objectType);
|
||||
if (constraint && isGenericMappedType(constraint)) {
|
||||
return substituteIndexedMappedType(constraint, type);
|
||||
return type.simplified = substituteIndexedMappedType(constraint, type);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, type) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
@@ -34600,7 +34647,7 @@ var ts;
|
||||
return links.resolvedType;
|
||||
}
|
||||
function getAliasSymbolForTypeNode(node) {
|
||||
return node.parent.kind === 236 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined;
|
||||
return (node.parent.kind === 236 /* TypeAliasDeclaration */ || node.parent.kind === 294 /* JSDocTypedefTag */) ? getSymbolOfNode(node.parent) : undefined;
|
||||
}
|
||||
function getAliasTypeArgumentsForTypeNode(node) {
|
||||
var symbol = getAliasSymbolForTypeNode(node);
|
||||
@@ -40461,8 +40508,17 @@ var ts;
|
||||
return unknownType;
|
||||
}
|
||||
}
|
||||
if (context.typeArguments) {
|
||||
signatures = ts.mapDefined(signatures, function (s) { return getJsxSignatureTypeArgumentInstantiation(s, context, isJs); });
|
||||
var links = getNodeLinks(context);
|
||||
if (!links.resolvedSignatures) {
|
||||
links.resolvedSignatures = ts.createMap();
|
||||
}
|
||||
var cacheKey = "" + getTypeId(valueType);
|
||||
if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) !== resolvingSignaturesArray) {
|
||||
signatures = links.resolvedSignatures.get(cacheKey);
|
||||
}
|
||||
else if (!links.resolvedSignatures.get(cacheKey)) {
|
||||
links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray);
|
||||
links.resolvedSignatures.set(cacheKey, signatures = instantiateJsxSignatures(context, signatures));
|
||||
}
|
||||
return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, /*reportErrors*/ false); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0 /* None */);
|
||||
}
|
||||
@@ -41369,6 +41425,37 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getInstantiatedJsxSignatures(openingLikeElement, elementType, reportErrors) {
|
||||
var links = getNodeLinks(openingLikeElement);
|
||||
if (!links.resolvedSignatures) {
|
||||
links.resolvedSignatures = ts.createMap();
|
||||
}
|
||||
var cacheKey = "" + getTypeId(elementType);
|
||||
if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) === resolvingSignaturesArray) {
|
||||
return;
|
||||
}
|
||||
else if (links.resolvedSignatures.get(cacheKey)) {
|
||||
return links.resolvedSignatures.get(cacheKey);
|
||||
}
|
||||
links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray);
|
||||
// Resolve the signatures, preferring constructor
|
||||
var signatures = getSignaturesOfType(elementType, 1 /* Construct */);
|
||||
if (signatures.length === 0) {
|
||||
// No construct signatures, try call signatures
|
||||
signatures = getSignaturesOfType(elementType, 0 /* Call */);
|
||||
if (signatures.length === 0) {
|
||||
// We found no signatures at all, which is an error
|
||||
if (reportErrors) {
|
||||
error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Instantiate in context of source type
|
||||
var results = instantiateJsxSignatures(openingLikeElement, signatures);
|
||||
links.resolvedSignatures.set(cacheKey, results);
|
||||
return results;
|
||||
}
|
||||
/**
|
||||
* Resolve attributes type of the given opening-like element. The attributes type is a type of attributes associated with the given elementType.
|
||||
* For instance:
|
||||
@@ -41424,19 +41511,10 @@ var ts;
|
||||
return anyType;
|
||||
}
|
||||
// Get the element instance type (the result of newing or invoking this tag)
|
||||
// Resolve the signatures, preferring constructor
|
||||
var signatures = getSignaturesOfType(elementType, 1 /* Construct */);
|
||||
if (signatures.length === 0) {
|
||||
// No construct signatures, try call signatures
|
||||
signatures = getSignaturesOfType(elementType, 0 /* Call */);
|
||||
if (signatures.length === 0) {
|
||||
// We found no signatures at all, which is an error
|
||||
error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName));
|
||||
return unknownType;
|
||||
}
|
||||
var instantiatedSignatures = getInstantiatedJsxSignatures(openingLikeElement, elementType, /*reportErrors*/ true);
|
||||
if (!ts.length(instantiatedSignatures)) {
|
||||
return unknownType;
|
||||
}
|
||||
// Instantiate in context of source type
|
||||
var instantiatedSignatures = instantiateJsxSignatures(openingLikeElement, signatures);
|
||||
var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2 /* Subtype */);
|
||||
// If we should include all stateless attributes type, then get all attributes type from all stateless function signature.
|
||||
// Otherwise get only attributes type from the signature picked by choose-overload logic.
|
||||
@@ -42945,10 +43023,10 @@ var ts;
|
||||
var isDecorator = node.kind === 149 /* Decorator */;
|
||||
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
||||
var typeArguments;
|
||||
if (!isDecorator && !isJsxOpeningOrSelfClosingElement) {
|
||||
if (!isDecorator) {
|
||||
typeArguments = node.typeArguments;
|
||||
// We already perform checking on the type arguments on the class declaration itself.
|
||||
if (isTaggedTemplate || node.expression.kind !== 97 /* SuperKeyword */) {
|
||||
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 97 /* SuperKeyword */) {
|
||||
ts.forEach(typeArguments, checkSourceElement);
|
||||
}
|
||||
}
|
||||
@@ -43473,28 +43551,6 @@ var ts;
|
||||
*/
|
||||
function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) {
|
||||
ts.Debug.assert(!(elementType.flags & 131072 /* Union */));
|
||||
return resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray);
|
||||
}
|
||||
/**
|
||||
* Try treating a given opening-like element as stateless function component and resolve a tagName to a function signature.
|
||||
* @param openingLikeElement an JSX opening-like element we want to try resolve its stateless function if possible
|
||||
* @param elementType a type of the opening-like JSX element, a result of resolving tagName in opening-like element.
|
||||
* @param candidatesOutArray an array of signature to be filled in by the function. It is passed by signature help in the language service;
|
||||
* the function will fill it up with appropriate candidate signatures
|
||||
* @return a resolved signature if we can find function matching function signature through resolve call or a first signature in the list of functions.
|
||||
* otherwise return undefined if tag-name of the opening-like element doesn't have call signatures
|
||||
*/
|
||||
function resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray) {
|
||||
// If this function is called from language service, elementType can be a union type. This is not possible if the function is called from compiler (see: resolveCustomJsxElementAttributesType)
|
||||
if (elementType.flags & 131072 /* Union */) {
|
||||
var types = elementType.types;
|
||||
var result = void 0;
|
||||
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
||||
var type = types_16[_i];
|
||||
result = result || resolveStatelessJsxOpeningLikeElement(openingLikeElement, type, candidatesOutArray);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var callSignatures = elementType && getSignaturesOfType(elementType, 0 /* Call */);
|
||||
if (callSignatures && callSignatures.length > 0) {
|
||||
return resolveCall(openingLikeElement, callSignatures, candidatesOutArray);
|
||||
@@ -43514,7 +43570,18 @@ var ts;
|
||||
case 256 /* JsxOpeningElement */:
|
||||
case 255 /* JsxSelfClosingElement */:
|
||||
// This code-path is called by language service
|
||||
return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray) || unknownSignature;
|
||||
var exprTypes = checkExpression(node.tagName);
|
||||
return forEachType(exprTypes, function (exprType) {
|
||||
var sfcResult = getResolvedJsxStatelessFunctionSignature(node, exprType, candidatesOutArray);
|
||||
if (sfcResult && sfcResult !== unknownSignature) {
|
||||
return sfcResult;
|
||||
}
|
||||
var sigs = getInstantiatedJsxSignatures(node, exprType);
|
||||
if (candidatesOutArray && ts.length(sigs)) {
|
||||
candidatesOutArray.push.apply(candidatesOutArray, sigs);
|
||||
}
|
||||
return ts.length(sigs) ? sigs[0] : unknownSignature;
|
||||
}) || unknownSignature;
|
||||
}
|
||||
ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
|
||||
}
|
||||
@@ -44401,8 +44468,8 @@ var ts;
|
||||
}
|
||||
if (type.flags & 393216 /* UnionOrIntersection */) {
|
||||
var types = type.types;
|
||||
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
||||
var t = types_17[_i];
|
||||
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
||||
var t = types_16[_i];
|
||||
if (maybeTypeOfKind(t, kind)) {
|
||||
return true;
|
||||
}
|
||||
@@ -47018,11 +47085,11 @@ var ts;
|
||||
if (!bindingPattern.elements.every(function (e) { return ts.contains(bindingElements, e); })) {
|
||||
for (var _i = 0, bindingElements_1 = bindingElements; _i < bindingElements_1.length; _i++) {
|
||||
var e = bindingElements_1[_i];
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, getBindingElementNameText(e)));
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(e.name, ts.isIdentifier))));
|
||||
}
|
||||
}
|
||||
else if (bindingElements.length === 1) {
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, getBindingElementNameText(ts.first(bindingElements))));
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(ts.first(bindingElements).name, ts.isIdentifier))));
|
||||
}
|
||||
else {
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics.All_destructured_elements_are_unused));
|
||||
@@ -54729,6 +54796,15 @@ var ts;
|
||||
return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text }));
|
||||
}
|
||||
ts.addSyntheticTrailingComment = addSyntheticTrailingComment;
|
||||
function moveSyntheticComments(node, original) {
|
||||
setSyntheticLeadingComments(node, getSyntheticLeadingComments(original));
|
||||
setSyntheticTrailingComments(node, getSyntheticTrailingComments(original));
|
||||
var emit = getOrCreateEmitNode(original);
|
||||
emit.leadingComments = undefined;
|
||||
emit.trailingComments = undefined;
|
||||
return node;
|
||||
}
|
||||
ts.moveSyntheticComments = moveSyntheticComments;
|
||||
/**
|
||||
* Gets the constant value to emit for an expression.
|
||||
*/
|
||||
@@ -60139,6 +60215,11 @@ var ts;
|
||||
// we can safely elide the parentheses here, as a new synthetic
|
||||
// ParenthesizedExpression will be inserted if we remove parentheses too
|
||||
// aggressively.
|
||||
// HOWEVER - if there are leading comments on the expression itself, to handle ASI
|
||||
// correctly for return and throw, we must keep the parenthesis
|
||||
if (ts.length(ts.getLeadingCommentRangesOfNode(expression, currentSourceFile))) {
|
||||
return ts.updateParen(node, expression);
|
||||
}
|
||||
return ts.createPartiallyEmittedExpression(expression, node);
|
||||
}
|
||||
return ts.visitEachChild(node, visitor, context);
|
||||
@@ -64017,6 +64098,7 @@ var ts;
|
||||
var expression = ts.visitNode(body, visitor, ts.isExpression);
|
||||
var returnStatement = ts.createReturn(expression);
|
||||
ts.setTextRange(returnStatement, body);
|
||||
ts.moveSyntheticComments(returnStatement, body);
|
||||
ts.setEmitFlags(returnStatement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 1024 /* NoTrailingComments */);
|
||||
statements.push(returnStatement);
|
||||
// To align with the source map emit for the old emitter, we set a custom
|
||||
@@ -76179,8 +76261,8 @@ var ts;
|
||||
write("/// <reference path=\"" + directive.fileName + "\" />");
|
||||
writeLine();
|
||||
}
|
||||
for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
|
||||
var directive = types_18[_d];
|
||||
for (var _d = 0, types_17 = types; _d < types_17.length; _d++) {
|
||||
var directive = types_17[_d];
|
||||
write("/// <reference types=\"" + directive.fileName + "\" />");
|
||||
writeLine();
|
||||
}
|
||||
@@ -85261,7 +85343,6 @@ var ts;
|
||||
return moduleSymbol.name.charCodeAt(0) === 34 /* doubleQuote */;
|
||||
}
|
||||
ts.isExternalModuleSymbol = isExternalModuleSymbol;
|
||||
/** Returns `true` the first time it encounters a node and `false` afterwards. */
|
||||
function nodeSeenTracker() {
|
||||
var seen = [];
|
||||
return function (node) {
|
||||
@@ -92085,12 +92166,42 @@ var ts;
|
||||
JsTyping.isTypingUpToDate = isTypingUpToDate;
|
||||
/* @internal */
|
||||
JsTyping.nodeCoreModuleList = [
|
||||
"buffer", "querystring", "events", "http", "cluster",
|
||||
"zlib", "os", "https", "punycode", "repl", "readline",
|
||||
"vm", "child_process", "url", "dns", "net",
|
||||
"dgram", "fs", "path", "string_decoder", "tls",
|
||||
"crypto", "stream", "util", "assert", "tty", "domain",
|
||||
"constants", "process", "v8", "timers", "console"
|
||||
"assert",
|
||||
"async_hooks",
|
||||
"buffer",
|
||||
"child_process",
|
||||
"cluster",
|
||||
"console",
|
||||
"constants",
|
||||
"crypto",
|
||||
"dgram",
|
||||
"dns",
|
||||
"domain",
|
||||
"events",
|
||||
"fs",
|
||||
"http",
|
||||
"https",
|
||||
"http2",
|
||||
"inspector",
|
||||
"net",
|
||||
"os",
|
||||
"path",
|
||||
"perf_hooks",
|
||||
"process",
|
||||
"punycode",
|
||||
"querystring",
|
||||
"readline",
|
||||
"repl",
|
||||
"stream",
|
||||
"string_decoder",
|
||||
"timers",
|
||||
"tls",
|
||||
"tty",
|
||||
"url",
|
||||
"util",
|
||||
"v8",
|
||||
"vm",
|
||||
"zlib"
|
||||
];
|
||||
/* @internal */
|
||||
JsTyping.nodeCoreModules = ts.arrayToSet(JsTyping.nodeCoreModuleList);
|
||||
@@ -94902,7 +95013,9 @@ var ts;
|
||||
program.getSemanticDiagnostics(sourceFile);
|
||||
var checker = program.getDiagnosticsProducingTypeChecker();
|
||||
var diags = [];
|
||||
if (sourceFile.commonJsModuleIndicator && (ts.programContainsEs6Modules(program) || ts.compilerOptionsIndicateEs6Modules(program.getCompilerOptions()))) {
|
||||
if (sourceFile.commonJsModuleIndicator &&
|
||||
(ts.programContainsEs6Modules(program) || ts.compilerOptionsIndicateEs6Modules(program.getCompilerOptions())) &&
|
||||
containsTopLevelCommonjs(sourceFile)) {
|
||||
diags.push(ts.createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), ts.Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module));
|
||||
}
|
||||
var isJsFile = ts.isSourceFileJavaScript(sourceFile);
|
||||
@@ -94954,6 +95067,29 @@ var ts;
|
||||
return diags.concat(checker.getSuggestionDiagnostics(sourceFile));
|
||||
}
|
||||
ts.computeSuggestionDiagnostics = computeSuggestionDiagnostics;
|
||||
// convertToEs6Module only works on top-level, so don't trigger it if commonjs code only appears in nested scopes.
|
||||
function containsTopLevelCommonjs(sourceFile) {
|
||||
return sourceFile.statements.some(function (statement) {
|
||||
switch (statement.kind) {
|
||||
case 213 /* VariableStatement */:
|
||||
return statement.declarationList.declarations.some(function (decl) {
|
||||
return ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true);
|
||||
});
|
||||
case 215 /* ExpressionStatement */: {
|
||||
var expression = statement.expression;
|
||||
if (!ts.isBinaryExpression(expression))
|
||||
return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true);
|
||||
var kind = ts.getSpecialPropertyAssignmentKind(expression);
|
||||
return kind === 1 /* ExportsProperty */ || kind === 2 /* ModuleExports */;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function propertyAccessLeftHandSide(node) {
|
||||
return ts.isPropertyAccessExpression(node) ? propertyAccessLeftHandSide(node.expression) : node;
|
||||
}
|
||||
function importNameForConvertToDefaultImport(node) {
|
||||
switch (node.kind) {
|
||||
case 243 /* ImportDeclaration */:
|
||||
@@ -98548,10 +98684,13 @@ var ts;
|
||||
if (options === void 0) { options = textChanges_3.useNonAdjustedPositions; }
|
||||
return this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options);
|
||||
};
|
||||
ChangeTracker.prototype.nextCommaToken = function (sourceFile, node) {
|
||||
var next = ts.findNextToken(node, node.parent, sourceFile);
|
||||
return next && next.kind === 26 /* CommaToken */ ? next : undefined;
|
||||
};
|
||||
ChangeTracker.prototype.replacePropertyAssignment = function (sourceFile, oldNode, newNode) {
|
||||
return this.replaceNode(sourceFile, oldNode, newNode, {
|
||||
suffix: "," + this.newLineCharacter
|
||||
});
|
||||
var suffix = this.nextCommaToken(sourceFile, oldNode) ? "" : ("," + this.newLineCharacter);
|
||||
return this.replaceNode(sourceFile, oldNode, newNode, { suffix: suffix });
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
@@ -98585,7 +98724,8 @@ var ts;
|
||||
// Otherwise, add an extra new line immediately before the error span.
|
||||
var insertAtLineStart = isValidLocationToAddComment(sourceFile, startPosition);
|
||||
var token = ts.getTouchingToken(sourceFile, insertAtLineStart ? startPosition : position, /*includeJsDocComment*/ false);
|
||||
var text = "" + (insertAtLineStart ? "" : this.newLineCharacter) + sourceFile.text.slice(lineStartPosition, startPosition) + "//" + commentText + this.newLineCharacter;
|
||||
var indent = sourceFile.text.slice(lineStartPosition, startPosition);
|
||||
var text = (insertAtLineStart ? "" : this.newLineCharacter) + "//" + commentText + this.newLineCharacter + indent;
|
||||
this.insertText(sourceFile, token.getStart(sourceFile), text);
|
||||
};
|
||||
ChangeTracker.prototype.replaceRangeWithText = function (sourceFile, range, text) {
|
||||
@@ -98677,6 +98817,10 @@ var ts;
|
||||
return { prefix: this.newLineCharacter, suffix: "" };
|
||||
}
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
|
||||
var endPosition = this.insertNodeAfterWorker(sourceFile, this.nextCommaToken(sourceFile, after) || after, newNode);
|
||||
this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after));
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
|
||||
var endPosition = this.insertNodeAfterWorker(sourceFile, after, newNode);
|
||||
this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after));
|
||||
@@ -98922,7 +99066,7 @@ var ts;
|
||||
changesToText.getTextChangesFromChanges = getTextChangesFromChanges;
|
||||
function newFileChanges(oldFile, fileName, statements, newLineCharacter) {
|
||||
var text = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
|
||||
return { fileName: fileName, textChanges: [ts.createTextChange(ts.createTextSpan(0, 0), text)] };
|
||||
return { fileName: fileName, textChanges: [ts.createTextChange(ts.createTextSpan(0, 0), text)], isNewFile: true };
|
||||
}
|
||||
changesToText.newFileChanges = newFileChanges;
|
||||
function computeNewText(change, sourceFile, newLineCharacter, formatContext, validate) {
|
||||
@@ -99874,7 +100018,7 @@ var ts;
|
||||
ts.Debug.assertNever(prop);
|
||||
}
|
||||
});
|
||||
return statements && [statements, true];
|
||||
return statements && [statements, false];
|
||||
}
|
||||
function convertNamedExport(sourceFile, assignment, changes, exports) {
|
||||
// If "originalKeywordKind" was set, this is e.g. `exports.
|
||||
@@ -101959,16 +102103,16 @@ var ts;
|
||||
}
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var declaration;
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken); });
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken, /*markSeenseen*/ ts.returnTrue); });
|
||||
return changes.length === 0 ? undefined
|
||||
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts.getNameOfDeclaration(declaration).getText(sourceFile)], fixId, ts.Diagnostics.Infer_all_types_from_usage)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile, program = context.program, cancellationToken = context.cancellationToken;
|
||||
var seenFunctions = ts.createMap();
|
||||
var markSeen = ts.nodeSeenTracker();
|
||||
return codefix.codeFixAll(context, errorCodes, function (changes, err) {
|
||||
doChange(changes, sourceFile, ts.getTokenAtPosition(err.file, err.start, /*includeJsDocComment*/ false), err.code, program, cancellationToken, seenFunctions);
|
||||
doChange(changes, sourceFile, ts.getTokenAtPosition(err.file, err.start, /*includeJsDocComment*/ false), err.code, program, cancellationToken, markSeen);
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -101982,7 +102126,7 @@ var ts;
|
||||
return ts.Diagnostics.Infer_type_of_0_from_usage;
|
||||
}
|
||||
}
|
||||
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, seenFunctions) {
|
||||
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen) {
|
||||
if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 71 /* Identifier */ && token.kind !== 24 /* DotDotDotToken */) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -101991,17 +102135,18 @@ var ts;
|
||||
// Variable and Property declarations
|
||||
case ts.Diagnostics.Member_0_implicitly_has_an_1_type.code:
|
||||
case ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code:
|
||||
if (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent)) { // handle bad location
|
||||
if ((ts.isVariableDeclaration(parent) && markSeen(parent)) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent)) { // handle bad location
|
||||
annotateVariableDeclaration(changes, sourceFile, parent, program, cancellationToken);
|
||||
return parent;
|
||||
}
|
||||
return undefined;
|
||||
case ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code: {
|
||||
var symbol = program.getTypeChecker().getSymbolAtLocation(token);
|
||||
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration)) {
|
||||
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) {
|
||||
annotateVariableDeclaration(changes, sourceFile, symbol.valueDeclaration, program, cancellationToken);
|
||||
return symbol.valueDeclaration;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var containingFunction = ts.getContainingFunction(token);
|
||||
@@ -102017,7 +102162,7 @@ var ts;
|
||||
}
|
||||
// falls through
|
||||
case ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
|
||||
if (!seenFunctions || ts.addToSeen(seenFunctions, ts.getNodeId(containingFunction))) {
|
||||
if (markSeen(containingFunction)) {
|
||||
var param = ts.cast(parent, ts.isParameter);
|
||||
annotateParameters(changes, param, containingFunction, sourceFile, program, cancellationToken);
|
||||
return param;
|
||||
@@ -102209,6 +102354,16 @@ var ts;
|
||||
case 185 /* ElementAccessExpression */:
|
||||
inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext);
|
||||
break;
|
||||
case 231 /* VariableDeclaration */: {
|
||||
var _a = node.parent, name = _a.name, initializer = _a.initializer;
|
||||
if (node === name) {
|
||||
if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error.
|
||||
addCandidateType(usageContext, checker.getTypeAtLocation(initializer));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// falls through
|
||||
default:
|
||||
return inferTypeFromContextualType(node, checker, usageContext);
|
||||
}
|
||||
@@ -102380,7 +102535,7 @@ var ts;
|
||||
return checker.getStringType();
|
||||
}
|
||||
else if (usageContext.candidateTypes) {
|
||||
return checker.getWidenedType(checker.getUnionType(ts.map(usageContext.candidateTypes, function (t) { return checker.getBaseTypeOfLiteralType(t); }), 2 /* Subtype */));
|
||||
return checker.getWidenedType(checker.getUnionType(usageContext.candidateTypes.map(function (t) { return checker.getBaseTypeOfLiteralType(t); }), 2 /* Subtype */));
|
||||
}
|
||||
else if (usageContext.properties && hasCallContext(usageContext.properties.get("then"))) {
|
||||
var paramType = getParameterTypeFromCallContexts(0, usageContext.properties.get("then").callContexts, /*isRestParameter*/ false, checker);
|
||||
@@ -104569,7 +104724,7 @@ var ts;
|
||||
return undefined;
|
||||
var isJS = ts.isSourceFileJavaScript(file);
|
||||
var changeTracker = ts.textChanges.ChangeTracker.fromContext(context);
|
||||
var isStatic = fieldInfo.isStatic, isReadonly = fieldInfo.isReadonly, fieldName = fieldInfo.fieldName, accessorName = fieldInfo.accessorName, originalName = fieldInfo.originalName, type = fieldInfo.type, container = fieldInfo.container, declaration = fieldInfo.declaration;
|
||||
var isStatic = fieldInfo.isStatic, isReadonly = fieldInfo.isReadonly, fieldName = fieldInfo.fieldName, accessorName = fieldInfo.accessorName, originalName = fieldInfo.originalName, type = fieldInfo.type, container = fieldInfo.container, declaration = fieldInfo.declaration, renameAccessor = fieldInfo.renameAccessor;
|
||||
ts.suppressLeadingAndTrailingTrivia(fieldName);
|
||||
ts.suppressLeadingAndTrailingTrivia(declaration);
|
||||
ts.suppressLeadingAndTrailingTrivia(container);
|
||||
@@ -104600,8 +104755,9 @@ var ts;
|
||||
}
|
||||
var edits = changeTracker.getChanges();
|
||||
var renameFilename = file.fileName;
|
||||
var renameLocationOffset = ts.isIdentifier(fieldName) ? 0 : -1;
|
||||
var renameLocation = renameLocationOffset + ts.getRenameLocation(edits, renameFilename, fieldName.text, /*preferLastLocation*/ ts.isParameter(declaration));
|
||||
var nameNeedRename = renameAccessor ? accessorName : fieldName;
|
||||
var renameLocationOffset = ts.isIdentifier(nameNeedRename) ? 0 : -1;
|
||||
var renameLocation = renameLocationOffset + ts.getRenameLocation(edits, renameFilename, nameNeedRename.text, /*preferLastLocation*/ ts.isParameter(declaration));
|
||||
return { renameFilename: renameFilename, renameLocation: renameLocation, edits: edits };
|
||||
}
|
||||
function isConvertableName(name) {
|
||||
@@ -104621,6 +104777,9 @@ var ts;
|
||||
var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(115 /* StaticKeyword */) : undefined);
|
||||
return modifiers && ts.createNodeArray(modifiers);
|
||||
}
|
||||
function startsWithUnderscore(name) {
|
||||
return name.charCodeAt(0) === 95 /* _ */;
|
||||
}
|
||||
function getConvertibleFieldAtPosition(file, startPosition) {
|
||||
var node = ts.getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false);
|
||||
var declaration = ts.findAncestor(node.parent, isAcceptedDeclaration);
|
||||
@@ -104628,8 +104787,10 @@ var ts;
|
||||
var meaning = 28 /* AccessibilityModifier */ | 32 /* Static */ | 64 /* Readonly */;
|
||||
if (!declaration || !isConvertableName(declaration.name) || (ts.getModifierFlags(declaration) | meaning) !== meaning)
|
||||
return undefined;
|
||||
var fieldName = createPropertyName(ts.getUniqueName("_" + declaration.name.text, file.text), declaration.name);
|
||||
var accessorName = createPropertyName(declaration.name.text, declaration.name);
|
||||
var name = declaration.name.text;
|
||||
var startWithUnderscore = startsWithUnderscore(name);
|
||||
var fieldName = createPropertyName(startWithUnderscore ? name : ts.getUniqueName("_" + name, file.text), declaration.name);
|
||||
var accessorName = createPropertyName(startWithUnderscore ? ts.getUniqueName(name.substring(1), file.text) : name, declaration.name);
|
||||
return {
|
||||
isStatic: ts.hasStaticModifier(declaration),
|
||||
isReadonly: ts.hasReadonlyModifier(declaration),
|
||||
@@ -104639,6 +104800,7 @@ var ts;
|
||||
declaration: declaration,
|
||||
fieldName: fieldName,
|
||||
accessorName: accessorName,
|
||||
renameAccessor: startWithUnderscore
|
||||
};
|
||||
}
|
||||
function generateGetAccessor(fieldName, accessorName, type, modifiers, isStatic, container) {
|
||||
@@ -104680,7 +104842,9 @@ var ts;
|
||||
function insertAccessor(changeTracker, file, accessor, declaration, container) {
|
||||
ts.isParameterPropertyDeclaration(declaration)
|
||||
? changeTracker.insertNodeAtClassStart(file, container, accessor)
|
||||
: changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
: ts.isPropertyAssignment(declaration)
|
||||
? changeTracker.insertNodeAfterComma(file, declaration, accessor)
|
||||
: changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
}
|
||||
function updateReadonlyPropertyInitializerStatementConstructor(changeTracker, context, constructor, fieldName, originalName) {
|
||||
if (!constructor.body)
|
||||
@@ -106792,7 +106956,8 @@ var ts;
|
||||
}
|
||||
function makeGetTargetOfMappedPosition(extract, create) {
|
||||
return getTargetOfMappedPosition;
|
||||
function getTargetOfMappedPosition(input) {
|
||||
function getTargetOfMappedPosition(input, original) {
|
||||
if (original === void 0) { original = input; }
|
||||
var info = extract(input);
|
||||
if (ts.endsWith(info.fileName, ".d.ts" /* Dts */)) {
|
||||
var file_17 = program.getSourceFile(info.fileName);
|
||||
@@ -106807,12 +106972,12 @@ var ts;
|
||||
var newLoc = mapper.getOriginalPosition(info);
|
||||
if (newLoc === info)
|
||||
return input;
|
||||
return getTargetOfMappedPosition(create(newLoc, input));
|
||||
return getTargetOfMappedPosition(create(newLoc, input, original), original);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
}
|
||||
var getTargetOfMappedDeclarationInfo = makeGetTargetOfMappedPosition(function (info) { return ({ fileName: info.fileName, position: info.textSpan.start }); }, function (newLoc, info) { return ({
|
||||
var getTargetOfMappedDeclarationInfo = makeGetTargetOfMappedPosition(function (info) { return ({ fileName: info.fileName, position: info.textSpan.start }); }, function (newLoc, info, original) { return ({
|
||||
containerKind: info.containerKind,
|
||||
containerName: info.containerName,
|
||||
fileName: newLoc.fileName,
|
||||
@@ -106821,10 +106986,12 @@ var ts;
|
||||
textSpan: {
|
||||
start: newLoc.position,
|
||||
length: info.textSpan.length
|
||||
}
|
||||
},
|
||||
originalFileName: original.fileName,
|
||||
originalTextSpan: original.textSpan
|
||||
}); });
|
||||
function getTargetOfMappedDeclarationFiles(infos) {
|
||||
return ts.map(infos, getTargetOfMappedDeclarationInfo);
|
||||
return ts.map(infos, function (d) { return getTargetOfMappedDeclarationInfo(d); });
|
||||
}
|
||||
/// Goto definition
|
||||
function getDefinitionAtPosition(fileName, position) {
|
||||
@@ -106857,10 +107024,12 @@ var ts;
|
||||
textSpan: {
|
||||
start: newLoc.position,
|
||||
length: info.textSpan.length
|
||||
}
|
||||
},
|
||||
originalFileName: info.fileName,
|
||||
originalTextSpan: info.textSpan
|
||||
}); });
|
||||
function getTargetOfMappedImplementationLocations(infos) {
|
||||
return ts.map(infos, getTargetOfMappedImplementationLocation);
|
||||
return ts.map(infos, function (d) { return getTargetOfMappedImplementationLocation(d); });
|
||||
}
|
||||
function getImplementationAtPosition(fileName, position) {
|
||||
synchronizeHostData();
|
||||
@@ -112176,11 +112345,11 @@ var ts;
|
||||
return;
|
||||
}
|
||||
this.seenProjects.set(projectKey, true);
|
||||
if (!this.eventHandler) {
|
||||
if (!this.eventHandler || !this.host.createSHA256Hash) {
|
||||
return;
|
||||
}
|
||||
var data = {
|
||||
projectId: this.host.createHash(projectKey),
|
||||
projectId: this.host.createSHA256Hash(projectKey),
|
||||
fileStats: server.countEachFileTypes(project.getScriptInfos()),
|
||||
compilerOptions: ts.convertCompilerOptionsForTelemetry(project.getCompilationSettings()),
|
||||
typeAcquisition: convertTypeAcquisition(project.getTypeAcquisition()),
|
||||
@@ -113958,9 +114127,7 @@ var ts;
|
||||
if (simplifiedResult) {
|
||||
return this.mapDefinitionInfo(definitions, project);
|
||||
}
|
||||
else {
|
||||
return definitions;
|
||||
}
|
||||
return definitions.map(Session.mapToOriginalLocation);
|
||||
};
|
||||
Session.prototype.getDefinitionAndBoundSpan = function (args, simplifiedResult) {
|
||||
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
||||
@@ -113979,12 +114146,26 @@ var ts;
|
||||
textSpan: this.toLocationTextSpan(definitionAndBoundSpan.textSpan, scriptInfo)
|
||||
};
|
||||
}
|
||||
return definitionAndBoundSpan;
|
||||
return __assign({}, definitionAndBoundSpan, { definitions: definitionAndBoundSpan.definitions.map(Session.mapToOriginalLocation) });
|
||||
};
|
||||
Session.prototype.mapDefinitionInfo = function (definitions, project) {
|
||||
var _this = this;
|
||||
return definitions.map(function (def) { return _this.toFileSpan(def.fileName, def.textSpan, project); });
|
||||
};
|
||||
/*
|
||||
* When we map a .d.ts location to .ts, Visual Studio gets confused because there's no associated Roslyn Document in
|
||||
* the same project which corresponds to the file. VS Code has no problem with this, and luckily we have two protocols.
|
||||
* This retains the existing behavior for the "simplified" (VS Code) protocol but stores the .d.ts location in a
|
||||
* set of additional fields, and does the reverse for VS (store the .d.ts location where
|
||||
* it used to be and stores the .ts location in the additional fields).
|
||||
*/
|
||||
Session.mapToOriginalLocation = function (def) {
|
||||
if (def.originalFileName) {
|
||||
ts.Debug.assert(def.originalTextSpan !== undefined, "originalTextSpan should be present if originalFileName is");
|
||||
return __assign({}, def, { fileName: def.originalFileName, textSpan: def.originalTextSpan, targetFileName: def.fileName, targetTextSpan: def.textSpan });
|
||||
}
|
||||
return def;
|
||||
};
|
||||
Session.prototype.toFileSpan = function (fileName, textSpan, project) {
|
||||
var ls = project.getLanguageService();
|
||||
var start = ls.toLineColumnOffset(fileName, textSpan.start);
|
||||
@@ -114018,9 +114199,7 @@ var ts;
|
||||
return _this.toFileSpan(fileName, textSpan, project);
|
||||
});
|
||||
}
|
||||
else {
|
||||
return implementations;
|
||||
}
|
||||
return implementations.map(Session.mapToOriginalLocation);
|
||||
};
|
||||
Session.prototype.getOccurrences = function (args) {
|
||||
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
||||
@@ -114882,10 +115061,16 @@ var ts;
|
||||
};
|
||||
Session.prototype.mapTextChangesToCodeEditsUsingScriptinfo = function (textChanges, scriptInfo) {
|
||||
var _this = this;
|
||||
return {
|
||||
fileName: textChanges.fileName,
|
||||
textChanges: textChanges.textChanges.map(function (textChange) { return _this.convertTextChangeToCodeEdit(textChange, scriptInfo); })
|
||||
};
|
||||
ts.Debug.assert(!!textChanges.isNewFile === !scriptInfo);
|
||||
if (scriptInfo) {
|
||||
return {
|
||||
fileName: textChanges.fileName,
|
||||
textChanges: textChanges.textChanges.map(function (textChange) { return _this.convertTextChangeToCodeEdit(textChange, scriptInfo); })
|
||||
};
|
||||
}
|
||||
else {
|
||||
return this.convertNewFileTextChangeToCodeEdit(textChanges);
|
||||
}
|
||||
};
|
||||
Session.prototype.convertTextChangeToCodeEdit = function (change, scriptInfo) {
|
||||
return {
|
||||
@@ -114894,6 +115079,12 @@ var ts;
|
||||
newText: change.newText ? change.newText : ""
|
||||
};
|
||||
};
|
||||
Session.prototype.convertNewFileTextChangeToCodeEdit = function (textChanges) {
|
||||
ts.Debug.assert(textChanges.textChanges.length === 1);
|
||||
var change = ts.first(textChanges.textChanges);
|
||||
ts.Debug.assert(change.span.start === 0 && change.span.length === 0);
|
||||
return { fileName: textChanges.fileName, textChanges: [{ start: { line: 0, offset: 0 }, end: { line: 0, offset: 0 }, newText: change.newText }] };
|
||||
};
|
||||
Session.prototype.getBraceMatching = function (args, simplifiedResult) {
|
||||
var _this = this;
|
||||
var _a = this.getFileAndLanguageServiceForSyntacticOperation(args), file = _a.file, languageService = _a.languageService;
|
||||
|
||||
Vendored
+12
-4
@@ -2248,6 +2248,7 @@ declare namespace ts {
|
||||
objectType: Type;
|
||||
indexType: Type;
|
||||
constraint?: Type;
|
||||
simplified?: Type;
|
||||
}
|
||||
type TypeVariable = TypeParameter | IndexedAccessType;
|
||||
interface IndexType extends InstantiableType {
|
||||
@@ -2980,10 +2981,11 @@ declare namespace ts {
|
||||
readDirectory(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
|
||||
getModifiedTime?(path: string): Date;
|
||||
/**
|
||||
* This should be cryptographically secure.
|
||||
* A good implementation is node.js' `crypto.createHash`. (https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm)
|
||||
*/
|
||||
createHash?(data: string): string;
|
||||
/** This must be cryptographically secure. Only implement this method using `crypto.createHash("sha256")`. */
|
||||
createSHA256Hash?(data: string): string;
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
realpath?(path: string): string;
|
||||
@@ -3858,6 +3860,7 @@ declare namespace ts {
|
||||
function getSyntheticTrailingComments(node: Node): SynthesizedComment[] | undefined;
|
||||
function setSyntheticTrailingComments<T extends Node>(node: T, comments: SynthesizedComment[]): T;
|
||||
function addSyntheticTrailingComment<T extends Node>(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T;
|
||||
function moveSyntheticComments<T extends Node>(node: T, original: Node): T;
|
||||
/**
|
||||
* Gets the constant value to emit for an expression.
|
||||
*/
|
||||
@@ -4615,6 +4618,7 @@ declare namespace ts {
|
||||
interface FileTextChanges {
|
||||
fileName: string;
|
||||
textChanges: TextChange[];
|
||||
isNewFile?: boolean;
|
||||
}
|
||||
interface CodeAction {
|
||||
/** Description of the code action to display in the UI of the editor */
|
||||
@@ -4701,6 +4705,12 @@ declare namespace ts {
|
||||
interface DocumentSpan {
|
||||
textSpan: TextSpan;
|
||||
fileName: string;
|
||||
/**
|
||||
* If the span represents a location that was remapped (e.g. via a .d.ts.map file),
|
||||
* then the original filename and span will be specified here
|
||||
*/
|
||||
originalTextSpan?: TextSpan;
|
||||
originalFileName?: string;
|
||||
}
|
||||
interface RenameLocation extends DocumentSpan {
|
||||
}
|
||||
@@ -4798,9 +4808,7 @@ declare namespace ts {
|
||||
insertSpaceBeforeTypeAnnotation?: boolean;
|
||||
indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean;
|
||||
}
|
||||
interface DefinitionInfo {
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
interface DefinitionInfo extends DocumentSpan {
|
||||
kind: ScriptElementKind;
|
||||
name: string;
|
||||
containerKind: ScriptElementKind;
|
||||
|
||||
+279
-110
@@ -1629,7 +1629,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "2.9";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".0-dev";
|
||||
ts.version = ts.versionMajorMinor + ".1";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
@@ -5151,6 +5151,7 @@ var ts;
|
||||
readDirectory: readDirectory,
|
||||
getModifiedTime: getModifiedTime,
|
||||
createHash: _crypto ? createMD5HashUsingNativeCrypto : generateDjb2Hash,
|
||||
createSHA256Hash: _crypto ? createSHA256Hash : undefined,
|
||||
getMemoryUsage: function () {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
@@ -5589,6 +5590,11 @@ var ts;
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
function createSHA256Hash(data) {
|
||||
var hash = _crypto.createHash("sha256");
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -10382,9 +10388,9 @@ var ts;
|
||||
node.body.kind === 238 /* ModuleDeclaration */ &&
|
||||
node.body;
|
||||
}
|
||||
function getJSDocCommentsAndTags(node) {
|
||||
function getJSDocCommentsAndTags(hostNode) {
|
||||
var result;
|
||||
getJSDocCommentsAndTagsWorker(node);
|
||||
getJSDocCommentsAndTagsWorker(hostNode);
|
||||
return result || ts.emptyArray;
|
||||
function getJSDocCommentsAndTagsWorker(node) {
|
||||
var parent = node.parent;
|
||||
@@ -10400,7 +10406,7 @@ var ts;
|
||||
// */
|
||||
// var x = function(name) { return name.length; }
|
||||
if (parent.parent &&
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node || getSourceOfAssignment(parent.parent))) {
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node)) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent);
|
||||
}
|
||||
if (parent.parent && parent.parent.parent &&
|
||||
@@ -10409,8 +10415,8 @@ var ts;
|
||||
getSourceOfDefaultedAssignment(parent.parent.parent))) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent.parent);
|
||||
}
|
||||
if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 /* None */ ||
|
||||
ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 /* None */ ||
|
||||
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 58 /* EqualsToken */ ||
|
||||
ts.isBinaryExpression(parent) && parent.operatorToken.kind === 58 /* EqualsToken */ ||
|
||||
node.kind === 184 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 215 /* ExpressionStatement */) {
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
@@ -10418,7 +10424,7 @@ var ts;
|
||||
if (node.kind === 148 /* Parameter */) {
|
||||
result = ts.addRange(result, ts.getJSDocParameterTags(node));
|
||||
}
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && ts.hasJSDocNodes(node.initializer)) {
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && node.initializer !== hostNode && ts.hasJSDocNodes(node.initializer)) {
|
||||
result = ts.addRange(result, node.initializer.jsDoc);
|
||||
}
|
||||
if (ts.hasJSDocNodes(node)) {
|
||||
@@ -11546,7 +11552,9 @@ var ts;
|
||||
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
||||
*/
|
||||
function getEffectiveTypeParameterDeclarations(node) {
|
||||
return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
return ts.isJSDocTypedefTag(node)
|
||||
? getJSDocTypeParameterDeclarations(node)
|
||||
: node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
}
|
||||
ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations;
|
||||
function getJSDocTypeParameterDeclarations(node) {
|
||||
@@ -13092,7 +13100,9 @@ var ts;
|
||||
var tags = node.jsDocCache;
|
||||
// If cache is 'null', that means we did the work of searching for JSDoc tags and came up with nothing.
|
||||
if (tags === undefined) {
|
||||
node.jsDocCache = tags = ts.flatMap(ts.getJSDocCommentsAndTags(node), function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
var comments = ts.getJSDocCommentsAndTags(node);
|
||||
ts.Debug.assert(comments.length < 2 || comments[0] !== comments[1]);
|
||||
node.jsDocCache = tags = ts.flatMap(comments, function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
@@ -16824,15 +16834,19 @@ var ts;
|
||||
node.initializer = parseInitializer();
|
||||
return finishNode(node);
|
||||
}
|
||||
/**
|
||||
* @returns If return type parsing succeeds
|
||||
*/
|
||||
function fillSignature(returnToken, flags, signature) {
|
||||
if (!(flags & 32 /* JSDoc */)) {
|
||||
signature.typeParameters = parseTypeParameters();
|
||||
}
|
||||
signature.parameters = parseParameterList(flags);
|
||||
signature.type = parseReturnType(returnToken, !!(flags & 4 /* Type */));
|
||||
}
|
||||
function parseReturnType(returnToken, isType) {
|
||||
return shouldParseReturnType(returnToken, isType) ? parseTypeOrTypePredicate() : undefined;
|
||||
if (shouldParseReturnType(returnToken, !!(flags & 4 /* Type */))) {
|
||||
signature.type = parseTypeOrTypePredicate();
|
||||
return signature.type !== undefined;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function shouldParseReturnType(returnToken, isType) {
|
||||
if (returnToken === 36 /* EqualsGreaterThanToken */) {
|
||||
@@ -17111,6 +17125,9 @@ var ts;
|
||||
var node = createNode(172 /* ParenthesizedType */);
|
||||
parseExpected(19 /* OpenParenToken */);
|
||||
node.type = parseType();
|
||||
if (!node.type) {
|
||||
return undefined;
|
||||
}
|
||||
parseExpected(20 /* CloseParenToken */);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -17119,7 +17136,12 @@ var ts;
|
||||
if (kind === 163 /* ConstructorType */) {
|
||||
parseExpected(94 /* NewKeyword */);
|
||||
}
|
||||
fillSignature(36 /* EqualsGreaterThanToken */, 4 /* Type */, node);
|
||||
if (!fillSignature(36 /* EqualsGreaterThanToken */, 4 /* Type */ | (sourceFile.languageVariant === 1 /* JSX */ ? 8 /* RequireCompleteParameterList */ : 0), node)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
}
|
||||
return finishNode(node);
|
||||
}
|
||||
function parseKeywordAndNoDot() {
|
||||
@@ -17870,7 +17892,9 @@ var ts;
|
||||
// a => (b => c)
|
||||
// And think that "(b =>" was actually a parenthesized arrow function with a missing
|
||||
// close paren.
|
||||
fillSignature(56 /* ColonToken */, isAsync | (allowAmbiguity ? 0 /* None */ : 8 /* RequireCompleteParameterList */), node);
|
||||
if (!fillSignature(56 /* ColonToken */, isAsync | (allowAmbiguity ? 0 /* None */ : 8 /* RequireCompleteParameterList */), node)) {
|
||||
return undefined;
|
||||
}
|
||||
// If we couldn't get parameters, we definitely could not parse out an arrow function.
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
@@ -26005,8 +26029,11 @@ var ts;
|
||||
}
|
||||
else {
|
||||
var jsPath = tryReadPackageJsonFields(/*readTypes*/ false, packageJsonContent, nodeModuleDirectory, state);
|
||||
if (typeof jsPath === "string") {
|
||||
subModuleName = ts.removeExtension(ts.removeExtension(jsPath.substring(nodeModuleDirectory.length + 1), ".js" /* Js */), ".jsx" /* Jsx */) + ".d.ts" /* Dts */;
|
||||
if (typeof jsPath === "string" && jsPath.length > nodeModuleDirectory.length) {
|
||||
var potentialSubModule_1 = jsPath.substring(nodeModuleDirectory.length + 1);
|
||||
subModuleName = (ts.forEach(ts.supportedJavascriptExtensions, function (extension) {
|
||||
return ts.tryRemoveExtension(potentialSubModule_1, extension);
|
||||
}) || potentialSubModule_1) + ".d.ts" /* Dts */;
|
||||
}
|
||||
else {
|
||||
subModuleName = "index.d.ts";
|
||||
@@ -26041,7 +26068,16 @@ var ts;
|
||||
function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) {
|
||||
var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript && extensions !== Extensions.Json, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
if (extensions === Extensions.TypeScript) {
|
||||
// When resolving typescript modules, try resolving using main field as well
|
||||
file = tryReadPackageJsonFields(/*readTypes*/ false, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host);
|
||||
var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state);
|
||||
@@ -26641,6 +26677,7 @@ var ts;
|
||||
var unknownSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, unknownType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var resolvingSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, anyType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var silentNeverSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, silentNeverType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var resolvingSignaturesArray = [resolvingSignature];
|
||||
var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true);
|
||||
var jsObjectLiteralIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false);
|
||||
var globals = ts.createSymbolTable();
|
||||
@@ -27119,6 +27156,7 @@ var ts;
|
||||
function mergeSymbol(target, source) {
|
||||
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
|
||||
(source.flags | target.flags) & 67108864 /* JSContainer */) {
|
||||
var targetValueDeclaration = target.valueDeclaration;
|
||||
ts.Debug.assert(!!(target.flags & 33554432 /* Transient */));
|
||||
// Javascript static-property-assignment declarations always merge, even though they are also values
|
||||
if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
|
||||
@@ -27145,12 +27183,13 @@ var ts;
|
||||
}
|
||||
if ((source.flags | target.flags) & 67108864 /* JSContainer */) {
|
||||
var sourceInitializer = ts.getJSInitializerSymbol(source);
|
||||
var targetInitializer = ts.getJSInitializerSymbol(target);
|
||||
var init = ts.getDeclaredJavascriptInitializer(targetValueDeclaration) || ts.getAssignedJavascriptInitializer(targetValueDeclaration);
|
||||
var targetInitializer = init && init.symbol ? init.symbol : target;
|
||||
if (!(targetInitializer.flags & 33554432 /* Transient */)) {
|
||||
var mergedInitializer = getMergedSymbol(targetInitializer);
|
||||
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
|
||||
}
|
||||
if (sourceInitializer !== source || targetInitializer !== target) {
|
||||
if (!(targetInitializer.flags & 33554432 /* Transient */)) {
|
||||
var mergedInitializer = getMergedSymbol(targetInitializer);
|
||||
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
|
||||
}
|
||||
mergeSymbol(targetInitializer, sourceInitializer);
|
||||
}
|
||||
}
|
||||
@@ -29947,6 +29986,10 @@ var ts;
|
||||
return false;
|
||||
function determineIfDeclarationIsVisible() {
|
||||
switch (node.kind) {
|
||||
case 294 /* JSDocTypedefTag */:
|
||||
// Top-level jsdoc typedefs are considered exported
|
||||
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
|
||||
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
|
||||
case 181 /* BindingElement */:
|
||||
return isDeclarationVisible(node.parent.parent);
|
||||
case 231 /* VariableDeclaration */:
|
||||
@@ -31000,7 +31043,7 @@ var ts;
|
||||
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
if (node.kind === 235 /* InterfaceDeclaration */ || node.kind === 234 /* ClassDeclaration */ ||
|
||||
node.kind === 204 /* ClassExpression */ || node.kind === 236 /* TypeAliasDeclaration */) {
|
||||
node.kind === 204 /* ClassExpression */ || node.kind === 236 /* TypeAliasDeclaration */ || node.kind === 294 /* JSDocTypedefTag */) {
|
||||
var declaration = node;
|
||||
var typeParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
|
||||
if (typeParameters) {
|
||||
@@ -34267,6 +34310,10 @@ var ts;
|
||||
// Transform an indexed access to a simpler form, if possible. Return the simpler form, or return
|
||||
// the type itself if no transformation is possible.
|
||||
function getSimplifiedIndexedAccessType(type) {
|
||||
if (type.simplified) {
|
||||
return type.simplified === circularConstraintType ? type : type.simplified;
|
||||
}
|
||||
type.simplified = circularConstraintType;
|
||||
var objectType = type.objectType;
|
||||
if (objectType.flags & 262144 /* Intersection */ && isGenericObjectType(objectType)) {
|
||||
// Given an indexed access type T[K], if T is an intersection containing one or more generic types and one or
|
||||
@@ -34285,7 +34332,7 @@ var ts;
|
||||
regularTypes.push(t);
|
||||
}
|
||||
}
|
||||
return getUnionType([
|
||||
return type.simplified = getUnionType([
|
||||
getSimplifiedType(getIndexedAccessType(getIntersectionType(regularTypes), type.indexType)),
|
||||
getIntersectionType(stringIndexTypes)
|
||||
]);
|
||||
@@ -34296,7 +34343,7 @@ var ts;
|
||||
// eventually anyway, but it easier to reason about.
|
||||
if (ts.some(objectType.types, isMappedTypeToNever)) {
|
||||
var nonNeverTypes = ts.filter(objectType.types, function (t) { return !isMappedTypeToNever(t); });
|
||||
return getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
return type.simplified = getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
}
|
||||
}
|
||||
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
|
||||
@@ -34304,15 +34351,15 @@ var ts;
|
||||
// construct the type Box<T[X]>. We do not further simplify the result because mapped types can be recursive
|
||||
// and we might never terminate.
|
||||
if (isGenericMappedType(objectType)) {
|
||||
return substituteIndexedMappedType(objectType, type);
|
||||
return type.simplified = substituteIndexedMappedType(objectType, type);
|
||||
}
|
||||
if (objectType.flags & 32768 /* TypeParameter */) {
|
||||
var constraint = getConstraintFromTypeParameter(objectType);
|
||||
if (constraint && isGenericMappedType(constraint)) {
|
||||
return substituteIndexedMappedType(constraint, type);
|
||||
return type.simplified = substituteIndexedMappedType(constraint, type);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, type) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
@@ -34600,7 +34647,7 @@ var ts;
|
||||
return links.resolvedType;
|
||||
}
|
||||
function getAliasSymbolForTypeNode(node) {
|
||||
return node.parent.kind === 236 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined;
|
||||
return (node.parent.kind === 236 /* TypeAliasDeclaration */ || node.parent.kind === 294 /* JSDocTypedefTag */) ? getSymbolOfNode(node.parent) : undefined;
|
||||
}
|
||||
function getAliasTypeArgumentsForTypeNode(node) {
|
||||
var symbol = getAliasSymbolForTypeNode(node);
|
||||
@@ -40461,8 +40508,17 @@ var ts;
|
||||
return unknownType;
|
||||
}
|
||||
}
|
||||
if (context.typeArguments) {
|
||||
signatures = ts.mapDefined(signatures, function (s) { return getJsxSignatureTypeArgumentInstantiation(s, context, isJs); });
|
||||
var links = getNodeLinks(context);
|
||||
if (!links.resolvedSignatures) {
|
||||
links.resolvedSignatures = ts.createMap();
|
||||
}
|
||||
var cacheKey = "" + getTypeId(valueType);
|
||||
if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) !== resolvingSignaturesArray) {
|
||||
signatures = links.resolvedSignatures.get(cacheKey);
|
||||
}
|
||||
else if (!links.resolvedSignatures.get(cacheKey)) {
|
||||
links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray);
|
||||
links.resolvedSignatures.set(cacheKey, signatures = instantiateJsxSignatures(context, signatures));
|
||||
}
|
||||
return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, /*reportErrors*/ false); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0 /* None */);
|
||||
}
|
||||
@@ -41369,6 +41425,37 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getInstantiatedJsxSignatures(openingLikeElement, elementType, reportErrors) {
|
||||
var links = getNodeLinks(openingLikeElement);
|
||||
if (!links.resolvedSignatures) {
|
||||
links.resolvedSignatures = ts.createMap();
|
||||
}
|
||||
var cacheKey = "" + getTypeId(elementType);
|
||||
if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) === resolvingSignaturesArray) {
|
||||
return;
|
||||
}
|
||||
else if (links.resolvedSignatures.get(cacheKey)) {
|
||||
return links.resolvedSignatures.get(cacheKey);
|
||||
}
|
||||
links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray);
|
||||
// Resolve the signatures, preferring constructor
|
||||
var signatures = getSignaturesOfType(elementType, 1 /* Construct */);
|
||||
if (signatures.length === 0) {
|
||||
// No construct signatures, try call signatures
|
||||
signatures = getSignaturesOfType(elementType, 0 /* Call */);
|
||||
if (signatures.length === 0) {
|
||||
// We found no signatures at all, which is an error
|
||||
if (reportErrors) {
|
||||
error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Instantiate in context of source type
|
||||
var results = instantiateJsxSignatures(openingLikeElement, signatures);
|
||||
links.resolvedSignatures.set(cacheKey, results);
|
||||
return results;
|
||||
}
|
||||
/**
|
||||
* Resolve attributes type of the given opening-like element. The attributes type is a type of attributes associated with the given elementType.
|
||||
* For instance:
|
||||
@@ -41424,19 +41511,10 @@ var ts;
|
||||
return anyType;
|
||||
}
|
||||
// Get the element instance type (the result of newing or invoking this tag)
|
||||
// Resolve the signatures, preferring constructor
|
||||
var signatures = getSignaturesOfType(elementType, 1 /* Construct */);
|
||||
if (signatures.length === 0) {
|
||||
// No construct signatures, try call signatures
|
||||
signatures = getSignaturesOfType(elementType, 0 /* Call */);
|
||||
if (signatures.length === 0) {
|
||||
// We found no signatures at all, which is an error
|
||||
error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName));
|
||||
return unknownType;
|
||||
}
|
||||
var instantiatedSignatures = getInstantiatedJsxSignatures(openingLikeElement, elementType, /*reportErrors*/ true);
|
||||
if (!ts.length(instantiatedSignatures)) {
|
||||
return unknownType;
|
||||
}
|
||||
// Instantiate in context of source type
|
||||
var instantiatedSignatures = instantiateJsxSignatures(openingLikeElement, signatures);
|
||||
var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2 /* Subtype */);
|
||||
// If we should include all stateless attributes type, then get all attributes type from all stateless function signature.
|
||||
// Otherwise get only attributes type from the signature picked by choose-overload logic.
|
||||
@@ -42945,10 +43023,10 @@ var ts;
|
||||
var isDecorator = node.kind === 149 /* Decorator */;
|
||||
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
||||
var typeArguments;
|
||||
if (!isDecorator && !isJsxOpeningOrSelfClosingElement) {
|
||||
if (!isDecorator) {
|
||||
typeArguments = node.typeArguments;
|
||||
// We already perform checking on the type arguments on the class declaration itself.
|
||||
if (isTaggedTemplate || node.expression.kind !== 97 /* SuperKeyword */) {
|
||||
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 97 /* SuperKeyword */) {
|
||||
ts.forEach(typeArguments, checkSourceElement);
|
||||
}
|
||||
}
|
||||
@@ -43473,28 +43551,6 @@ var ts;
|
||||
*/
|
||||
function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) {
|
||||
ts.Debug.assert(!(elementType.flags & 131072 /* Union */));
|
||||
return resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray);
|
||||
}
|
||||
/**
|
||||
* Try treating a given opening-like element as stateless function component and resolve a tagName to a function signature.
|
||||
* @param openingLikeElement an JSX opening-like element we want to try resolve its stateless function if possible
|
||||
* @param elementType a type of the opening-like JSX element, a result of resolving tagName in opening-like element.
|
||||
* @param candidatesOutArray an array of signature to be filled in by the function. It is passed by signature help in the language service;
|
||||
* the function will fill it up with appropriate candidate signatures
|
||||
* @return a resolved signature if we can find function matching function signature through resolve call or a first signature in the list of functions.
|
||||
* otherwise return undefined if tag-name of the opening-like element doesn't have call signatures
|
||||
*/
|
||||
function resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray) {
|
||||
// If this function is called from language service, elementType can be a union type. This is not possible if the function is called from compiler (see: resolveCustomJsxElementAttributesType)
|
||||
if (elementType.flags & 131072 /* Union */) {
|
||||
var types = elementType.types;
|
||||
var result = void 0;
|
||||
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
||||
var type = types_16[_i];
|
||||
result = result || resolveStatelessJsxOpeningLikeElement(openingLikeElement, type, candidatesOutArray);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var callSignatures = elementType && getSignaturesOfType(elementType, 0 /* Call */);
|
||||
if (callSignatures && callSignatures.length > 0) {
|
||||
return resolveCall(openingLikeElement, callSignatures, candidatesOutArray);
|
||||
@@ -43514,7 +43570,18 @@ var ts;
|
||||
case 256 /* JsxOpeningElement */:
|
||||
case 255 /* JsxSelfClosingElement */:
|
||||
// This code-path is called by language service
|
||||
return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray) || unknownSignature;
|
||||
var exprTypes = checkExpression(node.tagName);
|
||||
return forEachType(exprTypes, function (exprType) {
|
||||
var sfcResult = getResolvedJsxStatelessFunctionSignature(node, exprType, candidatesOutArray);
|
||||
if (sfcResult && sfcResult !== unknownSignature) {
|
||||
return sfcResult;
|
||||
}
|
||||
var sigs = getInstantiatedJsxSignatures(node, exprType);
|
||||
if (candidatesOutArray && ts.length(sigs)) {
|
||||
candidatesOutArray.push.apply(candidatesOutArray, sigs);
|
||||
}
|
||||
return ts.length(sigs) ? sigs[0] : unknownSignature;
|
||||
}) || unknownSignature;
|
||||
}
|
||||
ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
|
||||
}
|
||||
@@ -44401,8 +44468,8 @@ var ts;
|
||||
}
|
||||
if (type.flags & 393216 /* UnionOrIntersection */) {
|
||||
var types = type.types;
|
||||
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
||||
var t = types_17[_i];
|
||||
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
||||
var t = types_16[_i];
|
||||
if (maybeTypeOfKind(t, kind)) {
|
||||
return true;
|
||||
}
|
||||
@@ -47018,11 +47085,11 @@ var ts;
|
||||
if (!bindingPattern.elements.every(function (e) { return ts.contains(bindingElements, e); })) {
|
||||
for (var _i = 0, bindingElements_1 = bindingElements; _i < bindingElements_1.length; _i++) {
|
||||
var e = bindingElements_1[_i];
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, getBindingElementNameText(e)));
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(e.name, ts.isIdentifier))));
|
||||
}
|
||||
}
|
||||
else if (bindingElements.length === 1) {
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, getBindingElementNameText(ts.first(bindingElements))));
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(ts.first(bindingElements).name, ts.isIdentifier))));
|
||||
}
|
||||
else {
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics.All_destructured_elements_are_unused));
|
||||
@@ -54729,6 +54796,15 @@ var ts;
|
||||
return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text }));
|
||||
}
|
||||
ts.addSyntheticTrailingComment = addSyntheticTrailingComment;
|
||||
function moveSyntheticComments(node, original) {
|
||||
setSyntheticLeadingComments(node, getSyntheticLeadingComments(original));
|
||||
setSyntheticTrailingComments(node, getSyntheticTrailingComments(original));
|
||||
var emit = getOrCreateEmitNode(original);
|
||||
emit.leadingComments = undefined;
|
||||
emit.trailingComments = undefined;
|
||||
return node;
|
||||
}
|
||||
ts.moveSyntheticComments = moveSyntheticComments;
|
||||
/**
|
||||
* Gets the constant value to emit for an expression.
|
||||
*/
|
||||
@@ -60139,6 +60215,11 @@ var ts;
|
||||
// we can safely elide the parentheses here, as a new synthetic
|
||||
// ParenthesizedExpression will be inserted if we remove parentheses too
|
||||
// aggressively.
|
||||
// HOWEVER - if there are leading comments on the expression itself, to handle ASI
|
||||
// correctly for return and throw, we must keep the parenthesis
|
||||
if (ts.length(ts.getLeadingCommentRangesOfNode(expression, currentSourceFile))) {
|
||||
return ts.updateParen(node, expression);
|
||||
}
|
||||
return ts.createPartiallyEmittedExpression(expression, node);
|
||||
}
|
||||
return ts.visitEachChild(node, visitor, context);
|
||||
@@ -64017,6 +64098,7 @@ var ts;
|
||||
var expression = ts.visitNode(body, visitor, ts.isExpression);
|
||||
var returnStatement = ts.createReturn(expression);
|
||||
ts.setTextRange(returnStatement, body);
|
||||
ts.moveSyntheticComments(returnStatement, body);
|
||||
ts.setEmitFlags(returnStatement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 1024 /* NoTrailingComments */);
|
||||
statements.push(returnStatement);
|
||||
// To align with the source map emit for the old emitter, we set a custom
|
||||
@@ -76179,8 +76261,8 @@ var ts;
|
||||
write("/// <reference path=\"" + directive.fileName + "\" />");
|
||||
writeLine();
|
||||
}
|
||||
for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
|
||||
var directive = types_18[_d];
|
||||
for (var _d = 0, types_17 = types; _d < types_17.length; _d++) {
|
||||
var directive = types_17[_d];
|
||||
write("/// <reference types=\"" + directive.fileName + "\" />");
|
||||
writeLine();
|
||||
}
|
||||
@@ -85261,7 +85343,6 @@ var ts;
|
||||
return moduleSymbol.name.charCodeAt(0) === 34 /* doubleQuote */;
|
||||
}
|
||||
ts.isExternalModuleSymbol = isExternalModuleSymbol;
|
||||
/** Returns `true` the first time it encounters a node and `false` afterwards. */
|
||||
function nodeSeenTracker() {
|
||||
var seen = [];
|
||||
return function (node) {
|
||||
@@ -92085,12 +92166,42 @@ var ts;
|
||||
JsTyping.isTypingUpToDate = isTypingUpToDate;
|
||||
/* @internal */
|
||||
JsTyping.nodeCoreModuleList = [
|
||||
"buffer", "querystring", "events", "http", "cluster",
|
||||
"zlib", "os", "https", "punycode", "repl", "readline",
|
||||
"vm", "child_process", "url", "dns", "net",
|
||||
"dgram", "fs", "path", "string_decoder", "tls",
|
||||
"crypto", "stream", "util", "assert", "tty", "domain",
|
||||
"constants", "process", "v8", "timers", "console"
|
||||
"assert",
|
||||
"async_hooks",
|
||||
"buffer",
|
||||
"child_process",
|
||||
"cluster",
|
||||
"console",
|
||||
"constants",
|
||||
"crypto",
|
||||
"dgram",
|
||||
"dns",
|
||||
"domain",
|
||||
"events",
|
||||
"fs",
|
||||
"http",
|
||||
"https",
|
||||
"http2",
|
||||
"inspector",
|
||||
"net",
|
||||
"os",
|
||||
"path",
|
||||
"perf_hooks",
|
||||
"process",
|
||||
"punycode",
|
||||
"querystring",
|
||||
"readline",
|
||||
"repl",
|
||||
"stream",
|
||||
"string_decoder",
|
||||
"timers",
|
||||
"tls",
|
||||
"tty",
|
||||
"url",
|
||||
"util",
|
||||
"v8",
|
||||
"vm",
|
||||
"zlib"
|
||||
];
|
||||
/* @internal */
|
||||
JsTyping.nodeCoreModules = ts.arrayToSet(JsTyping.nodeCoreModuleList);
|
||||
@@ -94902,7 +95013,9 @@ var ts;
|
||||
program.getSemanticDiagnostics(sourceFile);
|
||||
var checker = program.getDiagnosticsProducingTypeChecker();
|
||||
var diags = [];
|
||||
if (sourceFile.commonJsModuleIndicator && (ts.programContainsEs6Modules(program) || ts.compilerOptionsIndicateEs6Modules(program.getCompilerOptions()))) {
|
||||
if (sourceFile.commonJsModuleIndicator &&
|
||||
(ts.programContainsEs6Modules(program) || ts.compilerOptionsIndicateEs6Modules(program.getCompilerOptions())) &&
|
||||
containsTopLevelCommonjs(sourceFile)) {
|
||||
diags.push(ts.createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), ts.Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module));
|
||||
}
|
||||
var isJsFile = ts.isSourceFileJavaScript(sourceFile);
|
||||
@@ -94954,6 +95067,29 @@ var ts;
|
||||
return diags.concat(checker.getSuggestionDiagnostics(sourceFile));
|
||||
}
|
||||
ts.computeSuggestionDiagnostics = computeSuggestionDiagnostics;
|
||||
// convertToEs6Module only works on top-level, so don't trigger it if commonjs code only appears in nested scopes.
|
||||
function containsTopLevelCommonjs(sourceFile) {
|
||||
return sourceFile.statements.some(function (statement) {
|
||||
switch (statement.kind) {
|
||||
case 213 /* VariableStatement */:
|
||||
return statement.declarationList.declarations.some(function (decl) {
|
||||
return ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true);
|
||||
});
|
||||
case 215 /* ExpressionStatement */: {
|
||||
var expression = statement.expression;
|
||||
if (!ts.isBinaryExpression(expression))
|
||||
return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true);
|
||||
var kind = ts.getSpecialPropertyAssignmentKind(expression);
|
||||
return kind === 1 /* ExportsProperty */ || kind === 2 /* ModuleExports */;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function propertyAccessLeftHandSide(node) {
|
||||
return ts.isPropertyAccessExpression(node) ? propertyAccessLeftHandSide(node.expression) : node;
|
||||
}
|
||||
function importNameForConvertToDefaultImport(node) {
|
||||
switch (node.kind) {
|
||||
case 243 /* ImportDeclaration */:
|
||||
@@ -98548,10 +98684,13 @@ var ts;
|
||||
if (options === void 0) { options = textChanges_3.useNonAdjustedPositions; }
|
||||
return this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options);
|
||||
};
|
||||
ChangeTracker.prototype.nextCommaToken = function (sourceFile, node) {
|
||||
var next = ts.findNextToken(node, node.parent, sourceFile);
|
||||
return next && next.kind === 26 /* CommaToken */ ? next : undefined;
|
||||
};
|
||||
ChangeTracker.prototype.replacePropertyAssignment = function (sourceFile, oldNode, newNode) {
|
||||
return this.replaceNode(sourceFile, oldNode, newNode, {
|
||||
suffix: "," + this.newLineCharacter
|
||||
});
|
||||
var suffix = this.nextCommaToken(sourceFile, oldNode) ? "" : ("," + this.newLineCharacter);
|
||||
return this.replaceNode(sourceFile, oldNode, newNode, { suffix: suffix });
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
@@ -98585,7 +98724,8 @@ var ts;
|
||||
// Otherwise, add an extra new line immediately before the error span.
|
||||
var insertAtLineStart = isValidLocationToAddComment(sourceFile, startPosition);
|
||||
var token = ts.getTouchingToken(sourceFile, insertAtLineStart ? startPosition : position, /*includeJsDocComment*/ false);
|
||||
var text = "" + (insertAtLineStart ? "" : this.newLineCharacter) + sourceFile.text.slice(lineStartPosition, startPosition) + "//" + commentText + this.newLineCharacter;
|
||||
var indent = sourceFile.text.slice(lineStartPosition, startPosition);
|
||||
var text = (insertAtLineStart ? "" : this.newLineCharacter) + "//" + commentText + this.newLineCharacter + indent;
|
||||
this.insertText(sourceFile, token.getStart(sourceFile), text);
|
||||
};
|
||||
ChangeTracker.prototype.replaceRangeWithText = function (sourceFile, range, text) {
|
||||
@@ -98677,6 +98817,10 @@ var ts;
|
||||
return { prefix: this.newLineCharacter, suffix: "" };
|
||||
}
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
|
||||
var endPosition = this.insertNodeAfterWorker(sourceFile, this.nextCommaToken(sourceFile, after) || after, newNode);
|
||||
this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after));
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
|
||||
var endPosition = this.insertNodeAfterWorker(sourceFile, after, newNode);
|
||||
this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after));
|
||||
@@ -98922,7 +99066,7 @@ var ts;
|
||||
changesToText.getTextChangesFromChanges = getTextChangesFromChanges;
|
||||
function newFileChanges(oldFile, fileName, statements, newLineCharacter) {
|
||||
var text = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
|
||||
return { fileName: fileName, textChanges: [ts.createTextChange(ts.createTextSpan(0, 0), text)] };
|
||||
return { fileName: fileName, textChanges: [ts.createTextChange(ts.createTextSpan(0, 0), text)], isNewFile: true };
|
||||
}
|
||||
changesToText.newFileChanges = newFileChanges;
|
||||
function computeNewText(change, sourceFile, newLineCharacter, formatContext, validate) {
|
||||
@@ -99874,7 +100018,7 @@ var ts;
|
||||
ts.Debug.assertNever(prop);
|
||||
}
|
||||
});
|
||||
return statements && [statements, true];
|
||||
return statements && [statements, false];
|
||||
}
|
||||
function convertNamedExport(sourceFile, assignment, changes, exports) {
|
||||
// If "originalKeywordKind" was set, this is e.g. `exports.
|
||||
@@ -101959,16 +102103,16 @@ var ts;
|
||||
}
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var declaration;
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken); });
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken, /*markSeenseen*/ ts.returnTrue); });
|
||||
return changes.length === 0 ? undefined
|
||||
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts.getNameOfDeclaration(declaration).getText(sourceFile)], fixId, ts.Diagnostics.Infer_all_types_from_usage)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile, program = context.program, cancellationToken = context.cancellationToken;
|
||||
var seenFunctions = ts.createMap();
|
||||
var markSeen = ts.nodeSeenTracker();
|
||||
return codefix.codeFixAll(context, errorCodes, function (changes, err) {
|
||||
doChange(changes, sourceFile, ts.getTokenAtPosition(err.file, err.start, /*includeJsDocComment*/ false), err.code, program, cancellationToken, seenFunctions);
|
||||
doChange(changes, sourceFile, ts.getTokenAtPosition(err.file, err.start, /*includeJsDocComment*/ false), err.code, program, cancellationToken, markSeen);
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -101982,7 +102126,7 @@ var ts;
|
||||
return ts.Diagnostics.Infer_type_of_0_from_usage;
|
||||
}
|
||||
}
|
||||
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, seenFunctions) {
|
||||
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen) {
|
||||
if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 71 /* Identifier */ && token.kind !== 24 /* DotDotDotToken */) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -101991,17 +102135,18 @@ var ts;
|
||||
// Variable and Property declarations
|
||||
case ts.Diagnostics.Member_0_implicitly_has_an_1_type.code:
|
||||
case ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code:
|
||||
if (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent)) { // handle bad location
|
||||
if ((ts.isVariableDeclaration(parent) && markSeen(parent)) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent)) { // handle bad location
|
||||
annotateVariableDeclaration(changes, sourceFile, parent, program, cancellationToken);
|
||||
return parent;
|
||||
}
|
||||
return undefined;
|
||||
case ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code: {
|
||||
var symbol = program.getTypeChecker().getSymbolAtLocation(token);
|
||||
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration)) {
|
||||
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) {
|
||||
annotateVariableDeclaration(changes, sourceFile, symbol.valueDeclaration, program, cancellationToken);
|
||||
return symbol.valueDeclaration;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var containingFunction = ts.getContainingFunction(token);
|
||||
@@ -102017,7 +102162,7 @@ var ts;
|
||||
}
|
||||
// falls through
|
||||
case ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
|
||||
if (!seenFunctions || ts.addToSeen(seenFunctions, ts.getNodeId(containingFunction))) {
|
||||
if (markSeen(containingFunction)) {
|
||||
var param = ts.cast(parent, ts.isParameter);
|
||||
annotateParameters(changes, param, containingFunction, sourceFile, program, cancellationToken);
|
||||
return param;
|
||||
@@ -102209,6 +102354,16 @@ var ts;
|
||||
case 185 /* ElementAccessExpression */:
|
||||
inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext);
|
||||
break;
|
||||
case 231 /* VariableDeclaration */: {
|
||||
var _a = node.parent, name = _a.name, initializer = _a.initializer;
|
||||
if (node === name) {
|
||||
if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error.
|
||||
addCandidateType(usageContext, checker.getTypeAtLocation(initializer));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// falls through
|
||||
default:
|
||||
return inferTypeFromContextualType(node, checker, usageContext);
|
||||
}
|
||||
@@ -102380,7 +102535,7 @@ var ts;
|
||||
return checker.getStringType();
|
||||
}
|
||||
else if (usageContext.candidateTypes) {
|
||||
return checker.getWidenedType(checker.getUnionType(ts.map(usageContext.candidateTypes, function (t) { return checker.getBaseTypeOfLiteralType(t); }), 2 /* Subtype */));
|
||||
return checker.getWidenedType(checker.getUnionType(usageContext.candidateTypes.map(function (t) { return checker.getBaseTypeOfLiteralType(t); }), 2 /* Subtype */));
|
||||
}
|
||||
else if (usageContext.properties && hasCallContext(usageContext.properties.get("then"))) {
|
||||
var paramType = getParameterTypeFromCallContexts(0, usageContext.properties.get("then").callContexts, /*isRestParameter*/ false, checker);
|
||||
@@ -104569,7 +104724,7 @@ var ts;
|
||||
return undefined;
|
||||
var isJS = ts.isSourceFileJavaScript(file);
|
||||
var changeTracker = ts.textChanges.ChangeTracker.fromContext(context);
|
||||
var isStatic = fieldInfo.isStatic, isReadonly = fieldInfo.isReadonly, fieldName = fieldInfo.fieldName, accessorName = fieldInfo.accessorName, originalName = fieldInfo.originalName, type = fieldInfo.type, container = fieldInfo.container, declaration = fieldInfo.declaration;
|
||||
var isStatic = fieldInfo.isStatic, isReadonly = fieldInfo.isReadonly, fieldName = fieldInfo.fieldName, accessorName = fieldInfo.accessorName, originalName = fieldInfo.originalName, type = fieldInfo.type, container = fieldInfo.container, declaration = fieldInfo.declaration, renameAccessor = fieldInfo.renameAccessor;
|
||||
ts.suppressLeadingAndTrailingTrivia(fieldName);
|
||||
ts.suppressLeadingAndTrailingTrivia(declaration);
|
||||
ts.suppressLeadingAndTrailingTrivia(container);
|
||||
@@ -104600,8 +104755,9 @@ var ts;
|
||||
}
|
||||
var edits = changeTracker.getChanges();
|
||||
var renameFilename = file.fileName;
|
||||
var renameLocationOffset = ts.isIdentifier(fieldName) ? 0 : -1;
|
||||
var renameLocation = renameLocationOffset + ts.getRenameLocation(edits, renameFilename, fieldName.text, /*preferLastLocation*/ ts.isParameter(declaration));
|
||||
var nameNeedRename = renameAccessor ? accessorName : fieldName;
|
||||
var renameLocationOffset = ts.isIdentifier(nameNeedRename) ? 0 : -1;
|
||||
var renameLocation = renameLocationOffset + ts.getRenameLocation(edits, renameFilename, nameNeedRename.text, /*preferLastLocation*/ ts.isParameter(declaration));
|
||||
return { renameFilename: renameFilename, renameLocation: renameLocation, edits: edits };
|
||||
}
|
||||
function isConvertableName(name) {
|
||||
@@ -104621,6 +104777,9 @@ var ts;
|
||||
var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(115 /* StaticKeyword */) : undefined);
|
||||
return modifiers && ts.createNodeArray(modifiers);
|
||||
}
|
||||
function startsWithUnderscore(name) {
|
||||
return name.charCodeAt(0) === 95 /* _ */;
|
||||
}
|
||||
function getConvertibleFieldAtPosition(file, startPosition) {
|
||||
var node = ts.getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false);
|
||||
var declaration = ts.findAncestor(node.parent, isAcceptedDeclaration);
|
||||
@@ -104628,8 +104787,10 @@ var ts;
|
||||
var meaning = 28 /* AccessibilityModifier */ | 32 /* Static */ | 64 /* Readonly */;
|
||||
if (!declaration || !isConvertableName(declaration.name) || (ts.getModifierFlags(declaration) | meaning) !== meaning)
|
||||
return undefined;
|
||||
var fieldName = createPropertyName(ts.getUniqueName("_" + declaration.name.text, file.text), declaration.name);
|
||||
var accessorName = createPropertyName(declaration.name.text, declaration.name);
|
||||
var name = declaration.name.text;
|
||||
var startWithUnderscore = startsWithUnderscore(name);
|
||||
var fieldName = createPropertyName(startWithUnderscore ? name : ts.getUniqueName("_" + name, file.text), declaration.name);
|
||||
var accessorName = createPropertyName(startWithUnderscore ? ts.getUniqueName(name.substring(1), file.text) : name, declaration.name);
|
||||
return {
|
||||
isStatic: ts.hasStaticModifier(declaration),
|
||||
isReadonly: ts.hasReadonlyModifier(declaration),
|
||||
@@ -104639,6 +104800,7 @@ var ts;
|
||||
declaration: declaration,
|
||||
fieldName: fieldName,
|
||||
accessorName: accessorName,
|
||||
renameAccessor: startWithUnderscore
|
||||
};
|
||||
}
|
||||
function generateGetAccessor(fieldName, accessorName, type, modifiers, isStatic, container) {
|
||||
@@ -104680,7 +104842,9 @@ var ts;
|
||||
function insertAccessor(changeTracker, file, accessor, declaration, container) {
|
||||
ts.isParameterPropertyDeclaration(declaration)
|
||||
? changeTracker.insertNodeAtClassStart(file, container, accessor)
|
||||
: changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
: ts.isPropertyAssignment(declaration)
|
||||
? changeTracker.insertNodeAfterComma(file, declaration, accessor)
|
||||
: changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
}
|
||||
function updateReadonlyPropertyInitializerStatementConstructor(changeTracker, context, constructor, fieldName, originalName) {
|
||||
if (!constructor.body)
|
||||
@@ -106792,7 +106956,8 @@ var ts;
|
||||
}
|
||||
function makeGetTargetOfMappedPosition(extract, create) {
|
||||
return getTargetOfMappedPosition;
|
||||
function getTargetOfMappedPosition(input) {
|
||||
function getTargetOfMappedPosition(input, original) {
|
||||
if (original === void 0) { original = input; }
|
||||
var info = extract(input);
|
||||
if (ts.endsWith(info.fileName, ".d.ts" /* Dts */)) {
|
||||
var file_17 = program.getSourceFile(info.fileName);
|
||||
@@ -106807,12 +106972,12 @@ var ts;
|
||||
var newLoc = mapper.getOriginalPosition(info);
|
||||
if (newLoc === info)
|
||||
return input;
|
||||
return getTargetOfMappedPosition(create(newLoc, input));
|
||||
return getTargetOfMappedPosition(create(newLoc, input, original), original);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
}
|
||||
var getTargetOfMappedDeclarationInfo = makeGetTargetOfMappedPosition(function (info) { return ({ fileName: info.fileName, position: info.textSpan.start }); }, function (newLoc, info) { return ({
|
||||
var getTargetOfMappedDeclarationInfo = makeGetTargetOfMappedPosition(function (info) { return ({ fileName: info.fileName, position: info.textSpan.start }); }, function (newLoc, info, original) { return ({
|
||||
containerKind: info.containerKind,
|
||||
containerName: info.containerName,
|
||||
fileName: newLoc.fileName,
|
||||
@@ -106821,10 +106986,12 @@ var ts;
|
||||
textSpan: {
|
||||
start: newLoc.position,
|
||||
length: info.textSpan.length
|
||||
}
|
||||
},
|
||||
originalFileName: original.fileName,
|
||||
originalTextSpan: original.textSpan
|
||||
}); });
|
||||
function getTargetOfMappedDeclarationFiles(infos) {
|
||||
return ts.map(infos, getTargetOfMappedDeclarationInfo);
|
||||
return ts.map(infos, function (d) { return getTargetOfMappedDeclarationInfo(d); });
|
||||
}
|
||||
/// Goto definition
|
||||
function getDefinitionAtPosition(fileName, position) {
|
||||
@@ -106857,10 +107024,12 @@ var ts;
|
||||
textSpan: {
|
||||
start: newLoc.position,
|
||||
length: info.textSpan.length
|
||||
}
|
||||
},
|
||||
originalFileName: info.fileName,
|
||||
originalTextSpan: info.textSpan
|
||||
}); });
|
||||
function getTargetOfMappedImplementationLocations(infos) {
|
||||
return ts.map(infos, getTargetOfMappedImplementationLocation);
|
||||
return ts.map(infos, function (d) { return getTargetOfMappedImplementationLocation(d); });
|
||||
}
|
||||
function getImplementationAtPosition(fileName, position) {
|
||||
synchronizeHostData();
|
||||
|
||||
Vendored
+12
-4
@@ -2248,6 +2248,7 @@ declare namespace ts {
|
||||
objectType: Type;
|
||||
indexType: Type;
|
||||
constraint?: Type;
|
||||
simplified?: Type;
|
||||
}
|
||||
type TypeVariable = TypeParameter | IndexedAccessType;
|
||||
interface IndexType extends InstantiableType {
|
||||
@@ -2980,10 +2981,11 @@ declare namespace ts {
|
||||
readDirectory(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
|
||||
getModifiedTime?(path: string): Date;
|
||||
/**
|
||||
* This should be cryptographically secure.
|
||||
* A good implementation is node.js' `crypto.createHash`. (https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm)
|
||||
*/
|
||||
createHash?(data: string): string;
|
||||
/** This must be cryptographically secure. Only implement this method using `crypto.createHash("sha256")`. */
|
||||
createSHA256Hash?(data: string): string;
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
realpath?(path: string): string;
|
||||
@@ -3858,6 +3860,7 @@ declare namespace ts {
|
||||
function getSyntheticTrailingComments(node: Node): SynthesizedComment[] | undefined;
|
||||
function setSyntheticTrailingComments<T extends Node>(node: T, comments: SynthesizedComment[]): T;
|
||||
function addSyntheticTrailingComment<T extends Node>(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T;
|
||||
function moveSyntheticComments<T extends Node>(node: T, original: Node): T;
|
||||
/**
|
||||
* Gets the constant value to emit for an expression.
|
||||
*/
|
||||
@@ -4615,6 +4618,7 @@ declare namespace ts {
|
||||
interface FileTextChanges {
|
||||
fileName: string;
|
||||
textChanges: TextChange[];
|
||||
isNewFile?: boolean;
|
||||
}
|
||||
interface CodeAction {
|
||||
/** Description of the code action to display in the UI of the editor */
|
||||
@@ -4701,6 +4705,12 @@ declare namespace ts {
|
||||
interface DocumentSpan {
|
||||
textSpan: TextSpan;
|
||||
fileName: string;
|
||||
/**
|
||||
* If the span represents a location that was remapped (e.g. via a .d.ts.map file),
|
||||
* then the original filename and span will be specified here
|
||||
*/
|
||||
originalTextSpan?: TextSpan;
|
||||
originalFileName?: string;
|
||||
}
|
||||
interface RenameLocation extends DocumentSpan {
|
||||
}
|
||||
@@ -4798,9 +4808,7 @@ declare namespace ts {
|
||||
insertSpaceBeforeTypeAnnotation?: boolean;
|
||||
indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean;
|
||||
}
|
||||
interface DefinitionInfo {
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
interface DefinitionInfo extends DocumentSpan {
|
||||
kind: ScriptElementKind;
|
||||
name: string;
|
||||
containerKind: ScriptElementKind;
|
||||
|
||||
+279
-110
@@ -1629,7 +1629,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "2.9";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".0-dev";
|
||||
ts.version = ts.versionMajorMinor + ".1";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
@@ -5151,6 +5151,7 @@ var ts;
|
||||
readDirectory: readDirectory,
|
||||
getModifiedTime: getModifiedTime,
|
||||
createHash: _crypto ? createMD5HashUsingNativeCrypto : generateDjb2Hash,
|
||||
createSHA256Hash: _crypto ? createSHA256Hash : undefined,
|
||||
getMemoryUsage: function () {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
@@ -5589,6 +5590,11 @@ var ts;
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
function createSHA256Hash(data) {
|
||||
var hash = _crypto.createHash("sha256");
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -10382,9 +10388,9 @@ var ts;
|
||||
node.body.kind === 238 /* ModuleDeclaration */ &&
|
||||
node.body;
|
||||
}
|
||||
function getJSDocCommentsAndTags(node) {
|
||||
function getJSDocCommentsAndTags(hostNode) {
|
||||
var result;
|
||||
getJSDocCommentsAndTagsWorker(node);
|
||||
getJSDocCommentsAndTagsWorker(hostNode);
|
||||
return result || ts.emptyArray;
|
||||
function getJSDocCommentsAndTagsWorker(node) {
|
||||
var parent = node.parent;
|
||||
@@ -10400,7 +10406,7 @@ var ts;
|
||||
// */
|
||||
// var x = function(name) { return name.length; }
|
||||
if (parent.parent &&
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node || getSourceOfAssignment(parent.parent))) {
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node)) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent);
|
||||
}
|
||||
if (parent.parent && parent.parent.parent &&
|
||||
@@ -10409,8 +10415,8 @@ var ts;
|
||||
getSourceOfDefaultedAssignment(parent.parent.parent))) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent.parent);
|
||||
}
|
||||
if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 /* None */ ||
|
||||
ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 /* None */ ||
|
||||
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 58 /* EqualsToken */ ||
|
||||
ts.isBinaryExpression(parent) && parent.operatorToken.kind === 58 /* EqualsToken */ ||
|
||||
node.kind === 184 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 215 /* ExpressionStatement */) {
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
@@ -10418,7 +10424,7 @@ var ts;
|
||||
if (node.kind === 148 /* Parameter */) {
|
||||
result = ts.addRange(result, ts.getJSDocParameterTags(node));
|
||||
}
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && ts.hasJSDocNodes(node.initializer)) {
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && node.initializer !== hostNode && ts.hasJSDocNodes(node.initializer)) {
|
||||
result = ts.addRange(result, node.initializer.jsDoc);
|
||||
}
|
||||
if (ts.hasJSDocNodes(node)) {
|
||||
@@ -11546,7 +11552,9 @@ var ts;
|
||||
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
||||
*/
|
||||
function getEffectiveTypeParameterDeclarations(node) {
|
||||
return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
return ts.isJSDocTypedefTag(node)
|
||||
? getJSDocTypeParameterDeclarations(node)
|
||||
: node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
}
|
||||
ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations;
|
||||
function getJSDocTypeParameterDeclarations(node) {
|
||||
@@ -13092,7 +13100,9 @@ var ts;
|
||||
var tags = node.jsDocCache;
|
||||
// If cache is 'null', that means we did the work of searching for JSDoc tags and came up with nothing.
|
||||
if (tags === undefined) {
|
||||
node.jsDocCache = tags = ts.flatMap(ts.getJSDocCommentsAndTags(node), function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
var comments = ts.getJSDocCommentsAndTags(node);
|
||||
ts.Debug.assert(comments.length < 2 || comments[0] !== comments[1]);
|
||||
node.jsDocCache = tags = ts.flatMap(comments, function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
@@ -16824,15 +16834,19 @@ var ts;
|
||||
node.initializer = parseInitializer();
|
||||
return finishNode(node);
|
||||
}
|
||||
/**
|
||||
* @returns If return type parsing succeeds
|
||||
*/
|
||||
function fillSignature(returnToken, flags, signature) {
|
||||
if (!(flags & 32 /* JSDoc */)) {
|
||||
signature.typeParameters = parseTypeParameters();
|
||||
}
|
||||
signature.parameters = parseParameterList(flags);
|
||||
signature.type = parseReturnType(returnToken, !!(flags & 4 /* Type */));
|
||||
}
|
||||
function parseReturnType(returnToken, isType) {
|
||||
return shouldParseReturnType(returnToken, isType) ? parseTypeOrTypePredicate() : undefined;
|
||||
if (shouldParseReturnType(returnToken, !!(flags & 4 /* Type */))) {
|
||||
signature.type = parseTypeOrTypePredicate();
|
||||
return signature.type !== undefined;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function shouldParseReturnType(returnToken, isType) {
|
||||
if (returnToken === 36 /* EqualsGreaterThanToken */) {
|
||||
@@ -17111,6 +17125,9 @@ var ts;
|
||||
var node = createNode(172 /* ParenthesizedType */);
|
||||
parseExpected(19 /* OpenParenToken */);
|
||||
node.type = parseType();
|
||||
if (!node.type) {
|
||||
return undefined;
|
||||
}
|
||||
parseExpected(20 /* CloseParenToken */);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -17119,7 +17136,12 @@ var ts;
|
||||
if (kind === 163 /* ConstructorType */) {
|
||||
parseExpected(94 /* NewKeyword */);
|
||||
}
|
||||
fillSignature(36 /* EqualsGreaterThanToken */, 4 /* Type */, node);
|
||||
if (!fillSignature(36 /* EqualsGreaterThanToken */, 4 /* Type */ | (sourceFile.languageVariant === 1 /* JSX */ ? 8 /* RequireCompleteParameterList */ : 0), node)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
}
|
||||
return finishNode(node);
|
||||
}
|
||||
function parseKeywordAndNoDot() {
|
||||
@@ -17870,7 +17892,9 @@ var ts;
|
||||
// a => (b => c)
|
||||
// And think that "(b =>" was actually a parenthesized arrow function with a missing
|
||||
// close paren.
|
||||
fillSignature(56 /* ColonToken */, isAsync | (allowAmbiguity ? 0 /* None */ : 8 /* RequireCompleteParameterList */), node);
|
||||
if (!fillSignature(56 /* ColonToken */, isAsync | (allowAmbiguity ? 0 /* None */ : 8 /* RequireCompleteParameterList */), node)) {
|
||||
return undefined;
|
||||
}
|
||||
// If we couldn't get parameters, we definitely could not parse out an arrow function.
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
@@ -26005,8 +26029,11 @@ var ts;
|
||||
}
|
||||
else {
|
||||
var jsPath = tryReadPackageJsonFields(/*readTypes*/ false, packageJsonContent, nodeModuleDirectory, state);
|
||||
if (typeof jsPath === "string") {
|
||||
subModuleName = ts.removeExtension(ts.removeExtension(jsPath.substring(nodeModuleDirectory.length + 1), ".js" /* Js */), ".jsx" /* Jsx */) + ".d.ts" /* Dts */;
|
||||
if (typeof jsPath === "string" && jsPath.length > nodeModuleDirectory.length) {
|
||||
var potentialSubModule_1 = jsPath.substring(nodeModuleDirectory.length + 1);
|
||||
subModuleName = (ts.forEach(ts.supportedJavascriptExtensions, function (extension) {
|
||||
return ts.tryRemoveExtension(potentialSubModule_1, extension);
|
||||
}) || potentialSubModule_1) + ".d.ts" /* Dts */;
|
||||
}
|
||||
else {
|
||||
subModuleName = "index.d.ts";
|
||||
@@ -26041,7 +26068,16 @@ var ts;
|
||||
function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) {
|
||||
var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript && extensions !== Extensions.Json, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
if (extensions === Extensions.TypeScript) {
|
||||
// When resolving typescript modules, try resolving using main field as well
|
||||
file = tryReadPackageJsonFields(/*readTypes*/ false, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host);
|
||||
var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state);
|
||||
@@ -26641,6 +26677,7 @@ var ts;
|
||||
var unknownSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, unknownType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var resolvingSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, anyType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var silentNeverSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, silentNeverType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var resolvingSignaturesArray = [resolvingSignature];
|
||||
var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true);
|
||||
var jsObjectLiteralIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false);
|
||||
var globals = ts.createSymbolTable();
|
||||
@@ -27119,6 +27156,7 @@ var ts;
|
||||
function mergeSymbol(target, source) {
|
||||
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
|
||||
(source.flags | target.flags) & 67108864 /* JSContainer */) {
|
||||
var targetValueDeclaration = target.valueDeclaration;
|
||||
ts.Debug.assert(!!(target.flags & 33554432 /* Transient */));
|
||||
// Javascript static-property-assignment declarations always merge, even though they are also values
|
||||
if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
|
||||
@@ -27145,12 +27183,13 @@ var ts;
|
||||
}
|
||||
if ((source.flags | target.flags) & 67108864 /* JSContainer */) {
|
||||
var sourceInitializer = ts.getJSInitializerSymbol(source);
|
||||
var targetInitializer = ts.getJSInitializerSymbol(target);
|
||||
var init = ts.getDeclaredJavascriptInitializer(targetValueDeclaration) || ts.getAssignedJavascriptInitializer(targetValueDeclaration);
|
||||
var targetInitializer = init && init.symbol ? init.symbol : target;
|
||||
if (!(targetInitializer.flags & 33554432 /* Transient */)) {
|
||||
var mergedInitializer = getMergedSymbol(targetInitializer);
|
||||
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
|
||||
}
|
||||
if (sourceInitializer !== source || targetInitializer !== target) {
|
||||
if (!(targetInitializer.flags & 33554432 /* Transient */)) {
|
||||
var mergedInitializer = getMergedSymbol(targetInitializer);
|
||||
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
|
||||
}
|
||||
mergeSymbol(targetInitializer, sourceInitializer);
|
||||
}
|
||||
}
|
||||
@@ -29947,6 +29986,10 @@ var ts;
|
||||
return false;
|
||||
function determineIfDeclarationIsVisible() {
|
||||
switch (node.kind) {
|
||||
case 294 /* JSDocTypedefTag */:
|
||||
// Top-level jsdoc typedefs are considered exported
|
||||
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
|
||||
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
|
||||
case 181 /* BindingElement */:
|
||||
return isDeclarationVisible(node.parent.parent);
|
||||
case 231 /* VariableDeclaration */:
|
||||
@@ -31000,7 +31043,7 @@ var ts;
|
||||
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
if (node.kind === 235 /* InterfaceDeclaration */ || node.kind === 234 /* ClassDeclaration */ ||
|
||||
node.kind === 204 /* ClassExpression */ || node.kind === 236 /* TypeAliasDeclaration */) {
|
||||
node.kind === 204 /* ClassExpression */ || node.kind === 236 /* TypeAliasDeclaration */ || node.kind === 294 /* JSDocTypedefTag */) {
|
||||
var declaration = node;
|
||||
var typeParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
|
||||
if (typeParameters) {
|
||||
@@ -34267,6 +34310,10 @@ var ts;
|
||||
// Transform an indexed access to a simpler form, if possible. Return the simpler form, or return
|
||||
// the type itself if no transformation is possible.
|
||||
function getSimplifiedIndexedAccessType(type) {
|
||||
if (type.simplified) {
|
||||
return type.simplified === circularConstraintType ? type : type.simplified;
|
||||
}
|
||||
type.simplified = circularConstraintType;
|
||||
var objectType = type.objectType;
|
||||
if (objectType.flags & 262144 /* Intersection */ && isGenericObjectType(objectType)) {
|
||||
// Given an indexed access type T[K], if T is an intersection containing one or more generic types and one or
|
||||
@@ -34285,7 +34332,7 @@ var ts;
|
||||
regularTypes.push(t);
|
||||
}
|
||||
}
|
||||
return getUnionType([
|
||||
return type.simplified = getUnionType([
|
||||
getSimplifiedType(getIndexedAccessType(getIntersectionType(regularTypes), type.indexType)),
|
||||
getIntersectionType(stringIndexTypes)
|
||||
]);
|
||||
@@ -34296,7 +34343,7 @@ var ts;
|
||||
// eventually anyway, but it easier to reason about.
|
||||
if (ts.some(objectType.types, isMappedTypeToNever)) {
|
||||
var nonNeverTypes = ts.filter(objectType.types, function (t) { return !isMappedTypeToNever(t); });
|
||||
return getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
return type.simplified = getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
}
|
||||
}
|
||||
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
|
||||
@@ -34304,15 +34351,15 @@ var ts;
|
||||
// construct the type Box<T[X]>. We do not further simplify the result because mapped types can be recursive
|
||||
// and we might never terminate.
|
||||
if (isGenericMappedType(objectType)) {
|
||||
return substituteIndexedMappedType(objectType, type);
|
||||
return type.simplified = substituteIndexedMappedType(objectType, type);
|
||||
}
|
||||
if (objectType.flags & 32768 /* TypeParameter */) {
|
||||
var constraint = getConstraintFromTypeParameter(objectType);
|
||||
if (constraint && isGenericMappedType(constraint)) {
|
||||
return substituteIndexedMappedType(constraint, type);
|
||||
return type.simplified = substituteIndexedMappedType(constraint, type);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, type) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
@@ -34600,7 +34647,7 @@ var ts;
|
||||
return links.resolvedType;
|
||||
}
|
||||
function getAliasSymbolForTypeNode(node) {
|
||||
return node.parent.kind === 236 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined;
|
||||
return (node.parent.kind === 236 /* TypeAliasDeclaration */ || node.parent.kind === 294 /* JSDocTypedefTag */) ? getSymbolOfNode(node.parent) : undefined;
|
||||
}
|
||||
function getAliasTypeArgumentsForTypeNode(node) {
|
||||
var symbol = getAliasSymbolForTypeNode(node);
|
||||
@@ -40461,8 +40508,17 @@ var ts;
|
||||
return unknownType;
|
||||
}
|
||||
}
|
||||
if (context.typeArguments) {
|
||||
signatures = ts.mapDefined(signatures, function (s) { return getJsxSignatureTypeArgumentInstantiation(s, context, isJs); });
|
||||
var links = getNodeLinks(context);
|
||||
if (!links.resolvedSignatures) {
|
||||
links.resolvedSignatures = ts.createMap();
|
||||
}
|
||||
var cacheKey = "" + getTypeId(valueType);
|
||||
if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) !== resolvingSignaturesArray) {
|
||||
signatures = links.resolvedSignatures.get(cacheKey);
|
||||
}
|
||||
else if (!links.resolvedSignatures.get(cacheKey)) {
|
||||
links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray);
|
||||
links.resolvedSignatures.set(cacheKey, signatures = instantiateJsxSignatures(context, signatures));
|
||||
}
|
||||
return getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, /*reportErrors*/ false); } : function (t) { return getJsxPropsTypeFromCallSignature(t, context); }), 0 /* None */);
|
||||
}
|
||||
@@ -41369,6 +41425,37 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getInstantiatedJsxSignatures(openingLikeElement, elementType, reportErrors) {
|
||||
var links = getNodeLinks(openingLikeElement);
|
||||
if (!links.resolvedSignatures) {
|
||||
links.resolvedSignatures = ts.createMap();
|
||||
}
|
||||
var cacheKey = "" + getTypeId(elementType);
|
||||
if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) === resolvingSignaturesArray) {
|
||||
return;
|
||||
}
|
||||
else if (links.resolvedSignatures.get(cacheKey)) {
|
||||
return links.resolvedSignatures.get(cacheKey);
|
||||
}
|
||||
links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray);
|
||||
// Resolve the signatures, preferring constructor
|
||||
var signatures = getSignaturesOfType(elementType, 1 /* Construct */);
|
||||
if (signatures.length === 0) {
|
||||
// No construct signatures, try call signatures
|
||||
signatures = getSignaturesOfType(elementType, 0 /* Call */);
|
||||
if (signatures.length === 0) {
|
||||
// We found no signatures at all, which is an error
|
||||
if (reportErrors) {
|
||||
error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Instantiate in context of source type
|
||||
var results = instantiateJsxSignatures(openingLikeElement, signatures);
|
||||
links.resolvedSignatures.set(cacheKey, results);
|
||||
return results;
|
||||
}
|
||||
/**
|
||||
* Resolve attributes type of the given opening-like element. The attributes type is a type of attributes associated with the given elementType.
|
||||
* For instance:
|
||||
@@ -41424,19 +41511,10 @@ var ts;
|
||||
return anyType;
|
||||
}
|
||||
// Get the element instance type (the result of newing or invoking this tag)
|
||||
// Resolve the signatures, preferring constructor
|
||||
var signatures = getSignaturesOfType(elementType, 1 /* Construct */);
|
||||
if (signatures.length === 0) {
|
||||
// No construct signatures, try call signatures
|
||||
signatures = getSignaturesOfType(elementType, 0 /* Call */);
|
||||
if (signatures.length === 0) {
|
||||
// We found no signatures at all, which is an error
|
||||
error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName));
|
||||
return unknownType;
|
||||
}
|
||||
var instantiatedSignatures = getInstantiatedJsxSignatures(openingLikeElement, elementType, /*reportErrors*/ true);
|
||||
if (!ts.length(instantiatedSignatures)) {
|
||||
return unknownType;
|
||||
}
|
||||
// Instantiate in context of source type
|
||||
var instantiatedSignatures = instantiateJsxSignatures(openingLikeElement, signatures);
|
||||
var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2 /* Subtype */);
|
||||
// If we should include all stateless attributes type, then get all attributes type from all stateless function signature.
|
||||
// Otherwise get only attributes type from the signature picked by choose-overload logic.
|
||||
@@ -42945,10 +43023,10 @@ var ts;
|
||||
var isDecorator = node.kind === 149 /* Decorator */;
|
||||
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
||||
var typeArguments;
|
||||
if (!isDecorator && !isJsxOpeningOrSelfClosingElement) {
|
||||
if (!isDecorator) {
|
||||
typeArguments = node.typeArguments;
|
||||
// We already perform checking on the type arguments on the class declaration itself.
|
||||
if (isTaggedTemplate || node.expression.kind !== 97 /* SuperKeyword */) {
|
||||
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 97 /* SuperKeyword */) {
|
||||
ts.forEach(typeArguments, checkSourceElement);
|
||||
}
|
||||
}
|
||||
@@ -43473,28 +43551,6 @@ var ts;
|
||||
*/
|
||||
function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) {
|
||||
ts.Debug.assert(!(elementType.flags & 131072 /* Union */));
|
||||
return resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray);
|
||||
}
|
||||
/**
|
||||
* Try treating a given opening-like element as stateless function component and resolve a tagName to a function signature.
|
||||
* @param openingLikeElement an JSX opening-like element we want to try resolve its stateless function if possible
|
||||
* @param elementType a type of the opening-like JSX element, a result of resolving tagName in opening-like element.
|
||||
* @param candidatesOutArray an array of signature to be filled in by the function. It is passed by signature help in the language service;
|
||||
* the function will fill it up with appropriate candidate signatures
|
||||
* @return a resolved signature if we can find function matching function signature through resolve call or a first signature in the list of functions.
|
||||
* otherwise return undefined if tag-name of the opening-like element doesn't have call signatures
|
||||
*/
|
||||
function resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray) {
|
||||
// If this function is called from language service, elementType can be a union type. This is not possible if the function is called from compiler (see: resolveCustomJsxElementAttributesType)
|
||||
if (elementType.flags & 131072 /* Union */) {
|
||||
var types = elementType.types;
|
||||
var result = void 0;
|
||||
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
||||
var type = types_16[_i];
|
||||
result = result || resolveStatelessJsxOpeningLikeElement(openingLikeElement, type, candidatesOutArray);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var callSignatures = elementType && getSignaturesOfType(elementType, 0 /* Call */);
|
||||
if (callSignatures && callSignatures.length > 0) {
|
||||
return resolveCall(openingLikeElement, callSignatures, candidatesOutArray);
|
||||
@@ -43514,7 +43570,18 @@ var ts;
|
||||
case 256 /* JsxOpeningElement */:
|
||||
case 255 /* JsxSelfClosingElement */:
|
||||
// This code-path is called by language service
|
||||
return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray) || unknownSignature;
|
||||
var exprTypes = checkExpression(node.tagName);
|
||||
return forEachType(exprTypes, function (exprType) {
|
||||
var sfcResult = getResolvedJsxStatelessFunctionSignature(node, exprType, candidatesOutArray);
|
||||
if (sfcResult && sfcResult !== unknownSignature) {
|
||||
return sfcResult;
|
||||
}
|
||||
var sigs = getInstantiatedJsxSignatures(node, exprType);
|
||||
if (candidatesOutArray && ts.length(sigs)) {
|
||||
candidatesOutArray.push.apply(candidatesOutArray, sigs);
|
||||
}
|
||||
return ts.length(sigs) ? sigs[0] : unknownSignature;
|
||||
}) || unknownSignature;
|
||||
}
|
||||
ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
|
||||
}
|
||||
@@ -44401,8 +44468,8 @@ var ts;
|
||||
}
|
||||
if (type.flags & 393216 /* UnionOrIntersection */) {
|
||||
var types = type.types;
|
||||
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
||||
var t = types_17[_i];
|
||||
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
||||
var t = types_16[_i];
|
||||
if (maybeTypeOfKind(t, kind)) {
|
||||
return true;
|
||||
}
|
||||
@@ -47018,11 +47085,11 @@ var ts;
|
||||
if (!bindingPattern.elements.every(function (e) { return ts.contains(bindingElements, e); })) {
|
||||
for (var _i = 0, bindingElements_1 = bindingElements; _i < bindingElements_1.length; _i++) {
|
||||
var e = bindingElements_1[_i];
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, getBindingElementNameText(e)));
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(e.name, ts.isIdentifier))));
|
||||
}
|
||||
}
|
||||
else if (bindingElements.length === 1) {
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, getBindingElementNameText(ts.first(bindingElements))));
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(ts.first(bindingElements).name, ts.isIdentifier))));
|
||||
}
|
||||
else {
|
||||
addDiagnostic(kind, ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics.All_destructured_elements_are_unused));
|
||||
@@ -54729,6 +54796,15 @@ var ts;
|
||||
return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text }));
|
||||
}
|
||||
ts.addSyntheticTrailingComment = addSyntheticTrailingComment;
|
||||
function moveSyntheticComments(node, original) {
|
||||
setSyntheticLeadingComments(node, getSyntheticLeadingComments(original));
|
||||
setSyntheticTrailingComments(node, getSyntheticTrailingComments(original));
|
||||
var emit = getOrCreateEmitNode(original);
|
||||
emit.leadingComments = undefined;
|
||||
emit.trailingComments = undefined;
|
||||
return node;
|
||||
}
|
||||
ts.moveSyntheticComments = moveSyntheticComments;
|
||||
/**
|
||||
* Gets the constant value to emit for an expression.
|
||||
*/
|
||||
@@ -60139,6 +60215,11 @@ var ts;
|
||||
// we can safely elide the parentheses here, as a new synthetic
|
||||
// ParenthesizedExpression will be inserted if we remove parentheses too
|
||||
// aggressively.
|
||||
// HOWEVER - if there are leading comments on the expression itself, to handle ASI
|
||||
// correctly for return and throw, we must keep the parenthesis
|
||||
if (ts.length(ts.getLeadingCommentRangesOfNode(expression, currentSourceFile))) {
|
||||
return ts.updateParen(node, expression);
|
||||
}
|
||||
return ts.createPartiallyEmittedExpression(expression, node);
|
||||
}
|
||||
return ts.visitEachChild(node, visitor, context);
|
||||
@@ -64017,6 +64098,7 @@ var ts;
|
||||
var expression = ts.visitNode(body, visitor, ts.isExpression);
|
||||
var returnStatement = ts.createReturn(expression);
|
||||
ts.setTextRange(returnStatement, body);
|
||||
ts.moveSyntheticComments(returnStatement, body);
|
||||
ts.setEmitFlags(returnStatement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 1024 /* NoTrailingComments */);
|
||||
statements.push(returnStatement);
|
||||
// To align with the source map emit for the old emitter, we set a custom
|
||||
@@ -76179,8 +76261,8 @@ var ts;
|
||||
write("/// <reference path=\"" + directive.fileName + "\" />");
|
||||
writeLine();
|
||||
}
|
||||
for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
|
||||
var directive = types_18[_d];
|
||||
for (var _d = 0, types_17 = types; _d < types_17.length; _d++) {
|
||||
var directive = types_17[_d];
|
||||
write("/// <reference types=\"" + directive.fileName + "\" />");
|
||||
writeLine();
|
||||
}
|
||||
@@ -85261,7 +85343,6 @@ var ts;
|
||||
return moduleSymbol.name.charCodeAt(0) === 34 /* doubleQuote */;
|
||||
}
|
||||
ts.isExternalModuleSymbol = isExternalModuleSymbol;
|
||||
/** Returns `true` the first time it encounters a node and `false` afterwards. */
|
||||
function nodeSeenTracker() {
|
||||
var seen = [];
|
||||
return function (node) {
|
||||
@@ -92085,12 +92166,42 @@ var ts;
|
||||
JsTyping.isTypingUpToDate = isTypingUpToDate;
|
||||
/* @internal */
|
||||
JsTyping.nodeCoreModuleList = [
|
||||
"buffer", "querystring", "events", "http", "cluster",
|
||||
"zlib", "os", "https", "punycode", "repl", "readline",
|
||||
"vm", "child_process", "url", "dns", "net",
|
||||
"dgram", "fs", "path", "string_decoder", "tls",
|
||||
"crypto", "stream", "util", "assert", "tty", "domain",
|
||||
"constants", "process", "v8", "timers", "console"
|
||||
"assert",
|
||||
"async_hooks",
|
||||
"buffer",
|
||||
"child_process",
|
||||
"cluster",
|
||||
"console",
|
||||
"constants",
|
||||
"crypto",
|
||||
"dgram",
|
||||
"dns",
|
||||
"domain",
|
||||
"events",
|
||||
"fs",
|
||||
"http",
|
||||
"https",
|
||||
"http2",
|
||||
"inspector",
|
||||
"net",
|
||||
"os",
|
||||
"path",
|
||||
"perf_hooks",
|
||||
"process",
|
||||
"punycode",
|
||||
"querystring",
|
||||
"readline",
|
||||
"repl",
|
||||
"stream",
|
||||
"string_decoder",
|
||||
"timers",
|
||||
"tls",
|
||||
"tty",
|
||||
"url",
|
||||
"util",
|
||||
"v8",
|
||||
"vm",
|
||||
"zlib"
|
||||
];
|
||||
/* @internal */
|
||||
JsTyping.nodeCoreModules = ts.arrayToSet(JsTyping.nodeCoreModuleList);
|
||||
@@ -94902,7 +95013,9 @@ var ts;
|
||||
program.getSemanticDiagnostics(sourceFile);
|
||||
var checker = program.getDiagnosticsProducingTypeChecker();
|
||||
var diags = [];
|
||||
if (sourceFile.commonJsModuleIndicator && (ts.programContainsEs6Modules(program) || ts.compilerOptionsIndicateEs6Modules(program.getCompilerOptions()))) {
|
||||
if (sourceFile.commonJsModuleIndicator &&
|
||||
(ts.programContainsEs6Modules(program) || ts.compilerOptionsIndicateEs6Modules(program.getCompilerOptions())) &&
|
||||
containsTopLevelCommonjs(sourceFile)) {
|
||||
diags.push(ts.createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), ts.Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module));
|
||||
}
|
||||
var isJsFile = ts.isSourceFileJavaScript(sourceFile);
|
||||
@@ -94954,6 +95067,29 @@ var ts;
|
||||
return diags.concat(checker.getSuggestionDiagnostics(sourceFile));
|
||||
}
|
||||
ts.computeSuggestionDiagnostics = computeSuggestionDiagnostics;
|
||||
// convertToEs6Module only works on top-level, so don't trigger it if commonjs code only appears in nested scopes.
|
||||
function containsTopLevelCommonjs(sourceFile) {
|
||||
return sourceFile.statements.some(function (statement) {
|
||||
switch (statement.kind) {
|
||||
case 213 /* VariableStatement */:
|
||||
return statement.declarationList.declarations.some(function (decl) {
|
||||
return ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true);
|
||||
});
|
||||
case 215 /* ExpressionStatement */: {
|
||||
var expression = statement.expression;
|
||||
if (!ts.isBinaryExpression(expression))
|
||||
return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true);
|
||||
var kind = ts.getSpecialPropertyAssignmentKind(expression);
|
||||
return kind === 1 /* ExportsProperty */ || kind === 2 /* ModuleExports */;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function propertyAccessLeftHandSide(node) {
|
||||
return ts.isPropertyAccessExpression(node) ? propertyAccessLeftHandSide(node.expression) : node;
|
||||
}
|
||||
function importNameForConvertToDefaultImport(node) {
|
||||
switch (node.kind) {
|
||||
case 243 /* ImportDeclaration */:
|
||||
@@ -98548,10 +98684,13 @@ var ts;
|
||||
if (options === void 0) { options = textChanges_3.useNonAdjustedPositions; }
|
||||
return this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options);
|
||||
};
|
||||
ChangeTracker.prototype.nextCommaToken = function (sourceFile, node) {
|
||||
var next = ts.findNextToken(node, node.parent, sourceFile);
|
||||
return next && next.kind === 26 /* CommaToken */ ? next : undefined;
|
||||
};
|
||||
ChangeTracker.prototype.replacePropertyAssignment = function (sourceFile, oldNode, newNode) {
|
||||
return this.replaceNode(sourceFile, oldNode, newNode, {
|
||||
suffix: "," + this.newLineCharacter
|
||||
});
|
||||
var suffix = this.nextCommaToken(sourceFile, oldNode) ? "" : ("," + this.newLineCharacter);
|
||||
return this.replaceNode(sourceFile, oldNode, newNode, { suffix: suffix });
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
@@ -98585,7 +98724,8 @@ var ts;
|
||||
// Otherwise, add an extra new line immediately before the error span.
|
||||
var insertAtLineStart = isValidLocationToAddComment(sourceFile, startPosition);
|
||||
var token = ts.getTouchingToken(sourceFile, insertAtLineStart ? startPosition : position, /*includeJsDocComment*/ false);
|
||||
var text = "" + (insertAtLineStart ? "" : this.newLineCharacter) + sourceFile.text.slice(lineStartPosition, startPosition) + "//" + commentText + this.newLineCharacter;
|
||||
var indent = sourceFile.text.slice(lineStartPosition, startPosition);
|
||||
var text = (insertAtLineStart ? "" : this.newLineCharacter) + "//" + commentText + this.newLineCharacter + indent;
|
||||
this.insertText(sourceFile, token.getStart(sourceFile), text);
|
||||
};
|
||||
ChangeTracker.prototype.replaceRangeWithText = function (sourceFile, range, text) {
|
||||
@@ -98677,6 +98817,10 @@ var ts;
|
||||
return { prefix: this.newLineCharacter, suffix: "" };
|
||||
}
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
|
||||
var endPosition = this.insertNodeAfterWorker(sourceFile, this.nextCommaToken(sourceFile, after) || after, newNode);
|
||||
this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after));
|
||||
};
|
||||
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
|
||||
var endPosition = this.insertNodeAfterWorker(sourceFile, after, newNode);
|
||||
this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after));
|
||||
@@ -98922,7 +99066,7 @@ var ts;
|
||||
changesToText.getTextChangesFromChanges = getTextChangesFromChanges;
|
||||
function newFileChanges(oldFile, fileName, statements, newLineCharacter) {
|
||||
var text = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
|
||||
return { fileName: fileName, textChanges: [ts.createTextChange(ts.createTextSpan(0, 0), text)] };
|
||||
return { fileName: fileName, textChanges: [ts.createTextChange(ts.createTextSpan(0, 0), text)], isNewFile: true };
|
||||
}
|
||||
changesToText.newFileChanges = newFileChanges;
|
||||
function computeNewText(change, sourceFile, newLineCharacter, formatContext, validate) {
|
||||
@@ -99874,7 +100018,7 @@ var ts;
|
||||
ts.Debug.assertNever(prop);
|
||||
}
|
||||
});
|
||||
return statements && [statements, true];
|
||||
return statements && [statements, false];
|
||||
}
|
||||
function convertNamedExport(sourceFile, assignment, changes, exports) {
|
||||
// If "originalKeywordKind" was set, this is e.g. `exports.
|
||||
@@ -101959,16 +102103,16 @@ var ts;
|
||||
}
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var declaration;
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken); });
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken, /*markSeenseen*/ ts.returnTrue); });
|
||||
return changes.length === 0 ? undefined
|
||||
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts.getNameOfDeclaration(declaration).getText(sourceFile)], fixId, ts.Diagnostics.Infer_all_types_from_usage)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile, program = context.program, cancellationToken = context.cancellationToken;
|
||||
var seenFunctions = ts.createMap();
|
||||
var markSeen = ts.nodeSeenTracker();
|
||||
return codefix.codeFixAll(context, errorCodes, function (changes, err) {
|
||||
doChange(changes, sourceFile, ts.getTokenAtPosition(err.file, err.start, /*includeJsDocComment*/ false), err.code, program, cancellationToken, seenFunctions);
|
||||
doChange(changes, sourceFile, ts.getTokenAtPosition(err.file, err.start, /*includeJsDocComment*/ false), err.code, program, cancellationToken, markSeen);
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -101982,7 +102126,7 @@ var ts;
|
||||
return ts.Diagnostics.Infer_type_of_0_from_usage;
|
||||
}
|
||||
}
|
||||
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, seenFunctions) {
|
||||
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen) {
|
||||
if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 71 /* Identifier */ && token.kind !== 24 /* DotDotDotToken */) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -101991,17 +102135,18 @@ var ts;
|
||||
// Variable and Property declarations
|
||||
case ts.Diagnostics.Member_0_implicitly_has_an_1_type.code:
|
||||
case ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code:
|
||||
if (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent)) { // handle bad location
|
||||
if ((ts.isVariableDeclaration(parent) && markSeen(parent)) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent)) { // handle bad location
|
||||
annotateVariableDeclaration(changes, sourceFile, parent, program, cancellationToken);
|
||||
return parent;
|
||||
}
|
||||
return undefined;
|
||||
case ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code: {
|
||||
var symbol = program.getTypeChecker().getSymbolAtLocation(token);
|
||||
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration)) {
|
||||
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) {
|
||||
annotateVariableDeclaration(changes, sourceFile, symbol.valueDeclaration, program, cancellationToken);
|
||||
return symbol.valueDeclaration;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var containingFunction = ts.getContainingFunction(token);
|
||||
@@ -102017,7 +102162,7 @@ var ts;
|
||||
}
|
||||
// falls through
|
||||
case ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:
|
||||
if (!seenFunctions || ts.addToSeen(seenFunctions, ts.getNodeId(containingFunction))) {
|
||||
if (markSeen(containingFunction)) {
|
||||
var param = ts.cast(parent, ts.isParameter);
|
||||
annotateParameters(changes, param, containingFunction, sourceFile, program, cancellationToken);
|
||||
return param;
|
||||
@@ -102209,6 +102354,16 @@ var ts;
|
||||
case 185 /* ElementAccessExpression */:
|
||||
inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext);
|
||||
break;
|
||||
case 231 /* VariableDeclaration */: {
|
||||
var _a = node.parent, name = _a.name, initializer = _a.initializer;
|
||||
if (node === name) {
|
||||
if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error.
|
||||
addCandidateType(usageContext, checker.getTypeAtLocation(initializer));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// falls through
|
||||
default:
|
||||
return inferTypeFromContextualType(node, checker, usageContext);
|
||||
}
|
||||
@@ -102380,7 +102535,7 @@ var ts;
|
||||
return checker.getStringType();
|
||||
}
|
||||
else if (usageContext.candidateTypes) {
|
||||
return checker.getWidenedType(checker.getUnionType(ts.map(usageContext.candidateTypes, function (t) { return checker.getBaseTypeOfLiteralType(t); }), 2 /* Subtype */));
|
||||
return checker.getWidenedType(checker.getUnionType(usageContext.candidateTypes.map(function (t) { return checker.getBaseTypeOfLiteralType(t); }), 2 /* Subtype */));
|
||||
}
|
||||
else if (usageContext.properties && hasCallContext(usageContext.properties.get("then"))) {
|
||||
var paramType = getParameterTypeFromCallContexts(0, usageContext.properties.get("then").callContexts, /*isRestParameter*/ false, checker);
|
||||
@@ -104569,7 +104724,7 @@ var ts;
|
||||
return undefined;
|
||||
var isJS = ts.isSourceFileJavaScript(file);
|
||||
var changeTracker = ts.textChanges.ChangeTracker.fromContext(context);
|
||||
var isStatic = fieldInfo.isStatic, isReadonly = fieldInfo.isReadonly, fieldName = fieldInfo.fieldName, accessorName = fieldInfo.accessorName, originalName = fieldInfo.originalName, type = fieldInfo.type, container = fieldInfo.container, declaration = fieldInfo.declaration;
|
||||
var isStatic = fieldInfo.isStatic, isReadonly = fieldInfo.isReadonly, fieldName = fieldInfo.fieldName, accessorName = fieldInfo.accessorName, originalName = fieldInfo.originalName, type = fieldInfo.type, container = fieldInfo.container, declaration = fieldInfo.declaration, renameAccessor = fieldInfo.renameAccessor;
|
||||
ts.suppressLeadingAndTrailingTrivia(fieldName);
|
||||
ts.suppressLeadingAndTrailingTrivia(declaration);
|
||||
ts.suppressLeadingAndTrailingTrivia(container);
|
||||
@@ -104600,8 +104755,9 @@ var ts;
|
||||
}
|
||||
var edits = changeTracker.getChanges();
|
||||
var renameFilename = file.fileName;
|
||||
var renameLocationOffset = ts.isIdentifier(fieldName) ? 0 : -1;
|
||||
var renameLocation = renameLocationOffset + ts.getRenameLocation(edits, renameFilename, fieldName.text, /*preferLastLocation*/ ts.isParameter(declaration));
|
||||
var nameNeedRename = renameAccessor ? accessorName : fieldName;
|
||||
var renameLocationOffset = ts.isIdentifier(nameNeedRename) ? 0 : -1;
|
||||
var renameLocation = renameLocationOffset + ts.getRenameLocation(edits, renameFilename, nameNeedRename.text, /*preferLastLocation*/ ts.isParameter(declaration));
|
||||
return { renameFilename: renameFilename, renameLocation: renameLocation, edits: edits };
|
||||
}
|
||||
function isConvertableName(name) {
|
||||
@@ -104621,6 +104777,9 @@ var ts;
|
||||
var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(115 /* StaticKeyword */) : undefined);
|
||||
return modifiers && ts.createNodeArray(modifiers);
|
||||
}
|
||||
function startsWithUnderscore(name) {
|
||||
return name.charCodeAt(0) === 95 /* _ */;
|
||||
}
|
||||
function getConvertibleFieldAtPosition(file, startPosition) {
|
||||
var node = ts.getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false);
|
||||
var declaration = ts.findAncestor(node.parent, isAcceptedDeclaration);
|
||||
@@ -104628,8 +104787,10 @@ var ts;
|
||||
var meaning = 28 /* AccessibilityModifier */ | 32 /* Static */ | 64 /* Readonly */;
|
||||
if (!declaration || !isConvertableName(declaration.name) || (ts.getModifierFlags(declaration) | meaning) !== meaning)
|
||||
return undefined;
|
||||
var fieldName = createPropertyName(ts.getUniqueName("_" + declaration.name.text, file.text), declaration.name);
|
||||
var accessorName = createPropertyName(declaration.name.text, declaration.name);
|
||||
var name = declaration.name.text;
|
||||
var startWithUnderscore = startsWithUnderscore(name);
|
||||
var fieldName = createPropertyName(startWithUnderscore ? name : ts.getUniqueName("_" + name, file.text), declaration.name);
|
||||
var accessorName = createPropertyName(startWithUnderscore ? ts.getUniqueName(name.substring(1), file.text) : name, declaration.name);
|
||||
return {
|
||||
isStatic: ts.hasStaticModifier(declaration),
|
||||
isReadonly: ts.hasReadonlyModifier(declaration),
|
||||
@@ -104639,6 +104800,7 @@ var ts;
|
||||
declaration: declaration,
|
||||
fieldName: fieldName,
|
||||
accessorName: accessorName,
|
||||
renameAccessor: startWithUnderscore
|
||||
};
|
||||
}
|
||||
function generateGetAccessor(fieldName, accessorName, type, modifiers, isStatic, container) {
|
||||
@@ -104680,7 +104842,9 @@ var ts;
|
||||
function insertAccessor(changeTracker, file, accessor, declaration, container) {
|
||||
ts.isParameterPropertyDeclaration(declaration)
|
||||
? changeTracker.insertNodeAtClassStart(file, container, accessor)
|
||||
: changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
: ts.isPropertyAssignment(declaration)
|
||||
? changeTracker.insertNodeAfterComma(file, declaration, accessor)
|
||||
: changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
}
|
||||
function updateReadonlyPropertyInitializerStatementConstructor(changeTracker, context, constructor, fieldName, originalName) {
|
||||
if (!constructor.body)
|
||||
@@ -106792,7 +106956,8 @@ var ts;
|
||||
}
|
||||
function makeGetTargetOfMappedPosition(extract, create) {
|
||||
return getTargetOfMappedPosition;
|
||||
function getTargetOfMappedPosition(input) {
|
||||
function getTargetOfMappedPosition(input, original) {
|
||||
if (original === void 0) { original = input; }
|
||||
var info = extract(input);
|
||||
if (ts.endsWith(info.fileName, ".d.ts" /* Dts */)) {
|
||||
var file_17 = program.getSourceFile(info.fileName);
|
||||
@@ -106807,12 +106972,12 @@ var ts;
|
||||
var newLoc = mapper.getOriginalPosition(info);
|
||||
if (newLoc === info)
|
||||
return input;
|
||||
return getTargetOfMappedPosition(create(newLoc, input));
|
||||
return getTargetOfMappedPosition(create(newLoc, input, original), original);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
}
|
||||
var getTargetOfMappedDeclarationInfo = makeGetTargetOfMappedPosition(function (info) { return ({ fileName: info.fileName, position: info.textSpan.start }); }, function (newLoc, info) { return ({
|
||||
var getTargetOfMappedDeclarationInfo = makeGetTargetOfMappedPosition(function (info) { return ({ fileName: info.fileName, position: info.textSpan.start }); }, function (newLoc, info, original) { return ({
|
||||
containerKind: info.containerKind,
|
||||
containerName: info.containerName,
|
||||
fileName: newLoc.fileName,
|
||||
@@ -106821,10 +106986,12 @@ var ts;
|
||||
textSpan: {
|
||||
start: newLoc.position,
|
||||
length: info.textSpan.length
|
||||
}
|
||||
},
|
||||
originalFileName: original.fileName,
|
||||
originalTextSpan: original.textSpan
|
||||
}); });
|
||||
function getTargetOfMappedDeclarationFiles(infos) {
|
||||
return ts.map(infos, getTargetOfMappedDeclarationInfo);
|
||||
return ts.map(infos, function (d) { return getTargetOfMappedDeclarationInfo(d); });
|
||||
}
|
||||
/// Goto definition
|
||||
function getDefinitionAtPosition(fileName, position) {
|
||||
@@ -106857,10 +107024,12 @@ var ts;
|
||||
textSpan: {
|
||||
start: newLoc.position,
|
||||
length: info.textSpan.length
|
||||
}
|
||||
},
|
||||
originalFileName: info.fileName,
|
||||
originalTextSpan: info.textSpan
|
||||
}); });
|
||||
function getTargetOfMappedImplementationLocations(infos) {
|
||||
return ts.map(infos, getTargetOfMappedImplementationLocation);
|
||||
return ts.map(infos, function (d) { return getTargetOfMappedImplementationLocation(d); });
|
||||
}
|
||||
function getImplementationAtPosition(fileName, position) {
|
||||
synchronizeHostData();
|
||||
|
||||
+86
-24
@@ -180,7 +180,7 @@ var ts;
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.versionMajorMinor = "2.9";
|
||||
ts.version = ts.versionMajorMinor + ".0-dev";
|
||||
ts.version = ts.versionMajorMinor + ".1";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
@@ -3163,6 +3163,7 @@ var ts;
|
||||
readDirectory: readDirectory,
|
||||
getModifiedTime: getModifiedTime,
|
||||
createHash: _crypto ? createMD5HashUsingNativeCrypto : generateDjb2Hash,
|
||||
createSHA256Hash: _crypto ? createSHA256Hash : undefined,
|
||||
getMemoryUsage: function () {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
@@ -3535,6 +3536,11 @@ var ts;
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
function createSHA256Hash(data) {
|
||||
var hash = _crypto.createHash("sha256");
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@@ -6237,9 +6243,9 @@ var ts;
|
||||
node.body.kind === 238 &&
|
||||
node.body;
|
||||
}
|
||||
function getJSDocCommentsAndTags(node) {
|
||||
function getJSDocCommentsAndTags(hostNode) {
|
||||
var result;
|
||||
getJSDocCommentsAndTagsWorker(node);
|
||||
getJSDocCommentsAndTagsWorker(hostNode);
|
||||
return result || ts.emptyArray;
|
||||
function getJSDocCommentsAndTagsWorker(node) {
|
||||
var parent = node.parent;
|
||||
@@ -6249,7 +6255,7 @@ var ts;
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
if (parent.parent &&
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node || getSourceOfAssignment(parent.parent))) {
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node)) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent);
|
||||
}
|
||||
if (parent.parent && parent.parent.parent &&
|
||||
@@ -6258,15 +6264,15 @@ var ts;
|
||||
getSourceOfDefaultedAssignment(parent.parent.parent))) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent.parent);
|
||||
}
|
||||
if (ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== 0 ||
|
||||
ts.isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== 0 ||
|
||||
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 58 ||
|
||||
ts.isBinaryExpression(parent) && parent.operatorToken.kind === 58 ||
|
||||
node.kind === 184 && node.parent && node.parent.kind === 215) {
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
if (node.kind === 148) {
|
||||
result = ts.addRange(result, ts.getJSDocParameterTags(node));
|
||||
}
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && ts.hasJSDocNodes(node.initializer)) {
|
||||
if (isVariableLike(node) && ts.hasInitializer(node) && node.initializer !== hostNode && ts.hasJSDocNodes(node.initializer)) {
|
||||
result = ts.addRange(result, node.initializer.jsDoc);
|
||||
}
|
||||
if (ts.hasJSDocNodes(node)) {
|
||||
@@ -7287,7 +7293,9 @@ var ts;
|
||||
}
|
||||
ts.getEffectiveReturnTypeNode = getEffectiveReturnTypeNode;
|
||||
function getEffectiveTypeParameterDeclarations(node) {
|
||||
return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
return ts.isJSDocTypedefTag(node)
|
||||
? getJSDocTypeParameterDeclarations(node)
|
||||
: node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
|
||||
}
|
||||
ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations;
|
||||
function getJSDocTypeParameterDeclarations(node) {
|
||||
@@ -8519,7 +8527,9 @@ var ts;
|
||||
function getJSDocTags(node) {
|
||||
var tags = node.jsDocCache;
|
||||
if (tags === undefined) {
|
||||
node.jsDocCache = tags = ts.flatMap(ts.getJSDocCommentsAndTags(node), function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
var comments = ts.getJSDocCommentsAndTags(node);
|
||||
ts.Debug.assert(comments.length < 2 || comments[0] !== comments[1]);
|
||||
node.jsDocCache = tags = ts.flatMap(comments, function (j) { return ts.isJSDoc(j) ? j.tags : j; });
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
@@ -13392,10 +13402,11 @@ var ts;
|
||||
signature.typeParameters = parseTypeParameters();
|
||||
}
|
||||
signature.parameters = parseParameterList(flags);
|
||||
signature.type = parseReturnType(returnToken, !!(flags & 4));
|
||||
}
|
||||
function parseReturnType(returnToken, isType) {
|
||||
return shouldParseReturnType(returnToken, isType) ? parseTypeOrTypePredicate() : undefined;
|
||||
if (shouldParseReturnType(returnToken, !!(flags & 4))) {
|
||||
signature.type = parseTypeOrTypePredicate();
|
||||
return signature.type !== undefined;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function shouldParseReturnType(returnToken, isType) {
|
||||
if (returnToken === 36) {
|
||||
@@ -13617,6 +13628,9 @@ var ts;
|
||||
var node = createNode(172);
|
||||
parseExpected(19);
|
||||
node.type = parseType();
|
||||
if (!node.type) {
|
||||
return undefined;
|
||||
}
|
||||
parseExpected(20);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -13625,7 +13639,12 @@ var ts;
|
||||
if (kind === 163) {
|
||||
parseExpected(94);
|
||||
}
|
||||
fillSignature(36, 4, node);
|
||||
if (!fillSignature(36, 4 | (sourceFile.languageVariant === 1 ? 8 : 0), node)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
}
|
||||
return finishNode(node);
|
||||
}
|
||||
function parseKeywordAndNoDot() {
|
||||
@@ -14225,7 +14244,9 @@ var ts;
|
||||
var node = createNodeWithJSDoc(192);
|
||||
node.modifiers = parseModifiersForArrowFunction();
|
||||
var isAsync = ts.hasModifier(node, 256) ? 2 : 0;
|
||||
fillSignature(56, isAsync | (allowAmbiguity ? 0 : 8), node);
|
||||
if (!fillSignature(56, isAsync | (allowAmbiguity ? 0 : 8), node)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!node.parameters) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -19810,8 +19831,11 @@ var ts;
|
||||
}
|
||||
else {
|
||||
var jsPath = tryReadPackageJsonFields(false, packageJsonContent, nodeModuleDirectory, state);
|
||||
if (typeof jsPath === "string") {
|
||||
subModuleName = ts.removeExtension(ts.removeExtension(jsPath.substring(nodeModuleDirectory.length + 1), ".js"), ".jsx") + ".d.ts";
|
||||
if (typeof jsPath === "string" && jsPath.length > nodeModuleDirectory.length) {
|
||||
var potentialSubModule_1 = jsPath.substring(nodeModuleDirectory.length + 1);
|
||||
subModuleName = (ts.forEach(ts.supportedJavascriptExtensions, function (extension) {
|
||||
return ts.tryRemoveExtension(potentialSubModule_1, extension);
|
||||
}) || potentialSubModule_1) + ".d.ts";
|
||||
}
|
||||
else {
|
||||
subModuleName = "index.d.ts";
|
||||
@@ -19845,7 +19869,15 @@ var ts;
|
||||
function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) {
|
||||
var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript && extensions !== Extensions.Json, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
if (extensions === Extensions.TypeScript) {
|
||||
file = tryReadPackageJsonFields(false, jsonContent, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host);
|
||||
var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state);
|
||||
@@ -20115,12 +20147,42 @@ var ts;
|
||||
}
|
||||
JsTyping.isTypingUpToDate = isTypingUpToDate;
|
||||
JsTyping.nodeCoreModuleList = [
|
||||
"buffer", "querystring", "events", "http", "cluster",
|
||||
"zlib", "os", "https", "punycode", "repl", "readline",
|
||||
"vm", "child_process", "url", "dns", "net",
|
||||
"dgram", "fs", "path", "string_decoder", "tls",
|
||||
"crypto", "stream", "util", "assert", "tty", "domain",
|
||||
"constants", "process", "v8", "timers", "console"
|
||||
"assert",
|
||||
"async_hooks",
|
||||
"buffer",
|
||||
"child_process",
|
||||
"cluster",
|
||||
"console",
|
||||
"constants",
|
||||
"crypto",
|
||||
"dgram",
|
||||
"dns",
|
||||
"domain",
|
||||
"events",
|
||||
"fs",
|
||||
"http",
|
||||
"https",
|
||||
"http2",
|
||||
"inspector",
|
||||
"net",
|
||||
"os",
|
||||
"path",
|
||||
"perf_hooks",
|
||||
"process",
|
||||
"punycode",
|
||||
"querystring",
|
||||
"readline",
|
||||
"repl",
|
||||
"stream",
|
||||
"string_decoder",
|
||||
"timers",
|
||||
"tls",
|
||||
"tty",
|
||||
"url",
|
||||
"util",
|
||||
"v8",
|
||||
"vm",
|
||||
"zlib"
|
||||
];
|
||||
JsTyping.nodeCoreModules = ts.arrayToSet(JsTyping.nodeCoreModuleList);
|
||||
function loadSafeList(host, safeListPath) {
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
"Duplicate_number_index_signature_2375": "数字索引签名重复。",
|
||||
"Duplicate_string_index_signature_2374": "字符串索引签名重复。",
|
||||
"Dynamic_import_cannot_have_type_arguments_1326": "动态导入不能含有类型参数",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "仅当 \"--module\" 标志为 \"commonjs\" 或 \"esNext\" 时,才支持动态导入。",
|
||||
"Dynamic_import_must_have_one_specifier_as_an_argument_1324": "动态导入必须具有一个说明符作为参数。",
|
||||
"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "动态导入的说明符类型必须是 \"string\",但此处类型是 \"{0}\"。",
|
||||
"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015": "元素隐式具有 \"any\" 类型,因为索引表达式的类型不为 \"number\"。",
|
||||
@@ -567,6 +567,7 @@
|
||||
"Module_name_0_was_successfully_resolved_to_1_6089": "======== 模块名“{0}”已成功解析为“{1}”。========",
|
||||
"Module_resolution_kind_is_not_specified_using_0_6088": "未指定模块解析类型,正在使用“{0}”。",
|
||||
"Module_resolution_using_rootDirs_has_failed_6111": "使用 \"rootDirs\" 的模块解析失败。",
|
||||
"Move_to_a_new_file_95049": "移动到新的文件",
|
||||
"Multiple_consecutive_numeric_separators_are_not_permitted_6189": "不允许使用多个连续的数字分隔符。",
|
||||
"Multiple_constructor_implementations_are_not_allowed_2392": "不允许存在多个构造函数实现。",
|
||||
"NEWLINE_6061": "换行符",
|
||||
@@ -706,9 +707,11 @@
|
||||
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "在带隐式“any\" 类型的 \"this\" 表达式上引发错误。",
|
||||
"Redirect_output_structure_to_the_directory_6006": "将输出结构重定向到目录。",
|
||||
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "引用的项目“{0}”必须拥有设置 \"composite\": true。",
|
||||
"Remove_all_unreachable_code_95051": "删除所有无法访问的代码",
|
||||
"Remove_declaration_for_Colon_0_90004": "删除“{0}”的声明",
|
||||
"Remove_destructuring_90009": "删除解构",
|
||||
"Remove_import_from_0_90005": "从“{0}”删除导入",
|
||||
"Remove_unreachable_code_95050": "删除无法访问的代码",
|
||||
"Replace_import_with_0_95015": "用“{0}”替换导入。",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "在函数中的所有代码路径并非都返回值时报告错误。",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "报告 switch 语句中遇到 fallthrough 情况的错误。",
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
"Duplicate_number_index_signature_2375": "數字索引簽章重複。",
|
||||
"Duplicate_string_index_signature_2374": "字串索引簽章重複。",
|
||||
"Dynamic_import_cannot_have_type_arguments_1326": "動態匯入不能有型別引數",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.",
|
||||
"Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323": "只有當 '--module' 旗標是 'commonjs' 或 'esNext' 時,才支援動態匯入。",
|
||||
"Dynamic_import_must_have_one_specifier_as_an_argument_1324": "動態匯入必須有一個指定名稱作為引數。",
|
||||
"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "動態匯入的指定名稱必須屬於類型 'string',但這裡的類型為 '{0}'。",
|
||||
"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015": "因為索引運算式不屬於類型 'number',所以元素具有隱含 'any' 類型。",
|
||||
@@ -567,6 +567,7 @@
|
||||
"Module_name_0_was_successfully_resolved_to_1_6089": "======== 模組名稱 '{0}' 已成功解析為 '{1}'。========",
|
||||
"Module_resolution_kind_is_not_specified_using_0_6088": "未指定模組解析種類,將使用 '{0}'。",
|
||||
"Module_resolution_using_rootDirs_has_failed_6111": "使用 'rootDirs' 解析模組失敗。",
|
||||
"Move_to_a_new_file_95049": "移至新行",
|
||||
"Multiple_consecutive_numeric_separators_are_not_permitted_6189": "不允許多個連續的數字分隔符號。",
|
||||
"Multiple_constructor_implementations_are_not_allowed_2392": "不允許多個建構函式實作。",
|
||||
"NEWLINE_6061": "新行",
|
||||
@@ -706,9 +707,11 @@
|
||||
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "對具有隱含 'any' 類型的 'this' 運算式引發錯誤。",
|
||||
"Redirect_output_structure_to_the_directory_6006": "將輸出結構重新導向至目錄。",
|
||||
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "參考的專案 '{0}' 之設定 \"composite\" 必須為 true。",
|
||||
"Remove_all_unreachable_code_95051": "移除所有無法連線的程式碼",
|
||||
"Remove_declaration_for_Colon_0_90004": "移除 '{0}' 的宣告",
|
||||
"Remove_destructuring_90009": "移除解構",
|
||||
"Remove_import_from_0_90005": "從 '{0}' 移除匯入",
|
||||
"Remove_unreachable_code_95050": "移除無法連線的程式碼",
|
||||
"Replace_import_with_0_95015": "以 '{0}' 取代匯入。",
|
||||
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "當函式中的部分程式碼路徑並未傳回值時回報錯誤。",
|
||||
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "回報 switch 陳述式內 fallthrough 案例的錯誤。",
|
||||
|
||||
Reference in New Issue
Block a user