Merge branch 'master' into pretty-watch-error-summaries

This commit is contained in:
Josh Goldberg
2018-04-01 21:44:55 -07:00
1054 changed files with 118092 additions and 81206 deletions
+4 -45
View File
@@ -2,30 +2,9 @@ workflows:
version: 2
main:
jobs:
- node9:
filters:
branches:
only:
- master
- release-2.5
- release-2.6
- release-2.7
- node8:
filters:
branches:
only:
- master
- release-2.5
- release-2.6
- release-2.7
- node6:
filters:
branches:
only:
- master
- release-2.5
- release-2.6
- release-2.7
- node9
- node8
- node6
nightly:
triggers:
- schedule:
@@ -35,31 +14,10 @@ workflows:
only: master
jobs:
- node9:
filters:
branches:
only:
- master
- release-2.5
- release-2.6
- release-2.7
context: nightlies
- node8:
filters:
branches:
only:
- master
- release-2.5
- release-2.6
- release-2.7
context: nightlies
- node6:
filters:
branches:
only:
- master
- release-2.5
- release-2.6
- release-2.7
context: nightlies
base: &base
@@ -69,6 +27,7 @@ base: &base
steps:
- checkout
- run: |
git submodule update --init --recursive
npm uninstall typescript --no-save
npm uninstall tslint --no-save
npm install
+6 -1
View File
@@ -316,4 +316,9 @@ Adnan Chowdhury <bttf@users.noreply.github.com>
Esakki Raj <esakkiraj.tce@gmail.com>
Jack Williams <jw@jackw.io>
Philippe Voinov <philippevoinov@gmail.com>
Stephan Ginthör <26004708+Lazarus535@users.noreply.github.com>
Stephan Ginthör <26004708+Lazarus535@users.noreply.github.com>
AdityaDaflapurkar <adaflapurkar@gmail.com> # Aditya Daflapurkar
Eric Grube <grubee79@gmail.com>
Martyn Janes <martyn@obany.com>
Ricardo N Feliciano <FelicianoTech@gmail.com>
Sergii Bezliudnyi <serg.bezludny@gmail.com>
+1 -2
View File
@@ -16,9 +16,8 @@ matrix:
branches:
only:
- master
- release-2.5
- release-2.6
- release-2.7
- release-2.8
install:
- npm uninstall typescript --no-save
+5
View File
@@ -3,6 +3,7 @@ TypeScript is authored by:
* Abubaker Bashir
* Adam Freidin
* Adi Dahiya
* Aditya Daflapurkar
* Adnan Chowdhury
* Adrian Leonhard
* Ahmad Farid
@@ -85,6 +86,7 @@ TypeScript is authored by:
* @e-cloud
* Elisée Maurer
* Emilio García-Pumarino
* Eric Grube
* Eric Tsang
* Erik Edrosa
* Erik McClenney
@@ -184,6 +186,7 @@ TypeScript is authored by:
* Marius Schulz
* Martin Hiller
* Martin Vseticka
* Martyn Janes
* Masahiro Wakame
* Matt Bierner
* Matt McCutchen
@@ -237,6 +240,7 @@ TypeScript is authored by:
* Raj Dosanjh
* Reiner Dolp
* Remo H. Jansen
* Ricardo N Feliciano
* Richard Karmazín
* Richard Knoll
* Richard Sentino
@@ -252,6 +256,7 @@ TypeScript is authored by:
* Sean Barag
* Sergey Rubanov
* Sergey Shandar
* Sergii Bezliudnyi
* Sharon Rolel
* Sheetal Nandi
* Shengping Zhong
+1
View File
@@ -115,6 +115,7 @@ var harnessCoreSources = [
});
var harnessSources = harnessCoreSources.concat([
"base64.ts",
"incrementalParser.ts",
"jsDocParsing.ts",
"services/colorization.ts",
+6734 -6734
View File
File diff suppressed because it is too large Load Diff
+15 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "Přistupující objekty musí být abstraktní nebo neabstraktní.",
"Add_0_to_existing_import_declaration_from_1_90015": "Přidat {0} k existující deklaraci importu z {1}",
"Add_async_modifier_to_containing_function_90029": "Přidat modifikátor async do obsahující funkce",
"Add_definite_assignment_assertion_to_property_0_95020": "Přidat kontrolní výraz jednoznačného přiřazení k vlastnosti {0}",
"Add_index_signature_for_property_0_90017": "Přidat signaturu indexu pro vlastnost {0}",
"Add_initializer_to_property_0_95019": "Přidat inicializační výraz k vlastnosti {0}",
"Add_missing_super_call_90001": "Přidat chybějící volání metody super()",
"Add_this_to_unresolved_variable_90008": "Přidat k nerozpoznané proměnné this.",
"Add_undefined_type_to_property_0_95018": "Přidat typ undefined k vlastnosti {0}",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Přidání souboru tsconfig.json vám pomůže uspořádat projekty, které obsahují jak soubory TypeScript, tak soubory JavaScript. Další informace najdete na adrese https://aka.ms/tsconfig.",
"Additional_Checks_6176": "Další kontroly",
"Advanced_Options_6178": "Upřesnit možnosti",
"All_declarations_of_0_must_have_identical_modifiers_2687": "Všechny deklarace {0} musí mít stejné modifikátory.",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "Všechny deklarace {0} musí mít stejné parametry typu.",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "Všechny deklarace abstraktní metody musí jít po sobě.",
"All_imports_in_import_declaration_are_unused_6192": "Žádné importy z deklarace importu se nepoužívají.",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "Povolte výchozí importy z modulů bez výchozího exportu. Nebude to mít vliv na generování kódu, jenom na kontrolu typů.",
"Allow_javascript_files_to_be_compiled_6102": "Povolí kompilaci souborů javascript.",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "Když se zadá příznak --isolatedModules, nepovolují se ambientní výčty.",
@@ -324,6 +328,7 @@
"Enables_experimental_support_for_ES7_decorators_6065": "Povolí experimentální podporu pro dekorátory ES7.",
"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066": "Povolí experimentální podporu pro generování metadat typu pro dekorátory.",
"Enum_0_used_before_its_declaration_2450": "Výčet {0} se používá dříve, než se deklaruje.",
"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567": "Deklarace výčtu jdou sloučit jenom s oborem názvů nebo jinými deklaracemi výčtu.",
"Enum_declarations_must_all_be_const_or_non_const_2473": "Všechny deklarace výčtu musí být konstantní nebo nekonstantní.",
"Enum_member_expected_1132": "Očekává se člen výčtu.",
"Enum_member_must_have_initializer_1061": "Člen výčtu musí mít inicializátor.",
@@ -378,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "Soubor {0} není pod kořenovým adresářem rootDir {1}. Očekává se, že rootDir bude obsahovat všechny zdrojové soubory.",
"File_0_not_found_6053": "Soubor {0} se nenašel.",
"File_change_detected_Starting_incremental_compilation_6032": "Zjistila se změna souboru. Spouští se přírůstková kompilace...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "Soubor je modul CommonJS; může se převést na modul ES6.",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "Název souboru {0} se od už zahrnutého názvu souboru {1} liší jenom velikostí písmen.",
"File_name_0_has_a_1_extension_stripping_it_6132": "Název souboru {0} má příponu {1} odstraňuje se",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "Specifikace souboru nemůže obsahovat nadřazený adresář (..), který se vyskytuje za rekurzivním zástupným znakem adresáře (**): {0}.",
@@ -424,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "Deklarace importu je v konfliktu s místní deklarací {0}.",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "Deklarace importu v oboru názvů nemůžou odkazovat na modul.",
"Import_emit_helpers_from_tslib_6139": "Importovat pomocné rutiny pro generování z tslib",
"Import_may_be_converted_to_a_default_import_80003": "Import se může převést na výchozí import.",
"Import_name_cannot_be_0_2438": "Název importu nemůže být {0}.",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "Deklarace importu nebo exportu v deklaraci ambientního modulu nemůže odkazovat na modul pomocí jeho relativního názvu.",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "Importy nejsou povolené v rozšířeních modulů. Zvažte jejich přesunutí do uzavírajícího externího modulu.",
@@ -462,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "Značka JSDoc @{0} není připojená k třídě.",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "JSDoc ... se může nacházet jen v posledním parametru signatury.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "Značka JSDoc @param má název {0}, ale neexistuje žádný parametr s tímto názvem.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "Značka JSDoc @param má název {0}, ale žádný parametr s tímto názvem neexistuje. Musí odpovídat hodnotě arguments, pokud má typ pole.",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "Značka JSDoc @typedef by měla mít poznámku k typu nebo by za ní měly následovat značky @property nebo @member.",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Typy JSDoc se můžou používat jenom v dokumentačních komentářích.",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "Typy JSDoc se můžou přesunout na typy TypeScript.",
"JSX_attribute_expected_17003": "Očekával se atribut JSX.",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Atributy JSX musí mít přiřazený neprázdný výraz.",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "Element JSX {0} nemá odpovídající uzavírací značku.",
@@ -476,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "Elementy JSX nemůžou mít víc atributů se stejným názvem.",
"JSX_expressions_must_have_one_parent_element_2657": "Výrazy JSX musí mít jeden nadřazený element.",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "Fragment JSX nemá odpovídající uzavírací značku.",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "Při použití vložené direktivy pragma objektu pro vytváření JSX se nepodporuje fragment JSX.",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "Při použití --jsxFactory se nepodporuje fragment JSX.",
"JSX_spread_child_must_be_an_array_type_2609": "Podřízený objekt JSX spread musí být typu pole.",
"Jump_target_cannot_cross_function_boundary_1107": "Cíl odkazu nemůže překročit hranici funkce.",
@@ -507,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "Modul {0} už exportoval člena s názvem {1}. Zvažte možnost vyřešení nejednoznačnosti explicitním opakováním exportu.",
"Module_0_has_no_default_export_1192": "Modul {0} nemá žádný výchozí export.",
"Module_0_has_no_exported_member_1_2305": "V modulu {0} není žádný exportovaný člen {1}.",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "Modul {0} nemá žádný exportovaný člen {1}. Neměli jste na mysli {2}?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "Modul {0} je skrytý místní deklarací se stejným názvem.",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "Modul {0} se překládá na nemodulovou entitu a nedá se importovat pomocí tohoto konstruktoru.",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Modul {0} používá export = a nedá se použít s možností export *.",
@@ -650,6 +661,7 @@
"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",
"Remove_declaration_for_Colon_0_90004": "Odebrat deklaraci pro {0}",
"Remove_import_from_0_90005": "Odebrat import z {0}",
"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.",
@@ -657,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "Umožňuje nahlásit chyby u nevyužitých místních hodnot.",
"Report_errors_on_unused_parameters_6135": "Umožňuje nahlásit chyby u nevyužitých parametrů.",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "Požadované parametry typu nemůžou být až za volitelnými parametry typu.",
"Resolution_for_module_0_was_found_in_cache_6147": "Překlad pro modul {0} se v mezipaměti nenašel.",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "Překlad pro modul {0} se našel v mezipaměti umístění {1}.",
"Resolving_from_node_modules_folder_6118": "Překládá se ze složky node_modules...",
"Resolving_module_0_from_1_6086": "======== Překládá se modul {0} z {1}. ========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "Překládá se název modulu {0} relativní k základní adrese URL {1}{2}.",
@@ -791,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Deklarace proměnné příkazu for...in nemůže obsahovat inicializátor.",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Deklarace proměnné příkazu for...of nemůže obsahovat inicializátor.",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Příkaz with není podporovaný. Všechny symboly s blokem with budou typu any.",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Tato funkce konstruktoru se může převést na deklaraci třídy.",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "Tato syntaxe vyžaduje importovanou podpůrnou aplikaci, ale modul {0} se nenašel.",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "Tato syntaxe vyžaduje importovanou podpůrnou aplikaci s názvem {1}, ale modul {0} nemá žádného exportovaného člena {1}.",
"Trailing_comma_not_allowed_1009": "Čárka na konci není povolená.",
@@ -887,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "Seznam deklarací proměnných nemůže být prázdný.",
"Version_0_6029": "Verze {0}",
"Watch_input_files_6005": "Sledovat vstupní soubory",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "Určuje, jestli se místo vymazání obrazovky má zachovat zastaralý výstup konzoly v režimu sledování.",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "Nejde přejmenovat elementy definované ve standardní knihovně TypeScriptu.",
"You_cannot_rename_this_element_8000": "Tento element nejde přejmenovat.",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "Objekt {0} přijímá málo argumentů k tomu, aby se dal použít jako dekoratér. Nechtěli jste ho nejprve volat a napsat @{0}()?",
+15 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "Beide Accessoren müssen abstrakt oder nicht abstrakt sein.",
"Add_0_to_existing_import_declaration_from_1_90015": "\"{0}\" der vorhandenen Importdeklaration aus \"{1}\" hinzufügen",
"Add_async_modifier_to_containing_function_90029": "Async-Modifizierer zur enthaltenden Funktion hinzufügen",
"Add_definite_assignment_assertion_to_property_0_95020": "Definitive Zuweisungsassertion zu Eigenschaft \"{0}\" hinzufügen",
"Add_index_signature_for_property_0_90017": "Indexsignatur für die Eigenschaft \"{0}\" hinzufügen",
"Add_initializer_to_property_0_95019": "Initialisierer zu Eigenschaft \"{0}\" hinzufügen",
"Add_missing_super_call_90001": "Fehlenden super()-Aufruf hinzufügen",
"Add_this_to_unresolved_variable_90008": "Der nicht aufgelösten Variablen \"this.\" hinzufügen",
"Add_undefined_type_to_property_0_95018": "undefined-Typ zu Eigenschaft \"{0}\" hinzufügen",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Das Hinzufügen einer \"tsconfig.json\"-Datei erleichtert die Organisation von Projekten, die sowohl TypeScript- als auch JavaScript-Dateien enthalten. Weitere Informationen finden Sie unter https://aka.ms/tsconfig.",
"Additional_Checks_6176": "Zusätzliche Überprüfungen",
"Advanced_Options_6178": "Erweiterte Optionen",
"All_declarations_of_0_must_have_identical_modifiers_2687": "Alle Deklarationen von \"{0}\" müssen identische Modifizierer aufweisen.",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "Alle Deklarationen von \"{0}\" müssen identische Typparameter aufweisen.",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "Alle Deklarationen einer abstrakten Methode müssen aufeinanderfolgend sein.",
"All_imports_in_import_declaration_are_unused_6192": "Keiner der Importe in der Importdeklaration wird verwendet.",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "Standardimporte von Modulen ohne Standardexport zulassen. Dies wirkt sich nicht auf die Codeausgabe aus, lediglich auf die Typprüfung.",
"Allow_javascript_files_to_be_compiled_6102": "Kompilierung von JavaScript-Dateien zulassen.",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "const-Umgebungsenumerationen sind unzulässig, wenn das Flag \"-isolatedModules\" angegeben wird.",
@@ -324,6 +328,7 @@
"Enables_experimental_support_for_ES7_decorators_6065": "Ermöglicht experimentelle Unterstützung für asynchrone ES7-Decorators.",
"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066": "Ermöglicht experimentelle Unterstützung zum Ausgeben von Typmetadaten für Decorators.",
"Enum_0_used_before_its_declaration_2450": "Enumeration \"{0}\", die vor der Deklaration wurde.",
"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567": "Enumerationsdeklarationen können nur mit Namespace- oder anderen Enumerationsdeklarationen zusammengeführt werden.",
"Enum_declarations_must_all_be_const_or_non_const_2473": "Enumerationsdeklarationen müssen alle konstant oder nicht konstant sein.",
"Enum_member_expected_1132": "Ein Enumerationsmember wurde erwartet.",
"Enum_member_must_have_initializer_1061": "Ein Enumerationsmember muss einen Initialisierer aufweisen.",
@@ -378,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "Datei \"{0}\" befindet sich nicht unter \"rootDir\" \"{1}\". \"rootDir\" muss alle Quelldateien enthalten.",
"File_0_not_found_6053": "Die Datei \"{0}\" wurde nicht gefunden.",
"File_change_detected_Starting_incremental_compilation_6032": "Es wurde eine Dateiänderung erkannt. Die inkrementelle Kompilierung wird gestartet...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "Die Datei ist ein CommonJS-Modul, sie kann in ein ES6-Modul konvertiert werden.",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "Der Dateiname \"{0}\" unterscheidet sich vom bereits enthaltenen Dateinamen \"{1}\" nur hinsichtlich der Groß-/Kleinschreibung.",
"File_name_0_has_a_1_extension_stripping_it_6132": "Der Dateiname \"{0}\" weist eine Erweiterung \"{1}\" auf. Diese wird entfernt.",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "Die Dateispezifikation darf kein übergeordnetes Verzeichnis (\"..\") enthalten, das nach einem rekursiven Verzeichnisplatzhalter (\"**\") angegeben wird: \"{0}\".",
@@ -424,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "Die Importdeklaration verursacht einen Konflikt mit der lokalen Deklaration von \"{0}\".",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "Importdeklarationen in einem Namespace dürfen nicht auf ein Modul verweisen.",
"Import_emit_helpers_from_tslib_6139": "Ausgabehilfsprogramme aus \"tslib\" importieren.",
"Import_may_be_converted_to_a_default_import_80003": "Der Import kann in einen Standardimport konvertiert werden.",
"Import_name_cannot_be_0_2438": "Der Importname darf nicht \"{0}\" sein.",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "Import- oder Exportdeklaration in einer Umgebungsmoduldeklaration dürfen nicht über den relativen Modulnamen auf ein Modul verweisen.",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "Importe sind in Modulerweiterungen unzulässig. Verschieben Sie diese ggf. in das einschließende externe Modul.",
@@ -462,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "JSDoc \"@{0}\" ist keiner Klassendeklaration zugeordnet.",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "Das JSDoc-Tag \"...\" wird möglicherweise nur im letzten Parameter einer Signatur angezeigt.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "Das JSDoc-Tag \"@param\" weist den Namen \"{0}\" auf, es gibt jedoch keinen Parameter dieses Namens.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "Das JSDoc-Tag \"@param\" weist den Namen \"{0}\" auf, es ist jedoch kein Parameter dieses Namens vorhanden. Es läge eine Übereinstimmung mit \"arguments\" vor, wenn ein Arraytyp vorläge.",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "Das JSDoc-Tag \"@typedef\" muss entweder eine Typanmerkung aufweisen, oder die Tags \"@property\" oder \"@member\" müssen darauf folgen.",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc-Typen können nur innerhalb von Dokumentationskommentaren verwendet werden.",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "JSDoc-Typen können in TypeScript-Typen verschoben werden.",
"JSX_attribute_expected_17003": "Ein JSX-Attribut wurde erwartet.",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "JSX-Attributen darf nur ein nicht leeres expression-Objekt zugewiesen werden.",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "Das JSX-Element \"{0}\" weist kein entsprechendes schließendes Tag auf.",
@@ -476,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "JSX-Elemente dürfen nicht mehrere Attribute mit dem gleichen Namen aufweisen.",
"JSX_expressions_must_have_one_parent_element_2657": "JSX-Ausdrücke müssen ein übergeordnetes Element aufweisen.",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "Das JSX-Fragment weist kein entsprechendes schließendes Tag auf.",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "Ein JSX-Fragment wird bei Verwendung eines Inline-JSX-Factory-Pragmas nicht unterstützt.",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "Das JSX-Fragment wird bei Verwendung von --jsxFactory nicht unterstützt.",
"JSX_spread_child_must_be_an_array_type_2609": "Die untergeordnete JSX-Verteilung muss ein Arraytyp sein.",
"Jump_target_cannot_cross_function_boundary_1107": "Das Sprungziel darf die Funktionsgrenze nicht überschreiten.",
@@ -507,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "Das Modul \"{0}\" hat bereits einen Member mit dem Namen \"{1}\" exportiert. Erwägen Sie, ihn explizit erneut zu exportieren, um die Mehrdeutigkeit zu vermeiden.",
"Module_0_has_no_default_export_1192": "Das Modul \"{0}\" weist keinen Standardexport auf.",
"Module_0_has_no_exported_member_1_2305": "Das Modul \"{0}\" weist keinen exportierten Member \"{1}\" auf.",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "Das Modul \"{0}\" umfasst keinen exportierten Member \"{1}\". Meinten Sie \"{2}\"?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "Das Modul \"{0}\" wird durch eine lokale Deklaration mit dem gleichen Namen ausgeblendet.",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "Das Modul \"{0}\" wird in eine Nicht-Modulentität aufgelöst und darf nicht mithilfe dieses Konstrukts importiert werden.",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Das Modul \"{0}\" verwendet \"export =\" und darf nicht mit \"export *\" verwendet werden.",
@@ -650,6 +661,7 @@
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "Fehler für \"this\"-Ausdrücke mit einem impliziten any-Typ auslösen.",
"Redirect_output_structure_to_the_directory_6006": "Die Ausgabestruktur in das Verzeichnis umleiten.",
"Remove_declaration_for_Colon_0_90004": "Deklaration entfernen für: {0}",
"Remove_import_from_0_90005": "Import aus \"{0}\" entfernen",
"Replace_import_with_0_95015": "Ersetzen Sie den Import durch \"{0}\".",
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Fehler melden, wenn nicht alle Codepfade in der Funktion einen Wert zurückgeben.",
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Für FallTrough-Fälle in switch-Anweisung Fehler melden.",
@@ -657,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "Fehler für nicht verwendete lokale Variablen melden.",
"Report_errors_on_unused_parameters_6135": "Fehler für nicht verwendete Parameter melden.",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "Erforderliche Typparameter dürfen nicht auf optionale Typparameter folgen.",
"Resolution_for_module_0_was_found_in_cache_6147": "Die Auflösung für das Modul \"{0}\" wurde im Cache gefunden.",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "Die Auflösung für das Modul \"{0}\" wurde im Cache des Standorts \"{1}\" gefunden.",
"Resolving_from_node_modules_folder_6118": "Auflösen aus dem Ordner \"node_modules\"...",
"Resolving_module_0_from_1_6086": "======== Das Modul \"{0}\" aus \"{1}\" wird aufgelöst. ========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "Der Modulname \"{0}\" relativ zur Basis-URL \"{1}\"\"{2}\" wird aufgelöst.",
@@ -791,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Die Variablendeklaration einer for...in-Anweisung darf keinen Initialisierer aufweisen.",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Die Variablendeklaration einer for...of-Anweisung darf keinen Initialisierer aufweisen.",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Die with-Anweisung wird nicht unterstützt. Alle Symbole in einem with-Block weisen den Typ \"any\" auf.",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Diese Konstruktorfunktion kann in eine Klassendeklaration konvertiert werden.",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "Diese Syntax erfordert ein importiertes Hilfsprogramm, aber das Modul \"{0}\" wurde nicht gefunden.",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "Diese Syntax erfordert ein importiertes Hilfsprogramm namens \"{1}\", aber das Modul \"{0}\" enthält keinen exportierten Member \"{1}\".",
"Trailing_comma_not_allowed_1009": "Ein nachgestelltes Komma ist unzulässig.",
@@ -887,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "Die Variablendeklarationsliste darf nicht leer sein.",
"Version_0_6029": "Version {0}",
"Watch_input_files_6005": "Eingabedateien überwachen.",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "Gibt an, ob eine veraltete Konsolenausgabe im Überwachungsmodus beibehalten wird, statt den Bildschirm zu löschen.",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "Sie können keine Elemente umbenennen, die in der TypeScript-Standardbibliothek definiert sind.",
"You_cannot_rename_this_element_8000": "Sie können dieses Element nicht umbenennen.",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "\"{0}\" akzeptiert zu wenige Argumente, um hier als Decorator verwendet zu werden. Wollten Sie es zuerst aufrufen und \"@{0}()\" schreiben?",
+236 -2
View File
@@ -579,30 +579,102 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_all_missing_members_95022" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add all missing members]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_all_missing_super_calls_95039" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add all missing super calls]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_async_modifier_to_containing_function_90029" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add async modifier to containing function]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_definite_assignment_assertion_to_property_0_95020" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add definite assignment assertion to property '{0}']]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_definite_assignment_assertions_to_all_uninitialized_properties_95028" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add definite assignment assertions to all uninitialized properties]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_index_signature_for_property_0_90017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add index signature for property '{0}']]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_initializer_to_property_0_95019" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add initializer to property '{0}']]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_initializers_to_all_uninitialized_properties_95027" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add initializers to all uninitialized properties]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_missing_super_call_90001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add missing 'super()' call]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_to_all_uncalled_decorators_95044" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add '()' to all uncalled decorators]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_ts_ignore_to_all_error_messages_95042" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add '@ts-ignore' to all error messages]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_undefined_type_to_all_uninitialized_properties_95029" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add undefined type to all uninitialized properties]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Add_undefined_type_to_property_0_95018" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Add 'undefined' type to property '{0}']]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.]]></Val>
@@ -639,6 +711,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";All_imports_in_import_declaration_are_unused_6192" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[All imports in import declaration are unused.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Allow default imports from modules with no default export. This does not affect code emit, just typechecking.]]></Val>
@@ -927,6 +1005,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Annotate_everything_with_types_from_JSDoc_95043" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Annotate everything with types from JSDoc]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Annotate_with_type_from_JSDoc_95009" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Annotate with type from JSDoc]]></Val>
@@ -1329,6 +1413,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Change_all_extended_interfaces_to_implements_95038" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Change all extended interfaces to 'implements']]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Change_all_jsdoc_style_types_to_TypeScript_95030" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Change all jsdoc-style types to TypeScript]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Change_extends_to_implements_90003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Change 'extends' to 'implements']]></Val>
@@ -1527,6 +1629,18 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_all_constructor_functions_to_classes_95045" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert all constructor functions to classes]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_all_to_default_imports_95035" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert all to default imports]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_function_0_to_class_95002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert function '{0}' to class]]></Val>
@@ -1635,6 +1749,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Delete_all_unused_declarations_95024" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete all unused declarations]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[[Deprecated]5D; Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit]]></Val>
@@ -2289,6 +2409,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File is a CommonJS module; it may be converted to an ES6 module.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[File name '{0}' differs from already included file name '{1}' only in casing.]]></Val>
@@ -2313,6 +2439,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Fix_all_detected_spelling_errors_95026" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Fix all detected spelling errors]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_package_json_at_0_6099" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 'package.json' at '{0}'.]]></Val>
@@ -2385,6 +2517,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Generates a sourcemap for each corresponding '.d.ts' file.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Generates_corresponding_d_ts_file_6002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Generates corresponding '.d.ts' file.]]></Val>
@@ -2511,6 +2649,18 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Implement_all_inherited_abstract_classes_95040" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Implement all inherited abstract classes]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Implement_all_unimplemented_interfaces_95032" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Implement all unimplemented interfaces]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Implement_inherited_abstract_class_90007" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Implement inherited abstract class]]></Val>
@@ -2565,6 +2715,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Import_may_be_converted_to_a_default_import_80003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Import may be converted to a default import.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Import_name_cannot_be_0_2438" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Import name cannot be '{0}'.]]></Val>
@@ -2625,6 +2781,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Infer_all_types_from_usage_95023" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Infer all types from usage]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Infer_parameter_types_from_usage_95012" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Infer parameter types from usage]]></Val>
@@ -2691,6 +2853,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Install_all_missing_types_packages_95033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Install all missing types packages]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Interface_0_cannot_simultaneously_extend_types_1_and_2_2320" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'.]]></Val>
@@ -2793,6 +2961,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags.]]></Val>
@@ -2805,6 +2979,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSDoc_types_may_be_moved_to_TypeScript_types_80004" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSDoc types may be moved to TypeScript types.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_attribute_expected_17003" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX attribute expected.]]></Val>
@@ -2877,6 +3057,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX fragment is not supported when using an inline JSX factory pragma]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSX_fragment_is_not_supported_when_using_jsxFactory_17016" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSX fragment is not supported when using --jsxFactory]]></Val>
@@ -2985,6 +3171,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Make_all_super_calls_the_first_statement_in_their_constructor_95036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Make all 'super()' calls the first statement in their constructor]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Make_super_call_the_first_statement_in_the_constructor_90002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Make 'super()' call the first statement in the constructor]]></Val>
@@ -3063,6 +3255,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Module_0_has_no_exported_member_1_Did_you_mean_2_2724" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Module '{0}' has no exported member '{1}'. Did you mean '{2}'?]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Module '{0}' is hidden by a local declaration with the same name.]]></Val>
@@ -3351,6 +3549,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Option_0_should_have_array_of_strings_as_a_value_6103" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Option '{0}' should have array of strings as a value.]]></Val>
@@ -3615,6 +3819,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Prefix_all_unused_declarations_with_where_possible_95025" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Prefix all unused declarations with '_' where possible]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Print_names_of_files_part_of_the_compilation_6155" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Print names of files part of the compilation.]]></Val>
@@ -3921,6 +4131,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Remove_import_from_0_90005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Remove import from '{0}']]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Replace_import_with_0_95015" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Replace import with '{0}'.]]></Val>
@@ -3963,9 +4179,9 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Resolution_for_module_0_was_found_in_cache_6147" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Resolution_for_module_0_was_found_in_cache_from_location_1_6147" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Resolution for module '{0}' was found in cache.]]></Val>
<Val><![CDATA[Resolution for module '{0}' was found in cache from location '{1}'.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
@@ -4197,6 +4413,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Rewrite_all_as_indexed_access_types_95034" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Rewrite all as indexed access types]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Rewrite_as_the_indexed_access_type_0_90026" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Rewrite as the indexed access type '{0}']]></Val>
@@ -4767,6 +4989,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_constructor_function_may_be_converted_to_a_class_declaration_80002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This constructor function may be converted to a class declaration.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This syntax requires an imported helper but module '{0}' cannot be found.]]></Val>
@@ -5343,6 +5571,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Whether to keep outdated console output in watch mode instead of clearing the screen.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[You cannot rename elements that are defined in the standard TypeScript library.]]></Val>
+15 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "Los descriptores de acceso deben ser los dos abstractos o los dos no abstractos.",
"Add_0_to_existing_import_declaration_from_1_90015": "Agregar \"{0}\" a una declaración de importación existente desde \"{1}\"",
"Add_async_modifier_to_containing_function_90029": "Agregar el modificador async a la función contenedora",
"Add_definite_assignment_assertion_to_property_0_95020": "Agregar aserción de asignación definitiva a la propiedad \"{0}\"",
"Add_index_signature_for_property_0_90017": "Agregar una signatura de índice para la propiedad \"{0}\"",
"Add_initializer_to_property_0_95019": "Agregar inicializador a la propiedad \"{0}\"",
"Add_missing_super_call_90001": "Agregar la llamada a \"super()\" que falta",
"Add_this_to_unresolved_variable_90008": "Agregar \"this.\" a una variable no resuelta",
"Add_undefined_type_to_property_0_95018": "Agregar un tipo \"undefined\" a la propiedad \"{0}\"",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Agregar un archivo tsconfig.json ayuda a organizar los proyectos que contienen archivos TypeScript y JavaScript. Más información en https://aka.ms/tsconfig.",
"Additional_Checks_6176": "Comprobaciones adicionales",
"Advanced_Options_6178": "Opciones avanzadas",
"All_declarations_of_0_must_have_identical_modifiers_2687": "Todas las declaraciones de '{0}' deben tener modificadores idénticos.",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "Todas las declaraciones de '{0}' deben tener parámetros de tipo idénticos.",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "Todas las declaraciones de un método abstracto deben ser consecutivas.",
"All_imports_in_import_declaration_are_unused_6192": "Todas las importaciones de la declaración de importación están sin utilizar.",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "Permitir las importaciones predeterminadas de los módulos sin exportación predeterminada. Esto no afecta a la emisión de código, solo a la comprobación de tipos.",
"Allow_javascript_files_to_be_compiled_6102": "Permitir que se compilen los archivos de JavaScript.",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "No se permiten enumeraciones const de ambiente cuando se proporciona la marca \"--isolatedModules\".",
@@ -324,6 +328,7 @@
"Enables_experimental_support_for_ES7_decorators_6065": "Habilita la compatibilidad experimental con los elementos Decorator de ES7.",
"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066": "Habilita la compatibilidad experimental para emitir metadatos de tipo para los elementos Decorator.",
"Enum_0_used_before_its_declaration_2450": "Se ha usado la enumeración \"{0}\" antes de declararla.",
"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567": "Las declaraciones de enumeración solo se pueden combinar con otras declaraciones de enumeración o de espacio de nombres.",
"Enum_declarations_must_all_be_const_or_non_const_2473": "Todas las declaraciones de enumeración deben ser de tipo const o no const.",
"Enum_member_expected_1132": "Se esperaba un miembro de enumeración.",
"Enum_member_must_have_initializer_1061": "El miembro de enumeración debe tener un inicializador.",
@@ -378,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "El archivo '{0}' no está en \"rootDir\" '{1}'. Se espera que \"rootDir\" contenga todos los archivos de origen.",
"File_0_not_found_6053": "Archivo '{0}' no encontrado.",
"File_change_detected_Starting_incremental_compilation_6032": "Se detectó un cambio de archivo. Iniciando la compilación incremental...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "El archivo es un módulo CommonJS; se puede convertir a un módulo ES6.",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "El nombre de archivo \"{0}\" es diferente del nombre de archivo \"{1}\" ya incluido solo en el uso de mayúsculas y minúsculas.",
"File_name_0_has_a_1_extension_stripping_it_6132": "El nombre de archivo \"{0}\" tiene una extensión \"{1}\" y se va a quitar.",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "La especificación del archivo no puede contener un directorio primario ('..') que aparezca después de un comodín de directorios recursivo ('**'): '{0}'.",
@@ -424,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "La declaración de importación está en conflicto con la declaración local de \"{0}\".",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "Las declaraciones de importación de un espacio de nombres no pueden hacer referencia a un módulo.",
"Import_emit_helpers_from_tslib_6139": "Importe elementos auxiliares de emisión de \"tslib\".",
"Import_may_be_converted_to_a_default_import_80003": "La importación puede convertirse a una importación predeterminada.",
"Import_name_cannot_be_0_2438": "El nombre de importación no puede ser \"{0}\".",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "La declaración de importación o exportación de una declaración de módulo de ambiente no puede hacer referencia al módulo a través de su nombre relativo.",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "No se permiten importaciones en aumentos de módulos. Considere la posibilidad de moverlas al módulo externo envolvente.",
@@ -462,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "La etiqueta \"@{0}\" de JSDoc no está asociada a una clase.",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "\"...\" de JSDoc solo puede aparecer en el último parámetro de una signatura.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "La etiqueta \"@param\" de JSDoc tiene el nombre \"{0}\", pero no hay ningún parámetro con ese nombre.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "La etiqueta de JSDoc \"@param\" tiene el nombre \"{0}\", pero no hay ningún parámetro con ese nombre. Coincidiría con \"arguments\" si tuviera un tipo de matriz.",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "La etiqueta \"@typedef\" de JSDoc debe tener una anotación de tipo o ir seguida de las etiquetas \"@property\" o \"@member\".",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Los tipos JSDoc solo se pueden usar en los comentarios de la documentación.",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "Los tipos de JSDoc pueden moverse a tipos de TypeScript.",
"JSX_attribute_expected_17003": "Se esperaba un atributo JSX.",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "A los atributos JSX se les debe asignar únicamente un elemento \"expression\" que no esté vacío.",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "El elemento JSX '{0}' no tiene la etiqueta de cierre correspondiente.",
@@ -476,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "Los elementos JSX no pueden tener varios atributos con el mismo nombre.",
"JSX_expressions_must_have_one_parent_element_2657": "Las expresiones JSX deben tener un elemento primario.",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "El fragmento de JSX no tiene la etiqueta de cierre correspondiente.",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "El fragmento JSX no se admite cuando se usa una pragma de fábrica JSX en línea",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "El fragmento de JSX no es compatible cuando se utiliza --jsxFactory",
"JSX_spread_child_must_be_an_array_type_2609": "El elemento secundario de propagación JSX debe ser de tipo matriz.",
"Jump_target_cannot_cross_function_boundary_1107": "Un destino de salto no puede atravesar el límite de función.",
@@ -507,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "El módulo {0} ya ha exportado un miembro denominado '{1}'. Considere la posibilidad de volver a exportarlo de forma explícita para resolver la ambigüedad.",
"Module_0_has_no_default_export_1192": "El módulo '{0}' no tiene ninguna exportación predeterminada.",
"Module_0_has_no_exported_member_1_2305": "El módulo '{0}' no tiene ningún miembro '{1}' exportado.",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "El módulo \"{0}\" no tiene ningún miembro exportado \"{1}\". ¿Pretendía utilizar \"{2}\"?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "El módulo \"{0}\" está oculto por una declaración local con el mismo nombre.",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "El módulo '{0}' se resuelve en una entidad que no es un módulo y no se puede importar mediante esta construcción.",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "El módulo '{0}' usa \"export =\" y no se puede usar con \"export *\".",
@@ -650,6 +661,7 @@
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "Generar un error en expresiones 'this' con un tipo 'any' implícito.",
"Redirect_output_structure_to_the_directory_6006": "Redirija la estructura de salida al directorio.",
"Remove_declaration_for_Colon_0_90004": "Quitar declaración de: \"{0}\"",
"Remove_import_from_0_90005": "Quitar importación de \"{0}\"",
"Replace_import_with_0_95015": "Reemplazar importación por \"{0}\".",
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "Notificar un error cuando no todas las rutas de acceso de código en funcionamiento devuelven un valor.",
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "Notificar errores de los casos de fallthrough en la instrucción switch.",
@@ -657,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "Informe de errores sobre variables locales no usadas.",
"Report_errors_on_unused_parameters_6135": "Informe de errores sobre parámetros no usados.",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "Los parámetros de tipo requeridos pueden no seguir parámetros de tipo opcionales.",
"Resolution_for_module_0_was_found_in_cache_6147": "La resolución del módulo \"{0}\" se encontró en la memoria caché.",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "La resolución del módulo \"{0}\" se encontró en la memoria caché de la ubicación \"{1}\".",
"Resolving_from_node_modules_folder_6118": "Resolviendo desde la carpeta node_modules...",
"Resolving_module_0_from_1_6086": "======== Resolviendo el módulo '{0}' de '{1}'. ========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "Resolviendo el nombre de módulo '{0}' relativo a la dirección URL base '{1}' - '{2}'.",
@@ -791,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "La declaración de variable de una instrucción \"for...in\" no puede tener un inicializador.",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "La declaración de variable de una instrucción \"for...of\" no puede tener un inicializador.",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "No se admite la instrucción 'with'. Todos los símbolos de un bloque 'with' tendrán el tipo 'any'.",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Esta función de constructor puede convertirse en una declaración de clase.",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "Esta sintaxis requiere una aplicación auxiliar importada, pero no se puede encontrar el módulo \"{0}\".",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "Esta sintaxis requiere una aplicación auxiliar importada denominada \"{1}\", pero el módulo \"{0}\" no tiene el miembro exportado \"{1}\".",
"Trailing_comma_not_allowed_1009": "No se permite la coma final.",
@@ -887,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "La lista de declaraciones de variable no puede estar vacía.",
"Version_0_6029": "Versión {0}",
"Watch_input_files_6005": "Inspeccionar archivos de entrada.",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "Si se debe mantener la salida de la consola no actualizada en el modo de inspección en lugar de borrar la pantalla.",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "No se puede cambiar el nombre de elementos definidos en la biblioteca TypeScript estándar.",
"You_cannot_rename_this_element_8000": "No se puede cambiar el nombre a este elemento.",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "\"{0}\" no acepta suficientes argumentos para utilizarse como decorador aquí. ¿Pretendía llamar primero y escribir \"@{0}()\"?",
+15 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "Les accesseurs doivent être abstraits ou non abstraits.",
"Add_0_to_existing_import_declaration_from_1_90015": "Ajouter '{0}' à la déclaration d'importation existante de \"{1}\"",
"Add_async_modifier_to_containing_function_90029": "Ajouter le modificateur async dans la fonction conteneur",
"Add_definite_assignment_assertion_to_property_0_95020": "Ajouter une assertion d'assignation définie à la propriété '{0}'",
"Add_index_signature_for_property_0_90017": "Ajouter une signature d'index pour la propriété '{0}'",
"Add_initializer_to_property_0_95019": "Ajouter un initialiseur à la propriété '{0}'",
"Add_missing_super_call_90001": "Ajouter l'appel manquant à 'super()'",
"Add_this_to_unresolved_variable_90008": "Ajouter 'this.' à la variable non résolue",
"Add_undefined_type_to_property_0_95018": "Ajouter un type 'undefined' à la propriété '{0}'",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "L'ajout d'un fichier tsconfig.json permet d'organiser les projets qui contiennent des fichiers TypeScript et JavaScript. En savoir plus sur https://aka.ms/tsconfig.",
"Additional_Checks_6176": "Vérifications supplémentaires",
"Advanced_Options_6178": "Options avancées",
"All_declarations_of_0_must_have_identical_modifiers_2687": "Toutes les déclarations de '{0}' doivent avoir des modificateurs identiques.",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "Toutes les déclarations de '{0}' doivent avoir des paramètres de type identiques.",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "Toutes les déclarations d'une méthode abstraite doivent être consécutives.",
"All_imports_in_import_declaration_are_unused_6192": "Les importations de la déclaration d'importation ne sont pas toutes utilisées.",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "Autorisez les importations par défaut à partir des modules sans exportation par défaut. Cela n'affecte pas l'émission du code, juste le contrôle de type.",
"Allow_javascript_files_to_be_compiled_6102": "Autorisez la compilation des fichiers JavaScript.",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "Les enums const ambiants ne sont pas autorisés quand l'indicateur '--isolatedModules' est fourni.",
@@ -324,6 +328,7 @@
"Enables_experimental_support_for_ES7_decorators_6065": "Active la prise en charge expérimentale des éléments décoratifs ES7.",
"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066": "Active la prise en charge expérimentale pour l'émission des métadonnées de type pour les éléments décoratifs.",
"Enum_0_used_before_its_declaration_2450": "Enum '{0}' utilisé avant sa déclaration.",
"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567": "Les déclarations enum ne peuvent fusionner qu'avec des espaces de noms ou d'autres déclarations enum.",
"Enum_declarations_must_all_be_const_or_non_const_2473": "Les déclarations d'enum doivent toutes être const ou non const.",
"Enum_member_expected_1132": "Membre enum attendu.",
"Enum_member_must_have_initializer_1061": "Un membre enum doit posséder un initialiseur.",
@@ -378,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "Le fichier '{0}' ne se trouve pas sous 'rootDir' '{1}'. 'rootDir' est supposé contenir tous les fichiers sources.",
"File_0_not_found_6053": "Fichier '{0}' introuvable.",
"File_change_detected_Starting_incremental_compilation_6032": "Modification de fichier détectée. Démarrage de la compilation incrémentielle...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "Le fichier est un module CommonJS ; il peut être converti en module ES6.",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "Le nom de fichier '{0}' diffère du nom de fichier '{1}' déjà inclus uniquement par la casse.",
"File_name_0_has_a_1_extension_stripping_it_6132": "Le nom de fichier '{0}' a une extension '{1}'. Suppression de l'extension.",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "La spécification de fichier ne peut pas contenir un répertoire parent ('..') après un caractère générique de répertoire récursif ('**') : '{0}'.",
@@ -424,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "La déclaration d'importation est en conflit avec la déclaration locale de '{0}'.",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "Les déclarations d'importation dans un espace de noms ne peuvent pas référencer un module.",
"Import_emit_helpers_from_tslib_6139": "Importer l'assistance à l'émission à partir de 'tslib'.",
"Import_may_be_converted_to_a_default_import_80003": "L'importation peut être convertie en importation par défaut.",
"Import_name_cannot_be_0_2438": "Le nom d'importation ne peut pas être '{0}'.",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "Une déclaration d'importation ou d'exportation dans une déclaration de module ambiant ne peut référencer un module au moyen d'un nom de module relatif.",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "Les importations ne sont pas autorisées dans les augmentations de module. Déplacez-les vers le module externe englobant.",
@@ -462,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "La balise JSDoc '@{0}' n'est pas attachée à une classe.",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "JSDoc '...' peut apparaître uniquement dans le dernier paramètre d'une signature.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "La balise JSDoc '@param' se nomme '{0}', mais il n'existe aucun paramètre portant ce nom.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "La balise JSDoc '@param' se nomme '{0}', mais il n'existe aucun paramètre portant ce nom. Elle doit correspondre à 'arguments', si elle est de type tableau.",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "La balise JSDoc '@typedef' doit avoir une annotation de type ou être suivie des balises '@property' ou '@member'.",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Les types JSDoc peuvent uniquement être utilisés dans les commentaires de la documentation.",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "Les types JSDoc peuvent être déplacés vers les types TypeScript.",
"JSX_attribute_expected_17003": "Attribut JSX attendu.",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Les attributs JSX doivent uniquement être attribués à une 'expression' non vide.",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "L'élément JSX '{0}' n'a pas de balise de fermeture correspondante.",
@@ -476,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "Les éléments JSX ne peuvent pas avoir plusieurs attributs du même nom.",
"JSX_expressions_must_have_one_parent_element_2657": "Les expressions JSX doivent avoir un élément parent.",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "Le fragment JSX n'a pas de balise de fermeture correspondante.",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "Le fragment JSX n'est pas pris en charge quand vous utilisez un pragma de fabrique JSX inline",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "Le fragment JSX n'est pas pris en charge quand --jsxFactory est utilisé",
"JSX_spread_child_must_be_an_array_type_2609": "L'enfant spread JSX doit être un type de tableau.",
"Jump_target_cannot_cross_function_boundary_1107": "La cible du saut ne peut pas traverser une limite de fonction.",
@@ -507,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "Le module {0} a déjà exporté un membre nommé '{1}'. Effectuez une réexportation explicite pour lever l'ambiguïté.",
"Module_0_has_no_default_export_1192": "Le module '{0}' n'a pas d'exportation par défaut.",
"Module_0_has_no_exported_member_1_2305": "Le module '{0}' n'a aucun membre exporté '{1}'.",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "Le module '{0}' n'a aucun membre exporté '{1}'. Pensiez-vous plutôt à '{2}' ?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "Le module '{0}' est masqué par une déclaration locale portant le même nom.",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "Le module '{0}' se résout en une entité non-module et ne peut pas être importé à l'aide de cette construction.",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Le module '{0}' utilise 'export =' et ne peut pas être utilisé avec 'export *'.",
@@ -650,6 +661,7 @@
"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.",
"Remove_declaration_for_Colon_0_90004": "Supprimer la déclaration pour : '{0}'",
"Remove_import_from_0_90005": "Supprimer l'importation de '{0}'",
"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.",
@@ -657,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "Signaler les erreurs sur les variables locales inutilisées.",
"Report_errors_on_unused_parameters_6135": "Signaler les erreurs sur les paramètres inutilisés.",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "Les paramètres de type obligatoires ne peuvent pas être placés à la suite des paramètres de type optionnels.",
"Resolution_for_module_0_was_found_in_cache_6147": "La résolution du module '{0}' a été trouvée dans le cache.",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "La résolution du module '{0}' a été trouvée dans le cache à l'emplacement '{1}'.",
"Resolving_from_node_modules_folder_6118": "Résolution à partir du dossier node_modules...",
"Resolving_module_0_from_1_6086": "======== Résolution du module '{0}' à partir de '{1}'. ========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "Résolution du nom de module '{0}' par rapport à l'URL de base '{1}' - '{2}'.",
@@ -791,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "La déclaration de variable d'une instruction 'for...in' ne peut pas avoir d'initialiseur.",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "La déclaration de variable d'une instruction 'for...of' ne peut pas avoir d'initialiseur.",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "L'instruction 'with' n'est pas prise en charge. Tous les symboles d'un bloc 'with' ont le type 'any'.",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Cette fonction constructeur peut être convertie en déclaration de classe.",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "Cette syntaxe nécessite une application d'assistance importée, mais le module '{0}' est introuvable.",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "Cette syntaxe nécessite une application d'assistance importée nommée '{1}', mais le module '{0}' ne compte aucun membre exporté '{1}'.",
"Trailing_comma_not_allowed_1009": "Virgule de fin non autorisée.",
@@ -887,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "La liste des déclarations de variable ne peut pas être vide.",
"Version_0_6029": "Version {0}",
"Watch_input_files_6005": "Fichiers d'entrée d'espion.",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "Garder la sortie de console obsolète en mode espion au lieu d'effacer l'écran.",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "Vous ne pouvez pas renommer des éléments définis dans la bibliothèque TypeScript standard.",
"You_cannot_rename_this_element_8000": "Vous ne pouvez pas renommer cet élément.",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "'{0}' accepte trop peu d'arguments pour pouvoir être utilisé ici en tant qu'élément décoratif. Voulez-vous vraiment l'appeler d'abord et écrire '@{0}()' ?",
+14 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "Le funzioni di accesso devono essere tutte astratte o tutte non astratte.",
"Add_0_to_existing_import_declaration_from_1_90015": "Aggiungere '{0}' alla dichiarazione di importazione esistente da \"{1}\"",
"Add_async_modifier_to_containing_function_90029": "Aggiungere il modificatore async alla funzione contenitore",
"Add_definite_assignment_assertion_to_property_0_95020": "Aggiungere l'asserzione di assegnazione definita alla proprietà '{0}'",
"Add_index_signature_for_property_0_90017": "Aggiungere la firma dell'indice per la proprietà '{0}'",
"Add_initializer_to_property_0_95019": "Aggiungere l'inizializzatore alla proprietà '{0}'",
"Add_missing_super_call_90001": "Aggiungere la chiamata mancante a 'super()'",
"Add_this_to_unresolved_variable_90008": "Aggiungere 'this.' alla variabile non risolta",
"Add_undefined_type_to_property_0_95018": "Aggiungere il tipo 'undefined' alla proprietà '{0}'",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Aggiungere un file tsconfig.json per organizzare più facilmente progetti che contengono sia file TypeScript che JavaScript. Per altre informazioni, vedere https://aka.ms/tsconfig.",
"Additional_Checks_6176": "Controlli aggiuntivi",
"Advanced_Options_6178": "Opzioni avanzate",
"All_declarations_of_0_must_have_identical_modifiers_2687": "Tutte le dichiarazioni di '{0}' devono contenere modificatori identici.",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "Tutte le dichiarazioni di '{0}' devono contenere parametri di tipo identici.",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "Tutte le dichiarazioni di un metodo astratto devono essere consecutive.",
"All_imports_in_import_declaration_are_unused_6192": "Tutte le importazioni nella dichiarazione di importazione sono inutilizzate.",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "Consente di eseguire importazioni predefinite da moduli senza esportazione predefinita. Non influisce sulla creazione del codice ma solo sul controllo dei tipi.",
"Allow_javascript_files_to_be_compiled_6102": "Consente la compilazione di file JavaScript.",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "Le enumerazioni const di ambiente non sono consentite quando viene specificato il flag '--isolatedModules'.",
@@ -379,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "Il file '{0}' non si trova in 'rootDir' '{1}'. 'rootDir' deve contenere tutti i file di origine.",
"File_0_not_found_6053": "Il file '{0}' non è stato trovato.",
"File_change_detected_Starting_incremental_compilation_6032": "È stata rilevata una modifica ai file. Verrà avviata la compilazione incrementale...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "Il file è un modulo CommonJS; può essere convertito in un modulo ES6.",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "Il nome file '{0}' differisce da quello già incluso '{1}' solo per l'uso di maiuscole/minuscole.",
"File_name_0_has_a_1_extension_stripping_it_6132": "L'estensione del nome file '{0}' è '{1}' e verrà rimossa.",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "La specifica del file non può contenere una directory padre ('..') inserita dopo un carattere jolly ('**') di directory ricorsiva: '{0}'.",
@@ -425,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "La dichiarazione di importazione è in conflitto con la dichiarazione locale di '{0}'.",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "Le dichiarazioni di importazione in uno spazio dei nomi non possono far riferimento a un modulo.",
"Import_emit_helpers_from_tslib_6139": "Importa gli helper di creazione da 'tslib'.",
"Import_may_be_converted_to_a_default_import_80003": "L'importazione può essere convertita in un'importazione predefinita.",
"Import_name_cannot_be_0_2438": "Il nome dell'importazione non può essere '{0}'.",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "La dichiarazione di importazione o esportazione in una dichiarazione di modulo di ambiente non può fare riferimento al modulo tramite il nome di modulo relativo.",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "Le importazioni non sono consentite negli aumenti di modulo. Provare a spostarle nel modulo esterno di inclusione.",
@@ -463,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "Il tag '@{0}' di JSDoc non è collegato a una classe.",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "JSDoc '...' può essere presente solo nell'ultimo parametro di una firma.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "Il nome del tag '@param' di JSDoc è '{0}', ma non esiste alcun parametro con questo nome.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "Il nome del tag '@param' di JSDoc è '{0}', ma non esiste alcun parametro con questo nome. Se contenesse un tipo matrice, corrisponderebbe ad 'arguments'.",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "Il tag '@typedef' di JSDoc deve contenere un'annotazione di tipo o essere seguito dal tag '@property' o '@member'.",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "I tipi JSDoc possono essere usati solo nei commenti della documentazione.",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "I tipi JSDoc possono essere convertiti in tipi TypeScript.",
"JSX_attribute_expected_17003": "È previsto l'attributo JSX.",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Agli attributi JSX deve essere assegnato solo un elemento 'expression' non vuoto.",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "Per l'elemento JSX '{0}' non esiste alcun tag di chiusura corrispondente.",
@@ -477,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "Gli elementi JSX non possono contenere più attributi con lo stesso nome.",
"JSX_expressions_must_have_one_parent_element_2657": "Le espressioni JSX devono contenere un solo elemento padre.",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "Per il frammento JSX non esiste alcun tag di chiusura corrispondente.",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "Il frammento JSX non è supportato quando si usa una direttiva pragma factory JSX inline",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "Il frammento JSX non è supportato quando si usa --jsxFactory",
"JSX_spread_child_must_be_an_array_type_2609": "L'elemento figlio dell'attributo spread JSX deve essere un tipo di matrice.",
"Jump_target_cannot_cross_function_boundary_1107": "La destinazione di collegamento non può oltrepassare il limite della funzione.",
@@ -508,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "Il modulo {0} ha già esportato un membro denominato '{1}'. Per risolvere l'ambiguità, provare a esportarlo di nuovo in modo esplicito.",
"Module_0_has_no_default_export_1192": "Per il modulo '{0}' non esistono esportazioni predefinite.",
"Module_0_has_no_exported_member_1_2305": "Il modulo '{0}' non contiene un membro esportato '{1}'.",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "Per il modulo '{0}' non esiste alcun membro esportato '{1}'. Si intendeva '{2}'?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "Il modulo '{0}' è nascosto da una dichiarazione locale con lo stesso nome.",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "Il modulo '{0}' viene risolto in un'entità non modulo e non può essere importato con questo costrutto.",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Il modulo '{0}' usa 'export =' e non può essere usato con 'export *'.",
@@ -651,6 +661,7 @@
"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.",
"Remove_declaration_for_Colon_0_90004": "Rimuovere la dichiarazione per '{0}'",
"Remove_import_from_0_90005": "Rimuovere l'importazione da '{0}'",
"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.",
@@ -658,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "Segnala errori relativi a variabili locali non usate.",
"Report_errors_on_unused_parameters_6135": "Segnala errori relativi a parametri non usati.",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "I parametri di tipo obbligatori potrebbero non seguire i parametri di tipo facoltativi.",
"Resolution_for_module_0_was_found_in_cache_6147": "La risoluzione per il modulo '{0}' non è stata trovata nella cache.",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "La risoluzione per il modulo '{0}' è stata trovata nella cache dal percorso '{1}'.",
"Resolving_from_node_modules_folder_6118": "Risoluzione dalla cartella node_modules...",
"Resolving_module_0_from_1_6086": "======== Risoluzione del modulo '{0}' da '{1}'. ========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "Verrà eseguita la risoluzione del nome del modulo '{0}' relativo all'URL di base '{1}' - '{2}'.",
@@ -792,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "La dichiarazione di variabile di un'istruzione 'for...in' non può contenere un inizializzatore.",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "La dichiarazione di variabile di un'istruzione 'for...of' non può contenere un inizializzatore.",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "L'istruzione 'with' non è supportata. Il tipo di tutti i simboli in un blocco 'with' è 'any'.",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Questa funzione del costruttore può essere convertita in una dichiarazione di classe.",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "Con questa sintassi è richiesto un helper importato, ma il modulo '{0}' non è stato trovato.",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "Con questa sintassi è richiesto un helper importato denominato '{1}', ma il modulo '{0}' non contiene alcun membro esportato '{1}'.",
"Trailing_comma_not_allowed_1009": "La virgola finale non è consentita.",
@@ -888,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "L'elenco delle dichiarazioni di variabile non può essere vuoto.",
"Version_0_6029": "Versione {0}",
"Watch_input_files_6005": "Controlla i file di input.",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "Indica se mantenere l'output della console obsoleto in modalità espressione di controllo invece di pulire lo schermo.",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "Non è possibile rinominare elementi definiti nella libreria TypeScript standard.",
"You_cannot_rename_this_element_8000": "Non è possibile rinominare questo elemento.",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "'{0}' accetta un numero troppo ridotto di argomenti da usare come espressione Decorator in questo punto. Si intendeva chiamarlo prima e scrivere '@{0}()'?",
+15 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "アクセサーはどちらも抽象または非抽象である必要があります。",
"Add_0_to_existing_import_declaration_from_1_90015": "\"{1}\" から既存のインポート宣言に '{0}' を追加する",
"Add_async_modifier_to_containing_function_90029": "含まれている関数に async 修飾子を追加します",
"Add_definite_assignment_assertion_to_property_0_95020": "プロパティ '{0}' に限定代入アサーションを追加します",
"Add_index_signature_for_property_0_90017": "プロパティ '{0}' のインデックス シグネチャを追加する",
"Add_initializer_to_property_0_95019": "プロパティ '{0}' に初期化子を追加します",
"Add_missing_super_call_90001": "欠落している 'super()' 呼び出しを追加する",
"Add_this_to_unresolved_variable_90008": "'this.' を未解決の変数に追加する",
"Add_undefined_type_to_property_0_95018": "プロパティ '{0}' に '未定義' の型を追加します",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "tsconfig.json ファイルを追加すると、TypeScript ファイルと JavaScript ファイルの両方を含むプロジェクトを整理できます。詳細については、https://aka.ms/tsconfig をご覧ください。",
"Additional_Checks_6176": "追加のチェック",
"Advanced_Options_6178": "詳細オプション",
"All_declarations_of_0_must_have_identical_modifiers_2687": "'{0}' のすべての宣言には、同一の修飾子が必要です。",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "'{0}' のすべての宣言には、同一の型パラメーターがある必要があります。",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "抽象メソッドの宣言はすべて連続している必要があります。",
"All_imports_in_import_declaration_are_unused_6192": "インポート宣言内のインポートはすべて未使用です。",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "既定のエクスポートがないモジュールからの既定のインポートを許可します。これは、型チェックのみのため、コード生成には影響を与えません。",
"Allow_javascript_files_to_be_compiled_6102": "javascript ファイルのコンパイルを許可します。",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "'--isolatedModules' フラグが指定されている場合、アンビエント const 列挙型は使用できません。",
@@ -324,6 +328,7 @@
"Enables_experimental_support_for_ES7_decorators_6065": "ES7 デコレーター用の実験的なサポートを有効にします。",
"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066": "デコレーター用の型メタデータを発行するための実験的なサポートを有効にします。",
"Enum_0_used_before_its_declaration_2450": "列挙型 '{0}' は宣言の前に使用されました。",
"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567": "列挙型の宣言は、名前空間または他の列挙型の宣言とのみマージできます。",
"Enum_declarations_must_all_be_const_or_non_const_2473": "列挙型宣言は、すべてが定数、またはすべてが非定数でなければなりません。",
"Enum_member_expected_1132": "列挙型メンバーが必要です。",
"Enum_member_must_have_initializer_1061": "列挙型メンバーには初期化子が必要です。",
@@ -378,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "ファイル '{0}' が 'rootDir' '{1}' の下にありません。'rootDir' にすべてにソース ファイルが含まれている必要があります。",
"File_0_not_found_6053": "ファイル '{0}' が見つかりません。",
"File_change_detected_Starting_incremental_compilation_6032": "ファイルの変更が検出されました。インクリメンタル コンパイルを開始しています...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "ファイルは CommonJS モジュールです。ES6 モジュールに変換される可能性があります。",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "ファイル名 '{0}' は、既に含まれているファイル名 '{1}' と大文字と小文字の指定だけが異なります。",
"File_name_0_has_a_1_extension_stripping_it_6132": "ファイル名 '{0}' に '{1}' 拡張子が使われています - 削除しています。",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "ファイルの指定で再帰ディレクトリのワイルドカード ('**') の後に親ディレクトリ ('..') を指定することはできません: '{0}'。",
@@ -424,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "インポート宣言が、'{0}' のローカル宣言と競合しています。",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "名前空間内のインポート宣言は、モジュールを参照できません。",
"Import_emit_helpers_from_tslib_6139": "生成ヘルパーを 'tslib' からインポートします。",
"Import_may_be_converted_to_a_default_import_80003": "インポートは既定のインポートに変換される可能性があります。",
"Import_name_cannot_be_0_2438": "インポート名を '{0}' にすることはできません。",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "アンビエント モジュール宣言内のインポート宣言またはエクスポート宣言は、相対モジュール名を通してモジュールを参照することはできません。",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "インポートはモジュールの拡張では許可されていません。外側の外部モジュールに移動することを検討してください。",
@@ -462,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "JSDoc '@{0}' はクラスにアタッチされていません。",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "JSDoc '...' は、シグネチャの最後のパラメーターにのみ使用できます。",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "JSDoc '@param' タグの名前は '{0}' ですが、その名前のパラメーターはありません。",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "JSDoc '@param' タグに名前 '{0}' が指定されていますが、その名前のパラメーターはありません。配列型があった場合は、'arguments' と一致したはずです。",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc '@typedef' タグには、型の注釈を指定するか、後に '@property' タグや '@member' タグを付ける必要があります。",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc の種類は、ドキュメント コメント内でのみ使用できます。",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "JSDoc の種類は TypeScript の種類に移行される可能性があります。",
"JSX_attribute_expected_17003": "JSX 属性が必要です。",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "JSX 属性は、空ではない '式' にのみ割り当てる必要があります。",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "JSX 要素 '{0}' には対応する終了タグがありません。",
@@ -476,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "JSX 要素に同じ名前の複数の属性を指定することはできません。",
"JSX_expressions_must_have_one_parent_element_2657": "JSX 式には 1 つの親要素が必要です。",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "JSX フラグメントには対応する終了タグがありません。",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "JSX フラグメントはインライン JSX ファクトリ プラグマの使用時にサポートされていません",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "--jsxFactory を使う場合、JSX フラグメントはサポートされません",
"JSX_spread_child_must_be_an_array_type_2609": "JSX スプレッドの子は、配列型でなければなりません。",
"Jump_target_cannot_cross_function_boundary_1107": "ジャンプ先は関数の境界を越えることはできません。",
@@ -507,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "モジュール {0} は既に '{1}' という名前のメンバーをエクスポートしています。あいまいさを解決するため、明示的にもう一度エクスポートすることを検討してください。",
"Module_0_has_no_default_export_1192": "モジュール '{0}' に既定エクスポートがありません。",
"Module_0_has_no_exported_member_1_2305": "モジュール '{0}' にエクスポートされたメンバー '{1}' がありません。",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "モジュール '{0}' にエクスポートされたメンバー '{1}' が含まれていません。候補: '{2}'",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "モジュール '{0}' は同じ名前のローカル宣言によって非表示になっています。",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "モジュール '{0}' はモジュール以外のエンティティに解決されるため、このコンストラクトを使用してインポートできません。",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "モジュール '{0}' には 'export =' が使用されているため、'export *' は併用できません。",
@@ -650,6 +661,7 @@
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "暗黙的な 'any' 型を持つ 'this' 式でエラーが発生します。",
"Redirect_output_structure_to_the_directory_6006": "ディレクトリへ出力構造をリダイレクトします。",
"Remove_declaration_for_Colon_0_90004": "次に対する宣言を削除する: '{0}'",
"Remove_import_from_0_90005": "'{0}' からのインポートを削除",
"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 のフォールスルーがある場合にエラーを報告します。",
@@ -657,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "使用されていないローカルに関するエラーを報告します。",
"Report_errors_on_unused_parameters_6135": "使用されていないパラメーターに関するエラーを報告します。",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "必須の型パラメーターの後に、オプションの型パラメーターを続けることはできません。",
"Resolution_for_module_0_was_found_in_cache_6147": "モジュール '{0}' の解決がキャッシュに見つかりました。",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "モジュール '{0}' の解決が場所 '{1}' のキャッシュに見つかりました。",
"Resolving_from_node_modules_folder_6118": "node_modules フォルダーから解決しています...",
"Resolving_module_0_from_1_6086": "======== '{1}' からモジュール '{0}' を解決しています。========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "ベース URL '{1}' - '{2}' に相対するモジュール名 '{0}' を解決しています。",
@@ -791,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' ステートメントの変数宣言に初期化子を指定することはできません。",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' ステートメントの変数宣言に初期化子を指定することはできません。",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "'with' ステートメントはサポートされていません。'with' ブロック内のすべてのシンボルの型は 'any' になります。",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "このコンストラクター関数はクラス宣言に変換される可能性があります。",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "この構文にはインポートされたヘルパーが必要ですが、モジュール '{0}' が見つかりません。",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "この構文には '{1}' という名前のインポートされたヘルパーが必要ですが、モジュール '{0}' にエクスポートされたメンバー '{1}' がありません。",
"Trailing_comma_not_allowed_1009": "末尾にコンマは使用できません。",
@@ -887,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "変数宣言リストを空にすることはできません。",
"Version_0_6029": "バージョン {0}",
"Watch_input_files_6005": "入力ファイルを監視します。",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "画面をクリアする代わりに、古くなったコンソール出力をウォッチ モードで保持するかどうか。",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "標準の TypeScript ライブラリで定義された要素の名前を変更することはできません。",
"You_cannot_rename_this_element_8000": "この要素の名前を変更することはできません。",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "'{0}' は受け入れる引数が少なすぎるので、ここでデコレーターとして使用することができません。最初にこれを呼び出してから、'@{0}()' を書き込むつもりでしたか?",
+14 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "접근자는 모두 추상이거나 비추상이어야 합니다.",
"Add_0_to_existing_import_declaration_from_1_90015": "\"{1}\"에서 기존 가져오기 선언에 '{0}' 추가",
"Add_async_modifier_to_containing_function_90029": "포함된 함수에 async 한정자 추가",
"Add_definite_assignment_assertion_to_property_0_95020": "'{0}' 속성에 한정된 할당 어설션 추가",
"Add_index_signature_for_property_0_90017": "'{0}' 속성에 대해 인덱스 시그니처 추가",
"Add_initializer_to_property_0_95019": "'{0}' 속성에 이니셜라이저 추가",
"Add_missing_super_call_90001": "누락된 'super()' 호출 추가",
"Add_this_to_unresolved_variable_90008": "확인되지 않은 변수에 'this.' 추가",
"Add_undefined_type_to_property_0_95018": "'{0}' 속성에 '정의되지 않은' 형식 추가",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "tsconfig.json 파일을 추가하면 TypeScript 파일과 JavaScript 파일이 둘 다 포함된 프로젝트를 정리하는 데 도움이 됩니다. 자세한 내용은 https://aka.ms/tsconfig를 참조하세요.",
"Additional_Checks_6176": "추가 검사",
"Advanced_Options_6178": "고급 옵션",
"All_declarations_of_0_must_have_identical_modifiers_2687": "'{0}'의 모든 선언에는 동일한 한정자가 있어야 합니다.",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "'{0}'의 모든 선언에는 동일한 형식 매개 변수가 있어야 합니다.",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "추상 메서드의 모든 선언은 연속적이어야 합니다.",
"All_imports_in_import_declaration_are_unused_6192": "가져오기 선언의 모든 가져오기가 사용되지 않습니다.",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "기본 내보내기가 없는 모듈에서 기본 가져오기를 허용합니다. 여기서는 코드 내보내기에는 영향을 주지 않고 형식 검사만 합니다.",
"Allow_javascript_files_to_be_compiled_6102": "Javascript 파일을 컴파일하도록 허용합니다.",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "'--isolatedModules' 플래그가 제공된 경우 앰비언트 const 열거형이 허용되지 않습니다.",
@@ -379,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "'{0}' 파일이 'rootDir' '{1}' 아래에 있지 않습니다. 'rootDir'에는 모든 소스 파일이 포함되어 있어야 합니다.",
"File_0_not_found_6053": "파일 '{0}'을(를) 찾을 수 없습니다.",
"File_change_detected_Starting_incremental_compilation_6032": "파일 변경이 검색되었습니다. 증분 컴파일을 시작하는 중...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "파일이 CommonJS 모듈입니다. ES6 모듈로 변환될 수 있습니다.",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "'{0}' 파일 이름은 이미 포함된 '{1}' 파일 이름과 대/소문자만 다릅니다.",
"File_name_0_has_a_1_extension_stripping_it_6132": "파일 이름 '{0}'에 '{1}' 확장명이 있어 제거하는 중입니다.",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "파일 사양은 재귀 디렉터리 와일드카드('**') 뒤에 나타나는 부모 디렉터리('..')를 포함할 수 없습니다. '{0}'.",
@@ -425,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "가져오기 선언이 '{0}'의 로컬 선언과 충돌합니다.",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "네임스페이스의 가져오기 선언은 모듈을 참조할 수 없습니다.",
"Import_emit_helpers_from_tslib_6139": "'tslib'에서 내보내기 도우미를 가져오세요.",
"Import_may_be_converted_to_a_default_import_80003": "가져오기가 기본 가져오기로 변환될 수 있습니다.",
"Import_name_cannot_be_0_2438": "가져오기 이름은 '{0}'일 수 없습니다.",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "앰비언트 모듈 선언의 가져오기 또는 내보내기 선언은 상대적 모듈 이름을 통해 모듈을 참조할 수 없습니다.",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "가져오기는 모듈 확대에서 허용되지 않습니다. 내보내기를 바깥쪽 외부 모듈로 이동하세요.",
@@ -463,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "JSDoc '@{0}'이(가) 클래스에 연결되어 있지 않습니다.",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "JSDoc '...'은 시그니처의 마지막 매개 변수에만 나타날 수 있습니다.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "JSDoc '@param' 태그의 이름이 '{0}'인데 해당 이름의 매개 변수가 없습니다.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "JSDoc '@param' 태그에 '{0}' 이름이 있지만, 해당 이름의 매개 변수가 없습니다. 배열 형식이 있는 경우 '인수'를 일치시킵니다.",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc '@typedef' 태그는 형식 주석을 포함하거나, '@property' 또는 '@member' 태그 앞에 와야 합니다.",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc 유형은 문서 주석 내에서만 사용될 수 있습니다.",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "JSDoc 형식이 TypeScript 형식으로 이동될 수 있습니다.",
"JSX_attribute_expected_17003": "JSX 특성이 필요합니다.",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "JSX 특성에는 비어 있지 않은 '식'만 할당할 수 있습니다.",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "JSX 요소 '{0}'에 닫는 태그가 없습니다.",
@@ -477,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "JSX 요소에 이름이 같은 특성을 여러 개 사용할 수 없습니다.",
"JSX_expressions_must_have_one_parent_element_2657": "JSX 식에는 부모 요소가 하나 있어야 합니다.",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "JSX 조각에 닫는 태그가 없습니다.",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "인라인 JSX 팩터리 pragma를 사용할 때에는 JSX 조각이 지원되지 않습니다.",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "JSX 조각은 --jsxFactory를 사용하는 경우 지원되지 않습니다.",
"JSX_spread_child_must_be_an_array_type_2609": "JSX 분배 자식은 배열 형식이어야 합니다.",
"Jump_target_cannot_cross_function_boundary_1107": "점프 대상은 함수 경계를 벗어날 수 없습니다.",
@@ -508,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "{0} 모듈에서 '{1}'(이)라는 멤버를 이미 내보냈습니다. 모호성을 해결하려면 명시적으로 다시 내보내는 것이 좋습니다.",
"Module_0_has_no_default_export_1192": "모듈 '{0}'에는 기본 내보내기가 없습니다.",
"Module_0_has_no_exported_member_1_2305": "'{0}' 모듈에 내보낸 멤버 '{1}'이(가) 없습니다.",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "모듈 '{0}'에 내보낸 멤버 '{1}'이(가) 없습니다. '{2}'이(가) 아닌지 확인하세요.",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "'{0}' 모듈은 이름이 같은 로컬 선언으로 숨겨집니다.",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "모듈 '{0}'은(는) 모듈이 아닌 엔터티로 확인되므로 이 구문을 사용하여 가져올 수 없습니다.",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "모듈 '{0}'은(는) 'export ='을 사용하며 'export *'와 함께 사용할 수 없습니다.",
@@ -651,6 +661,7 @@
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "암시된 'any' 형식이 있는 'this' 식에서 오류를 발생합니다.",
"Redirect_output_structure_to_the_directory_6006": "출력 구조를 디렉터리로 리디렉션합니다.",
"Remove_declaration_for_Colon_0_90004": "'{0}'에 대한 선언 제거",
"Remove_import_from_0_90005": "'{0}'에서 가져오기 제거",
"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에 대한 오류를 보고합니다.",
@@ -658,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "사용되지 않은 로컬 항목에 대한 오류를 보고합니다.",
"Report_errors_on_unused_parameters_6135": "사용되지 않은 매개 변수에 대한 오류를 보고합니다.",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "필수 형식 매개 변수는 선택적 형식 매개 변수 다음에 올 수 없습니다.",
"Resolution_for_module_0_was_found_in_cache_6147": "'{0}' 모듈에 대한 해결을 캐시에서 찾았습니다.",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "'{0}' 모듈에 대한 해결을 '{1}' 위치의 캐시에서 찾았습니다.",
"Resolving_from_node_modules_folder_6118": "node_modules 폴더에서 확인하는 중...",
"Resolving_module_0_from_1_6086": "======== '{1}'에서 '{0}' 모듈을 확인하는 중입니다. ========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "기본 URL '{1}' - '{2}'을(를) 기준으로 모듈 이름 '{0}'을(를) 확인하는 중입니다.",
@@ -792,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' 문의 변수 선언에 이니셜라이저가 포함될 수 없습니다.",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' 문의 변수 선언에 이니셜라이저가 포함될 수 없습니다.",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "'with' 문은 지원되지 않습니다. 'with' 블록의 모든 기호가 'any' 형식이 됩니다.",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "이 생성자 함수는 클래스 선언으로 변환될 수 있습니다.",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "이 구문에는 가져온 도우미가 필요하지만 '{0}' 모듈을 찾을 수 없습니다.",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "이 구문에는 가져온 도우미 '{1}'이(가) 필요하지만 '{0}' 모듈에 내보낸 멤버 '{1}'이(가) 없습니다.",
"Trailing_comma_not_allowed_1009": "후행 쉼표는 허용되지 않습니다.",
@@ -888,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "변수 선언 목록은 비워 둘 수 없습니다.",
"Version_0_6029": "버전 {0}",
"Watch_input_files_6005": "조사식 입력 파일입니다.",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "화면을 지우지 않고, 감시 모드의 오래된 콘솔 출력을 유지할지 여부입니다.",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "표준 TypeScript 라이브러리에 정의된 요소의 이름을 바꿀 수 없습니다.",
"You_cannot_rename_this_element_8000": "이 요소의 이름을 바꿀 수 없습니다.",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "'{0}'이(가) 여기에서 decorator로 사용할 인수를 너무 적게 허용합니다. 먼저 이를 호출하고 '@{0}()'을(를) 작성하시겠습니까?",
+4882 -4349
View File
File diff suppressed because it is too large Load Diff
+4882 -4349
View File
File diff suppressed because it is too large Load Diff
+4882 -4349
View File
File diff suppressed because it is too large Load Diff
+4882 -4349
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -19,3 +19,5 @@ and limitations under the License.
/// <reference path="lib.es2017.d.ts" />
/// <reference path="lib.es2018.promise.d.ts" />
/// <reference path="lib.es2018.regexp.d.ts" />
+4884 -4350
View File
File diff suppressed because it is too large Load Diff
+32
View File
@@ -0,0 +1,32 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> {
/**
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
* resolved value cannot be modified from the callback.
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
* @returns A Promise for the completion of the callback.
*/
finally(onfinally?: (() => void) | undefined | null): Promise<T>
}
+31
View File
@@ -0,0 +1,31 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface RegExpMatchArray {
groups?: {
[key: string]: string
}
}
interface RegExpExecArray {
groups?: {
[key: string]: string
}
}
+4882 -4349
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -21,4 +21,3 @@ and limitations under the License.
/// <reference path="lib.es2018.d.ts" />
/// <reference path="lib.esnext.asynciterable.d.ts" />
/// <reference path="lib.esnext.array.d.ts" />
/// <reference path="lib.esnext.promise.d.ts" />
+4882 -4350
View File
File diff suppressed because it is too large Load Diff
+735 -908
View File
File diff suppressed because it is too large Load Diff
+14 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "Obie metody dostępu muszą być abstrakcyjne lub nieabstrakcyjne.",
"Add_0_to_existing_import_declaration_from_1_90015": "Dodaj element „{0}” do istniejącej deklaracji importu z elementu „{1}”",
"Add_async_modifier_to_containing_function_90029": "Dodaj modyfikator asynchroniczny do funkcji zawierającej",
"Add_definite_assignment_assertion_to_property_0_95020": "Dodaj asercję określonego przypisania do właściwości „{0}”",
"Add_index_signature_for_property_0_90017": "Dodaj sygnaturę indeksu dla właściwości „{0}”",
"Add_initializer_to_property_0_95019": "Dodaj inicjator do właściwości „{0}”",
"Add_missing_super_call_90001": "Dodaj brakujące wywołanie „super()”",
"Add_this_to_unresolved_variable_90008": "Dodaj „this.” do nierozpoznanej zmiennej",
"Add_undefined_type_to_property_0_95018": "Dodaj typ „undefined” do właściwości „{0}”",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Dodanie pliku tsconfig.json pomoże w organizowaniu projektów, które zawierają pliki TypeScript i JavaScript. Dowiedz się więcej: https://aka.ms/tsconfig.",
"Additional_Checks_6176": "Dodatkowe kontrole",
"Advanced_Options_6178": "Opcje zaawansowane",
"All_declarations_of_0_must_have_identical_modifiers_2687": "Wszystkie deklaracje elementu „{0}” muszą mieć identyczne modyfikatory.",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "Wszystkie deklaracje „{0}” muszą mieć identyczne parametry typu.",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "Wszystkie deklaracje metody abstrakcyjnej muszą występować obok siebie.",
"All_imports_in_import_declaration_are_unused_6192": "Wszystkie importy w deklaracji importu są nieużywane.",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "Zezwalaj na domyślne importy z modułów bez domyślnego eksportu. To nie wpływa na emitowanie kodu, a tylko na sprawdzanie typów.",
"Allow_javascript_files_to_be_compiled_6102": "Zezwalaj na kompilowanie plików JavaScript.",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "Otaczające wyliczenia ze specyfikacją const nie są dozwolone w przypadku podania flagi „--isolatedModules”.",
@@ -379,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "Plik „{0}” nie znajduje się w katalogu „rootDir” „{1}”. Katalog „rootDir” powinien zawierać wszystkie pliki źródłowe.",
"File_0_not_found_6053": "Nie można odnaleźć pliku '{0}'.",
"File_change_detected_Starting_incremental_compilation_6032": "Wykryto zmianę pliku. Trwa rozpoczynanie kompilacji przyrostowej...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "Plik jest modułem CommonJS. Może zostać przekonwertowany na moduł ES6.",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "Nazwa pliku „{0}” różni się od już dołączonej nazwy pliku „{1}” tylko wielkością liter.",
"File_name_0_has_a_1_extension_stripping_it_6132": "Nazwa pliku „{0}” ma rozszerzenie „{1}” — zostanie ono usunięte.",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "Specyfikacja pliku nie może zawierać katalogu nadrzędnego („..”) wyświetlanego po symbolu wieloznacznym katalogu rekursywnego („**”): „{0}”.",
@@ -425,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "Deklaracja importu powoduje konflikt z deklaracją lokalną „{0}”.",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "Deklaracje importu w przestrzeni nazw nie mogą odwoływać się do modułu.",
"Import_emit_helpers_from_tslib_6139": "Importuj pomocników emitowania z elementu „tslib”.",
"Import_may_be_converted_to_a_default_import_80003": "Import może zostać przekonwertowany na import domyślny.",
"Import_name_cannot_be_0_2438": "Import nie może mieć nazwy „{0}”.",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "Deklaracja importu lub eksportu w deklaracji otaczającego modułu nie może przywoływać modułu za pomocą jego nazwy względnej.",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "Importy nie są dozwolone w rozszerzeniach modułów. Rozważ przeniesienie ich do obejmującego modułu zewnętrznego.",
@@ -463,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "Element JSDoc „@{0}” nie został dołączony do klasy.",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "Element „...” JSDoc może występować tylko w ostatnim parametrze sygnatury.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "Tag JSDoc „@param” tag ma nazwę „{0}”, ale nie ma parametru o tej nazwie.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "Tag JSDoc „@param” ma nazwę „{0}”, ale nie istnieje parametr o tej nazwie. Byłby on zgodny z elementem „arguments”, gdyby miał typ tablicy.",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "Tag „@typedef” JSDoc powinien mieć adnotację typu lub powinien po nim następować tag „@property” lub „@member”.",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Typy JSDoc mogą być używane wyłącznie w komentarzach dokumentacji.",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "Typy JSDoc mogą być przenoszone do typów TypeScript.",
"JSX_attribute_expected_17003": "Oczekiwano atrybutu JSX.",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Atrybuty JSX muszą mieć przypisane wyrażenie, które nie jest puste.",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "Element JSX „{0}” nie ma odpowiedniego tagu zamykającego.",
@@ -477,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "Elementy JSX nie mogą mieć wielu atrybutów o tej samej nazwie.",
"JSX_expressions_must_have_one_parent_element_2657": "Wyrażenia JSX muszą mieć jeden element nadrzędny.",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "Fragment kodu JSX nie ma odpowiedniego tagu zamykającego.",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "Fragment JSX nie jest obsługiwany podczas używania śródwierszowej dyrektywy pragma fabryki JSX",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "W przypadku korzystania z opcji --jsxFactory fragment kodu JSX nie jest obsługiwany",
"JSX_spread_child_must_be_an_array_type_2609": "Element podrzędny rozkładu JSX musi być typem tablicy.",
"Jump_target_cannot_cross_function_boundary_1107": "Cel skoku nie może przekraczać granicy funkcji.",
@@ -508,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "Moduł {0} już wyeksportował składową o nazwie „{1}”. Zastanów się nad jawnym ponownym eksportem, aby rozstrzygnąć niejednoznaczność.",
"Module_0_has_no_default_export_1192": "Moduł „{0}” nie ma eksportu domyślnego.",
"Module_0_has_no_exported_member_1_2305": "Moduł „{0}” nie ma wyeksportowanej składowej „{1}”.",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "Moduł „{0}” nie ma wyeksportowanego elementu członkowskiego „{1}”. Czy chodziło o „{2}”?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "Moduł „{0}” został ukryty przez deklarację lokalną o takiej samej nazwie.",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "Wynikiem rozpoznania modułu „{0}” jest jednostka niebędąca modułem i nie można zaimportować tego modułu przy użyciu tej konstrukcji.",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Moduł „{0}” używa elementu „export =” i nie może być używany z elementem „export *”.",
@@ -651,6 +661,7 @@
"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.",
"Remove_declaration_for_Colon_0_90004": "Usuń deklarację dla: „{0}”",
"Remove_import_from_0_90005": "Usuń import z „{0}”",
"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.",
@@ -658,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "Raportuj błędy dla nieużywanych elementów lokalnych.",
"Report_errors_on_unused_parameters_6135": "Raportuj błędy dla nieużywanych parametrów.",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "Wymagane parametry typu mogą nie być zgodne z opcjonalnymi parametrami typu.",
"Resolution_for_module_0_was_found_in_cache_6147": "Znaleziono rozwiązanie dla modułu „{0}” w pamięci podręcznej.",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "Znaleziono rozwiązanie dla modułu „{0}” w pamięci podręcznej z lokalizacji „{1}”.",
"Resolving_from_node_modules_folder_6118": "Trwa rozpoznawanie na podstawie folderu node_modules...",
"Resolving_module_0_from_1_6086": "======== Rozpoznawanie modułu „{0}” na podstawie „{1}”. ========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "Rozpoznawanie nazwy modułu „{0}” względem podstawowego adresu URL „{1}” — „{2}”.",
@@ -792,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Deklaracja zmiennej instrukcji „for...in” nie może mieć inicjatora.",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Deklaracja zmiennej instrukcji „for...of” nie może mieć inicjatora.",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Instrukcja „with” nie jest obsługiwana. Wszystkie symbole w bloku „with” będą mieć typ „any”.",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Ta funkcja konstruktora może zostać przekonwertowana na deklarację klasy.",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "Ta składnia wymaga zaimportowanego pomocnika, ale nie można znaleźć modułu „{0}”.",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "Ta składnia wymaga zaimportowanego pomocnika o nazwie „{1}”, ale moduł „{0}” nie ma wyeksportowanej składowej „{1}”.",
"Trailing_comma_not_allowed_1009": "Końcowy przecinek jest niedozwolony.",
@@ -888,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "Lista deklaracji zmiennych nie może być pusta.",
"Version_0_6029": "Wersja {0}",
"Watch_input_files_6005": "Obserwuj pliki wejściowe.",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "Określa, czy zachować nieaktualne dane wyjściowe konsoli w trybie śledzenia zamiast wyczyścić ekran.",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "Nie można zmienić nazw elementów zdefiniowanych w standardowej bibliotece TypeScript.",
"You_cannot_rename_this_element_8000": "Nie można zmienić nazwy tego elementu.",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "Element „{0}” akceptuje za mało argumentów, aby można go było użyć w tym miejscu jako dekorator. Czy chcesz najpierw go wywołać i zapisać tag „@{0}()”?",
+63 -10
View File
@@ -23,10 +23,12 @@ declare namespace ts.server.protocol {
GeterrForProject = "geterrForProject",
SemanticDiagnosticsSync = "semanticDiagnosticsSync",
SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
SuggestionDiagnosticsSync = "suggestionDiagnosticsSync",
NavBar = "navbar",
Navto = "navto",
NavTree = "navtree",
NavTreeFull = "navtree-full",
/** @deprecated */
Occurrences = "occurrences",
DocumentHighlights = "documentHighlights",
Open = "open",
@@ -44,6 +46,7 @@ declare namespace ts.server.protocol {
OpenExternalProject = "openExternalProject",
OpenExternalProjects = "openExternalProjects",
CloseExternalProject = "closeExternalProject",
GetOutliningSpans = "getOutliningSpans",
TodoComments = "todoComments",
Indentation = "indentation",
DocCommentTemplate = "docCommentTemplate",
@@ -202,6 +205,31 @@ declare namespace ts.server.protocol {
*/
onlyMultiLine: boolean;
}
/**
* Request to obtain outlining spans in file.
*/
interface OutliningSpansRequest extends FileRequest {
command: CommandTypes.GetOutliningSpans;
}
interface OutliningSpan {
/** The span of the document to actually collapse. */
textSpan: TextSpan;
/** The span of the document to display when the user hovers over the collapsed span. */
hintSpan: TextSpan;
/** The text to display in the editor for the collapsed region. */
bannerText: string;
/**
* Whether or not this region should be automatically collapsed when
* the 'Collapse to Definitions' command is invoked.
*/
autoCollapse: boolean;
}
/**
* Response to OutliningSpansRequest request.
*/
interface OutliningSpansResponse extends Response {
body?: OutliningSpan[];
}
/**
* A request to get indentation for a location in file
*/
@@ -627,6 +655,7 @@ declare namespace ts.server.protocol {
openingBrace: string;
}
/**
* @deprecated
* Get occurrences request; value of command field is
* "occurrences". Return response giving spans that are relevant
* in the file at a given line and column.
@@ -634,6 +663,7 @@ declare namespace ts.server.protocol {
interface OccurrencesRequest extends FileLocationRequest {
command: CommandTypes.Occurrences;
}
/** @deprecated */
interface OccurrencesResponseItem extends FileSpan {
/**
* True if the occurrence is a write location, false otherwise.
@@ -644,6 +674,7 @@ declare namespace ts.server.protocol {
*/
isInString?: true;
}
/** @deprecated */
interface OccurrencesResponse extends Response {
body?: OccurrencesResponseItem[];
}
@@ -906,6 +937,7 @@ declare namespace ts.server.protocol {
* The format options to use during formatting and other code editing features.
*/
formatOptions?: FormatCodeSettings;
preferences?: UserPreferences;
/**
* The host's additional supported .js file extensions
*/
@@ -1240,6 +1272,8 @@ declare namespace ts.server.protocol {
* This may be omitted to indicate that the code fix can't be applied in a group.
*/
fixId?: {};
/** Should be present if and only if 'fixId' is. */
fixAllDescription?: string;
}
/**
* Format and format on key response message.
@@ -1278,15 +1312,13 @@ declare namespace ts.server.protocol {
*/
prefix?: string;
/**
* If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
* This affects lone identifier completions but not completions on the right hand side of `obj.`.
* @deprecated Use UserPreferences.includeCompletionsForModuleExports
*/
includeExternalModuleExports: boolean;
includeExternalModuleExports?: boolean;
/**
* If enabled, the completion list will include completions with invalid identifier names.
* For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
* @deprecated Use UserPreferences.includeCompletionsWithInsertText
*/
includeInsertTextCompletions: boolean;
includeInsertTextCompletions?: boolean;
}
/**
* Completions request; value of command field is "completions".
@@ -1541,6 +1573,12 @@ declare namespace ts.server.protocol {
interface SemanticDiagnosticsSyncResponse extends Response {
body?: Diagnostic[] | DiagnosticWithLinePosition[];
}
interface SuggestionDiagnosticsSyncRequest extends FileRequest {
command: CommandTypes.SuggestionDiagnosticsSync;
arguments: SuggestionDiagnosticsSyncRequestArgs;
}
type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs;
type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse;
/**
* Synchronous request for syntactic diagnostics of one file.
*/
@@ -1637,7 +1675,7 @@ declare namespace ts.server.protocol {
*/
text: string;
/**
* The category of the diagnostic message, e.g. "error" vs. "warning"
* The category of the diagnostic message, e.g. "error", "warning", or "suggestion".
*/
category: string;
/**
@@ -1665,8 +1703,9 @@ declare namespace ts.server.protocol {
*/
diagnostics: Diagnostic[];
}
type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag";
/**
* Event message for "syntaxDiag" and "semanticDiag" event types.
* Event message for DiagnosticEventKind event types.
* These events provide syntactic and semantic errors for a file.
*/
interface DiagnosticEvent extends Event {
@@ -2036,6 +2075,20 @@ declare namespace ts.server.protocol {
placeOpenBraceOnNewLineForControlBlocks?: boolean;
insertSpaceBeforeTypeAnnotation?: boolean;
}
interface UserPreferences {
readonly quotePreference?: "double" | "single";
/**
* If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
* This affects lone identifier completions but not completions on the right hand side of `obj.`.
*/
readonly includeCompletionsForModuleExports?: boolean;
/**
* If enabled, the completion list will include completions with invalid identifier names.
* For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
*/
readonly includeCompletionsWithInsertText?: boolean;
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
}
interface CompilerOptions {
allowJs?: boolean;
allowSyntheticDefaultImports?: boolean;
@@ -2162,7 +2215,7 @@ declare namespace ts.server.protocol {
none = "none",
definition = "definition",
reference = "reference",
writtenReference = "writtenReference",
writtenReference = "writtenReference"
}
enum ScriptElementKind {
@@ -2230,7 +2283,7 @@ declare namespace ts.server.protocol {
/**
* <JsxTagName attribute1 attribute2={0} />
*/
jsxAttribute = "JSX attribute",
jsxAttribute = "JSX attribute"
}
interface TypeAcquisition {
+15 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "Acessadores devem ser abstratos ou não abstratos.",
"Add_0_to_existing_import_declaration_from_1_90015": "Adicionar '{0}' à declaração de importação existente de \"{1}\"",
"Add_async_modifier_to_containing_function_90029": "Adicione o modificador assíncrono que contém a função",
"Add_definite_assignment_assertion_to_property_0_95020": "Adicionar a asserção de atribuição definitiva à propriedade '{0}'",
"Add_index_signature_for_property_0_90017": "Adicionar assinatura de índice para a propriedade '{0}'",
"Add_initializer_to_property_0_95019": "Adicionar inicializador à propriedade '{0}'",
"Add_missing_super_call_90001": "Adicionar chamada 'super()' ausente",
"Add_this_to_unresolved_variable_90008": "Adicionar 'this.' a uma variável não resolvida",
"Add_undefined_type_to_property_0_95018": "Adicionar tipo 'indefinido' à propriedade '{0}'",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Adicionar um arquivo tsconfig.json ajudará a organizar projetos que contêm arquivos TypeScript e JavaScript. Saiba mais em https://aka.ms/tsconfig.",
"Additional_Checks_6176": "Verificações Adicionais",
"Advanced_Options_6178": "Opções Avançadas",
"All_declarations_of_0_must_have_identical_modifiers_2687": "Todas as declarações de '{0}' devem ter modificadores idênticos.",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "Todas as declarações de '{0}' devem ter parâmetros de tipo idênticos.",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "Todas as declarações de um método abstrato devem ser consecutivas.",
"All_imports_in_import_declaration_are_unused_6192": "Nenhuma das importações na declaração de importação está sendo utilizada.",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "Permita importações padrão de módulos sem exportação padrão. Isso não afeta a emissão do código, apenas a verificação de digitação.",
"Allow_javascript_files_to_be_compiled_6102": "Permita que arquivos javascript sejam compilados.",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "As enumerações de constante de ambiente não são permitidas quando o sinalizador '--isolatedModules' é fornecido.",
@@ -324,6 +328,7 @@
"Enables_experimental_support_for_ES7_decorators_6065": "Habilita o suporte experimental para decoradores ES7.",
"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066": "Habilita o suporte experimental para a emissão de tipo de metadados para decoradores.",
"Enum_0_used_before_its_declaration_2450": "A enumeração '{0}' usada antes de sua declaração.",
"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567": "As declarações de enum apenas podem se mescladas com namespaces ou com outras declarações de enum.",
"Enum_declarations_must_all_be_const_or_non_const_2473": "Declarações de enumeração devem ser const ou não const.",
"Enum_member_expected_1132": "Membro de enumeração esperado.",
"Enum_member_must_have_initializer_1061": "O membro de enumeração deve ter um inicializador.",
@@ -378,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "O arquivo '{0}' não está em 'rootDir' '{1}'. Espera-se que 'rootDir' contenha todos os arquivos de origem.",
"File_0_not_found_6053": "Arquivo '{0}' não encontrado.",
"File_change_detected_Starting_incremental_compilation_6032": "Alteração do arquivo detectada. Iniciando compilação incremental...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "O arquivo é um módulo CommonJS; ele pode ser convertido em um módulo ES6.",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "O nome do arquivo '{0}' difere do nome de arquivo '{1}' já incluído somente em maiúsculas e minúsculas.",
"File_name_0_has_a_1_extension_stripping_it_6132": "O nome do arquivo '{0}' tem uma extensão '{1}' remoção.",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "A especificação de arquivo não pode conter um diretório pai ('..') que aparece após um curinga de diretório recursivo ('**'): '{0}'.",
@@ -424,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "A declaração da importação está em conflito com a declaração local '{0}'.",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "As declarações de importação em um namespace não podem fazer referência a um módulo.",
"Import_emit_helpers_from_tslib_6139": "Importar auxiliares de emissão de 'tslib'.",
"Import_may_be_converted_to_a_default_import_80003": "A importação pode ser convertida em uma importação padrão.",
"Import_name_cannot_be_0_2438": "O nome da importação não pode ser '{0}'.",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "A declaração de importação e exportação em uma declaração de módulo de ambiente não pode fazer referência ao módulo por meio do nome do módulo relativo.",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "Importações não são permitidas em acréscimos de módulo. Considere movê-las para o módulo externo delimitador.",
@@ -462,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "O '@{0}' do JSDoc não está anexado a uma classe.",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "JSDoc '...' só pode aparecer no último parâmetro de uma assinatura.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "A marcação do JSDoc \"@param\" tem o nome \"{0}\", mas não há nenhum parâmetro com esse nome.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "A marca '@param' do JSDoc tem o nome '{0}', mas não há nenhum parâmetro com esse nome. Ela corresponderia a 'argumentos' se tivesse um tipo de matriz.",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "A marca JSDoc \"@typedef\" deve ter uma anotação de tipo ou ser seguida pelas marcas \"@property\" or \"@member\".",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Os tipos de JSDoc podem ser usados somente dentro dos comentários de documentação.",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "Tipos JSDoc podem ser movidos para tipos TypeScript.",
"JSX_attribute_expected_17003": "Atributo JSX esperado.",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Os atributos JSX só devem ser atribuídos a 'expressões' que não estejam vazias.",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "O elemento JSX '{0}' não tem uma marcação de fechamento correspondente.",
@@ -476,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "Elementos JSX não podem ter vários atributos com o mesmo nome.",
"JSX_expressions_must_have_one_parent_element_2657": "As expressões JSX devem ter um elemento pai.",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "O fragmento JSX não tem uma marcação de fechamento correspondente.",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "O fragmento de JSX não é compatível ao se utilizar um pragma de fábrica JSX embutido",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "O fragmento JSX não é compatível com o uso de --jsxFactory",
"JSX_spread_child_must_be_an_array_type_2609": "O filho do espalhamento JSX deve ser um tipo de matriz.",
"Jump_target_cannot_cross_function_boundary_1107": "O destino do salto não pode ultrapassar o limite de função.",
@@ -507,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "O módulo {0} já exportou um membro denominado '{1}'. Considere reexportar explicitamente para resolver a ambiguidade.",
"Module_0_has_no_default_export_1192": "O módulo '{0}' não tem padrão de exportação.",
"Module_0_has_no_exported_member_1_2305": "O módulo '{0}' não tem nenhum membro exportado '{1}'.",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "O módulo '{0}' não tem nenhum membro exportado '{1}'. Você quis dizer '{2}'?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "O módulo '{0}' está oculto por uma declaração de local com o mesmo nome.",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "O módulo '{0}' resolve para uma entidade sem módulo e não pode ser importado usando este constructo.",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "O módulo '{0}' usa 'export =' e não pode ser usado com 'export *'.",
@@ -650,6 +661,7 @@
"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.",
"Remove_declaration_for_Colon_0_90004": "Remover declaração para: '{0}'",
"Remove_import_from_0_90005": "Remover importação do '{0}'",
"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.",
@@ -657,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "Relatar erros nos locais não utilizados.",
"Report_errors_on_unused_parameters_6135": "Relatar erros nos parâmetros não utilizados.",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "Os parâmetros de tipo necessários podem não seguir os parâmetros de tipo opcionais.",
"Resolution_for_module_0_was_found_in_cache_6147": "A resolução para o modo '{0}' foi encontrada no cache.",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "A resolução para o módulo '{0}' foi encontrada no cache do local '{1}'.",
"Resolving_from_node_modules_folder_6118": "Resolvendo na pasta node_modules...",
"Resolving_module_0_from_1_6086": "======== Resolvendo módulo '{0}' de '{1}'. ========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "Resolvendo nome de módulo '{0}' relativo à URL base '{1}' - '{2}'.",
@@ -791,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "A declaração de variável de uma instrução 'for...in' não pode ter um inicializador.",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "A declaração de variável de uma instrução 'for...of' não pode ter um inicializador.",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "A instrução \"with\" não tem suporte. Todos os símbolos em um bloco \"with\" terão o tipo \"any\".",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Esta função de construtor pode ser convertida em uma declaração de classe.",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "Essa sintaxe requer um auxiliar importado, mas o módulo '{0}' não pode ser encontrado.",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "Essa sintaxe requer um auxiliar importado chamado '{1}', mas o módulo '{0}' não tem nenhum membro exportado '{1}'.",
"Trailing_comma_not_allowed_1009": "Vírgula à direita não permitida.",
@@ -887,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "A lista de declaração de variável não pode estar vazia.",
"Version_0_6029": "Versão {0}",
"Watch_input_files_6005": "Observe os arquivos de entrada.",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "Se se deve manter a saída de console desatualizada no modo de inspeção, em vez de limpar a tela.",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "Não é possível renomear elementos que são definidos na biblioteca TypeScript padrão.",
"You_cannot_rename_this_element_8000": "Você não pode renomear este elemento.",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "'{0}' aceita muito poucos argumentos para serem usados como um decorador aqui. Você quis dizer para chamá-lo primeiro e gravar '@{0}()'?",
+15 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "Методы доступа должны быть абстрактными или неабстрактными.",
"Add_0_to_existing_import_declaration_from_1_90015": "Добавьте \"{0}\" в существующее объявление импорта из \"{1}\"",
"Add_async_modifier_to_containing_function_90029": "Добавьте модификатор async в содержащую функцию",
"Add_definite_assignment_assertion_to_property_0_95020": "Добавить утверждение определенного присваивания к свойству \"{0}\"",
"Add_index_signature_for_property_0_90017": "Добавьте сигнатуру индекса для свойства \"{0}\"",
"Add_initializer_to_property_0_95019": "Добавить инициализатор к свойству \"{0}\"",
"Add_missing_super_call_90001": "Добавьте отсутствующий вызов \"super()\"",
"Add_this_to_unresolved_variable_90008": "Добавьте \"this.\" к неразрешенной переменной",
"Add_undefined_type_to_property_0_95018": "Добавить тип \"undefined\" к свойству \"{0}\"",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Добавление файла tsconfig.json поможет организовать проекты, содержащие файлы TypeScript и JavaScript. Дополнительные сведения: https://aka.ms/tsconfig.",
"Additional_Checks_6176": "Дополнительные проверки",
"Advanced_Options_6178": "Дополнительные параметры",
"All_declarations_of_0_must_have_identical_modifiers_2687": "Все объявления \"{0}\" должны иметь одинаковые модификаторы.",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "Все объявления \"{0}\" должны иметь одинаковые параметры типа.",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "Все объявления абстрактных методов должны быть последовательными.",
"All_imports_in_import_declaration_are_unused_6192": "Ни один из импортов в объявлении импорта не используется.",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "Разрешить импорт по умолчанию из модулей без экспорта по умолчанию. Это не повлияет на выведение кода — только на проверку типов.",
"Allow_javascript_files_to_be_compiled_6102": "Разрешить компиляцию файлов javascript.",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "Перечисление внешних констант не разрешено, если задан флаг \"--isolatedModules\".",
@@ -324,6 +328,7 @@
"Enables_experimental_support_for_ES7_decorators_6065": "Включает экспериментальную поддержку для декораторов ES7.",
"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066": "Включает экспериментальную поддержку для создания метаданных типа для декораторов.",
"Enum_0_used_before_its_declaration_2450": "Перечисление \"{0}\" использовано прежде, чем объявлено.",
"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567": "Объявления перечислений можно объединять только с пространствами имен или другими объявлениями перечислений.",
"Enum_declarations_must_all_be_const_or_non_const_2473": "Все объявления перечислений должны иметь значение const или отличное от const.",
"Enum_member_expected_1132": "Ожидался элемент перечисления.",
"Enum_member_must_have_initializer_1061": "У элемента перечисления должен быть инициализатор.",
@@ -378,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "Файл \"{0}\" отсутствует в \"rootDir\" \"{1}\". Все исходные файлы должны находиться в каталоге \"rootDir\".",
"File_0_not_found_6053": "Файл \"{0}\" не найден.",
"File_change_detected_Starting_incremental_compilation_6032": "Обнаружено изменение в файле. Запускается инкрементная компиляция...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "Файл является модулем CommonJS; его можно преобразовать в модуль ES6.",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "Файл с именем \"{0}\" отличается от уже включенного файла с именем \"{1}\" только регистром.",
"File_name_0_has_a_1_extension_stripping_it_6132": "У имени файла \"{0}\" есть расширение \"{1}\"; расширение удаляется.",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "Спецификация файла не может содержать родительский каталог (\"..\"), который указывается после рекурсивного подстановочного знака каталога (\"**\"): \"{0}\".",
@@ -424,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "Объявление импорта конфликтует с локальным объявлением \"{0}\".",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "Объявления импорта в пространстве имен не могут иметь ссылки на модуль.",
"Import_emit_helpers_from_tslib_6139": "Импорт вспомогательных объектов, участвующих в порождении, из \"tslib\".",
"Import_may_be_converted_to_a_default_import_80003": "Импорт можно преобразовать в импорт по умолчанию.",
"Import_name_cannot_be_0_2438": "Имя импорта не может иметь значение \"{0}\".",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "Объявление импорта или экспорта во объявлении окружающего модуля не может иметь ссылки на модуль через относительное имя модуля.",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "Операции импорта запрещены в улучшениях модуля. Попробуйте переместить их в содержащий внешний модуль.",
@@ -462,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "Параметр \"@{0}\" JSDoc не связан с классом.",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "JSDoc \"...\" может использоваться только в последнем параметре сигнатуры.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "У тега \"@param\" JSDoc есть имя \"{0}\", но параметр с таким именем отсутствует.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "Тег \"@param\" JSDoc имеет имя \"{0}\", но параметра с таким именем не существует. Он совпадал бы с \"arguments\", если бы у него был указан тип массива.",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "У тега \"@typedef\" JSDoc должна быть аннотация типа, или после него должны стоять теги \"@property\" или \"@member\".",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "Типы JSDoc можно использовать только в комментариях в документации.",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "Типы JSDoc могут быть преобразованы в типы TypeScript.",
"JSX_attribute_expected_17003": "Ожидался атрибут JSX.",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "Атрибутам JSX должно назначаться только непустое \"expression\".",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "Элемент JSX \"{0}\" не содержит соответствующий закрывающий тег.",
@@ -476,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "Элементы JSX не могут иметь несколько атрибутов с одним именем.",
"JSX_expressions_must_have_one_parent_element_2657": "Выражения JSX должны иметь один родительский элемент.",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "Фрагмент JSX не имеет соответствующего закрывающего тега.",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "Фрагмент JSX не поддерживается при использовании встроенной директивы pragma фабрики JSX.",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "Фрагмент JSX не поддерживается при использовании --jsxFactory",
"JSX_spread_child_must_be_an_array_type_2609": "Дочерний объект расширения JSX должен иметь тип массива.",
"Jump_target_cannot_cross_function_boundary_1107": "Целевой объект перехода не может находиться за границей функции.",
@@ -507,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "Модуль {0} уже экспортировал элемент с именем \"{1}\". Попробуйте явно повторно экспортировать его, чтобы устранить неоднозначность.",
"Module_0_has_no_default_export_1192": "У модуля \"{0}\" нет экспорта по умолчанию.",
"Module_0_has_no_exported_member_1_2305": "Модуль \"{0}\" не имеет экспортированного элемента \"{1}\".",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "В модуле \"{0}\" нет экспортированного элемента \"{1}\". Вы имели в виду \"{2}\"?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "Модуль \"{0}\" скрыт локальным объявлением с таким же именем.",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "Модуль \"{0}\" разрешается в немодульную сущность и не может быть импортирован с помощью этой конструкции.",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "Модуль \"{0}\" использует параметр \"export =\" и не может использоваться с параметром \"export *\".",
@@ -650,6 +661,7 @@
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "Вызвать ошибку в выражениях this с неявным типом any.",
"Redirect_output_structure_to_the_directory_6006": "Перенаправить структуру вывода в каталог.",
"Remove_declaration_for_Colon_0_90004": "Удалите объявление: \"{0}\"",
"Remove_import_from_0_90005": "Удалить импорт из \"{0}\"",
"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.",
@@ -657,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "Сообщать об ошибках в неиспользованных локальных переменных.",
"Report_errors_on_unused_parameters_6135": "Сообщать об ошибках в неиспользованных параметрах.",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "Обязательные параметры типа не могут следовать за необязательными параметрами типа.",
"Resolution_for_module_0_was_found_in_cache_6147": "Разрешение для модуля \"{0}\" найдено в кэше.",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "Разрешение для модуля \"{0}\" найдено в кэше из расположения \"{1}\".",
"Resolving_from_node_modules_folder_6118": "Идет разрешение из папки node_modules...",
"Resolving_module_0_from_1_6086": "======== Идет разрешение модуля \"{0}\" из \"{1}\". ========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "Идет разрешение имени модуля \"{0}\" относительного к базовому URL-адресу \"{1}\" — \"{2}\".",
@@ -791,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Объявление переменной оператора for...in не может содержать инициализатор.",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Объявление переменной оператора for...of не может содержать инициализатор.",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Оператор with не поддерживается. Все символы в блоке with получат тип any.",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Эту функцию конструктора можно преобразовать в объявление класса.",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "Для этого синтаксиса требуется импортированный вспомогательный объект, но найти модуль \"{0}\" не удается.",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "Для этого синтаксиса требуется импортированный вспомогательный объект \"{1}\", но у модуля \"{0}\" нет экспортированного элемента \"{1}\".",
"Trailing_comma_not_allowed_1009": "Завершающая запятая запрещена.",
@@ -887,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "Список объявлений переменной не может быть пустым.",
"Version_0_6029": "Версия {0}",
"Watch_input_files_6005": "Просмотр входных файлов.",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "Сохранять ли устаревшие выходные данные консоли в режиме просмотра вместо очистки экрана.",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "Невозможно переименовать элементы, определенные в стандартной библиотеке TypeScript.",
"You_cannot_rename_this_element_8000": "Этот элемент переименовать нельзя.",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "\"{0}\" принимает слишком мало аргументов для использования в качестве декоратора. Вы хотели сначала вызвать его и записать \"@{0}()\"?",
+15 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "İki erişimci de soyut veya soyut olmayan olmalıdır.",
"Add_0_to_existing_import_declaration_from_1_90015": "'{0}' öğesini \"{1}\" konumundaki mevcut içeri aktarma bildirimine ekle",
"Add_async_modifier_to_containing_function_90029": "İçeren işleve zaman uyumsuz değiştirici ekle",
"Add_definite_assignment_assertion_to_property_0_95020": "'{0}' özelliğine belirli atama onayı ekle",
"Add_index_signature_for_property_0_90017": "'{0}' özelliği için dizin imzası ekle",
"Add_initializer_to_property_0_95019": "'{0}' özelliğine başlatıcı ekle",
"Add_missing_super_call_90001": "Eksik 'super()' çağrısını ekle",
"Add_this_to_unresolved_variable_90008": "Çözümlenmemiş değişkene 'this.' ekle",
"Add_undefined_type_to_property_0_95018": "'{0}' özelliğine 'undefined' türünü ekle",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "Bir tsconfig.json dosyası eklemek, hem TypeScript hem de JavaScript dosyaları içeren projeleri düzenlemenize yardımcı olur. Daha fazla bilgi edinmek için bkz. https://aka.ms/tsconfig.",
"Additional_Checks_6176": "Ek Denetimler",
"Advanced_Options_6178": "Gelişmiş Seçenekler",
"All_declarations_of_0_must_have_identical_modifiers_2687": "Tüm '{0}' bildirimleri aynı değiştiricilere sahip olmalıdır.",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "Tüm '{0}' bildirimleri özdeş tür parametrelerine sahip olmalıdır.",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "Soyut metoda ait tüm bildirimler ardışık olmalıdır.",
"All_imports_in_import_declaration_are_unused_6192": "İçeri aktarma bildirimindeki hiçbir içeri aktarma kullanılmadı.",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "Varsayılan dışarı aktarmaya sahip olmayan modüllerde varsayılan içeri aktarmalara izin verin. Bu işlem kod üretimini etkilemez, yalnızca tür denetimini etkiler.",
"Allow_javascript_files_to_be_compiled_6102": "Javascript dosyalarının derlenmesine izin ver.",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "'--isolatedModules' bayrağı sağlandığında çevresel const sabit listesi değerlerine izin verilmez.",
@@ -324,6 +328,7 @@
"Enables_experimental_support_for_ES7_decorators_6065": "ES7 dekoratörleri için deneysel desteği etkinleştirir.",
"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066": "Dekoratörlere tür meta verisi gönderme için deneysel desteği etkinleştirir.",
"Enum_0_used_before_its_declaration_2450": "'{0}' sabit listesi, bildiriminden önce kullanıldı.",
"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567": "Enum bildirimleri yalnızca ad alanı veya diğer enum bildirimleri ile birleştirilebilir.",
"Enum_declarations_must_all_be_const_or_non_const_2473": "Sabit listesi bildirimlerinin tümü const veya const olmayan değerler olmalıdır.",
"Enum_member_expected_1132": "Sabit listesi üyesi bekleniyor.",
"Enum_member_must_have_initializer_1061": "Sabit listesi üyesi bir başlatıcıya sahip olmalıdır.",
@@ -378,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "'{0}' dosyası, 'rootDir' '{1}' dizininde değil. 'rootDir' dizininin tüm kaynak dosyalarını içermesi bekleniyor.",
"File_0_not_found_6053": "'{0}' dosyası bulunamadı.",
"File_change_detected_Starting_incremental_compilation_6032": "Dosya değişikliği algılandı. Artımlı derleme başlatılıyor...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "Bir CommonJS modülü olan dosya, ES6 modülüne dönüştürülebilir.",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "'{0}' dosya adının, zaten eklenmiş olan '{1}' dosya adından tek farkı, büyük/küçük harf kullanımı.",
"File_name_0_has_a_1_extension_stripping_it_6132": "'{0}' dosya adında '{1}' uzantısı var; uzantı ayrılıyor.",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "Dosya belirtimi, özyinelemeli dizin joker karakterinden ('**') sonra görünen bir üst dizin ('..') içeremez: '{0}'.",
@@ -424,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "İçeri aktarma bildirimi, yerel '{0}' bildirimiyle çakışıyor.",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "Ad alanındaki içeri aktarma bildirimleri bir modüle başvuramaz.",
"Import_emit_helpers_from_tslib_6139": "'Tslib'den yayma yardımcılarını içeri aktar.",
"Import_may_be_converted_to_a_default_import_80003": "İçeri aktarma varsayılan bir içeri aktarmaya dönüştürülebilir.",
"Import_name_cannot_be_0_2438": "İçeri aktarma adı '{0}' olamaz.",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "Çevresel modül bildirimindeki içeri veya dışarı aktarma bildirimi, göreli modül adı aracılığıyla modüle başvuramaz.",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "Modül genişletmelerinde içeri aktarmalara izin verilmez. Bunları, kapsayan dış modüle taşımanız önerilir.",
@@ -462,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "JSDoc '@{0}' bir sınıfa eklenmemiş.",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "JSDoc '...' yalnızca bir imzanın son parametresi içinde görünebilir.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "JSDoc '@param' etiketinin adı '{0}' ancak bu ada sahip bir parametre yok.",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "JSDoc '@param' etiketi '{0}' adına sahip ancak bu ada sahip bir parametre yok. Bir dizi türü olsaydı 'arguments' ile eşleşirdi.",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc '@typedef' etiketi bir tür ek açıklamasına sahip olmalıdır veya sonrasında '@property' ya da '@member' etiketlerinden biri gelmelidir.",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc türleri yalnızca belge açıklamalarının içinde kullanılabilir.",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "JSDoc türleri TypeScript türlerine taşınabilir.",
"JSX_attribute_expected_17003": "JSX özniteliği bekleniyor.",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "JSX özniteliklerine yalnızca boş olmayan 'expression' ifadesi atanabilir.",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "'{0}' adlı JSX öğesine karşılık gelen bir kapatma etiketi yok.",
@@ -476,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "JSX öğeleri aynı ada sahip birden fazla özniteliğe sahip olamaz.",
"JSX_expressions_must_have_one_parent_element_2657": "JSX ifadelerinin bir üst öğesi olmalıdır.",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "JSX parçasına karşılık gelen bir kapatma etiketi yok.",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "Satır içi JSX fabrika pragma'sı kullanılırken JSX parçası desteklenmez",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "JSX parçası --jsxFactory kullanılırken desteklenmiyor",
"JSX_spread_child_must_be_an_array_type_2609": "JSX yayılma alt öğesi, bir dizi türü olmalıdır.",
"Jump_target_cannot_cross_function_boundary_1107": "Atlama hedefi işlev sınırını geçemez.",
@@ -507,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "{0} modülü, '{1}' adlı bir üyeyi zaten dışarı aktardı. Belirsizliği çözmek için açık olarak yeniden dışarı aktarmayı göz önünde bulundurun.",
"Module_0_has_no_default_export_1192": "'{0}' modülü için varsayılan dışarı aktarma yok.",
"Module_0_has_no_exported_member_1_2305": "'{0}' modülü, dışarı aktarılan '{1}' üyesine sahip değil.",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "'{0}' modülünün dışa aktarılan '{1}' adlı bir üyesi yok. Şunu mu demek istediniz: '{2}'?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "'{0}' modülü, aynı ada sahip bir yerel bildirim tarafından gizleniyor.",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "'{0}' modülü, modül olmayan bir varlığa çözümleniyor ve bu oluşturma ile içeri aktarılamaz.",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "'{0}' modülü 'export =' kullanıyor ve 'export *' ile birlikte kullanılamaz.",
@@ -650,6 +661,7 @@
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "Örtük olarak 'any' türü içeren 'this' ifadelerinde hata tetikle.",
"Redirect_output_structure_to_the_directory_6006": "Çıktı yapısını dizine yeniden yönlendir.",
"Remove_declaration_for_Colon_0_90004": "'{0}' bildirimini kaldır",
"Remove_import_from_0_90005": "'{0}' öğesinden içeri aktarmayı kaldır",
"Replace_import_with_0_95015": "İçeri aktarma işlemini '{0}' ile değiştirin.",
"Report_error_when_not_all_code_paths_in_function_return_a_value_6075": "İşlevdeki tüm kod yolları bir değer döndürmediğinde hata bildir.",
"Report_errors_for_fallthrough_cases_in_switch_statement_6076": "switch deyiminde sonraki ifadelere geçiş ile ilgili hataları bildir.",
@@ -657,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "Kullanılmayan yerel öğelerdeki hataları bildirin.",
"Report_errors_on_unused_parameters_6135": "Kullanılmayan parametrelerdeki hataları bildirin.",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "Gerekli tür parametreleri, isteğe bağlı tür parametrelerini takip edemez.",
"Resolution_for_module_0_was_found_in_cache_6147": "'{0}' modülüne yönelik çözüm önbellekte bulundu.",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "'{0}' modülünün çözümü '{1}' konumundaki önbellekte bulundu.",
"Resolving_from_node_modules_folder_6118": "Node_modules klasöründen çözümleniyor...",
"Resolving_module_0_from_1_6086": "======== '{0}' modülü '{1}' öğesinden çözümleniyor. ========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "'{0}' modül adı, '{1}' - '{2}' temel url'sine göre çözümleniyor.",
@@ -791,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' deyiminin değişken bildirimi bir başlatıcıya sahip olamaz.",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' deyiminin değişken bildirimi bir başlatıcıya sahip olamaz.",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "'with' ifadesi desteklenmiyor. 'with' bloklarındaki tüm simgeler 'any' türüne sahip olacaktır.",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Bu oluşturucu işlevi bir sınıf bildirimine dönüştürülebilir.",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "Bu söz dizimi, içeri aktarılan bir yardımcı gerektiriyor ancak '{0}' modülü bulunamıyor.",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "Bu söz dizimi, '{1}' adlı içeri aktarılan yardımcıyı gerektiriyor ancak '{0}' modülünde dışarı aktarılan '{1}' üyesi yok.",
"Trailing_comma_not_allowed_1009": "Sona eklenen virgüle izin verilmez.",
@@ -887,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "Değişken bildirim listesi boş olamaz.",
"Version_0_6029": "Sürüm {0}",
"Watch_input_files_6005": "Giriş dosyalarını izleyin.",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "Eski konsol çıktısının ekrandan kaldırılmak yerine izleme modunda tutulup tutulmayacağı.",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "Standart TypeScript kitaplığında tanımlanmış öğeleri yeniden adlandıramazsınız.",
"You_cannot_rename_this_element_8000": "Bu öğeyi yeniden adlandıramazsınız.",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "'{0}' burada dekoratör olarak kullanılmak için çok az bağımsız değişken kabul ediyor. Önce çağırıp '@{0}()' yazmak mı istediniz?",
+4820 -3735
View File
File diff suppressed because it is too large Load Diff
+7651 -6479
View File
File diff suppressed because it is too large Load Diff
+394 -316
View File
File diff suppressed because it is too large Load Diff
+8480 -7030
View File
File diff suppressed because it is too large Load Diff
+149 -138
View File
@@ -59,7 +59,8 @@ declare namespace ts {
pos: number;
end: number;
}
type JsDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.Unknown;
type JsDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.Unknown;
type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
enum SyntaxKind {
Unknown = 0,
EndOfFileToken = 1,
@@ -389,7 +390,7 @@ declare namespace ts {
FirstJSDocNode = 274,
LastJSDocNode = 292,
FirstJSDocTagNode = 284,
LastJSDocTagNode = 292,
LastJSDocTagNode = 292
}
enum NodeFlags {
None = 0,
@@ -417,7 +418,7 @@ declare namespace ts {
ReachabilityCheckFlags = 384,
ReachabilityAndEmitFlags = 1408,
ContextFlags = 6387712,
TypeExcludesFlags = 20480,
TypeExcludesFlags = 20480
}
enum ModifierFlags {
None = 0,
@@ -438,6 +439,7 @@ declare namespace ts {
NonPublicAccessibilityModifier = 24,
TypeScriptModifier = 2270,
ExportDefault = 513,
All = 3071
}
enum JsxFlags {
None = 0,
@@ -445,7 +447,7 @@ declare namespace ts {
IntrinsicNamedElement = 1,
/** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
IntrinsicIndexedElement = 2,
IntrinsicElement = 3,
IntrinsicElement = 3
}
interface Node extends TextRange {
kind: SyntaxKind;
@@ -643,8 +645,9 @@ declare namespace ts {
questionToken?: QuestionToken;
body?: Block | Expression;
}
type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | FunctionExpression | ArrowFunction;
type FunctionLike = FunctionLikeDeclaration | FunctionTypeNode | ConstructorTypeNode | IndexSignatureDeclaration | MethodSignature | ConstructSignatureDeclaration | CallSignatureDeclaration | JSDocFunctionType;
type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction;
/** @deprecated Use SignatureDeclaration */
type FunctionLike = SignatureDeclaration;
interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement {
kind: SyntaxKind.FunctionDeclaration;
name?: Identifier;
@@ -652,7 +655,7 @@ declare namespace ts {
}
interface MethodSignature extends SignatureDeclarationBase, TypeElement {
kind: SyntaxKind.MethodSignature;
parent?: ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
parent?: ObjectTypeDeclaration;
name: PropertyName;
}
interface MethodDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
@@ -686,7 +689,7 @@ declare namespace ts {
type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;
interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement {
kind: SyntaxKind.IndexSignature;
parent?: ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
parent?: ObjectTypeDeclaration;
}
interface TypeNode extends Node {
_typeNodeBrand: any;
@@ -1078,11 +1081,13 @@ declare namespace ts {
kind: SyntaxKind.JsxOpeningElement;
parent?: JsxElement;
tagName: JsxTagNameExpression;
typeArguments?: NodeArray<TypeNode>;
attributes: JsxAttributes;
}
interface JsxSelfClosingElement extends PrimaryExpression {
kind: SyntaxKind.JsxSelfClosingElement;
tagName: JsxTagNameExpression;
typeArguments?: NodeArray<TypeNode>;
attributes: JsxAttributes;
}
interface JsxFragment extends PrimaryExpression {
@@ -1261,6 +1266,7 @@ declare namespace ts {
variableDeclaration?: VariableDeclaration;
block: Block;
}
type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag;
interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer {
kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression;
@@ -1553,7 +1559,7 @@ declare namespace ts {
PreFinally = 2048,
AfterFinally = 4096,
Label = 12,
Condition = 96,
Condition = 96
}
interface FlowLock {
locked?: boolean;
@@ -1725,7 +1731,7 @@ declare namespace ts {
enum ExitStatus {
Success = 0,
DiagnosticsPresent_OutputsSkipped = 1,
DiagnosticsPresent_OutputsGenerated = 2,
DiagnosticsPresent_OutputsGenerated = 2
}
interface EmitResult {
emitSkipped: boolean;
@@ -1750,9 +1756,9 @@ declare namespace ts {
/** Note that the resulting nodes cannot be checked. */
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode;
/** Note that the resulting nodes cannot be checked. */
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): SignatureDeclaration & {
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): (SignatureDeclaration & {
typeArguments?: NodeArray<TypeNode>;
} | undefined;
}) | undefined;
/** Note that the resulting nodes cannot be checked. */
indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration | undefined;
/** Note that the resulting nodes cannot be checked. */
@@ -1801,7 +1807,7 @@ declare namespace ts {
*/
getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature;
getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined;
isImplementationOfOverload(node: FunctionLike): boolean | undefined;
isImplementationOfOverload(node: SignatureDeclaration): boolean | undefined;
isUndefinedSymbol(symbol: Symbol): boolean;
isArgumentsSymbol(symbol: Symbol): boolean;
isUnknownSymbol(symbol: Symbol): boolean;
@@ -1811,7 +1817,7 @@ declare namespace ts {
getAliasedSymbol(symbol: Symbol): Symbol;
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
getAllAttributesTypeFromJsxOpeningLikeElement(elementNode: JsxOpeningLikeElement): Type | undefined;
getJsxIntrinsicTagNames(): Symbol[];
getJsxIntrinsicTagNamesAt(location: Node): Symbol[];
isOptionalParameter(node: ParameterDeclaration): boolean;
getAmbientModules(): Symbol[];
tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
@@ -1847,7 +1853,7 @@ declare namespace ts {
InObjectTypeLiteral = 4194304,
InTypeAlias = 8388608,
InInitialEntityName = 16777216,
InReverseMappedType = 33554432,
InReverseMappedType = 33554432
}
enum TypeFormatFlags {
None = 0,
@@ -1870,14 +1876,14 @@ declare namespace ts {
InFirstTypeArgument = 4194304,
InTypeAlias = 8388608,
/** @deprecated */ WriteOwnNameForAnyLike = 0,
NodeBuilderFlagsMask = 9469291,
NodeBuilderFlagsMask = 9469291
}
enum SymbolFormatFlags {
None = 0,
WriteTypeParametersOrArguments = 1,
UseOnlyExternalAliasing = 2,
AllowAnyNodeKind = 4,
UseAliasDefinedOutsideCurrentScope = 8,
UseAliasDefinedOutsideCurrentScope = 8
}
/**
* @deprecated
@@ -1914,7 +1920,7 @@ declare namespace ts {
}
enum TypePredicateKind {
This = 0,
Identifier = 1,
Identifier = 1
}
interface TypePredicateBase {
kind: TypePredicateKind;
@@ -1960,28 +1966,28 @@ declare namespace ts {
JSContainer = 67108864,
Enum = 384,
Variable = 3,
Value = 107455,
Type = 793064,
Value = 67216319,
Type = 67901928,
Namespace = 1920,
Module = 1536,
Accessor = 98304,
FunctionScopedVariableExcludes = 107454,
BlockScopedVariableExcludes = 107455,
ParameterExcludes = 107455,
FunctionScopedVariableExcludes = 67216318,
BlockScopedVariableExcludes = 67216319,
ParameterExcludes = 67216319,
PropertyExcludes = 0,
EnumMemberExcludes = 900095,
FunctionExcludes = 106927,
ClassExcludes = 899519,
InterfaceExcludes = 792968,
RegularEnumExcludes = 899327,
ConstEnumExcludes = 899967,
ValueModuleExcludes = 106639,
EnumMemberExcludes = 68008959,
FunctionExcludes = 67215791,
ClassExcludes = 68008383,
InterfaceExcludes = 67901832,
RegularEnumExcludes = 68008191,
ConstEnumExcludes = 68008831,
ValueModuleExcludes = 67215503,
NamespaceModuleExcludes = 0,
MethodExcludes = 99263,
GetAccessorExcludes = 41919,
SetAccessorExcludes = 74687,
TypeParameterExcludes = 530920,
TypeAliasExcludes = 793064,
MethodExcludes = 67208127,
GetAccessorExcludes = 67150783,
SetAccessorExcludes = 67183551,
TypeParameterExcludes = 67639784,
TypeAliasExcludes = 67901928,
AliasExcludes = 2097152,
ModuleMember = 2623475,
ExportHasLocal = 944,
@@ -1989,7 +1995,7 @@ declare namespace ts {
HasMembers = 6240,
BlockScoped = 418,
PropertyOrAccessor = 98308,
ClassMember = 106500,
ClassMember = 106500
}
interface Symbol {
flags: SymbolFlags;
@@ -2016,7 +2022,7 @@ declare namespace ts {
Computed = "__computed",
Resolving = "__resolving__",
ExportEquals = "export=",
Default = "default",
Default = "default"
}
/**
* This represents a string whose leading underscore have been escaped by adding extra leading underscores.
@@ -2091,7 +2097,7 @@ declare namespace ts {
Instantiable = 7897088,
StructuredOrInstantiable = 8355840,
Narrowable = 142575359,
NotUnionOrUnit = 134283777,
NotUnionOrUnit = 134283777
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
@@ -2132,7 +2138,7 @@ declare namespace ts {
ReverseMapped = 2048,
JsxAttributes = 4096,
MarkerType = 8192,
ClassOrInterface = 3,
ClassOrInterface = 3
}
interface ObjectType extends Type {
objectFlags: ObjectFlags;
@@ -2189,31 +2195,46 @@ declare namespace ts {
indexType: Type;
constraint?: Type;
}
type TypeVariable = TypeParameter | IndexedAccessType;
interface IndexType extends InstantiableType {
type: InstantiableType | UnionOrIntersectionType;
}
interface ConditionalType extends InstantiableType {
interface ConditionalRoot {
node: ConditionalTypeNode;
checkType: Type;
extendsType: Type;
trueType: Type;
falseType: Type;
isDistributive: boolean;
inferTypeParameters: TypeParameter[];
outerTypeParameters?: TypeParameter[];
instantiations?: Map<Type>;
aliasSymbol: Symbol;
aliasTypeArguments: Type[];
}
interface ConditionalType extends InstantiableType {
root: ConditionalRoot;
checkType: Type;
extendsType: Type;
resolvedTrueType?: Type;
resolvedFalseType?: Type;
}
interface SubstitutionType extends InstantiableType {
typeParameter: TypeParameter;
typeVariable: TypeVariable;
substitute: Type;
}
enum SignatureKind {
Call = 0,
Construct = 1,
Construct = 1
}
interface Signature {
declaration: SignatureDeclaration;
declaration?: SignatureDeclaration;
typeParameters?: TypeParameter[];
parameters: Symbol[];
}
enum IndexKind {
String = 0,
Number = 1,
Number = 1
}
interface IndexInfo {
type: Type;
@@ -2222,41 +2243,14 @@ declare namespace ts {
}
enum InferencePriority {
NakedTypeVariable = 1,
MappedType = 2,
ReturnType = 4,
NoConstraints = 8,
AlwaysStrict = 16,
HomomorphicMappedType = 2,
MappedTypeConstraint = 4,
ReturnType = 8,
LiteralKeyof = 16,
NoConstraints = 32,
AlwaysStrict = 64,
PriorityImpliesCombination = 28
}
interface InferenceInfo {
typeParameter: TypeParameter;
candidates: Type[];
contraCandidates: Type[];
inferredType: Type;
priority: InferencePriority;
topLevel: boolean;
isFixed: boolean;
}
enum InferenceFlags {
None = 0,
InferUnionTypes = 1,
NoDefault = 2,
AnyDefault = 4,
}
/**
* Ternary values are defined such that
* x & y is False if either x or y is False.
* x & y is Maybe if either x or y is Maybe, but neither x or y is False.
* x & y is True if both x and y are True.
* x | y is False if both x and y are False.
* x | y is Maybe if either x or y is Maybe, but neither x or y is True.
* x | y is True if either x or y is True.
*/
enum Ternary {
False = 0,
Maybe = 1,
True = -1,
}
type TypeComparer = (s: Type, t: Type, reportErrors?: boolean) => Ternary;
interface JsFileExtensionInfo {
extension: string;
isMixedContent: boolean;
@@ -2292,11 +2286,12 @@ declare namespace ts {
enum DiagnosticCategory {
Warning = 0,
Error = 1,
Message = 2,
Suggestion = 2,
Message = 3
}
enum ModuleResolutionKind {
Classic = 1,
NodeJs = 2,
NodeJs = 2
}
interface PluginImport {
name: string;
@@ -2312,6 +2307,7 @@ declare namespace ts {
charset?: string;
checkJs?: boolean;
declaration?: boolean;
declarationMap?: boolean;
emitDeclarationOnly?: boolean;
declarationDir?: string;
disableSizeLimit?: boolean;
@@ -2390,17 +2386,17 @@ declare namespace ts {
UMD = 3,
System = 4,
ES2015 = 5,
ESNext = 6,
ESNext = 6
}
enum JsxEmit {
None = 0,
Preserve = 1,
React = 2,
ReactNative = 3,
ReactNative = 3
}
enum NewLineKind {
CarriageReturnLineFeed = 0,
LineFeed = 1,
LineFeed = 1
}
interface LineAndCharacter {
/** 0-based. */
@@ -2414,7 +2410,7 @@ declare namespace ts {
TS = 3,
TSX = 4,
External = 5,
JSON = 6,
JSON = 6
}
enum ScriptTarget {
ES3 = 0,
@@ -2424,11 +2420,11 @@ declare namespace ts {
ES2017 = 4,
ES2018 = 5,
ESNext = 6,
Latest = 6,
Latest = 6
}
enum LanguageVariant {
Standard = 0,
JSX = 1,
JSX = 1
}
/** Either a parsed command line or a parsed tsconfig.json */
interface ParsedCommandLine {
@@ -2442,7 +2438,7 @@ declare namespace ts {
}
enum WatchDirectoryFlags {
None = 0,
Recursive = 1,
Recursive = 1
}
interface ExpandResult {
fileNames: string[];
@@ -2512,7 +2508,7 @@ declare namespace ts {
Dts = ".d.ts",
Js = ".js",
Jsx = ".jsx",
Json = ".json",
Json = ".json"
}
interface ResolvedModuleWithFailedLookupLocations {
readonly resolvedModule: ResolvedModuleFull | undefined;
@@ -2582,7 +2578,7 @@ declare namespace ts {
NoHoisting = 2097152,
HasEndOfDeclarationMarker = 4194304,
Iterator = 8388608,
NoAsciiEscaping = 16777216,
NoAsciiEscaping = 16777216
}
interface EmitHelper {
readonly name: string;
@@ -2595,7 +2591,7 @@ declare namespace ts {
Expression = 1,
IdentifierName = 2,
MappedTypeParameter = 3,
Unspecified = 4,
Unspecified = 4
}
interface TransformationContext {
/** Gets the compiler options supplied to the transformer. */
@@ -2762,6 +2758,7 @@ declare namespace ts {
newLine?: NewLineKind;
omitTrailingSemicolon?: boolean;
}
/** @deprecated See comment on SymbolWriter */
interface SymbolTracker {
trackSymbol?(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
reportInaccessibleThisError?(): void;
@@ -2812,9 +2809,9 @@ declare namespace ts {
SingleElement = 524288,
Modifiers = 131328,
HeritageClauses = 256,
SingleLineTypeLiteralMembers = 448,
MultiLineTypeLiteralMembers = 65,
TupleTypeElements = 336,
SingleLineTypeLiteralMembers = 384,
MultiLineTypeLiteralMembers = 16449,
TupleTypeElements = 272,
UnionTypeConstituents = 260,
IntersectionTypeConstituents = 264,
ObjectBindingPatternElements = 262576,
@@ -2830,12 +2827,12 @@ declare namespace ts {
VariableDeclarationList = 272,
SingleLineFunctionBodyStatements = 384,
MultiLineFunctionBodyStatements = 1,
ClassHeritageClauses = 256,
ClassHeritageClauses = 0,
ClassMembers = 65,
InterfaceMembers = 65,
EnumMembers = 81,
CaseBlockClauses = 65,
NamedImportsOrExportsElements = 432,
NamedImportsOrExportsElements = 262576,
JsxElementOrFragmentChildren = 131072,
JsxElementAttributes = 131328,
CaseOrDefaultClauseStatements = 81985,
@@ -2845,11 +2842,11 @@ declare namespace ts {
TypeArguments = 26896,
TypeParameters = 26896,
Parameters = 1296,
IndexSignatureParameters = 4432,
IndexSignatureParameters = 4432
}
}
declare namespace ts {
const versionMajorMinor = "2.8";
const versionMajorMinor = "2.9";
/** The version of the TypeScript compiler release */
const version: string;
}
@@ -2863,15 +2860,10 @@ declare namespace ts {
enum FileWatcherEventKind {
Created = 0,
Changed = 1,
Deleted = 2,
Deleted = 2
}
type FileWatcherCallback = (fileName: string, eventKind: FileWatcherEventKind) => void;
type DirectoryWatcherCallback = (fileName: string) => void;
interface WatchedFile {
fileName: string;
callback: FileWatcherCallback;
mtime?: Date;
}
interface System {
args: string[];
newLine: string;
@@ -2906,6 +2898,8 @@ declare namespace ts {
setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
clearTimeout?(timeoutId: any): void;
clearScreen?(): void;
base64decode?(input: string): string;
base64encode?(input: string): string;
}
interface FileWatcher {
close(): void;
@@ -2932,8 +2926,8 @@ declare namespace ts {
reScanTemplateToken(): SyntaxKind;
scanJsxIdentifier(): SyntaxKind;
scanJsxAttributeValue(): SyntaxKind;
reScanJsxToken(): SyntaxKind;
scanJsxToken(): SyntaxKind;
reScanJsxToken(): JsxTokenSyntaxKind;
scanJsxToken(): JsxTokenSyntaxKind;
scanJSDocToken(): JsDocSyntaxKind;
scan(): SyntaxKind;
getText(): string;
@@ -2947,7 +2941,7 @@ declare namespace ts {
tryScan<T>(callback: () => T): T;
}
function tokenToString(t: SyntaxKind): string | undefined;
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number;
function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter;
function isWhiteSpaceLike(ch: number): boolean;
/** Does not include line breaks. For that, see isWhiteSpaceLike. */
@@ -3066,7 +3060,7 @@ declare namespace ts {
* Does not return tags for binding patterns, because JSDoc matches
* parameters by name and binding patterns do not have a name.
*/
function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray<JSDocParameterTag> | undefined;
function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray<JSDocParameterTag>;
/**
* Return true if the node has JSDoc parameter tags.
*
@@ -3104,9 +3098,9 @@ declare namespace ts {
*/
function getJSDocReturnType(node: Node): TypeNode | undefined;
/** Get all JSDoc tags related to a node, including those on parent nodes. */
function getJSDocTags(node: Node): ReadonlyArray<JSDocTag> | undefined;
function getJSDocTags(node: Node): ReadonlyArray<JSDocTag>;
/** Gets all JSDoc tags of a specified kind, or undefined if not present. */
function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): ReadonlyArray<JSDocTag> | undefined;
function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): ReadonlyArray<JSDocTag>;
}
declare namespace ts {
function isNumericLiteral(node: Node): node is NumericLiteral;
@@ -3260,6 +3254,7 @@ declare namespace ts {
function isJSDocVariadicType(node: Node): node is JSDocVariadicType;
function isJSDoc(node: Node): node is JSDoc;
function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
function isJSDocClassTag(node: Node): node is JSDocClassTag;
function isJSDocParameterTag(node: Node): node is JSDocParameterTag;
function isJSDocReturnTag(node: Node): node is JSDocReturnTag;
function isJSDocTypeTag(node: Node): node is JSDocTypeTag;
@@ -3283,7 +3278,7 @@ declare namespace ts {
function isEntityName(node: Node): node is EntityName;
function isPropertyName(node: Node): node is PropertyName;
function isBindingName(node: Node): node is BindingName;
function isFunctionLike(node: Node): node is FunctionLike;
function isFunctionLike(node: Node): node is SignatureDeclaration;
function isClassElement(node: Node): node is ClassElement;
function isClassLike(node: Node): node is ClassLikeDeclaration;
function isAccessor(node: Node): node is AccessorDeclaration;
@@ -3301,7 +3296,8 @@ declare namespace ts {
function isCallOrNewExpression(node: Node): node is CallExpression | NewExpression;
function isTemplateLiteral(node: Node): node is TemplateLiteral;
function isAssertionExpression(node: Node): node is AssertionExpression;
function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement;
function isIterationStatement(node: Node, lookInLabeledStatements: false): node is IterationStatement;
function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement | LabeledStatement;
function isJsxOpeningLikeElement(node: Node): node is JsxOpeningLikeElement;
function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause;
/** True if node is of a kind that may contain comment text. */
@@ -3398,6 +3394,8 @@ declare namespace ts {
function createLoopVariable(): Identifier;
/** Create a unique name based on the supplied text. */
function createUniqueName(text: string): Identifier;
/** Create a unique name based on the supplied text. */
function createOptimisticUniqueName(text: string): Identifier;
/** Create a unique name generated for a node. */
function getGeneratedNameForNode(node: Node): Identifier;
function createToken<TKind extends SyntaxKind>(token: TKind): Token<TKind>;
@@ -3406,6 +3404,8 @@ declare namespace ts {
function createNull(): NullLiteral & Token<SyntaxKind.NullKeyword>;
function createTrue(): BooleanLiteral & Token<SyntaxKind.TrueKeyword>;
function createFalse(): BooleanLiteral & Token<SyntaxKind.FalseKeyword>;
function createModifier<T extends Modifier["kind"]>(kind: T): Token<T>;
function createModifiersFromModifierFlags(flags: ModifierFlags): Modifier[];
function createQualifiedName(left: EntityName, right: string | Identifier): QualifiedName;
function updateQualifiedName(node: QualifiedName, left: EntityName, right: Identifier): QualifiedName;
function createComputedPropertyName(expression: Expression): ComputedPropertyName;
@@ -3606,7 +3606,7 @@ declare namespace ts {
function updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration;
function createImportEqualsDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
function updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
function createImportDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, importClause: ImportClause | undefined, moduleSpecifier?: Expression): ImportDeclaration;
function createImportDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
function updateImportDeclaration(node: ImportDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression | undefined): ImportDeclaration;
function createImportClause(name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
function updateImportClause(node: ImportClause, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
@@ -3628,10 +3628,10 @@ declare namespace ts {
function updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference;
function createJsxElement(openingElement: JsxOpeningElement, children: ReadonlyArray<JsxChild>, closingElement: JsxClosingElement): JsxElement;
function updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: ReadonlyArray<JsxChild>, closingElement: JsxClosingElement): JsxElement;
function createJsxSelfClosingElement(tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxSelfClosingElement;
function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxSelfClosingElement;
function createJsxOpeningElement(tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement;
function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement;
function createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxSelfClosingElement;
function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxSelfClosingElement;
function createJsxOpeningElement(tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxOpeningElement;
function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxOpeningElement;
function createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement;
function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement;
function createJsxFragment(openingFragment: JsxOpeningFragment, children: ReadonlyArray<JsxChild>, closingFragment: JsxClosingFragment): JsxFragment;
@@ -3660,7 +3660,7 @@ declare namespace ts {
function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment;
function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember;
function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember;
function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>): SourceFile;
function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"]): SourceFile;
/**
* Creates a shallow, memberwise clone of a node for mutation.
*/
@@ -4332,10 +4332,17 @@ declare namespace ts {
isKnownTypesPackageName?(name: string): boolean;
installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
}
interface UserPreferences {
readonly quotePreference?: "double" | "single";
readonly includeCompletionsForModuleExports?: boolean;
readonly includeCompletionsWithInsertText?: boolean;
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
}
interface LanguageService {
cleanupSemanticCache(): void;
getSyntacticDiagnostics(fileName: string): Diagnostic[];
getSemanticDiagnostics(fileName: string): Diagnostic[];
getSuggestionDiagnostics(fileName: string): Diagnostic[];
getCompilerOptionsDiagnostics(): Diagnostic[];
/**
* @deprecated Use getEncodedSyntacticClassifications instead.
@@ -4348,7 +4355,7 @@ declare namespace ts {
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
getCompletionsAtPosition(fileName: string, position: number, options: GetCompletionsAtPositionOptions | undefined): CompletionInfo;
getCompletionEntryDetails(fileName: string, position: number, name: string, options: FormatCodeOptions | FormatCodeSettings | undefined, source: string | undefined): CompletionEntryDetails;
getCompletionEntryDetails(fileName: string, position: number, name: string, formatOptions: FormatCodeOptions | FormatCodeSettings | undefined, source: string | undefined, preferences: UserPreferences | undefined): CompletionEntryDetails;
getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string | undefined): Symbol;
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan;
@@ -4378,8 +4385,8 @@ declare namespace ts {
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan;
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray<number>, formatOptions: FormatCodeSettings): ReadonlyArray<CodeFixAction>;
getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings): CombinedCodeActions;
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray<number>, formatOptions: FormatCodeSettings, preferences: UserPreferences): ReadonlyArray<CodeFixAction>;
getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, preferences: UserPreferences): CombinedCodeActions;
applyCodeActionCommand(action: CodeActionCommand): Promise<ApplyCodeActionCommandResult>;
applyCodeActionCommand(action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
@@ -4389,9 +4396,9 @@ declare namespace ts {
applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
/** @deprecated `fileName` will be ignored */
applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange): ApplicableRefactorInfo[];
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string): RefactorEditInfo | undefined;
organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings): ReadonlyArray<FileTextChanges>;
getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange, preferences: UserPreferences | undefined): ApplicableRefactorInfo[];
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): ReadonlyArray<FileTextChanges>;
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
getProgram(): Program;
dispose(): void;
@@ -4401,9 +4408,12 @@ declare namespace ts {
fileName: string;
}
type OrganizeImportsScope = CombinedCodeFixScope;
interface GetCompletionsAtPositionOptions {
includeExternalModuleExports: boolean;
includeInsertTextCompletions: boolean;
/** @deprecated Use UserPreferences */
interface GetCompletionsAtPositionOptions extends UserPreferences {
/** @deprecated Use includeCompletionsForModuleExports */
includeExternalModuleExports?: boolean;
/** @deprecated Use includeCompletionsWithInsertText */
includeInsertTextCompletions?: boolean;
}
interface ApplyCodeActionCommandResult {
successMessage: string;
@@ -4484,6 +4494,7 @@ declare namespace ts {
* This may be omitted to indicate that the code fix can't be applied in a group.
*/
fixId?: {};
fixAllDescription?: string;
}
interface CombinedCodeActions {
changes: ReadonlyArray<FileTextChanges>;
@@ -4569,7 +4580,7 @@ declare namespace ts {
none = "none",
definition = "definition",
reference = "reference",
writtenReference = "writtenReference",
writtenReference = "writtenReference"
}
interface HighlightSpan {
fileName?: string;
@@ -4591,7 +4602,7 @@ declare namespace ts {
enum IndentStyle {
None = 0,
Block = 1,
Smart = 2,
Smart = 2
}
interface EditorOptions {
BaseIndentSize?: number;
@@ -4686,7 +4697,7 @@ declare namespace ts {
typeParameterName = 18,
enumMemberName = 19,
functionName = 20,
regularExpressionLiteral = 21,
regularExpressionLiteral = 21
}
interface SymbolDisplayPart {
text: string;
@@ -4746,7 +4757,7 @@ declare namespace ts {
argumentCount: number;
}
interface CompletionInfo {
/** Not true for all glboal completions. This will be true if the enclosing scope matches a few syntax kinds. See `isGlobalCompletionScope`. */
/** Not true for all glboal completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */
isGlobalCompletion: boolean;
isMemberCompletion: boolean;
/**
@@ -4797,7 +4808,7 @@ declare namespace ts {
enum OutputFileType {
JavaScript = 0,
SourceMap = 1,
Declaration = 2,
Declaration = 2
}
enum EndOfLineState {
None = 0,
@@ -4806,7 +4817,7 @@ declare namespace ts {
InDoubleQuoteStringLiteral = 3,
InTemplateHeadOrNoSubstitutionTemplate = 4,
InTemplateMiddleOrTail = 5,
InTemplateSubstitutionPosition = 6,
InTemplateSubstitutionPosition = 6
}
enum TokenClass {
Punctuation = 0,
@@ -4817,7 +4828,7 @@ declare namespace ts {
Identifier = 5,
NumberLiteral = 6,
StringLiteral = 7,
RegExpLiteral = 8,
RegExpLiteral = 8
}
interface ClassificationResult {
finalLexState: EndOfLineState;
@@ -4916,7 +4927,7 @@ declare namespace ts {
/**
* <JsxTagName attribute1 attribute2={0} />
*/
jsxAttribute = "JSX attribute",
jsxAttribute = "JSX attribute"
}
enum ScriptElementKindModifier {
none = "",
@@ -4927,7 +4938,7 @@ declare namespace ts {
ambientModifier = "declare",
staticModifier = "static",
abstractModifier = "abstract",
optionalModifier = "optional",
optionalModifier = "optional"
}
enum ClassificationTypeNames {
comment = "comment",
@@ -4952,7 +4963,7 @@ declare namespace ts {
jsxSelfClosingTagName = "jsx self closing tag name",
jsxAttribute = "jsx attribute",
jsxText = "jsx text",
jsxAttributeStringLiteralValue = "jsx attribute string literal value",
jsxAttributeStringLiteralValue = "jsx attribute string literal value"
}
enum ClassificationType {
comment = 1,
@@ -4978,7 +4989,7 @@ declare namespace ts {
jsxSelfClosingTagName = 21,
jsxAttribute = 22,
jsxText = 23,
jsxAttributeStringLiteralValue = 24,
jsxAttributeStringLiteralValue = 24
}
}
declare namespace ts {
@@ -5072,7 +5083,7 @@ declare namespace ts {
}
declare namespace ts {
/** The version of the language service API */
const servicesVersion = "0.7";
const servicesVersion = "0.8";
function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;
function displayPartsToString(displayParts: SymbolDisplayPart[]): string;
function getDefaultCompilerOptions(): CompilerOptions;
+8306 -6878
View File
File diff suppressed because it is too large Load Diff
+149 -138
View File
@@ -59,7 +59,8 @@ declare namespace ts {
pos: number;
end: number;
}
type JsDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.Unknown;
type JsDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.Unknown;
type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
enum SyntaxKind {
Unknown = 0,
EndOfFileToken = 1,
@@ -389,7 +390,7 @@ declare namespace ts {
FirstJSDocNode = 274,
LastJSDocNode = 292,
FirstJSDocTagNode = 284,
LastJSDocTagNode = 292,
LastJSDocTagNode = 292
}
enum NodeFlags {
None = 0,
@@ -417,7 +418,7 @@ declare namespace ts {
ReachabilityCheckFlags = 384,
ReachabilityAndEmitFlags = 1408,
ContextFlags = 6387712,
TypeExcludesFlags = 20480,
TypeExcludesFlags = 20480
}
enum ModifierFlags {
None = 0,
@@ -438,6 +439,7 @@ declare namespace ts {
NonPublicAccessibilityModifier = 24,
TypeScriptModifier = 2270,
ExportDefault = 513,
All = 3071
}
enum JsxFlags {
None = 0,
@@ -445,7 +447,7 @@ declare namespace ts {
IntrinsicNamedElement = 1,
/** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
IntrinsicIndexedElement = 2,
IntrinsicElement = 3,
IntrinsicElement = 3
}
interface Node extends TextRange {
kind: SyntaxKind;
@@ -643,8 +645,9 @@ declare namespace ts {
questionToken?: QuestionToken;
body?: Block | Expression;
}
type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | FunctionExpression | ArrowFunction;
type FunctionLike = FunctionLikeDeclaration | FunctionTypeNode | ConstructorTypeNode | IndexSignatureDeclaration | MethodSignature | ConstructSignatureDeclaration | CallSignatureDeclaration | JSDocFunctionType;
type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction;
/** @deprecated Use SignatureDeclaration */
type FunctionLike = SignatureDeclaration;
interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement {
kind: SyntaxKind.FunctionDeclaration;
name?: Identifier;
@@ -652,7 +655,7 @@ declare namespace ts {
}
interface MethodSignature extends SignatureDeclarationBase, TypeElement {
kind: SyntaxKind.MethodSignature;
parent?: ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
parent?: ObjectTypeDeclaration;
name: PropertyName;
}
interface MethodDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
@@ -686,7 +689,7 @@ declare namespace ts {
type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;
interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement {
kind: SyntaxKind.IndexSignature;
parent?: ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
parent?: ObjectTypeDeclaration;
}
interface TypeNode extends Node {
_typeNodeBrand: any;
@@ -1078,11 +1081,13 @@ declare namespace ts {
kind: SyntaxKind.JsxOpeningElement;
parent?: JsxElement;
tagName: JsxTagNameExpression;
typeArguments?: NodeArray<TypeNode>;
attributes: JsxAttributes;
}
interface JsxSelfClosingElement extends PrimaryExpression {
kind: SyntaxKind.JsxSelfClosingElement;
tagName: JsxTagNameExpression;
typeArguments?: NodeArray<TypeNode>;
attributes: JsxAttributes;
}
interface JsxFragment extends PrimaryExpression {
@@ -1261,6 +1266,7 @@ declare namespace ts {
variableDeclaration?: VariableDeclaration;
block: Block;
}
type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag;
interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer {
kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression;
@@ -1553,7 +1559,7 @@ declare namespace ts {
PreFinally = 2048,
AfterFinally = 4096,
Label = 12,
Condition = 96,
Condition = 96
}
interface FlowLock {
locked?: boolean;
@@ -1725,7 +1731,7 @@ declare namespace ts {
enum ExitStatus {
Success = 0,
DiagnosticsPresent_OutputsSkipped = 1,
DiagnosticsPresent_OutputsGenerated = 2,
DiagnosticsPresent_OutputsGenerated = 2
}
interface EmitResult {
emitSkipped: boolean;
@@ -1750,9 +1756,9 @@ declare namespace ts {
/** Note that the resulting nodes cannot be checked. */
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode;
/** Note that the resulting nodes cannot be checked. */
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): SignatureDeclaration & {
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): (SignatureDeclaration & {
typeArguments?: NodeArray<TypeNode>;
} | undefined;
}) | undefined;
/** Note that the resulting nodes cannot be checked. */
indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration | undefined;
/** Note that the resulting nodes cannot be checked. */
@@ -1801,7 +1807,7 @@ declare namespace ts {
*/
getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature;
getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined;
isImplementationOfOverload(node: FunctionLike): boolean | undefined;
isImplementationOfOverload(node: SignatureDeclaration): boolean | undefined;
isUndefinedSymbol(symbol: Symbol): boolean;
isArgumentsSymbol(symbol: Symbol): boolean;
isUnknownSymbol(symbol: Symbol): boolean;
@@ -1811,7 +1817,7 @@ declare namespace ts {
getAliasedSymbol(symbol: Symbol): Symbol;
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
getAllAttributesTypeFromJsxOpeningLikeElement(elementNode: JsxOpeningLikeElement): Type | undefined;
getJsxIntrinsicTagNames(): Symbol[];
getJsxIntrinsicTagNamesAt(location: Node): Symbol[];
isOptionalParameter(node: ParameterDeclaration): boolean;
getAmbientModules(): Symbol[];
tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
@@ -1847,7 +1853,7 @@ declare namespace ts {
InObjectTypeLiteral = 4194304,
InTypeAlias = 8388608,
InInitialEntityName = 16777216,
InReverseMappedType = 33554432,
InReverseMappedType = 33554432
}
enum TypeFormatFlags {
None = 0,
@@ -1870,14 +1876,14 @@ declare namespace ts {
InFirstTypeArgument = 4194304,
InTypeAlias = 8388608,
/** @deprecated */ WriteOwnNameForAnyLike = 0,
NodeBuilderFlagsMask = 9469291,
NodeBuilderFlagsMask = 9469291
}
enum SymbolFormatFlags {
None = 0,
WriteTypeParametersOrArguments = 1,
UseOnlyExternalAliasing = 2,
AllowAnyNodeKind = 4,
UseAliasDefinedOutsideCurrentScope = 8,
UseAliasDefinedOutsideCurrentScope = 8
}
/**
* @deprecated
@@ -1914,7 +1920,7 @@ declare namespace ts {
}
enum TypePredicateKind {
This = 0,
Identifier = 1,
Identifier = 1
}
interface TypePredicateBase {
kind: TypePredicateKind;
@@ -1960,28 +1966,28 @@ declare namespace ts {
JSContainer = 67108864,
Enum = 384,
Variable = 3,
Value = 107455,
Type = 793064,
Value = 67216319,
Type = 67901928,
Namespace = 1920,
Module = 1536,
Accessor = 98304,
FunctionScopedVariableExcludes = 107454,
BlockScopedVariableExcludes = 107455,
ParameterExcludes = 107455,
FunctionScopedVariableExcludes = 67216318,
BlockScopedVariableExcludes = 67216319,
ParameterExcludes = 67216319,
PropertyExcludes = 0,
EnumMemberExcludes = 900095,
FunctionExcludes = 106927,
ClassExcludes = 899519,
InterfaceExcludes = 792968,
RegularEnumExcludes = 899327,
ConstEnumExcludes = 899967,
ValueModuleExcludes = 106639,
EnumMemberExcludes = 68008959,
FunctionExcludes = 67215791,
ClassExcludes = 68008383,
InterfaceExcludes = 67901832,
RegularEnumExcludes = 68008191,
ConstEnumExcludes = 68008831,
ValueModuleExcludes = 67215503,
NamespaceModuleExcludes = 0,
MethodExcludes = 99263,
GetAccessorExcludes = 41919,
SetAccessorExcludes = 74687,
TypeParameterExcludes = 530920,
TypeAliasExcludes = 793064,
MethodExcludes = 67208127,
GetAccessorExcludes = 67150783,
SetAccessorExcludes = 67183551,
TypeParameterExcludes = 67639784,
TypeAliasExcludes = 67901928,
AliasExcludes = 2097152,
ModuleMember = 2623475,
ExportHasLocal = 944,
@@ -1989,7 +1995,7 @@ declare namespace ts {
HasMembers = 6240,
BlockScoped = 418,
PropertyOrAccessor = 98308,
ClassMember = 106500,
ClassMember = 106500
}
interface Symbol {
flags: SymbolFlags;
@@ -2016,7 +2022,7 @@ declare namespace ts {
Computed = "__computed",
Resolving = "__resolving__",
ExportEquals = "export=",
Default = "default",
Default = "default"
}
/**
* This represents a string whose leading underscore have been escaped by adding extra leading underscores.
@@ -2091,7 +2097,7 @@ declare namespace ts {
Instantiable = 7897088,
StructuredOrInstantiable = 8355840,
Narrowable = 142575359,
NotUnionOrUnit = 134283777,
NotUnionOrUnit = 134283777
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
@@ -2132,7 +2138,7 @@ declare namespace ts {
ReverseMapped = 2048,
JsxAttributes = 4096,
MarkerType = 8192,
ClassOrInterface = 3,
ClassOrInterface = 3
}
interface ObjectType extends Type {
objectFlags: ObjectFlags;
@@ -2189,31 +2195,46 @@ declare namespace ts {
indexType: Type;
constraint?: Type;
}
type TypeVariable = TypeParameter | IndexedAccessType;
interface IndexType extends InstantiableType {
type: InstantiableType | UnionOrIntersectionType;
}
interface ConditionalType extends InstantiableType {
interface ConditionalRoot {
node: ConditionalTypeNode;
checkType: Type;
extendsType: Type;
trueType: Type;
falseType: Type;
isDistributive: boolean;
inferTypeParameters: TypeParameter[];
outerTypeParameters?: TypeParameter[];
instantiations?: Map<Type>;
aliasSymbol: Symbol;
aliasTypeArguments: Type[];
}
interface ConditionalType extends InstantiableType {
root: ConditionalRoot;
checkType: Type;
extendsType: Type;
resolvedTrueType?: Type;
resolvedFalseType?: Type;
}
interface SubstitutionType extends InstantiableType {
typeParameter: TypeParameter;
typeVariable: TypeVariable;
substitute: Type;
}
enum SignatureKind {
Call = 0,
Construct = 1,
Construct = 1
}
interface Signature {
declaration: SignatureDeclaration;
declaration?: SignatureDeclaration;
typeParameters?: TypeParameter[];
parameters: Symbol[];
}
enum IndexKind {
String = 0,
Number = 1,
Number = 1
}
interface IndexInfo {
type: Type;
@@ -2222,41 +2243,14 @@ declare namespace ts {
}
enum InferencePriority {
NakedTypeVariable = 1,
MappedType = 2,
ReturnType = 4,
NoConstraints = 8,
AlwaysStrict = 16,
HomomorphicMappedType = 2,
MappedTypeConstraint = 4,
ReturnType = 8,
LiteralKeyof = 16,
NoConstraints = 32,
AlwaysStrict = 64,
PriorityImpliesCombination = 28
}
interface InferenceInfo {
typeParameter: TypeParameter;
candidates: Type[];
contraCandidates: Type[];
inferredType: Type;
priority: InferencePriority;
topLevel: boolean;
isFixed: boolean;
}
enum InferenceFlags {
None = 0,
InferUnionTypes = 1,
NoDefault = 2,
AnyDefault = 4,
}
/**
* Ternary values are defined such that
* x & y is False if either x or y is False.
* x & y is Maybe if either x or y is Maybe, but neither x or y is False.
* x & y is True if both x and y are True.
* x | y is False if both x and y are False.
* x | y is Maybe if either x or y is Maybe, but neither x or y is True.
* x | y is True if either x or y is True.
*/
enum Ternary {
False = 0,
Maybe = 1,
True = -1,
}
type TypeComparer = (s: Type, t: Type, reportErrors?: boolean) => Ternary;
interface JsFileExtensionInfo {
extension: string;
isMixedContent: boolean;
@@ -2292,11 +2286,12 @@ declare namespace ts {
enum DiagnosticCategory {
Warning = 0,
Error = 1,
Message = 2,
Suggestion = 2,
Message = 3
}
enum ModuleResolutionKind {
Classic = 1,
NodeJs = 2,
NodeJs = 2
}
interface PluginImport {
name: string;
@@ -2312,6 +2307,7 @@ declare namespace ts {
charset?: string;
checkJs?: boolean;
declaration?: boolean;
declarationMap?: boolean;
emitDeclarationOnly?: boolean;
declarationDir?: string;
disableSizeLimit?: boolean;
@@ -2390,17 +2386,17 @@ declare namespace ts {
UMD = 3,
System = 4,
ES2015 = 5,
ESNext = 6,
ESNext = 6
}
enum JsxEmit {
None = 0,
Preserve = 1,
React = 2,
ReactNative = 3,
ReactNative = 3
}
enum NewLineKind {
CarriageReturnLineFeed = 0,
LineFeed = 1,
LineFeed = 1
}
interface LineAndCharacter {
/** 0-based. */
@@ -2414,7 +2410,7 @@ declare namespace ts {
TS = 3,
TSX = 4,
External = 5,
JSON = 6,
JSON = 6
}
enum ScriptTarget {
ES3 = 0,
@@ -2424,11 +2420,11 @@ declare namespace ts {
ES2017 = 4,
ES2018 = 5,
ESNext = 6,
Latest = 6,
Latest = 6
}
enum LanguageVariant {
Standard = 0,
JSX = 1,
JSX = 1
}
/** Either a parsed command line or a parsed tsconfig.json */
interface ParsedCommandLine {
@@ -2442,7 +2438,7 @@ declare namespace ts {
}
enum WatchDirectoryFlags {
None = 0,
Recursive = 1,
Recursive = 1
}
interface ExpandResult {
fileNames: string[];
@@ -2512,7 +2508,7 @@ declare namespace ts {
Dts = ".d.ts",
Js = ".js",
Jsx = ".jsx",
Json = ".json",
Json = ".json"
}
interface ResolvedModuleWithFailedLookupLocations {
readonly resolvedModule: ResolvedModuleFull | undefined;
@@ -2582,7 +2578,7 @@ declare namespace ts {
NoHoisting = 2097152,
HasEndOfDeclarationMarker = 4194304,
Iterator = 8388608,
NoAsciiEscaping = 16777216,
NoAsciiEscaping = 16777216
}
interface EmitHelper {
readonly name: string;
@@ -2595,7 +2591,7 @@ declare namespace ts {
Expression = 1,
IdentifierName = 2,
MappedTypeParameter = 3,
Unspecified = 4,
Unspecified = 4
}
interface TransformationContext {
/** Gets the compiler options supplied to the transformer. */
@@ -2762,6 +2758,7 @@ declare namespace ts {
newLine?: NewLineKind;
omitTrailingSemicolon?: boolean;
}
/** @deprecated See comment on SymbolWriter */
interface SymbolTracker {
trackSymbol?(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
reportInaccessibleThisError?(): void;
@@ -2812,9 +2809,9 @@ declare namespace ts {
SingleElement = 524288,
Modifiers = 131328,
HeritageClauses = 256,
SingleLineTypeLiteralMembers = 448,
MultiLineTypeLiteralMembers = 65,
TupleTypeElements = 336,
SingleLineTypeLiteralMembers = 384,
MultiLineTypeLiteralMembers = 16449,
TupleTypeElements = 272,
UnionTypeConstituents = 260,
IntersectionTypeConstituents = 264,
ObjectBindingPatternElements = 262576,
@@ -2830,12 +2827,12 @@ declare namespace ts {
VariableDeclarationList = 272,
SingleLineFunctionBodyStatements = 384,
MultiLineFunctionBodyStatements = 1,
ClassHeritageClauses = 256,
ClassHeritageClauses = 0,
ClassMembers = 65,
InterfaceMembers = 65,
EnumMembers = 81,
CaseBlockClauses = 65,
NamedImportsOrExportsElements = 432,
NamedImportsOrExportsElements = 262576,
JsxElementOrFragmentChildren = 131072,
JsxElementAttributes = 131328,
CaseOrDefaultClauseStatements = 81985,
@@ -2845,11 +2842,11 @@ declare namespace ts {
TypeArguments = 26896,
TypeParameters = 26896,
Parameters = 1296,
IndexSignatureParameters = 4432,
IndexSignatureParameters = 4432
}
}
declare namespace ts {
const versionMajorMinor = "2.8";
const versionMajorMinor = "2.9";
/** The version of the TypeScript compiler release */
const version: string;
}
@@ -2863,15 +2860,10 @@ declare namespace ts {
enum FileWatcherEventKind {
Created = 0,
Changed = 1,
Deleted = 2,
Deleted = 2
}
type FileWatcherCallback = (fileName: string, eventKind: FileWatcherEventKind) => void;
type DirectoryWatcherCallback = (fileName: string) => void;
interface WatchedFile {
fileName: string;
callback: FileWatcherCallback;
mtime?: Date;
}
interface System {
args: string[];
newLine: string;
@@ -2906,6 +2898,8 @@ declare namespace ts {
setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
clearTimeout?(timeoutId: any): void;
clearScreen?(): void;
base64decode?(input: string): string;
base64encode?(input: string): string;
}
interface FileWatcher {
close(): void;
@@ -2932,8 +2926,8 @@ declare namespace ts {
reScanTemplateToken(): SyntaxKind;
scanJsxIdentifier(): SyntaxKind;
scanJsxAttributeValue(): SyntaxKind;
reScanJsxToken(): SyntaxKind;
scanJsxToken(): SyntaxKind;
reScanJsxToken(): JsxTokenSyntaxKind;
scanJsxToken(): JsxTokenSyntaxKind;
scanJSDocToken(): JsDocSyntaxKind;
scan(): SyntaxKind;
getText(): string;
@@ -2947,7 +2941,7 @@ declare namespace ts {
tryScan<T>(callback: () => T): T;
}
function tokenToString(t: SyntaxKind): string | undefined;
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number;
function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter;
function isWhiteSpaceLike(ch: number): boolean;
/** Does not include line breaks. For that, see isWhiteSpaceLike. */
@@ -3066,7 +3060,7 @@ declare namespace ts {
* Does not return tags for binding patterns, because JSDoc matches
* parameters by name and binding patterns do not have a name.
*/
function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray<JSDocParameterTag> | undefined;
function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray<JSDocParameterTag>;
/**
* Return true if the node has JSDoc parameter tags.
*
@@ -3104,9 +3098,9 @@ declare namespace ts {
*/
function getJSDocReturnType(node: Node): TypeNode | undefined;
/** Get all JSDoc tags related to a node, including those on parent nodes. */
function getJSDocTags(node: Node): ReadonlyArray<JSDocTag> | undefined;
function getJSDocTags(node: Node): ReadonlyArray<JSDocTag>;
/** Gets all JSDoc tags of a specified kind, or undefined if not present. */
function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): ReadonlyArray<JSDocTag> | undefined;
function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): ReadonlyArray<JSDocTag>;
}
declare namespace ts {
function isNumericLiteral(node: Node): node is NumericLiteral;
@@ -3260,6 +3254,7 @@ declare namespace ts {
function isJSDocVariadicType(node: Node): node is JSDocVariadicType;
function isJSDoc(node: Node): node is JSDoc;
function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
function isJSDocClassTag(node: Node): node is JSDocClassTag;
function isJSDocParameterTag(node: Node): node is JSDocParameterTag;
function isJSDocReturnTag(node: Node): node is JSDocReturnTag;
function isJSDocTypeTag(node: Node): node is JSDocTypeTag;
@@ -3283,7 +3278,7 @@ declare namespace ts {
function isEntityName(node: Node): node is EntityName;
function isPropertyName(node: Node): node is PropertyName;
function isBindingName(node: Node): node is BindingName;
function isFunctionLike(node: Node): node is FunctionLike;
function isFunctionLike(node: Node): node is SignatureDeclaration;
function isClassElement(node: Node): node is ClassElement;
function isClassLike(node: Node): node is ClassLikeDeclaration;
function isAccessor(node: Node): node is AccessorDeclaration;
@@ -3301,7 +3296,8 @@ declare namespace ts {
function isCallOrNewExpression(node: Node): node is CallExpression | NewExpression;
function isTemplateLiteral(node: Node): node is TemplateLiteral;
function isAssertionExpression(node: Node): node is AssertionExpression;
function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement;
function isIterationStatement(node: Node, lookInLabeledStatements: false): node is IterationStatement;
function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement | LabeledStatement;
function isJsxOpeningLikeElement(node: Node): node is JsxOpeningLikeElement;
function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause;
/** True if node is of a kind that may contain comment text. */
@@ -3398,6 +3394,8 @@ declare namespace ts {
function createLoopVariable(): Identifier;
/** Create a unique name based on the supplied text. */
function createUniqueName(text: string): Identifier;
/** Create a unique name based on the supplied text. */
function createOptimisticUniqueName(text: string): Identifier;
/** Create a unique name generated for a node. */
function getGeneratedNameForNode(node: Node): Identifier;
function createToken<TKind extends SyntaxKind>(token: TKind): Token<TKind>;
@@ -3406,6 +3404,8 @@ declare namespace ts {
function createNull(): NullLiteral & Token<SyntaxKind.NullKeyword>;
function createTrue(): BooleanLiteral & Token<SyntaxKind.TrueKeyword>;
function createFalse(): BooleanLiteral & Token<SyntaxKind.FalseKeyword>;
function createModifier<T extends Modifier["kind"]>(kind: T): Token<T>;
function createModifiersFromModifierFlags(flags: ModifierFlags): Modifier[];
function createQualifiedName(left: EntityName, right: string | Identifier): QualifiedName;
function updateQualifiedName(node: QualifiedName, left: EntityName, right: Identifier): QualifiedName;
function createComputedPropertyName(expression: Expression): ComputedPropertyName;
@@ -3606,7 +3606,7 @@ declare namespace ts {
function updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration;
function createImportEqualsDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
function updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
function createImportDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, importClause: ImportClause | undefined, moduleSpecifier?: Expression): ImportDeclaration;
function createImportDeclaration(decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
function updateImportDeclaration(node: ImportDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression | undefined): ImportDeclaration;
function createImportClause(name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
function updateImportClause(node: ImportClause, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
@@ -3628,10 +3628,10 @@ declare namespace ts {
function updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference;
function createJsxElement(openingElement: JsxOpeningElement, children: ReadonlyArray<JsxChild>, closingElement: JsxClosingElement): JsxElement;
function updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: ReadonlyArray<JsxChild>, closingElement: JsxClosingElement): JsxElement;
function createJsxSelfClosingElement(tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxSelfClosingElement;
function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxSelfClosingElement;
function createJsxOpeningElement(tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement;
function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement;
function createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxSelfClosingElement;
function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxSelfClosingElement;
function createJsxOpeningElement(tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxOpeningElement;
function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes): JsxOpeningElement;
function createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement;
function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement;
function createJsxFragment(openingFragment: JsxOpeningFragment, children: ReadonlyArray<JsxChild>, closingFragment: JsxClosingFragment): JsxFragment;
@@ -3660,7 +3660,7 @@ declare namespace ts {
function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment;
function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember;
function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember;
function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>): SourceFile;
function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"]): SourceFile;
/**
* Creates a shallow, memberwise clone of a node for mutation.
*/
@@ -4332,10 +4332,17 @@ declare namespace ts {
isKnownTypesPackageName?(name: string): boolean;
installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
}
interface UserPreferences {
readonly quotePreference?: "double" | "single";
readonly includeCompletionsForModuleExports?: boolean;
readonly includeCompletionsWithInsertText?: boolean;
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
}
interface LanguageService {
cleanupSemanticCache(): void;
getSyntacticDiagnostics(fileName: string): Diagnostic[];
getSemanticDiagnostics(fileName: string): Diagnostic[];
getSuggestionDiagnostics(fileName: string): Diagnostic[];
getCompilerOptionsDiagnostics(): Diagnostic[];
/**
* @deprecated Use getEncodedSyntacticClassifications instead.
@@ -4348,7 +4355,7 @@ declare namespace ts {
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
getCompletionsAtPosition(fileName: string, position: number, options: GetCompletionsAtPositionOptions | undefined): CompletionInfo;
getCompletionEntryDetails(fileName: string, position: number, name: string, options: FormatCodeOptions | FormatCodeSettings | undefined, source: string | undefined): CompletionEntryDetails;
getCompletionEntryDetails(fileName: string, position: number, name: string, formatOptions: FormatCodeOptions | FormatCodeSettings | undefined, source: string | undefined, preferences: UserPreferences | undefined): CompletionEntryDetails;
getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string | undefined): Symbol;
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan;
@@ -4378,8 +4385,8 @@ declare namespace ts {
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan;
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray<number>, formatOptions: FormatCodeSettings): ReadonlyArray<CodeFixAction>;
getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings): CombinedCodeActions;
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: ReadonlyArray<number>, formatOptions: FormatCodeSettings, preferences: UserPreferences): ReadonlyArray<CodeFixAction>;
getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, preferences: UserPreferences): CombinedCodeActions;
applyCodeActionCommand(action: CodeActionCommand): Promise<ApplyCodeActionCommandResult>;
applyCodeActionCommand(action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
@@ -4389,9 +4396,9 @@ declare namespace ts {
applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
/** @deprecated `fileName` will be ignored */
applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange): ApplicableRefactorInfo[];
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string): RefactorEditInfo | undefined;
organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings): ReadonlyArray<FileTextChanges>;
getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange, preferences: UserPreferences | undefined): ApplicableRefactorInfo[];
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): ReadonlyArray<FileTextChanges>;
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
getProgram(): Program;
dispose(): void;
@@ -4401,9 +4408,12 @@ declare namespace ts {
fileName: string;
}
type OrganizeImportsScope = CombinedCodeFixScope;
interface GetCompletionsAtPositionOptions {
includeExternalModuleExports: boolean;
includeInsertTextCompletions: boolean;
/** @deprecated Use UserPreferences */
interface GetCompletionsAtPositionOptions extends UserPreferences {
/** @deprecated Use includeCompletionsForModuleExports */
includeExternalModuleExports?: boolean;
/** @deprecated Use includeCompletionsWithInsertText */
includeInsertTextCompletions?: boolean;
}
interface ApplyCodeActionCommandResult {
successMessage: string;
@@ -4484,6 +4494,7 @@ declare namespace ts {
* This may be omitted to indicate that the code fix can't be applied in a group.
*/
fixId?: {};
fixAllDescription?: string;
}
interface CombinedCodeActions {
changes: ReadonlyArray<FileTextChanges>;
@@ -4569,7 +4580,7 @@ declare namespace ts {
none = "none",
definition = "definition",
reference = "reference",
writtenReference = "writtenReference",
writtenReference = "writtenReference"
}
interface HighlightSpan {
fileName?: string;
@@ -4591,7 +4602,7 @@ declare namespace ts {
enum IndentStyle {
None = 0,
Block = 1,
Smart = 2,
Smart = 2
}
interface EditorOptions {
BaseIndentSize?: number;
@@ -4686,7 +4697,7 @@ declare namespace ts {
typeParameterName = 18,
enumMemberName = 19,
functionName = 20,
regularExpressionLiteral = 21,
regularExpressionLiteral = 21
}
interface SymbolDisplayPart {
text: string;
@@ -4746,7 +4757,7 @@ declare namespace ts {
argumentCount: number;
}
interface CompletionInfo {
/** Not true for all glboal completions. This will be true if the enclosing scope matches a few syntax kinds. See `isGlobalCompletionScope`. */
/** Not true for all glboal completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */
isGlobalCompletion: boolean;
isMemberCompletion: boolean;
/**
@@ -4797,7 +4808,7 @@ declare namespace ts {
enum OutputFileType {
JavaScript = 0,
SourceMap = 1,
Declaration = 2,
Declaration = 2
}
enum EndOfLineState {
None = 0,
@@ -4806,7 +4817,7 @@ declare namespace ts {
InDoubleQuoteStringLiteral = 3,
InTemplateHeadOrNoSubstitutionTemplate = 4,
InTemplateMiddleOrTail = 5,
InTemplateSubstitutionPosition = 6,
InTemplateSubstitutionPosition = 6
}
enum TokenClass {
Punctuation = 0,
@@ -4817,7 +4828,7 @@ declare namespace ts {
Identifier = 5,
NumberLiteral = 6,
StringLiteral = 7,
RegExpLiteral = 8,
RegExpLiteral = 8
}
interface ClassificationResult {
finalLexState: EndOfLineState;
@@ -4916,7 +4927,7 @@ declare namespace ts {
/**
* <JsxTagName attribute1 attribute2={0} />
*/
jsxAttribute = "JSX attribute",
jsxAttribute = "JSX attribute"
}
enum ScriptElementKindModifier {
none = "",
@@ -4927,7 +4938,7 @@ declare namespace ts {
ambientModifier = "declare",
staticModifier = "static",
abstractModifier = "abstract",
optionalModifier = "optional",
optionalModifier = "optional"
}
enum ClassificationTypeNames {
comment = "comment",
@@ -4952,7 +4963,7 @@ declare namespace ts {
jsxSelfClosingTagName = "jsx self closing tag name",
jsxAttribute = "jsx attribute",
jsxText = "jsx text",
jsxAttributeStringLiteralValue = "jsx attribute string literal value",
jsxAttributeStringLiteralValue = "jsx attribute string literal value"
}
enum ClassificationType {
comment = 1,
@@ -4978,7 +4989,7 @@ declare namespace ts {
jsxSelfClosingTagName = 21,
jsxAttribute = 22,
jsxText = 23,
jsxAttributeStringLiteralValue = 24,
jsxAttributeStringLiteralValue = 24
}
}
declare namespace ts {
@@ -5072,7 +5083,7 @@ declare namespace ts {
}
declare namespace ts {
/** The version of the language service API */
const servicesVersion = "0.7";
const servicesVersion = "0.8";
function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;
function displayPartsToString(displayParts: SymbolDisplayPart[]): string;
function getDefaultCompilerOptions(): CompilerOptions;
+8306 -6878
View File
File diff suppressed because it is too large Load Diff
+1600 -790
View File
File diff suppressed because it is too large Load Diff
+15 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "两个取值函数必须都是抽象的或都是非抽象的。",
"Add_0_to_existing_import_declaration_from_1_90015": "将“{0}”从“{1}”添加到现有导入声明",
"Add_async_modifier_to_containing_function_90029": "将异步修饰符添加到包含函数",
"Add_definite_assignment_assertion_to_property_0_95020": "向属性“{0}”添加明确的赋值断言",
"Add_index_signature_for_property_0_90017": "为属性“{0}”添加索引签名",
"Add_initializer_to_property_0_95019": "向属性“{0}”添加初始值设定项",
"Add_missing_super_call_90001": "添加缺失的 \"super()\" 调用",
"Add_this_to_unresolved_variable_90008": "向未解析的变量添加 \"this.\"",
"Add_undefined_type_to_property_0_95018": "向属性“{0}”添加“未定义”类型",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "添加 tsconfig.json 文件有助于组织包含 TypeScript 和 JavaScript 文件的项目。有关详细信息,请访问 https://aka.ms/tsconfig。",
"Additional_Checks_6176": "其他检查",
"Advanced_Options_6178": "高级选项",
"All_declarations_of_0_must_have_identical_modifiers_2687": "“{0}”的所有声明必须具有相同的修饰符。",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "“{0}”的所有声明都必须具有相同的类型参数。",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "抽象方法的所有声明必须是连续的。",
"All_imports_in_import_declaration_are_unused_6192": "未使用导入声明中的所有导入。",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "允许从不带默认输出的模块中默认输入。这不会影响代码发出,只是类型检查。",
"Allow_javascript_files_to_be_compiled_6102": "允许编译 JavaScript 文件。",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "提供 \"--isolatedModules\" 标志的情况下不允许使用环境常数枚举。",
@@ -324,6 +328,7 @@
"Enables_experimental_support_for_ES7_decorators_6065": "对 ES7 修饰器启用实验支持。",
"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066": "对发出修饰器的类型元数据启用实验支持。",
"Enum_0_used_before_its_declaration_2450": "枚举“{0}”用于其声明前。",
"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567": "枚举声明只能与命名空间或其他枚举声明合并。",
"Enum_declarations_must_all_be_const_or_non_const_2473": "枚举声明必须全为常数或非常数。",
"Enum_member_expected_1132": "应为枚举成员。",
"Enum_member_must_have_initializer_1061": "枚举成员必须具有初始化表达式。",
@@ -378,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "文件“{0}”不在 \"rootDir\"“{1}”下。\"rootDir\" 应包含所有源文件。",
"File_0_not_found_6053": "找不到文件“{0}”。",
"File_change_detected_Starting_incremental_compilation_6032": "检测到文件更改。正在启动增量编译...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "文件是 CommonJS 模块;它可能会转换为 ES6 模块。",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "文件名“{0}”仅在大小写方面与包含的文件名“{1}”不同。",
"File_name_0_has_a_1_extension_stripping_it_6132": "文件名“{0}”的扩展名为“{1}”,请去除它。",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "文件规范不能包含出现在递归目录通配符(\"*\"): “{0}”后的父目录(\"..\")。",
@@ -424,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "导入声明与“{0}”的局部声明冲突。",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "命名空间中的导入声明不能引用模块。",
"Import_emit_helpers_from_tslib_6139": "从 \"tslib\" 导入发出帮助程序。",
"Import_may_be_converted_to_a_default_import_80003": "导入可能会转换为默认导入。",
"Import_name_cannot_be_0_2438": "导入名称不能为“{0}”。",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "环境模块声明中的导入或导出声明不能通过相对模块名引用模块。",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "模块扩大中不允许导入。请考虑将它们移动到封闭的外部模块。",
@@ -462,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "JSDoc \"@{0}\" 未附加到类。",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "JSDoc \"...\" 可能仅出现在签名的最后一个参数中。",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "JSDoc \"@param\" 标记具有名称 \"{0}\",但不存在具有该名称的参数。",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "JSDoc \"@param\" 标记的名称为“{0}”,但该名称没有参数。如果它为数组类型,将匹配 \"arguments\"。",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc \"@typedef\" 标记应具有类型注释,或其后跟有 \"@property\" 或 \"@member\" 标记。",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc 类型只能在文档注释内部使用。",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "JSDoc 类型可能会移到 TypeScript 类型。",
"JSX_attribute_expected_17003": "需要 JSX 属性。",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "只能为 JSX 属性分配非空“表达式”。",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "JSX 元素“{0}”没有相应的结束标记。",
@@ -476,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "JSX 元素不能具有多个名称相同的特性。",
"JSX_expressions_must_have_one_parent_element_2657": "JSX 表达式必须具有一个父元素。",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "JSX 片段没有相应的结束标记。",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "使用内联 JSX 工厂杂注时,不支持 JSX 片段",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "使用 --jsxFactory 时不支持 JSX 片段",
"JSX_spread_child_must_be_an_array_type_2609": "JSX 扩展子属性必须为数组类型。",
"Jump_target_cannot_cross_function_boundary_1107": "跳转目标不能跨越函数边界。",
@@ -507,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "模块 {0} 已导出一个名为“{1}”的成员。请考虑重新显式导出以解决歧义。",
"Module_0_has_no_default_export_1192": "模块“{0}”没有默认导出。",
"Module_0_has_no_exported_member_1_2305": "模块“{0}”没有导出的成员“{1}”。",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "模块“{0}”没有导出的成员“{1}”。你是否指的是“{2}”?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "模块“{0}”被具有相同名称的局部声明隐藏。",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "模块“{0}”解析为非模块实体,且不能使用此构造导入。",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "模块“{0}”使用 \"export =\" 且无法与 \"export *\" 一起使用。",
@@ -650,6 +661,7 @@
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "在带隐式“any\" 类型的 \"this\" 表达式上引发错误。",
"Redirect_output_structure_to_the_directory_6006": "将输出结构重定向到目录。",
"Remove_declaration_for_Colon_0_90004": "删除“{0}”的声明",
"Remove_import_from_0_90005": "从“{0}”删除导入",
"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 情况的错误。",
@@ -657,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "报告未使用的局部变量上的错误。",
"Report_errors_on_unused_parameters_6135": "报告未使用的参数上的错误。",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "所需的类型参数可能不遵循可选类型参数。",
"Resolution_for_module_0_was_found_in_cache_6147": "在缓存中找到模块“{0}”的解析。",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "在位置“{1}”的缓存中找到模块“{0}”的解析。",
"Resolving_from_node_modules_folder_6118": "正在从 node_modules 文件夹解析...",
"Resolving_module_0_from_1_6086": "======== 正在从“{1}”解析模块“{0}”。========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "正在相对于基 URL“{1}”-“{2}”解析模块名“{0}”。",
@@ -791,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "\"for...in\" 语句的变量声明不能有初始化表达式。",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "\"for...of\" 语句的变量声明不能有初始化表达式。",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "不支持 \"with\" 语句。\"with\" 程序块中的所有符号都将具有类型 \"any\"。",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "此构造函数可能会转换为类声明。",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "此语法需要一个导入的帮助程序,但找不到模块“{0}”。",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "此语法需要一个名为“{1}”的导入帮助程序,但模块“{0}”没有导出的成员“{1}”。",
"Trailing_comma_not_allowed_1009": "不允许使用尾随逗号。",
@@ -887,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "变量声明列表不能为空。",
"Version_0_6029": "版本 {0}",
"Watch_input_files_6005": "监视输入文件。",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "是否在监视模式下保留过时的控制台输出,而不是清除屏幕。",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "不能重命名标准 TypeScript 库中定义的元素。",
"You_cannot_rename_this_element_8000": "无法重命名此元素。",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "“{0}”收到的参数过少,无法在此处充当修饰器。你是要先调用它,然后再写入 \"@{0}()\" 吗?",
+15 -1
View File
@@ -95,15 +95,19 @@
"Accessors_must_both_be_abstract_or_non_abstract_2676": "存取子必須兩者均為抽象或非抽象。",
"Add_0_to_existing_import_declaration_from_1_90015": "從 \"{1}\" 將 '{0}' 新增至現有的匯入宣告",
"Add_async_modifier_to_containing_function_90029": "將 async 修飾詞新增至包含的函式",
"Add_definite_assignment_assertion_to_property_0_95020": "將明確指派判斷提示新增至屬性 '{0}'",
"Add_index_signature_for_property_0_90017": "為屬性 '{0}' 新增索引簽章",
"Add_initializer_to_property_0_95019": "將初始設定式新增至屬性 '{0}'",
"Add_missing_super_call_90001": "新增遺漏的 'super()' 呼叫",
"Add_this_to_unresolved_variable_90008": "將 'this' 新增至未解析的變數",
"Add_undefined_type_to_property_0_95018": "將 'undefined' 類型新增至屬性 '{0}'",
"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "新增 tsconfig.json 檔案有助於組織同時包含 TypeScript 及 JavaScript 檔案的專案。若要深入了解,請前往 https://aka.ms/tsconfig。",
"Additional_Checks_6176": "其他檢查",
"Advanced_Options_6178": "進階選項",
"All_declarations_of_0_must_have_identical_modifiers_2687": "'{0}' 的所有宣告都必須有相同修飾詞。",
"All_declarations_of_0_must_have_identical_type_parameters_2428": "'{0}' 的所有宣告都必須具有相同的類型參數。",
"All_declarations_of_an_abstract_method_must_be_consecutive_2516": "抽象方法的所有宣告必須連續。",
"All_imports_in_import_declaration_are_unused_6192": "匯入宣告中的所有匯入皆未使用。",
"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011": "允許從沒有預設匯出的模組進行預設匯入。這不會影響程式碼發出,僅為類型檢查。",
"Allow_javascript_files_to_be_compiled_6102": "允許編譯 JavaScript 檔案。",
"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209": "提供 '--isolatedModules' 旗標時,不可使用環境常數列舉。",
@@ -324,6 +328,7 @@
"Enables_experimental_support_for_ES7_decorators_6065": "啟用 ES7 裝飾項目的實驗支援。",
"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066": "啟用實驗支援以發出裝飾項目類型的中繼資料。",
"Enum_0_used_before_its_declaration_2450": "列舉 '{0}' 的位置在其宣告之前。",
"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567": "列舉宣告只能與命名空間或其他列舉宣告合併。",
"Enum_declarations_must_all_be_const_or_non_const_2473": "列舉宣告必須都是 const 或非 const。",
"Enum_member_expected_1132": "必須是列舉成員。",
"Enum_member_must_have_initializer_1061": "列舉成員必須有初始設定式。",
@@ -378,6 +383,7 @@
"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059": "檔案 '{0}' 不在 'rootDir' '{1}' 之下。'rootDir' 必須包含所有原始程式檔。",
"File_0_not_found_6053": "找不到檔案 '{0}'。",
"File_change_detected_Starting_incremental_compilation_6032": "偵測到檔案變更。正在啟動累加編譯...",
"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001": "檔案為 CommonJS 模組; 其可轉換為 ES6 模組。",
"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149": "檔案名稱 '{0}' 與包含的檔案名稱 '{1}' 只差在大小寫。",
"File_name_0_has_a_1_extension_stripping_it_6132": "檔案名稱 '{0}' 的副檔名為 '{1}'。正予以移除。",
"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065": "檔案規格不得包含出現在遞迴目錄萬用字元 ('**') 之後的父目錄 ('..'): '{0}'。",
@@ -424,6 +430,7 @@
"Import_declaration_conflicts_with_local_declaration_of_0_2440": "匯入宣告與 '{0}' 的區域宣告衝突。",
"Import_declarations_in_a_namespace_cannot_reference_a_module_1147": "命名空間中的匯入宣告不得參考模組。",
"Import_emit_helpers_from_tslib_6139": "從 'tslib' 匯入發出協助程式。",
"Import_may_be_converted_to_a_default_import_80003": "匯入可轉換成預設匯入。",
"Import_name_cannot_be_0_2438": "匯入名稱不得為 '{0}'。",
"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439": "環境模組宣告中的匯入或匯出宣告,不得透過相對模組名稱參考模組。",
"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667": "模組增強指定中不允許匯入。請考慮將其移至封入外部模組。",
@@ -462,8 +469,10 @@
"JSDoc_0_is_not_attached_to_a_class_8022": "JSDoc ''@{0}' 未連結到類別。",
"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028": "JSDoc '...' 只能出現在特徵標記的最後一個參數中。",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024": "JSDoc '@param' 標記的名稱為 '{0}',但沒有為該名稱的參數。",
"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029": "JSDoc '@param' 標籤的名稱為 '{0}',但沒有任何參數使用該名稱。如有陣列類型,則會與 'arguments' 相符。",
"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc '@typedef' 標記應具有類型註解,或者其後接著 '@property' 或 '@member' 標記。",
"JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc 類型只能在文件註解中使用。",
"JSDoc_types_may_be_moved_to_TypeScript_types_80004": "JSDoc 類型可移為 TypeScript 類型。",
"JSX_attribute_expected_17003": "必須是 JSX 屬性。",
"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "只能將非空白的 'expression' 指派給 JSX 屬性。",
"JSX_element_0_has_no_corresponding_closing_tag_17008": "JSX 元素 '{0}' 沒有對應的結尾標記。",
@@ -476,6 +485,7 @@
"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001": "JSX 項目不得有多個同名的屬性。",
"JSX_expressions_must_have_one_parent_element_2657": "JSX 運算式必須具有一個父元素。",
"JSX_fragment_has_no_corresponding_closing_tag_17014": "JSX 片段沒有對應的結尾標記。",
"JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017": "使用內嵌 JSX 處理站 pragma 時,不支援 JSX 片段",
"JSX_fragment_is_not_supported_when_using_jsxFactory_17016": "使用 --jsxFactory 時,不支援 JSX 片段",
"JSX_spread_child_must_be_an_array_type_2609": "JSX 擴張子系必須為陣列類型。",
"Jump_target_cannot_cross_function_boundary_1107": "跳躍目標不得跨越函式界限。",
@@ -507,6 +517,7 @@
"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308": "模組 {0} 已匯出名為 '{1}' 的成員。請考慮明確重新匯出項目以解決模稜兩可的情形。",
"Module_0_has_no_default_export_1192": "模組 '{0}' 沒有預設匯出。",
"Module_0_has_no_exported_member_1_2305": "模組 '{0}' 沒有匯出的成員 '{1}'。",
"Module_0_has_no_exported_member_1_Did_you_mean_2_2724": "模組 '{0}' 沒有任何匯出的成員 '{1}'。您是否指的是 '{2}'?",
"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437": "同名的區域宣告隱藏了模組 '{0}'。",
"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497": "模組 '{0}' 會解析成非模組實體,且不可使用這個建構加以匯入。",
"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498": "模組 '{0}' 使用 'export =',因而無法以 'export *' 的方式使用。",
@@ -650,6 +661,7 @@
"Raise_error_on_this_expressions_with_an_implied_any_type_6115": "對具有隱含 'any' 類型的 'this' 運算式引發錯誤。",
"Redirect_output_structure_to_the_directory_6006": "將輸出結構重新導向至目錄。",
"Remove_declaration_for_Colon_0_90004": "移除 '{0}' 的宣告",
"Remove_import_from_0_90005": "從 '{0}' 移除匯入",
"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 案例的錯誤。",
@@ -657,7 +669,7 @@
"Report_errors_on_unused_locals_6134": "回報未使用之區域變數的錯誤。",
"Report_errors_on_unused_parameters_6135": "回報未使用之參數的錯誤。",
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "必要型別參數可能未遵循選擇性型別參數。",
"Resolution_for_module_0_was_found_in_cache_6147": "快取找到模組 '{0}' 的解析。",
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "從位置 '{1}' 的快取找到模組 '{0}' 的解析。",
"Resolving_from_node_modules_folder_6118": "正在從 node_modules 資料夾解析...",
"Resolving_module_0_from_1_6086": "======== 正在從 '{1}' 解析模組 '{0}'。========",
"Resolving_module_name_0_relative_to_base_url_1_2_6094": "正在解析與基底 URL '{1}' 相對的模組名稱 '{0}' - '{2}'。",
@@ -791,6 +803,7 @@
"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' 陳述式的變數宣告不得有初始設定式。",
"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' 陳述式的變數宣告不得有初始設定式。",
"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "不支援 'with' 陳述式。'with' 區塊中的所有符號都會有類型 'any'。",
"This_constructor_function_may_be_converted_to_a_class_declaration_80002": "此建構函式可轉換為類別宣告。",
"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "此語法需要已匯入的協助程式,但找不到模組 '{0}'。",
"This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343": "此語法需要名為 '{1}' 的已匯入協助程式,但模組 '{0}' 沒有匯出的成員 '{1}'。",
"Trailing_comma_not_allowed_1009": "尾端不得為逗號。",
@@ -887,6 +900,7 @@
"Variable_declaration_list_cannot_be_empty_1123": "變數宣告清單不得為空白。",
"Version_0_6029": "版本 {0}",
"Watch_input_files_6005": "監看輸入檔案。",
"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "是否要將已過期的主控台輸出,維持在監看模式下,而非清除螢幕。",
"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001": "您無法重新命名標準 TypeScript 程式庫中所定義的項目。",
"You_cannot_rename_this_element_8000": "您無法重新命名這個項目。",
"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329": "'{0}' 在此只接受極少數的引數用為裝飾項目。要先呼叫此項目,然後再寫入 '@{0}()' 嗎?",
+486 -692
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "2.8.0",
"version": "2.9.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
+86 -54
View File
@@ -101,7 +101,6 @@ namespace ts {
HasLocals = 1 << 5,
IsInterface = 1 << 6,
IsObjectLiteralOrClassExpressionMethod = 1 << 7,
IsInferenceContainer = 1 << 8,
}
const binder = createBinder();
@@ -119,8 +118,8 @@ namespace ts {
let languageVersion: ScriptTarget;
let parent: Node;
let container: Node;
let thisParentContainer: Node; // Container one level up
let blockScopeContainer: Node;
let inferenceContainer: Node;
let lastContainer: Node;
let seenThisKeyword: boolean;
@@ -187,8 +186,8 @@ namespace ts {
languageVersion = undefined;
parent = undefined;
container = undefined;
thisParentContainer = undefined;
blockScopeContainer = undefined;
inferenceContainer = undefined;
lastContainer = undefined;
seenThisKeyword = false;
currentFlow = undefined;
@@ -224,13 +223,7 @@ namespace ts {
symbol.flags |= symbolFlags;
node.symbol = symbol;
if (!symbol.declarations) {
symbol.declarations = [node];
}
else {
symbol.declarations.push(node);
}
symbol.declarations = append(symbol.declarations, node);
if (symbolFlags & SymbolFlags.HasExports && !symbol.exports) {
symbol.exports = createSymbolTable();
@@ -304,7 +297,7 @@ namespace ts {
case SyntaxKind.Parameter:
// Parameters with names are handled at the top of this function. Parameters
// without names can only come from JSDocFunctionTypes.
Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType);
Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType, "Impossible parameter parent kind", () => `parent is: ${(ts as any).SyntaxKind ? (ts as any).SyntaxKind[node.parent.kind] : node.parent.kind}, expected JSDocFunctionType`);
const functionType = <JSDocFunctionType>node.parent;
const index = functionType.parameters.indexOf(node as ParameterDeclaration);
return "arg" + index as __String;
@@ -486,12 +479,13 @@ namespace ts {
// and block-container. Then after we pop out of processing the children, we restore
// these saved values.
const saveContainer = container;
const saveThisParentContainer = thisParentContainer;
const savedBlockScopeContainer = blockScopeContainer;
// Depending on what kind of node this is, we may have to adjust the current container
// and block-container. If the current node is a container, then it is automatically
// considered the current block-container as well. Also, for containers that we know
// may contain locals, we proactively initialize the .locals field. We do this because
// may contain locals, we eagerly initialize the .locals field. We do this because
// it's highly likely that the .locals will be needed to place some child in (for example,
// a parameter, or variable declaration).
//
@@ -506,6 +500,9 @@ namespace ts {
// for it. We must clear this so we don't accidentally move any stale data forward from
// a previous compilation.
if (containerFlags & ContainerFlags.IsContainer) {
if (node.kind !== SyntaxKind.ArrowFunction) {
thisParentContainer = container;
}
container = blockScopeContainer = node;
if (containerFlags & ContainerFlags.HasLocals) {
container.locals = createSymbolTable();
@@ -570,17 +567,12 @@ namespace ts {
bindChildren(node);
node.flags = seenThisKeyword ? node.flags | NodeFlags.ContainsThis : node.flags & ~NodeFlags.ContainsThis;
}
else if (containerFlags & ContainerFlags.IsInferenceContainer) {
const saveInferenceContainer = inferenceContainer;
inferenceContainer = node;
node.locals = undefined;
bindChildren(node);
inferenceContainer = saveInferenceContainer;
}
else {
bindChildren(node);
}
container = saveContainer;
thisParentContainer = saveThisParentContainer;
blockScopeContainer = savedBlockScopeContainer;
}
@@ -602,20 +594,25 @@ namespace ts {
}
}
function bindEach(nodes: NodeArray<Node>) {
function bindEachFunctionsFirst(nodes: NodeArray<Node>) {
bindEach(nodes, n => n.kind === SyntaxKind.FunctionDeclaration ? bind(n) : undefined);
bindEach(nodes, n => n.kind !== SyntaxKind.FunctionDeclaration ? bind(n) : undefined);
}
function bindEach(nodes: NodeArray<Node>, bindFunction = bind) {
if (nodes === undefined) {
return;
}
if (skipTransformFlagAggregation) {
forEach(nodes, bind);
forEach(nodes, bindFunction);
}
else {
const savedSubtreeTransformFlags = subtreeTransformFlags;
subtreeTransformFlags = TransformFlags.None;
let nodeArrayFlags = TransformFlags.None;
for (const node of nodes) {
bind(node);
bindFunction(node);
nodeArrayFlags |= node.transformFlags & ~TransformFlags.HasComputedFlags;
}
nodes.transformFlags = nodeArrayFlags | TransformFlags.HasComputedFlags;
@@ -715,6 +712,15 @@ namespace ts {
case SyntaxKind.JSDocTypedefTag:
bindJSDocTypedefTag(<JSDocTypedefTag>node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
case SyntaxKind.SourceFile:
bindEachFunctionsFirst((node as SourceFile).statements);
bind((node as SourceFile).endOfFileToken);
break;
case SyntaxKind.Block:
case SyntaxKind.ModuleBlock:
bindEachFunctionsFirst((node as Block).statements);
break;
default:
bindEachChild(node);
break;
@@ -1433,9 +1439,6 @@ namespace ts {
case SyntaxKind.MappedType:
return ContainerFlags.IsContainer | ContainerFlags.HasLocals;
case SyntaxKind.ConditionalType:
return ContainerFlags.IsInferenceContainer;
case SyntaxKind.SourceFile:
return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals;
@@ -2327,14 +2330,25 @@ namespace ts {
function bindThisPropertyAssignment(node: BinaryExpression | PropertyAccessExpression) {
Debug.assert(isInJavaScriptFile(node));
const container = getThisContainer(node, /*includeArrowFunctions*/ false);
switch (container.kind) {
const thisContainer = getThisContainer(node, /*includeArrowFunctions*/ false);
switch (thisContainer.kind) {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
// Declare a 'member' if the container is an ES5 class or ES6 constructor
container.symbol.members = container.symbol.members || createSymbolTable();
// It's acceptable for multiple 'this' assignments of the same identifier to occur
declareSymbol(container.symbol.members, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
let constructorSymbol = thisContainer.symbol;
// For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression.
if (isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === SyntaxKind.EqualsToken) {
const l = thisContainer.parent.left;
if (isPropertyAccessEntityNameExpression(l) && isPrototypeAccess(l.expression)) {
constructorSymbol = getJSInitializerSymbolFromName(l.expression.expression, thisParentContainer);
}
}
if (constructorSymbol) {
// Declare a 'member' if the container is an ES5 class or ES6 constructor
constructorSymbol.members = constructorSymbol.members || createSymbolTable();
// It's acceptable for multiple 'this' assignments of the same identifier to occur
declareSymbol(constructorSymbol.members, constructorSymbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
}
break;
case SyntaxKind.Constructor:
@@ -2344,10 +2358,17 @@ namespace ts {
case SyntaxKind.SetAccessor:
// this.foo assignment in a JavaScript class
// Bind this property to the containing class
const containingClass = container.parent;
const symbolTable = hasModifier(container, ModifierFlags.Static) ? containingClass.symbol.exports : containingClass.symbol.members;
const containingClass = thisContainer.parent;
const symbolTable = hasModifier(thisContainer, ModifierFlags.Static) ? containingClass.symbol.exports : containingClass.symbol.members;
declareSymbol(symbolTable, containingClass.symbol, node, SymbolFlags.Property, SymbolFlags.None, /*isReplaceableByMethod*/ true);
break;
case SyntaxKind.SourceFile:
// this.foo assignment in a source file
// Do not bind. It would be nice to support this someday though.
break;
default:
Debug.fail(Debug.showSyntaxKind(thisContainer));
}
}
@@ -2355,12 +2376,12 @@ namespace ts {
if (node.expression.kind === SyntaxKind.ThisKeyword) {
bindThisPropertyAssignment(node);
}
else if (isEntityNameExpression(node) && node.parent.parent.kind === SyntaxKind.SourceFile) {
if (isPropertyAccessExpression(node.expression) && node.expression.name.escapedText === "prototype") {
bindPrototypePropertyAssignment(node as PropertyAccessEntityNameExpression, node.parent);
else if (isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === SyntaxKind.SourceFile) {
if (isPrototypeAccess(node.expression)) {
bindPrototypePropertyAssignment(node, node.parent);
}
else {
bindStaticPropertyAssignment(node as PropertyAccessEntityNameExpression);
bindStaticPropertyAssignment(node);
}
}
}
@@ -2417,17 +2438,16 @@ namespace ts {
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false);
}
function getJSInitializerSymbolFromName(name: EntityNameExpression, lookupContainer?: Node): Symbol {
return getJSInitializerSymbol(lookupSymbolForPropertyAccess(name, lookupContainer));
}
function bindPropertyAssignment(name: EntityNameExpression, propertyAccess: PropertyAccessEntityNameExpression, isPrototypeProperty: boolean) {
let symbol = getJSInitializerSymbol(lookupSymbolForPropertyAccess(name));
let isToplevelNamespaceableInitializer: boolean;
if (isBinaryExpression(propertyAccess.parent)) {
const isPrototypeAssignment = isPropertyAccessExpression(propertyAccess.parent.left) && propertyAccess.parent.left.name.escapedText === "prototype";
isToplevelNamespaceableInitializer = propertyAccess.parent.parent.parent.kind === SyntaxKind.SourceFile &&
!!getJavascriptInitializer(propertyAccess.parent.right, isPrototypeAssignment);
}
else {
isToplevelNamespaceableInitializer = propertyAccess.parent.parent.kind === SyntaxKind.SourceFile;
}
let symbol = getJSInitializerSymbolFromName(name);
const isToplevelNamespaceableInitializer = isBinaryExpression(propertyAccess.parent)
? propertyAccess.parent.parent.parent.kind === SyntaxKind.SourceFile &&
!!getJavascriptInitializer(propertyAccess.parent.right, isPrototypeAccess(propertyAccess.parent.left))
: propertyAccess.parent.parent.kind === SyntaxKind.SourceFile;
if (!isPrototypeProperty && (!symbol || !(symbol.flags & SymbolFlags.Namespace)) && isToplevelNamespaceableInitializer) {
// make symbols or add declarations for intermediate containers
const flags = SymbolFlags.Module | SymbolFlags.JSContainer;
@@ -2458,9 +2478,9 @@ namespace ts {
declareSymbol(symbolTable, symbol, propertyAccess, symbolFlags, symbolExcludes);
}
function lookupSymbolForPropertyAccess(node: EntityNameExpression): Symbol | undefined {
function lookupSymbolForPropertyAccess(node: EntityNameExpression, lookupContainer: Node = container): Symbol | undefined {
if (isIdentifier(node)) {
return lookupSymbolForNameWorker(container, node.escapedText);
return lookupSymbolForNameWorker(lookupContainer, node.escapedText);
}
else {
const symbol = getJSInitializerSymbol(lookupSymbolForPropertyAccess(node.expression));
@@ -2485,7 +2505,7 @@ namespace ts {
function bindCallExpression(node: CallExpression) {
// We're only inspecting call expressions to detect CommonJS modules, so we can skip
// this check if we've already seen the module indicator
if (!file.commonJsModuleIndicator && isRequireCall(node, /*checkArgumentIsStringLiteral*/ false)) {
if (!file.commonJsModuleIndicator && isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ false)) {
setCommonJsModuleIndicator(node);
}
}
@@ -2626,13 +2646,25 @@ namespace ts {
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
}
function getInferTypeContainer(node: Node): ConditionalTypeNode {
while (node) {
const parent = node.parent;
if (parent && parent.kind === SyntaxKind.ConditionalType && (<ConditionalTypeNode>parent).extendsType === node) {
return <ConditionalTypeNode>parent;
}
node = parent;
}
return undefined;
}
function bindTypeParameter(node: TypeParameterDeclaration) {
if (node.parent.kind === SyntaxKind.InferType) {
if (inferenceContainer) {
if (!inferenceContainer.locals) {
inferenceContainer.locals = createSymbolTable();
const container = getInferTypeContainer(node.parent);
if (container) {
if (!container.locals) {
container.locals = createSymbolTable();
}
declareSymbol(inferenceContainer.locals, /*parent*/ undefined, node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
declareSymbol(container.locals, /*parent*/ undefined, node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
}
else {
bindAnonymousDeclaration(node, SymbolFlags.TypeParameter, getDeclarationName(node));
+35 -18
View File
@@ -218,29 +218,40 @@ namespace ts {
newProgram: Program;
host: BuilderProgramHost;
oldProgram: BuilderProgram | undefined;
configFileParsingDiagnostics: ReadonlyArray<Diagnostic>;
}
export function getBuilderCreationParameters(newProgramOrRootNames: Program | ReadonlyArray<string>, hostOrOptions: BuilderProgramHost | CompilerOptions, oldProgramOrHost?: CompilerHost | BuilderProgram, oldProgram?: BuilderProgram): BuilderCreationParameters {
export function getBuilderCreationParameters(newProgramOrRootNames: Program | ReadonlyArray<string> | undefined, hostOrOptions: BuilderProgramHost | CompilerOptions | undefined, oldProgramOrHost?: BuilderProgram | CompilerHost, configFileParsingDiagnosticsOrOldProgram?: ReadonlyArray<Diagnostic> | BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): BuilderCreationParameters {
let host: BuilderProgramHost;
let newProgram: Program;
if (isArray(newProgramOrRootNames)) {
newProgram = createProgram(newProgramOrRootNames, hostOrOptions as CompilerOptions, oldProgramOrHost as CompilerHost, oldProgram && oldProgram.getProgram());
let oldProgram: BuilderProgram;
if (newProgramOrRootNames === undefined) {
Debug.assert(hostOrOptions === undefined);
host = oldProgramOrHost as CompilerHost;
oldProgram = configFileParsingDiagnosticsOrOldProgram as BuilderProgram;
Debug.assert(!!oldProgram);
newProgram = oldProgram.getProgram();
}
else if (isArray(newProgramOrRootNames)) {
oldProgram = configFileParsingDiagnosticsOrOldProgram as BuilderProgram;
newProgram = createProgram(newProgramOrRootNames, hostOrOptions as CompilerOptions, oldProgramOrHost as CompilerHost, oldProgram && oldProgram.getProgram(), configFileParsingDiagnostics);
host = oldProgramOrHost as CompilerHost;
}
else {
newProgram = newProgramOrRootNames;
host = hostOrOptions as BuilderProgramHost;
oldProgram = oldProgramOrHost as BuilderProgram;
configFileParsingDiagnostics = configFileParsingDiagnosticsOrOldProgram as ReadonlyArray<Diagnostic>;
}
return { host, newProgram, oldProgram };
return { host, newProgram, oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || emptyArray };
}
export function createBuilderProgram(kind: BuilderProgramKind.SemanticDiagnosticsBuilderProgram, builderCreationParameters: BuilderCreationParameters): SemanticDiagnosticsBuilderProgram;
export function createBuilderProgram(kind: BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, builderCreationParameters: BuilderCreationParameters): EmitAndSemanticDiagnosticsBuilderProgram;
export function createBuilderProgram(kind: BuilderProgramKind, { newProgram, host, oldProgram }: BuilderCreationParameters) {
export function createBuilderProgram(kind: BuilderProgramKind, { newProgram, host, oldProgram, configFileParsingDiagnostics }: BuilderCreationParameters) {
// Return same program if underlying program doesnt change
let oldState = oldProgram && oldProgram.getState();
if (oldState && newProgram === oldState.program) {
if (oldState && newProgram === oldState.program && configFileParsingDiagnostics !== newProgram.getConfigFileParsingDiagnostics()) {
newProgram = undefined;
oldState = undefined;
return oldProgram;
@@ -269,6 +280,7 @@ namespace ts {
getSourceFiles: () => state.program.getSourceFiles(),
getOptionsDiagnostics: cancellationToken => state.program.getOptionsDiagnostics(cancellationToken),
getGlobalDiagnostics: cancellationToken => state.program.getGlobalDiagnostics(cancellationToken),
getConfigFileParsingDiagnostics: () => configFileParsingDiagnostics || state.program.getConfigFileParsingDiagnostics(),
getSyntacticDiagnostics: (sourceFile, cancellationToken) => state.program.getSyntacticDiagnostics(sourceFile, cancellationToken),
getSemanticDiagnostics,
emit,
@@ -471,6 +483,10 @@ namespace ts {
* Get the diagnostics that dont belong to any file
*/
getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
/**
* Get the diagnostics from config file parsing
*/
getConfigFileParsingDiagnostics(): ReadonlyArray<Diagnostic>;
/**
* Get the syntax diagnostics, for all source files if source file is not supplied
*/
@@ -533,29 +549,29 @@ namespace ts {
/**
* Create the builder to manage semantic diagnostics and cache them
*/
export function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram): SemanticDiagnosticsBuilderProgram;
export function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram): SemanticDiagnosticsBuilderProgram;
export function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames: Program | ReadonlyArray<string>, hostOrOptions: BuilderProgramHost | CompilerOptions, oldProgramOrHost?: CompilerHost | SemanticDiagnosticsBuilderProgram, oldProgram?: SemanticDiagnosticsBuilderProgram) {
return createBuilderProgram(BuilderProgramKind.SemanticDiagnosticsBuilderProgram, getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram));
export function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): SemanticDiagnosticsBuilderProgram;
export function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): SemanticDiagnosticsBuilderProgram;
export function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames: Program | ReadonlyArray<string>, hostOrOptions: BuilderProgramHost | CompilerOptions, oldProgramOrHost?: CompilerHost | SemanticDiagnosticsBuilderProgram, configFileParsingDiagnosticsOrOldProgram?: ReadonlyArray<Diagnostic> | SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>) {
return createBuilderProgram(BuilderProgramKind.SemanticDiagnosticsBuilderProgram, getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics));
}
/**
* Create the builder that can handle the changes in program and iterate through changed files
* to emit the those files and manage semantic diagnostics cache as well
*/
export function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram): EmitAndSemanticDiagnosticsBuilderProgram;
export function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram): EmitAndSemanticDiagnosticsBuilderProgram;
export function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames: Program | ReadonlyArray<string>, hostOrOptions: BuilderProgramHost | CompilerOptions, oldProgramOrHost?: CompilerHost | EmitAndSemanticDiagnosticsBuilderProgram, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram) {
return createBuilderProgram(BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram));
export function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): EmitAndSemanticDiagnosticsBuilderProgram;
export function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): EmitAndSemanticDiagnosticsBuilderProgram;
export function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames: Program | ReadonlyArray<string>, hostOrOptions: BuilderProgramHost | CompilerOptions, oldProgramOrHost?: CompilerHost | EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnosticsOrOldProgram?: ReadonlyArray<Diagnostic> | EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>) {
return createBuilderProgram(BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics));
}
/**
* Creates a builder thats just abstraction over program and can be used with watch
*/
export function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram): BuilderProgram;
export function createAbstractBuilder(rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: BuilderProgram): BuilderProgram;
export function createAbstractBuilder(newProgramOrRootNames: Program | ReadonlyArray<string>, hostOrOptions: BuilderProgramHost | CompilerOptions, oldProgramOrHost?: CompilerHost | BuilderProgram, oldProgram?: BuilderProgram): BuilderProgram {
const { newProgram: program } = getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram);
export function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): BuilderProgram;
export function createAbstractBuilder(rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): BuilderProgram;
export function createAbstractBuilder(newProgramOrRootNames: Program | ReadonlyArray<string>, hostOrOptions: BuilderProgramHost | CompilerOptions, oldProgramOrHost?: CompilerHost | BuilderProgram, configFileParsingDiagnosticsOrOldProgram?: ReadonlyArray<Diagnostic> | BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): BuilderProgram {
const { newProgram: program } = getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics);
return {
// Only return program, all other methods are not implemented
getProgram: () => program,
@@ -565,6 +581,7 @@ namespace ts {
getSourceFiles: notImplemented,
getOptionsDiagnostics: notImplemented,
getGlobalDiagnostics: notImplemented,
getConfigFileParsingDiagnostics: notImplemented,
getSyntacticDiagnostics: notImplemented,
getSemanticDiagnostics: notImplemented,
emit: notImplemented,
+620 -442
View File
File diff suppressed because it is too large Load Diff
+17 -1
View File
@@ -194,6 +194,13 @@ namespace ts {
category: Diagnostics.Basic_Options,
description: Diagnostics.Generates_corresponding_d_ts_file,
},
{
name: "declarationMap",
type: "boolean",
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
description: Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
},
{
name: "emitDeclarationOnly",
type: "boolean",
@@ -1334,12 +1341,21 @@ namespace ts {
return Array(paddingLength + 1).join(" ");
}
function isAllowedOption({ category, name }: CommandLineOption): boolean {
// Skip options which do not have a category or have category `Command_line_Options`
// Exclude all possible `Advanced_Options` in tsconfig.json which were NOT defined in command line
return category !== undefined
&& category !== Diagnostics.Command_line_Options
&& (category !== Diagnostics.Advanced_Options || compilerOptionsMap.has(name));
}
function writeConfigurations() {
// Filter applicable options to place in the file
const categorizedOptions = createMultiMap<CommandLineOption>();
for (const option of optionDeclarations) {
const { category } = option;
if (category !== undefined && category !== Diagnostics.Command_line_Options && category !== Diagnostics.Advanced_Options) {
if (isAllowedOption(option)) {
categorizedOptions.add(getLocaleSpecificMessage(category), option);
}
}
+10
View File
@@ -260,7 +260,15 @@ namespace ts {
}
}
function shouldWriteComment(text: string, pos: number) {
if (printerOptions.onlyPrintJsDocStyle) {
return (isJSDocLikeText(text, pos) || isPinnedComment(text, pos));
}
return true;
}
function emitLeadingComment(commentPos: number, commentEnd: number, kind: SyntaxKind, hasTrailingNewLine: boolean, rangePos: number) {
if (!shouldWriteComment(currentText, commentPos)) return;
if (!hasWrittenComment) {
emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos);
hasWrittenComment = true;
@@ -292,6 +300,7 @@ namespace ts {
}
function emitTrailingComment(commentPos: number, commentEnd: number, _kind: SyntaxKind, hasTrailingNewLine: boolean) {
if (!shouldWriteComment(currentText, commentPos)) return;
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/
if (!writer.isAtStartOfLine()) {
writer.write(" ");
@@ -404,6 +413,7 @@ namespace ts {
}
function writeComment(text: string, lineMap: number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) {
if (!shouldWriteComment(currentText, commentPos)) return;
if (emitPos) emitPos(commentPos);
writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
if (emitPos) emitPos(commentEnd);
+12 -26
View File
@@ -4,7 +4,7 @@
namespace ts {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configureNightly` too.
export const versionMajorMinor = "2.8";
export const versionMajorMinor = "2.9";
/** The version of the TypeScript compiler release */
export const version = `${versionMajorMinor}.0-dev`;
}
@@ -623,23 +623,6 @@ namespace ts {
};
}
/**
* Computes the first matching span of elements and returns a tuple of the first span
* and the remaining elements.
*/
export function span<T>(array: ReadonlyArray<T>, f: (x: T, i: number) => boolean): [T[], T[]] {
if (array) {
for (let i = 0; i < array.length; i++) {
if (!f(array[i], i)) {
return [array.slice(0, i), array.slice(i)];
}
}
return [array.slice(0), []];
}
return undefined;
}
/**
* Maps contiguous spans of values with the same key.
*
@@ -920,8 +903,7 @@ namespace ts {
export function sum<T extends Record<K, number>, K extends string>(array: ReadonlyArray<T>, prop: K): number {
let result = 0;
for (const v of array) {
// TODO: Remove the following type assertion once the fix for #17069 is merged
result += v[prop] as number;
result += v[prop];
}
return result;
}
@@ -1077,7 +1059,7 @@ namespace ts {
* Returns the first element of an array if non-empty, `undefined` otherwise.
*/
export function firstOrUndefined<T>(array: ReadonlyArray<T>): T | undefined {
return elementAt(array, 0);
return array.length === 0 ? undefined : array[0];
}
export function first<T>(array: ReadonlyArray<T>): T {
@@ -1089,7 +1071,7 @@ namespace ts {
* Returns the last element of an array if non-empty, `undefined` otherwise.
*/
export function lastOrUndefined<T>(array: ReadonlyArray<T>): T | undefined {
return elementAt(array, -1);
return array.length === 0 ? undefined : array[array.length - 1];
}
export function last<T>(array: ReadonlyArray<T>): T {
@@ -1588,10 +1570,10 @@ namespace ts {
}
}
export function formatStringFromArgs(text: string, args: { [index: number]: string; }, baseIndex?: number): string {
export function formatStringFromArgs(text: string, args: ArrayLike<string>, baseIndex?: number): string {
baseIndex = baseIndex || 0;
return text.replace(/{(\d+)}/g, (_match, index?) => args[+index + baseIndex]);
return text.replace(/{(\d+)}/g, (_match, index?: string) => Debug.assertDefined(args[+index + baseIndex]));
}
export let localizedDiagnosticMessages: MapLike<string>;
@@ -2052,7 +2034,7 @@ namespace ts {
return compilerOptions.target || ScriptTarget.ES3;
}
export function getEmitModuleKind(compilerOptions: CompilerOptions) {
export function getEmitModuleKind(compilerOptions: {module?: CompilerOptions["module"], target?: CompilerOptions["target"]}) {
return typeof compilerOptions.module === "number" ?
compilerOptions.module :
getEmitScriptTarget(compilerOptions) >= ScriptTarget.ES2015 ? ModuleKind.ES2015 : ModuleKind.CommonJS;
@@ -2066,6 +2048,10 @@ namespace ts {
return moduleResolution;
}
export function getAreDeclarationMapsEnabled(options: CompilerOptions) {
return !!(options.declaration && options.declarationMap);
}
export function getAllowSyntheticDefaultImports(compilerOptions: CompilerOptions) {
const moduleKind = getEmitModuleKind(compilerOptions);
return compilerOptions.allowSyntheticDefaultImports !== undefined
@@ -2923,7 +2909,7 @@ namespace ts {
return value;
}
export function assertEachDefined<T, A extends ReadonlyArray<T>>(value: A, message: string): A {
export function assertEachDefined<T, A extends ReadonlyArray<T>>(value: A, message?: string): A {
for (const v of value) {
assertDefined(v, message);
}
File diff suppressed because it is too large Load Diff
+123 -3
View File
@@ -27,6 +27,10 @@
"category": "Error",
"code": 1012
},
"A rest parameter or binding pattern may not have a trailing comma.": {
"category": "Error",
"code": 1013
},
"A rest parameter must be last in a parameter list.": {
"category": "Error",
"code": 1014
@@ -1372,7 +1376,7 @@
"category": "Error",
"code": 2406
},
"The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": {
"The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'.": {
"category": "Error",
"code": 2407
},
@@ -1668,7 +1672,7 @@
"category": "Error",
"code": 2487
},
"Type must have a '[Symbol.iterator]()' method that returns an iterator.": {
"Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator.": {
"category": "Error",
"code": 2488
},
@@ -1732,7 +1736,7 @@
"category": "Error",
"code": 2503
},
"Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.": {
"Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.": {
"category": "Error",
"code": 2504
},
@@ -1988,6 +1992,14 @@
"category": "Error",
"code": 2567
},
"Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators.": {
"category": "Error",
"code": 2568
},
"Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.": {
"category": "Error",
"code": 2569
},
"JSX element attributes type '{0}' may not be a union type.": {
"category": "Error",
@@ -2767,7 +2779,15 @@
"category": "Error",
"code": 5068
},
"Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'.": {
"category": "Error",
"code": 5069
},
"Generates a sourcemap for each corresponding '.d.ts' file.": {
"category": "Message",
"code": 6000
},
"Concatenate and emit output to single file.": {
"category": "Message",
"code": 6001
@@ -3728,6 +3748,10 @@
"category": "Error",
"code": 8028
},
"JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type.": {
"category": "Error",
"code": 8029
},
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.": {
"category": "Error",
"code": 9002
@@ -4022,5 +4046,101 @@
"Add definite assignment assertion to property '{0}'": {
"category": "Message",
"code": 95020
},
"Add all missing members": {
"category": "Message",
"code": 95022
},
"Infer all types from usage": {
"category": "Message",
"code": 95023
},
"Delete all unused declarations": {
"category": "Message",
"code": 95024
},
"Prefix all unused declarations with '_' where possible": {
"category": "Message",
"code": 95025
},
"Fix all detected spelling errors": {
"category": "Message",
"code": 95026
},
"Add initializers to all uninitialized properties": {
"category": "Message",
"code": 95027
},
"Add definite assignment assertions to all uninitialized properties": {
"category": "Message",
"code": 95028
},
"Add undefined type to all uninitialized properties": {
"category": "Message",
"code": 95029
},
"Change all jsdoc-style types to TypeScript": {
"category": "Message",
"code": 95030
},
"Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)": {
"category": "Message",
"code": 95031
},
"Implement all unimplemented interfaces": {
"category": "Message",
"code": 95032
},
"Install all missing types packages": {
"category": "Message",
"code": 95033
},
"Rewrite all as indexed access types": {
"category": "Message",
"code": 95034
},
"Convert all to default imports": {
"category": "Message",
"code": 95035
},
"Make all 'super()' calls the first statement in their constructor": {
"category": "Message",
"code": 95036
},
"Add 'this.' to all unresolved variables matching a member name": {
"category": "Message",
"code": 95037
},
"Change all extended interfaces to 'implements'": {
"category": "Message",
"code": 95038
},
"Add all missing super calls": {
"category": "Message",
"code": 95039
},
"Implement all inherited abstract classes": {
"category": "Message",
"code": 95040
},
"Add all missing 'async' modifiers": {
"category": "Message",
"code": 95041
},
"Add '@ts-ignore' to all error messages": {
"category": "Message",
"code": 95042
},
"Annotate everything with types from JSDoc": {
"category": "Message",
"code": 95043
},
"Add '()' to all uncalled decorators": {
"category": "Message",
"code": 95044
},
"Convert all constructor functions to classes": {
"category": "Message",
"code": 95045
}
}
+261 -177
View File
@@ -1,6 +1,5 @@
/// <reference path="checker.ts" />
/// <reference path="transformer.ts" />
/// <reference path="declarationEmitter.ts" />
/// <reference path="sourcemap.ts" />
/// <reference path="comments.ts" />
@@ -18,18 +17,16 @@ namespace ts {
* Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine the list of source files to emit.
*/
export function forEachEmittedFile<T>(
host: EmitHost, action: (emitFileNames: EmitFileNames, sourceFileOrBundle: SourceFile | Bundle, emitOnlyDtsFiles: boolean) => T,
sourceFilesOrTargetSourceFile?: SourceFile[] | SourceFile,
host: EmitHost, action: (emitFileNames: EmitFileNames, sourceFileOrBundle: SourceFile | Bundle) => T,
sourceFilesOrTargetSourceFile?: ReadonlyArray<SourceFile> | SourceFile,
emitOnlyDtsFiles?: boolean) {
const sourceFiles = isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile);
const options = host.getCompilerOptions();
if (options.outFile || options.out) {
if (sourceFiles.length) {
const jsFilePath = options.outFile || options.out;
const sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);
const declarationFilePath = options.declaration ? removeFileExtension(jsFilePath) + Extension.Dts : "";
const result = action({ jsFilePath, sourceMapFilePath, declarationFilePath }, createBundle(sourceFiles), emitOnlyDtsFiles);
const bundle = createBundle(sourceFiles);
const result = action(getOutputPathsFor(bundle, host, emitOnlyDtsFiles), bundle);
if (result) {
return result;
}
@@ -37,10 +34,7 @@ namespace ts {
}
else {
for (const sourceFile of sourceFiles) {
const jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options));
const sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);
const declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;
const result = action({ jsFilePath, sourceMapFilePath, declarationFilePath }, sourceFile, emitOnlyDtsFiles);
const result = action(getOutputPathsFor(sourceFile, host, emitOnlyDtsFiles), sourceFile);
if (result) {
return result;
}
@@ -48,8 +42,29 @@ namespace ts {
}
}
/*@internal*/
export function getOutputPathsFor(sourceFile: SourceFile | Bundle, host: EmitHost, forceDtsPaths: boolean) {
const options = host.getCompilerOptions();
if (sourceFile.kind === SyntaxKind.Bundle) {
const jsFilePath = options.outFile || options.out;
const sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);
const declarationFilePath = (forceDtsPaths || options.declaration) ? removeFileExtension(jsFilePath) + Extension.Dts : undefined;
const declarationMapPath = getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : undefined;
return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
}
else {
const jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options));
const sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);
// For legacy reasons (ie, we have baselines capturing the behavior), js files don't report a .d.ts output path - this would only matter if `declaration` and `allowJs` were both on, which is currently an error
const isJs = isSourceFileJavaScript(sourceFile);
const declarationFilePath = ((forceDtsPaths || options.declaration) && !isJs) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined;
const declarationMapPath = getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : undefined;
return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
}
}
function getSourceMapFilePath(jsFilePath: string, options: CompilerOptions) {
return options.sourceMap ? jsFilePath + ".map" : undefined;
return (options.sourceMap && !options.inlineSourceMap) ? jsFilePath + ".map" : undefined;
}
// JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also.
@@ -70,61 +85,31 @@ namespace ts {
return Extension.Js;
}
function getOriginalSourceFileOrBundle(sourceFileOrBundle: SourceFile | Bundle) {
if (sourceFileOrBundle.kind === SyntaxKind.Bundle) {
return updateBundle(sourceFileOrBundle, sameMap(sourceFileOrBundle.sourceFiles, getOriginalSourceFile));
}
return getOriginalSourceFile(sourceFileOrBundle);
}
/*@internal*/
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile, emitOnlyDtsFiles?: boolean, transformers?: TransformerFactory<SourceFile>[]): EmitResult {
const compilerOptions = host.getCompilerOptions();
const moduleKind = getEmitModuleKind(compilerOptions);
const sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined;
const sourceMapDataList: SourceMapData[] = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined;
const emittedFilesList: string[] = compilerOptions.listEmittedFiles ? [] : undefined;
const emitterDiagnostics = createDiagnosticCollection();
const newLine = host.getNewLine();
const writer = createTextWriter(newLine);
const sourceMap = createSourceMapWriter(host, writer);
let currentSourceFile: SourceFile;
let bundledHelpers: Map<boolean>;
let isOwnFileEmit: boolean;
let emitSkipped = false;
const sourceFiles = getSourceFilesToEmit(host, targetSourceFile);
// Transform the source files
const transform = transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, /*allowDtsFiles*/ false);
// Create a printer to print the nodes
const printer = createPrinter(compilerOptions, {
// resolver hooks
hasGlobalName: resolver.hasGlobalName,
// transform hooks
onEmitNode: transform.emitNodeWithNotification,
substituteNode: transform.substituteNode,
// sourcemap hooks
onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap,
onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap,
onEmitSourceMapOfPosition: sourceMap.emitPos,
// emitter hooks
onEmitHelpers: emitHelpers,
onSetSourceFile: setSourceFile,
const declarationSourceMap = createSourceMapWriter(host, writer, {
sourceMap: compilerOptions.declarationMap,
sourceRoot: compilerOptions.sourceRoot,
mapRoot: compilerOptions.mapRoot,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
// Explicitly do not passthru either `inline` option
});
let emitSkipped = false;
// Emit each output file
performance.mark("beforePrint");
forEachEmittedFile(host, emitSourceFileOrBundle, transform.transformed, emitOnlyDtsFiles);
forEachEmittedFile(host, emitSourceFileOrBundle, getSourceFilesToEmit(host, targetSourceFile), emitOnlyDtsFiles);
performance.measure("printTime", "beforePrint");
// Clean up emit nodes on parse tree
transform.dispose();
return {
emitSkipped,
@@ -133,20 +118,9 @@ namespace ts {
sourceMaps: sourceMapDataList
};
function emitSourceFileOrBundle({ jsFilePath, sourceMapFilePath, declarationFilePath }: EmitFileNames, sourceFileOrBundle: SourceFile | Bundle) {
// Make sure not to write js file and source map file if any of them cannot be written
if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit && !compilerOptions.emitDeclarationOnly) {
if (!emitOnlyDtsFiles) {
printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle);
}
}
else {
emitSkipped = true;
}
if (declarationFilePath) {
emitSkipped = writeDeclarationFile(declarationFilePath, getOriginalSourceFileOrBundle(sourceFileOrBundle), host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped;
}
function emitSourceFileOrBundle({ jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath }: EmitFileNames, sourceFileOrBundle: SourceFile | Bundle) {
emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath);
emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath);
if (!emitSkipped && emittedFilesList) {
if (!emitOnlyDtsFiles) {
@@ -161,100 +135,118 @@ namespace ts {
}
}
function printSourceFileOrBundle(jsFilePath: string, sourceMapFilePath: string, sourceFileOrBundle: SourceFile | Bundle) {
function emitJsFileOrBundle(sourceFileOrBundle: SourceFile | Bundle, jsFilePath: string, sourceMapFilePath: string) {
const sourceFiles = isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
// Make sure not to write js file and source map file if any of them cannot be written
if (host.isEmitBlocked(jsFilePath) || compilerOptions.noEmit || compilerOptions.emitDeclarationOnly) {
emitSkipped = true;
return;
}
if (emitOnlyDtsFiles) {
return;
}
// Transform the source files
const transform = transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, /*allowDtsFiles*/ false);
// Create a printer to print the nodes
const printer = createPrinter({ ...compilerOptions, noEmitHelpers: compilerOptions.noEmitHelpers } as PrinterOptions, {
// resolver hooks
hasGlobalName: resolver.hasGlobalName,
// transform hooks
onEmitNode: transform.emitNodeWithNotification,
substituteNode: transform.substituteNode,
// sourcemap hooks
onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap,
onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap,
onEmitSourceMapOfPosition: sourceMap.emitPos,
// emitter hooks
onSetSourceFile: setSourceFile,
});
printSourceFileOrBundle(jsFilePath, sourceMapFilePath, isSourceFile(sourceFileOrBundle) ? transform.transformed[0] : createBundle(transform.transformed), printer, sourceMap);
// Clean up emit nodes on parse tree
transform.dispose();
}
function emitDeclarationFileOrBundle(sourceFileOrBundle: SourceFile | Bundle, declarationFilePath: string | undefined, declarationMapPath: string | undefined) {
if (!(declarationFilePath && !isInJavaScriptFile(sourceFileOrBundle))) {
return;
}
const sourceFiles = isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
// Setup and perform the transformation to retrieve declarations from the input files
const nonJsFiles = filter(sourceFiles, isSourceFileNotJavaScript);
const inputListOrBundle = (compilerOptions.outFile || compilerOptions.out) ? [createBundle(nonJsFiles)] : nonJsFiles;
const declarationTransform = transformNodes(resolver, host, compilerOptions, inputListOrBundle, [transformDeclarations], /*allowDtsFiles*/ false);
if (length(declarationTransform.diagnostics)) {
for (const diagnostic of declarationTransform.diagnostics) {
emitterDiagnostics.add(diagnostic);
}
}
const declarationPrinter = createPrinter({ ...compilerOptions, onlyPrintJsDocStyle: true, noEmitHelpers: true } as PrinterOptions, {
// resolver hooks
hasGlobalName: resolver.hasGlobalName,
// sourcemap hooks
onEmitSourceMapOfNode: declarationSourceMap.emitNodeWithSourceMap,
onEmitSourceMapOfToken: declarationSourceMap.emitTokenWithSourceMap,
onEmitSourceMapOfPosition: declarationSourceMap.emitPos,
onSetSourceFile: setSourceFileForDeclarationSourceMaps,
// transform hooks
onEmitNode: declarationTransform.emitNodeWithNotification,
substituteNode: declarationTransform.substituteNode,
});
const declBlocked = (!!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length) || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
emitSkipped = emitSkipped || declBlocked;
if (!declBlocked || emitOnlyDtsFiles) {
printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], declarationPrinter, declarationSourceMap);
}
declarationTransform.dispose();
}
function printSourceFileOrBundle(jsFilePath: string, sourceMapFilePath: string | undefined, sourceFileOrBundle: SourceFile | Bundle, printer: Printer, mapRecorder: SourceMapWriter) {
const bundle = sourceFileOrBundle.kind === SyntaxKind.Bundle ? sourceFileOrBundle : undefined;
const sourceFile = sourceFileOrBundle.kind === SyntaxKind.SourceFile ? sourceFileOrBundle : undefined;
const sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle);
mapRecorder.initialize(jsFilePath, sourceMapFilePath || "", sourceFileOrBundle, sourceMapDataList);
if (bundle) {
bundledHelpers = createMap<boolean>();
isOwnFileEmit = false;
printer.writeBundle(bundle, writer);
}
else {
isOwnFileEmit = true;
printer.writeFile(sourceFile, writer);
}
writer.writeLine();
const sourceMappingURL = sourceMap.getSourceMappingURL();
const sourceMappingURL = mapRecorder.getSourceMappingURL();
if (sourceMappingURL) {
writer.write(`//# ${"sourceMappingURL"}=${sourceMappingURL}`); // Sometimes tools can sometimes see this line as a source mapping url comment
}
// Write the source map
if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles);
}
// Record source map data for the test harness.
if (sourceMapDataList) {
sourceMapDataList.push(sourceMap.getSourceMapData());
if (sourceMapFilePath) {
writeFile(host, emitterDiagnostics, sourceMapFilePath, mapRecorder.getText(), /*writeByteOrderMark*/ false, sourceFiles);
}
// Write the output file
writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles);
// Reset state
sourceMap.reset();
mapRecorder.reset();
writer.clear();
currentSourceFile = undefined;
bundledHelpers = undefined;
isOwnFileEmit = false;
}
function setSourceFile(node: SourceFile) {
currentSourceFile = node;
sourceMap.setSourceFile(node);
}
function emitHelpers(node: Node, writeLines: (text: string) => void) {
let helpersEmitted = false;
const bundle = node.kind === SyntaxKind.Bundle ? <Bundle>node : undefined;
if (bundle && moduleKind === ModuleKind.None) {
return;
}
const numNodes = bundle ? bundle.sourceFiles.length : 1;
for (let i = 0; i < numNodes; i++) {
const currentNode = bundle ? bundle.sourceFiles[i] : node;
const sourceFile = isSourceFile(currentNode) ? currentNode : currentSourceFile;
const shouldSkip = compilerOptions.noEmitHelpers || getExternalHelpersModuleName(sourceFile) !== undefined;
const shouldBundle = isSourceFile(currentNode) && !isOwnFileEmit;
const helpers = getEmitHelpers(currentNode);
if (helpers) {
for (const helper of stableSort(helpers, compareEmitHelpers)) {
if (!helper.scoped) {
// Skip the helper if it can be skipped and the noEmitHelpers compiler
// option is set, or if it can be imported and the importHelpers compiler
// option is set.
if (shouldSkip) continue;
// Skip the helper if it can be bundled but hasn't already been emitted and we
// are emitting a bundled module.
if (shouldBundle) {
if (bundledHelpers.get(helper.name)) {
continue;
}
bundledHelpers.set(helper.name, true);
}
}
else if (bundle) {
// Skip the helper if it is scoped and we are emitting bundled helpers
continue;
}
writeLines(helper.text);
helpersEmitted = true;
}
}
}
return helpersEmitted;
function setSourceFileForDeclarationSourceMaps(node: SourceFile) {
declarationSourceMap.setSourceFile(node);
}
}
@@ -265,7 +257,6 @@ namespace ts {
onEmitSourceMapOfToken,
onEmitSourceMapOfPosition,
onEmitNode,
onEmitHelpers,
onSetSourceFile,
substituteNode,
onBeforeEmitNodeArray,
@@ -303,6 +294,9 @@ namespace ts {
writeSemicolon = deferWriteSemicolon;
}
const syntheticParent: TextRange = { pos: -1, end: -1 };
const moduleKind = getEmitModuleKind(printerOptions);
const bundledHelpers = createMap<boolean>();
let isOwnFileEmit: boolean;
reset();
return {
@@ -379,11 +373,13 @@ namespace ts {
}
function writeBundle(bundle: Bundle, output: EmitTextWriter) {
isOwnFileEmit = false;
const previousWriter = writer;
setWriter(output);
emitShebangIfNeeded(bundle);
emitPrologueDirectivesIfNeeded(bundle);
emitHelpersIndirect(bundle);
emitHelpers(bundle);
emitSyntheticTripleSlashReferencesIfNeeded(bundle);
for (const sourceFile of bundle.sourceFiles) {
print(EmitHint.SourceFile, sourceFile, sourceFile);
}
@@ -392,6 +388,7 @@ namespace ts {
}
function writeFile(sourceFile: SourceFile, output: EmitTextWriter) {
isOwnFileEmit = true;
const previousWriter = writer;
setWriter(output);
emitShebangIfNeeded(sourceFile);
@@ -515,7 +512,7 @@ namespace ts {
writeSpace();
writeKeyword("in");
writeSpace();
emit(node.constraint);
emitIfPresent(node.constraint);
}
function pipelineEmitUnspecified(node: Node): void {
@@ -896,10 +893,55 @@ namespace ts {
return node && substituteNode && substituteNode(hint, node) || node;
}
function emitHelpersIndirect(node: Node) {
if (onEmitHelpers) {
onEmitHelpers(node, writeLines);
function emitHelpers(node: Node) {
let helpersEmitted = false;
const bundle = node.kind === SyntaxKind.Bundle ? <Bundle>node : undefined;
if (bundle && moduleKind === ModuleKind.None) {
return;
}
const numNodes = bundle ? bundle.sourceFiles.length : 1;
for (let i = 0; i < numNodes; i++) {
const currentNode = bundle ? bundle.sourceFiles[i] : node;
const sourceFile = isSourceFile(currentNode) ? currentNode : currentSourceFile;
const shouldSkip = printerOptions.noEmitHelpers || getExternalHelpersModuleName(sourceFile) !== undefined;
const shouldBundle = isSourceFile(currentNode) && !isOwnFileEmit;
const helpers = getEmitHelpers(currentNode);
if (helpers) {
for (const helper of stableSort(helpers, compareEmitHelpers)) {
if (!helper.scoped) {
// Skip the helper if it can be skipped and the noEmitHelpers compiler
// option is set, or if it can be imported and the importHelpers compiler
// option is set.
if (shouldSkip) continue;
// Skip the helper if it can be bundled but hasn't already been emitted and we
// are emitting a bundled module.
if (shouldBundle) {
if (bundledHelpers.get(helper.name)) {
continue;
}
bundledHelpers.set(helper.name, true);
}
}
else if (bundle) {
// Skip the helper if it is scoped and we are emitting bundled helpers
continue;
}
if (typeof helper.text === "string") {
writeLines(helper.text);
}
else {
writeLines(helper.text(makeFileLevelOptmiisticUniqueName));
}
helpersEmitted = true;
}
}
}
return helpersEmitted;
}
//
@@ -993,7 +1035,7 @@ namespace ts {
}
emitIfPresent(node.questionToken);
if (node.parent && node.parent.kind === SyntaxKind.JSDocFunctionType && !node.name) {
emit(node.type);
emitIfPresent(node.type);
}
else {
emitTypeAnnotation(node.type);
@@ -1121,14 +1163,14 @@ namespace ts {
writeSpace();
writePunctuation("=>");
writeSpace();
emit(node.type);
emitIfPresent(node.type);
}
function emitJSDocFunctionType(node: JSDocFunctionType) {
write("function");
emitParameters(node, node.parameters);
write(":");
emit(node.type);
emitIfPresent(node.type);
}
@@ -1155,7 +1197,7 @@ namespace ts {
writeSpace();
writePunctuation("=>");
writeSpace();
emit(node.type);
emitIfPresent(node.type);
}
function emitTypeQuery(node: TypeQueryNode) {
@@ -1269,7 +1311,7 @@ namespace ts {
}
writePunctuation(":");
writeSpace();
emit(node.type);
emitIfPresent(node.type);
writeSemicolon();
if (emitFlags & EmitFlags.SingleLine) {
writeSpace();
@@ -1540,7 +1582,7 @@ namespace ts {
function emitYieldExpression(node: YieldExpression) {
emitTokenWithComment(SyntaxKind.YieldKeyword, node.pos, writeKeyword, node);
emit(node.asteriskToken);
emitIfPresent(node.asteriskToken);
emitExpressionWithLeadingSpace(node.expression);
}
@@ -1728,14 +1770,14 @@ namespace ts {
writeSemicolon();
}
function emitTokenWithComment(token: SyntaxKind, pos: number, writer: (s: string) => void, contextNode?: Node, indentLeading?: boolean) {
const node = contextNode && getParseTreeNode(contextNode);
function emitTokenWithComment(token: SyntaxKind, pos: number, writer: (s: string) => void, contextNode: Node, indentLeading?: boolean) {
const node = getParseTreeNode(contextNode);
const isSimilarNode = node && node.kind === contextNode.kind;
const startPos = pos;
if (isSimilarNode) {
pos = skipTrivia(currentSourceFile.text, pos);
}
if (emitLeadingCommentsOfPosition && isSimilarNode) {
if (emitLeadingCommentsOfPosition && isSimilarNode && contextNode.pos !== startPos) {
const needsIndent = indentLeading && !positionsAreOnSameLine(startPos, pos, currentSourceFile);
if (needsIndent) {
increaseIndent();
@@ -1746,7 +1788,7 @@ namespace ts {
}
}
pos = writeTokenText(token, writer, pos);
if (emitTrailingCommentsOfPosition && isSimilarNode) {
if (emitTrailingCommentsOfPosition && isSimilarNode && contextNode.end !== pos) {
emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ true);
}
return pos;
@@ -1953,7 +1995,7 @@ namespace ts {
// Emit all the prologue directives (like "use strict").
const statementOffset = emitPrologueDirectives(body.statements, /*startWithNewLine*/ true);
const pos = writer.getTextPos();
emitHelpersIndirect(body);
emitHelpers(body);
if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) {
decreaseIndent();
emitList(body, body.statements, ListFormat.SingleLineFunctionBodyStatements);
@@ -2044,6 +2086,7 @@ namespace ts {
emit(node.name);
let body = node.body;
if (!body) return writeSemicolon();
while (body.kind === SyntaxKind.ModuleDeclaration) {
writePunctuation(".");
emit((<ModuleDeclaration>body).name);
@@ -2102,12 +2145,12 @@ namespace ts {
}
function emitImportClause(node: ImportClause) {
emit(node.name);
emitIfPresent(node.name);
if (node.name && node.namedBindings) {
emitTokenWithComment(SyntaxKind.CommaToken, node.name.end, writePunctuation, node);
writeSpace();
}
emit(node.namedBindings);
emitIfPresent(node.namedBindings);
}
function emitNamespaceImport(node: NamespaceImport) {
@@ -2220,10 +2263,7 @@ namespace ts {
writePunctuation("<");
emitJsxTagName(node.tagName);
writeSpace();
// We are checking here so we won't re-enter the emiting pipeline and emit extra sourcemap
if (node.attributes.properties && node.attributes.properties.length > 0) {
emit(node.attributes);
}
emit(node.attributes);
writePunctuation("/>");
}
@@ -2238,11 +2278,10 @@ namespace ts {
if (isJsxOpeningElement(node)) {
emitJsxTagName(node.tagName);
// We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap
if (node.attributes.properties && node.attributes.properties.length > 0) {
writeSpace();
emit(node.attributes);
}
emit(node.attributes);
}
writePunctuation(">");
@@ -2422,11 +2461,50 @@ namespace ts {
emitSourceFileWorker(node);
}
function emitSyntheticTripleSlashReferencesIfNeeded(node: Bundle) {
emitTripleSlashDirectives(node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || []);
}
function emitTripleSlashDirectivesIfNeeded(node: SourceFile) {
if (node.isDeclarationFile) emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives);
}
function emitTripleSlashDirectives(hasNoDefaultLib: boolean, files: ReadonlyArray<FileReference>, types: ReadonlyArray<FileReference>) {
if (hasNoDefaultLib) {
write(`/// <reference no-default-lib="true"/>`);
writeLine();
}
if (currentSourceFile && currentSourceFile.moduleName) {
write(`/// <amd-module name="${currentSourceFile.moduleName}" />`);
writeLine();
}
if (currentSourceFile && currentSourceFile.amdDependencies) {
for (const dep of currentSourceFile.amdDependencies) {
if (dep.name) {
write(`/// <amd-dependency name="${dep.name}" path="${dep.path}" />`);
}
else {
write(`/// <amd-dependency path="${dep.path}" />`);
}
writeLine();
}
}
for (const directive of files) {
write(`/// <reference path="${directive.fileName}" />`);
writeLine();
}
for (const directive of types) {
write(`/// <reference types="${directive.fileName}" />`);
writeLine();
}
}
function emitSourceFileWorker(node: SourceFile) {
const statements = node.statements;
pushNameGenerationScope(node);
emitHelpersIndirect(node);
emitHelpers(node);
const index = findIndex(statements, statement => !isPrologueDirective(statement));
emitTripleSlashDirectivesIfNeeded(node);
emitList(node, statements, ListFormat.MultiLine, index === -1 ? statements.length : index);
popNameGenerationScope(node);
}
@@ -2672,7 +2750,7 @@ namespace ts {
if (format & ListFormat.BracketsMask) {
writePunctuation(getOpeningBracket(format));
if (isEmpty) {
if (isEmpty && !isUndefined) {
emitTrailingCommentsOfPosition(children.pos, /*prefixSpace*/ true); // Emit comments within empty bracketed lists
}
}
@@ -2800,7 +2878,7 @@ namespace ts {
}
if (format & ListFormat.BracketsMask) {
if (isEmpty) {
if (isEmpty && !isUndefined) {
emitLeadingCommentsOfPosition(children.end); // Emit leading comments within empty lists
}
writePunctuation(getClosingBracket(format));
@@ -2931,21 +3009,6 @@ namespace ts {
}
}
function guessIndentation(lines: string[]) {
let indentation: number;
for (const line of lines) {
for (let i = 0; i < line.length && (indentation === undefined || i < indentation); i++) {
if (!isWhiteSpaceLike(line.charCodeAt(i))) {
if (indentation === undefined || i < indentation) {
indentation = i;
break;
}
}
}
}
return indentation;
}
function increaseIndentIf(value: boolean, valueToWriteWhenNotIndenting?: string) {
if (value) {
increaseIndent();
@@ -3182,12 +3245,18 @@ namespace ts {
* or within the NameGenerator.
*/
function isUniqueName(name: string): boolean {
return !(hasGlobalName && hasGlobalName(name))
&& !currentSourceFile.identifiers.has(name)
return isFileLevelUniqueName(name)
&& !generatedNames.has(name)
&& !(reservedNames && reservedNames.has(name));
}
/**
* Returns a value indicating whether a name is unique globally or within the current file.
*/
function isFileLevelUniqueName(name: string) {
return ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName);
}
/**
* Returns a value indicating whether a name is unique within a container.
*/
@@ -3243,8 +3312,15 @@ namespace ts {
* in global scope. The name is formed by adding an '_n' suffix to the specified base name,
* where n is a positive integer. Note that names generated by makeTempVariableName and
* makeUniqueName are guaranteed to never conflict.
* If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1'
*/
function makeUniqueName(baseName: string): string {
function makeUniqueName(baseName: string, checkFn: (name: string) => boolean = isUniqueName, optimistic?: boolean): string {
if (optimistic) {
if (checkFn(baseName)) {
generatedNames.set(baseName, true);
return baseName;
}
}
// Find the first unique 'name_n', where n is a positive number
if (baseName.charCodeAt(baseName.length - 1) !== CharacterCodes._) {
baseName += "_";
@@ -3252,7 +3328,7 @@ namespace ts {
let i = 1;
while (true) {
const generatedName = baseName + i;
if (isUniqueName(generatedName)) {
if (checkFn(generatedName)) {
generatedNames.set(generatedName, true);
return generatedName;
}
@@ -3260,6 +3336,10 @@ namespace ts {
}
}
function makeFileLevelOptmiisticUniqueName(name: string) {
return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true);
}
/**
* Generates a unique name for a ModuleDeclaration or EnumDeclaration.
*/
@@ -3338,7 +3418,11 @@ namespace ts {
case GeneratedIdentifierFlags.Loop:
return makeTempVariableName(TempFlags._i, !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes));
case GeneratedIdentifierFlags.Unique:
return makeUniqueName(idText(name));
return makeUniqueName(
idText(name),
(name.autoGenerateFlags & GeneratedIdentifierFlags.FileLevel) ? isFileLevelUniqueName : isUniqueName,
!!(name.autoGenerateFlags & GeneratedIdentifierFlags.Optimistic)
);
}
Debug.fail("Unsupported GeneratedIdentifierKind.");
+74 -24
View File
@@ -24,14 +24,14 @@ namespace ts {
* Make `elements` into a `NodeArray<T>`. If `elements` is `undefined`, returns an empty `NodeArray<T>`.
*/
export function createNodeArray<T extends Node>(elements?: ReadonlyArray<T>, hasTrailingComma?: boolean): NodeArray<T> {
if (elements) {
if (!elements || elements === emptyArray) {
elements = [];
}
else {
if (isNodeArray(elements)) {
return elements;
}
}
else {
elements = [];
}
const array = <NodeArray<T>>elements;
array.pos = -1;
@@ -70,12 +70,13 @@ namespace ts {
// Literals
/* @internal */ export function createLiteral(value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier, isSingleQuote: boolean): StringLiteral; // tslint:disable-line unified-signatures
/** If a node is passed, creates a string literal whose source text is read from a source node during emit. */
export function createLiteral(value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier): StringLiteral;
export function createLiteral(value: number): NumericLiteral;
export function createLiteral(value: boolean): BooleanLiteral;
export function createLiteral(value: string | number | boolean): PrimaryExpression;
export function createLiteral(value: string | number | boolean | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier): PrimaryExpression {
export function createLiteral(value: string | number | boolean | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier, isSingleQuote?: boolean): PrimaryExpression {
if (typeof value === "number") {
return createNumericLiteral(value + "");
}
@@ -83,7 +84,9 @@ namespace ts {
return value ? createTrue() : createFalse();
}
if (isString(value)) {
return createStringLiteral(value);
const res = createStringLiteral(value);
if (isSingleQuote) res.singleQuote = true;
return res;
}
return createLiteralFromNode(value);
}
@@ -171,6 +174,22 @@ namespace ts {
return name;
}
/** Create a unique name based on the supplied text. */
export function createOptimisticUniqueName(text: string): Identifier {
const name = createIdentifier(text);
name.autoGenerateFlags = GeneratedIdentifierFlags.Unique | GeneratedIdentifierFlags.Optimistic;
name.autoGenerateId = nextAutoGenerateId;
nextAutoGenerateId++;
return name;
}
/** Create a unique name based on the supplied text. This does not consider names injected by the transformer. */
export function createFileLevelUniqueName(text: string): Identifier {
const name = createOptimisticUniqueName(text);
name.autoGenerateFlags |= GeneratedIdentifierFlags.FileLevel;
return name;
}
/** Create a unique name generated for a node. */
export function getGeneratedNameForNode(node: Node): Identifier;
/* @internal */ export function getGeneratedNameForNode(node: Node, shouldSkipNameGenerationScope?: boolean): Identifier; // tslint:disable-line unified-signatures
@@ -214,6 +233,28 @@ namespace ts {
return <BooleanLiteral & Token<SyntaxKind.FalseKeyword>>createSynthesizedNode(SyntaxKind.FalseKeyword);
}
// Modifiers
export function createModifier<T extends Modifier["kind"]>(kind: T) {
return createToken(kind);
}
export function createModifiersFromModifierFlags(flags: ModifierFlags) {
const result: Modifier[] = [];
if (flags & ModifierFlags.Export) { result.push(createModifier(SyntaxKind.ExportKeyword)); }
if (flags & ModifierFlags.Ambient) { result.push(createModifier(SyntaxKind.DeclareKeyword)); }
if (flags & ModifierFlags.Default) { result.push(createModifier(SyntaxKind.DefaultKeyword)); }
if (flags & ModifierFlags.Const) { result.push(createModifier(SyntaxKind.ConstKeyword)); }
if (flags & ModifierFlags.Public) { result.push(createModifier(SyntaxKind.PublicKeyword)); }
if (flags & ModifierFlags.Private) { result.push(createModifier(SyntaxKind.PrivateKeyword)); }
if (flags & ModifierFlags.Protected) { result.push(createModifier(SyntaxKind.ProtectedKeyword)); }
if (flags & ModifierFlags.Abstract) { result.push(createModifier(SyntaxKind.AbstractKeyword)); }
if (flags & ModifierFlags.Static) { result.push(createModifier(SyntaxKind.StaticKeyword)); }
if (flags & ModifierFlags.Readonly) { result.push(createModifier(SyntaxKind.ReadonlyKeyword)); }
if (flags & ModifierFlags.Async) { result.push(createModifier(SyntaxKind.AsyncKeyword)); }
return result;
}
// Names
export function createQualifiedName(left: EntityName, right: string | Identifier) {
@@ -1953,7 +1994,7 @@ namespace ts {
decorators: ReadonlyArray<Decorator> | undefined,
modifiers: ReadonlyArray<Modifier> | undefined,
importClause: ImportClause | undefined,
moduleSpecifier?: Expression): ImportDeclaration {
moduleSpecifier: Expression): ImportDeclaration {
const node = <ImportDeclaration>createSynthesizedNode(SyntaxKind.ImportDeclaration);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
@@ -2126,31 +2167,35 @@ namespace ts {
: node;
}
export function createJsxSelfClosingElement(tagName: JsxTagNameExpression, attributes: JsxAttributes) {
export function createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes) {
const node = <JsxSelfClosingElement>createSynthesizedNode(SyntaxKind.JsxSelfClosingElement);
node.tagName = tagName;
node.typeArguments = typeArguments && createNodeArray(typeArguments);
node.attributes = attributes;
return node;
}
export function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, attributes: JsxAttributes) {
export function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes) {
return node.tagName !== tagName
|| node.typeArguments !== typeArguments
|| node.attributes !== attributes
? updateNode(createJsxSelfClosingElement(tagName, attributes), node)
? updateNode(createJsxSelfClosingElement(tagName, typeArguments, attributes), node)
: node;
}
export function createJsxOpeningElement(tagName: JsxTagNameExpression, attributes: JsxAttributes) {
export function createJsxOpeningElement(tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes) {
const node = <JsxOpeningElement>createSynthesizedNode(SyntaxKind.JsxOpeningElement);
node.tagName = tagName;
node.typeArguments = typeArguments && createNodeArray(typeArguments);
node.attributes = attributes;
return node;
}
export function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributes) {
export function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes) {
return node.tagName !== tagName
|| node.typeArguments !== typeArguments
|| node.attributes !== attributes
? updateNode(createJsxOpeningElement(tagName, attributes), node)
? updateNode(createJsxOpeningElement(tagName, typeArguments, attributes), node)
: node;
}
@@ -2349,8 +2394,14 @@ namespace ts {
// Top-level nodes
export function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>) {
if (node.statements !== statements) {
export function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean) {
if (
node.statements !== statements ||
(isDeclarationFile !== undefined && node.isDeclarationFile !== isDeclarationFile) ||
(referencedFiles !== undefined && node.referencedFiles !== referencedFiles) ||
(typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) ||
(hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)
) {
const updated = <SourceFile>createSynthesizedNode(SyntaxKind.SourceFile);
updated.flags |= node.flags;
updated.statements = createNodeArray(statements);
@@ -2358,14 +2409,14 @@ namespace ts {
updated.fileName = node.fileName;
updated.path = node.path;
updated.text = node.text;
updated.isDeclarationFile = isDeclarationFile === undefined ? node.isDeclarationFile : isDeclarationFile;
updated.referencedFiles = referencedFiles === undefined ? node.referencedFiles : referencedFiles;
updated.typeReferenceDirectives = typeReferences === undefined ? node.typeReferenceDirectives : typeReferences;
updated.hasNoDefaultLib = hasNoDefaultLib === undefined ? node.hasNoDefaultLib : hasNoDefaultLib;
if (node.amdDependencies !== undefined) updated.amdDependencies = node.amdDependencies;
if (node.moduleName !== undefined) updated.moduleName = node.moduleName;
if (node.referencedFiles !== undefined) updated.referencedFiles = node.referencedFiles;
if (node.typeReferenceDirectives !== undefined) updated.typeReferenceDirectives = node.typeReferenceDirectives;
if (node.languageVariant !== undefined) updated.languageVariant = node.languageVariant;
if (node.isDeclarationFile !== undefined) updated.isDeclarationFile = node.isDeclarationFile;
if (node.renamedDependencies !== undefined) updated.renamedDependencies = node.renamedDependencies;
if (node.hasNoDefaultLib !== undefined) updated.hasNoDefaultLib = node.hasNoDefaultLib;
if (node.languageVersion !== undefined) updated.languageVersion = node.languageVersion;
if (node.scriptKind !== undefined) updated.scriptKind = node.scriptKind;
if (node.externalModuleIndicator !== undefined) updated.externalModuleIndicator = node.externalModuleIndicator;
@@ -2958,7 +3009,8 @@ namespace ts {
requestEmitHelper: noop,
resumeLexicalEnvironment: noop,
startLexicalEnvironment: noop,
suspendLexicalEnvironment: noop
suspendLexicalEnvironment: noop,
addDiagnostic: noop,
};
// Compound nodes
@@ -3157,8 +3209,7 @@ namespace ts {
return { value: o && o[i++], done: !o };
}
};
};
`
};`
};
export function createValuesHelper(context: TransformationContext, expression: Expression, location?: TextRange) {
@@ -3192,8 +3243,7 @@ namespace ts {
finally { if (e) throw e.error; }
}
return ar;
};
`
};`
};
export function createReadHelper(context: TransformationContext, iteratorRecord: Expression, count: number | undefined, location?: TextRange) {
+5 -3
View File
@@ -794,6 +794,7 @@ namespace ts {
if (traceEnabled) {
trace(host, Diagnostics.Resolving_real_path_for_0_result_1, path, real);
}
Debug.assert(host.fileExists(real), `${path} linked to nonexistent file ${real}`); // tslint:disable-line
return real;
}
@@ -1118,7 +1119,7 @@ namespace ts {
const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
return forEachAncestorDirectory(normalizeSlashes(directory), ancestorDirectory => {
if (getBaseFileName(ancestorDirectory) !== "node_modules") {
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host);
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host, failedLookupLocations);
if (resolutionFromCache) {
return resolutionFromCache;
}
@@ -1196,12 +1197,13 @@ namespace ts {
typesPackageName;
}
function tryFindNonRelativeModuleNameInCache(cache: PerModuleNameCache | undefined, moduleName: string, containingDirectory: string, traceEnabled: boolean, host: ModuleResolutionHost): SearchResult<Resolved> {
function tryFindNonRelativeModuleNameInCache(cache: PerModuleNameCache | undefined, moduleName: string, containingDirectory: string, traceEnabled: boolean, host: ModuleResolutionHost, failedLookupLocations: Push<string>): SearchResult<Resolved> {
const result = cache && cache.get(containingDirectory);
if (result) {
if (traceEnabled) {
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
}
failedLookupLocations.push(...result.failedLookupLocations);
return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId } };
}
}
@@ -1226,7 +1228,7 @@ namespace ts {
if (!isExternalModuleNameRelative(moduleName)) {
// Climb up parent directories looking for a module.
const resolved = forEachAncestorDirectory(containingDirectory, directory => {
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host);
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host, failedLookupLocations);
if (resolutionFromCache) {
return resolutionFromCache;
}
+141 -185
View File
@@ -52,6 +52,13 @@ namespace ts {
}
}
/*@internal*/
export function isJSDocLikeText(text: string, start: number) {
return text.charCodeAt(start + 1) === CharacterCodes.asterisk &&
text.charCodeAt(start + 2) === CharacterCodes.asterisk &&
text.charCodeAt(start + 3) !== CharacterCodes.slash;
}
/**
* Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes
* stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise,
@@ -422,6 +429,7 @@ namespace ts {
case SyntaxKind.JsxSelfClosingElement:
case SyntaxKind.JsxOpeningElement:
return visitNode(cbNode, (<JsxOpeningLikeElement>node).tagName) ||
visitNodes(cbNode, cbNodes, (<JsxOpeningLikeElement>node).typeArguments) ||
visitNode(cbNode, (<JsxOpeningLikeElement>node).attributes);
case SyntaxKind.JsxAttributes:
return visitNodes(cbNode, cbNodes, (<JsxAttributes>node).properties);
@@ -971,10 +979,7 @@ namespace ts {
}
function parseErrorAtCurrentToken(message: DiagnosticMessage, arg0?: any): void {
const start = scanner.getTokenPos();
const length = scanner.getTextPos() - start;
parseErrorAtPosition(start, length, message, arg0);
parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
}
function parseErrorAtPosition(start: number, length: number, message: DiagnosticMessage, arg0?: any): void {
@@ -989,9 +994,16 @@ namespace ts {
parseErrorBeforeNextFinishedNode = true;
}
function scanError(message: DiagnosticMessage, length?: number) {
const pos = scanner.getTextPos();
parseErrorAtPosition(pos, length || 0, message);
function parseErrorAt(start: number, end: number, message: DiagnosticMessage, arg0?: any): void {
parseErrorAtPosition(start, end - start, message, arg0);
}
function parseErrorAtRange(range: TextRange, message: DiagnosticMessage, arg0?: any): void {
parseErrorAt(range.pos, range.end, message, arg0);
}
function scanError(message: DiagnosticMessage, length: number): void {
parseErrorAtPosition(scanner.getTextPos(), length, message);
}
function getNodePos(): number {
@@ -1332,26 +1344,26 @@ namespace ts {
}
function nextTokenCanFollowModifier() {
if (token() === SyntaxKind.ConstKeyword) {
// 'const' is only a modifier if followed by 'enum'.
return nextToken() === SyntaxKind.EnumKeyword;
switch (token()) {
case SyntaxKind.ConstKeyword:
// 'const' is only a modifier if followed by 'enum'.
return nextToken() === SyntaxKind.EnumKeyword;
case SyntaxKind.ExportKeyword:
nextToken();
if (token() === SyntaxKind.DefaultKeyword) {
return lookAhead(nextTokenCanFollowDefaultKeyword);
}
return token() !== SyntaxKind.AsteriskToken && token() !== SyntaxKind.AsKeyword && token() !== SyntaxKind.OpenBraceToken && canFollowModifier();
case SyntaxKind.DefaultKeyword:
return nextTokenCanFollowDefaultKeyword();
case SyntaxKind.StaticKeyword:
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
nextToken();
return canFollowModifier();
default:
return nextTokenIsOnSameLineAndCanFollowModifier();
}
if (token() === SyntaxKind.ExportKeyword) {
nextToken();
if (token() === SyntaxKind.DefaultKeyword) {
return lookAhead(nextTokenCanFollowDefaultKeyword);
}
return token() !== SyntaxKind.AsteriskToken && token() !== SyntaxKind.AsKeyword && token() !== SyntaxKind.OpenBraceToken && canFollowModifier();
}
if (token() === SyntaxKind.DefaultKeyword) {
return nextTokenCanFollowDefaultKeyword();
}
if (token() === SyntaxKind.StaticKeyword) {
nextToken();
return canFollowModifier();
}
return nextTokenIsOnSameLineAndCanFollowModifier();
}
function parseAnyContextualModifier(): boolean {
@@ -2196,9 +2208,21 @@ namespace ts {
return finishNode(node);
}
function parseJSDocAllType(): JSDocAllType {
const result = <JSDocAllType>createNode(SyntaxKind.JSDocAllType);
function parseJSDocAllType(postFixEquals: boolean): JSDocAllType | JSDocOptionalType {
const result = createNode(SyntaxKind.JSDocAllType) as JSDocAllType;
if (postFixEquals) {
return createJSDocPostfixType(SyntaxKind.JSDocOptionalType, result) as JSDocOptionalType;
}
else {
nextToken();
}
return finishNode(result);
}
function parseJSDocNonNullableType(): TypeNode {
const result = createNode(SyntaxKind.JSDocNonNullableType) as JSDocNonNullableType;
nextToken();
result.type = parseNonArrayType();
return finishNode(result);
}
@@ -2252,15 +2276,22 @@ namespace ts {
parameter.name = parseIdentifierName();
parseExpected(SyntaxKind.ColonToken);
}
parameter.type = parseType();
parameter.type = parseJSDocType();
return finishNode(parameter);
}
function parseJSDocNodeWithType(kind: SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocNonNullableType): TypeNode {
const result = createNode(kind) as JSDocVariadicType | JSDocNonNullableType;
nextToken();
result.type = parseNonArrayType();
return finishNode(result);
function parseJSDocType() {
const dotdotdot = parseOptionalToken(SyntaxKind.DotDotDotToken);
let type = parseType();
if (dotdotdot) {
const variadic = createNode(SyntaxKind.JSDocVariadicType, dotdotdot.pos) as JSDocVariadicType;
variadic.type = type;
type = finishNode(variadic);
}
if (token() === SyntaxKind.EqualsToken) {
return createJSDocPostfixType(SyntaxKind.JSDocOptionalType, type);
}
return type;
}
function parseTypeQuery(): TypeQueryNode {
@@ -2719,13 +2750,15 @@ namespace ts {
// If these are followed by a dot, then parse these out as a dotted type reference instead.
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
case SyntaxKind.AsteriskToken:
return parseJSDocAllType();
return parseJSDocAllType(/*postfixEquals*/ false);
case SyntaxKind.AsteriskEqualsToken:
return parseJSDocAllType(/*postfixEquals*/ true);
case SyntaxKind.QuestionToken:
return parseJSDocUnknownOrNullableType();
case SyntaxKind.FunctionKeyword:
return parseJSDocFunctionType();
case SyntaxKind.ExclamationToken:
return parseJSDocNodeWithType(SyntaxKind.JSDocNonNullableType);
return parseJSDocNonNullableType();
case SyntaxKind.NoSubstitutionTemplateLiteral:
case SyntaxKind.StringLiteral:
case SyntaxKind.NumericLiteral:
@@ -2810,13 +2843,6 @@ namespace ts {
let type = parseNonArrayType();
while (!scanner.hasPrecedingLineBreak()) {
switch (token()) {
case SyntaxKind.EqualsToken:
// only parse postfix = inside jsdoc, because it's ambiguous elsewhere
if (!(contextFlags & NodeFlags.JSDoc)) {
return type;
}
type = createJSDocPostfixType(SyntaxKind.JSDocOptionalType, type);
break;
case SyntaxKind.ExclamationToken:
type = createJSDocPostfixType(SyntaxKind.JSDocNonNullableType, type);
break;
@@ -2882,12 +2908,6 @@ namespace ts {
return parseTypeOperator(operator);
case SyntaxKind.InferKeyword:
return parseInferType();
case SyntaxKind.DotDotDotToken: {
const result = createNode(SyntaxKind.JSDocVariadicType) as JSDocVariadicType;
nextToken();
result.type = parsePostfixTypeOrHigher();
return finishNode(result);
}
}
return parsePostfixTypeOrHigher();
}
@@ -3580,7 +3600,7 @@ namespace ts {
// reScanGreaterToken so that we merge token sequences like > and = into >=
reScanGreaterToken();
const newPrecedence = getBinaryOperatorPrecedence();
const newPrecedence = getBinaryOperatorPrecedence(token());
// Check the precedence to see if we should "take" this operator
// - For left associative operator (all operator but **), consume the operator,
@@ -3642,52 +3662,7 @@ namespace ts {
return false;
}
return getBinaryOperatorPrecedence() > 0;
}
function getBinaryOperatorPrecedence(): number {
switch (token()) {
case SyntaxKind.BarBarToken:
return 1;
case SyntaxKind.AmpersandAmpersandToken:
return 2;
case SyntaxKind.BarToken:
return 3;
case SyntaxKind.CaretToken:
return 4;
case SyntaxKind.AmpersandToken:
return 5;
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsEqualsToken:
return 6;
case SyntaxKind.LessThanToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.InstanceOfKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.AsKeyword:
return 7;
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
return 8;
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
return 9;
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
return 10;
case SyntaxKind.AsteriskAsteriskToken:
return 11;
}
// -1 is lower than all other precedences. Returning it will cause binary expression
// parsing to stop.
return -1;
return getBinaryOperatorPrecedence(token()) > 0;
}
function makeBinaryExpression(left: Expression, operatorToken: BinaryOperatorToken, right: Expression): BinaryExpression {
@@ -3775,7 +3750,7 @@ namespace ts {
if (isUpdateExpression()) {
const updateExpression = parseUpdateExpression();
return token() === SyntaxKind.AsteriskAsteriskToken ?
<BinaryExpression>parseBinaryExpressionRest(getBinaryOperatorPrecedence(), updateExpression) :
<BinaryExpression>parseBinaryExpressionRest(getBinaryOperatorPrecedence(token()), updateExpression) :
updateExpression;
}
@@ -3793,12 +3768,13 @@ namespace ts {
const unaryOperator = token();
const simpleUnaryExpression = parseSimpleUnaryExpression();
if (token() === SyntaxKind.AsteriskAsteriskToken) {
const start = skipTrivia(sourceText, simpleUnaryExpression.pos);
const pos = skipTrivia(sourceText, simpleUnaryExpression.pos);
const { end } = simpleUnaryExpression;
if (simpleUnaryExpression.kind === SyntaxKind.TypeAssertionExpression) {
parseErrorAtPosition(start, simpleUnaryExpression.end - start, Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
parseErrorAt(pos, end, Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
parseErrorAtPosition(start, simpleUnaryExpression.end - start, Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, tokenToString(unaryOperator));
parseErrorAt(pos, end, Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, tokenToString(unaryOperator));
}
}
return simpleUnaryExpression;
@@ -4069,7 +4045,7 @@ namespace ts {
node.closingElement = parseJsxClosingElement(inExpressionContext);
if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) {
parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName));
parseErrorAtRange(node.closingElement, Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName));
}
result = finishNode(node);
@@ -4119,17 +4095,31 @@ namespace ts {
return finishNode(node);
}
function parseJsxChild(): JsxChild {
switch (token()) {
function parseJsxChild(openingTag: JsxOpeningElement | JsxOpeningFragment, token: JsxTokenSyntaxKind): JsxChild | undefined {
switch (token) {
case SyntaxKind.EndOfFileToken:
// If we hit EOF, issue the error at the tag that lacks the closing element
// rather than at the end of the file (which is useless)
if (isJsxOpeningFragment(openingTag)) {
parseErrorAtRange(openingTag, Diagnostics.JSX_fragment_has_no_corresponding_closing_tag);
}
else {
parseErrorAtRange(openingTag.tagName, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTag.tagName));
}
return undefined;
case SyntaxKind.LessThanSlashToken:
case SyntaxKind.ConflictMarkerTrivia:
return undefined;
case SyntaxKind.JsxText:
case SyntaxKind.JsxTextAllWhiteSpaces:
return parseJsxText();
case SyntaxKind.OpenBraceToken:
return parseJsxExpression(/*inExpressionContext*/ false)!;
return parseJsxExpression(/*inExpressionContext*/ false);
case SyntaxKind.LessThanToken:
return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ false);
default:
return Debug.assertNever(token);
}
Debug.fail("Unknown JSX child kind " + token());
}
function parseJsxChildren(openingTag: JsxOpeningElement | JsxOpeningFragment): NodeArray<JsxChild> {
@@ -4139,34 +4129,12 @@ namespace ts {
parsingContext |= 1 << ParsingContext.JsxChildren;
while (true) {
currentToken = scanner.reScanJsxToken();
if (token() === SyntaxKind.LessThanSlashToken) {
// Closing tag
break;
}
else if (token() === SyntaxKind.EndOfFileToken) {
// If we hit EOF, issue the error at the tag that lacks the closing element
// rather than at the end of the file (which is useless)
if (isJsxOpeningFragment(openingTag)) {
parseErrorAtPosition(openingTag.pos, openingTag.end - openingTag.pos, Diagnostics.JSX_fragment_has_no_corresponding_closing_tag);
}
else {
const openingTagName = openingTag.tagName;
parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTagName));
}
break;
}
else if (token() === SyntaxKind.ConflictMarkerTrivia) {
break;
}
const child = parseJsxChild();
if (child) {
list.push(child);
}
const child = parseJsxChild(openingTag, currentToken = scanner.reScanJsxToken());
if (!child) break;
list.push(child);
}
parsingContext = saveParsingContext;
return createNodeArray(list, listPos);
}
@@ -4189,6 +4157,7 @@ namespace ts {
}
const tagName = parseJsxElementName();
const typeArguments = tryParseTypeArguments();
const attributes = parseJsxAttributes();
let node: JsxOpeningLikeElement;
@@ -4213,6 +4182,7 @@ namespace ts {
}
node.tagName = tagName;
node.typeArguments = typeArguments;
node.attributes = attributes;
return finishNode(node);
@@ -4306,8 +4276,7 @@ namespace ts {
const node = <JsxClosingFragment>createNode(SyntaxKind.JsxClosingFragment);
parseExpected(SyntaxKind.LessThanSlashToken);
if (tokenIsIdentifierOrKeyword(token())) {
const unexpectedTagName = parseJsxElementName();
parseErrorAtPosition(unexpectedTagName.pos, unexpectedTagName.end - unexpectedTagName.pos, Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
}
if (inExpressionContext) {
parseExpected(SyntaxKind.GreaterThanToken);
@@ -5492,19 +5461,6 @@ namespace ts {
return finishNode(node);
}
function isClassMemberModifier(idToken: SyntaxKind) {
switch (idToken) {
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.StaticKeyword:
case SyntaxKind.ReadonlyKeyword:
return true;
default:
return false;
}
}
function isClassMemberStart(): boolean {
let idToken: SyntaxKind;
@@ -6055,8 +6011,7 @@ namespace ts {
node.name = identifierName;
}
if (kind === SyntaxKind.ImportSpecifier && checkIdentifierIsKeyword) {
// Report error identifier expected
parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, Diagnostics.Identifier_expected);
parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected);
}
return finishNode(node);
}
@@ -6156,7 +6111,7 @@ namespace ts {
const result = <JSDocTypeExpression>createNode(SyntaxKind.JSDocTypeExpression, scanner.getTokenPos());
const hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(SyntaxKind.OpenBraceToken);
result.type = doInsideOfContext(NodeFlags.JSDoc, parseType);
result.type = doInsideOfContext(NodeFlags.JSDoc, parseJSDocType);
if (!mayOmitBraces || hasBrace) {
parseExpected(SyntaxKind.CloseBraceToken);
}
@@ -6226,7 +6181,7 @@ namespace ts {
let result: JSDoc;
// Check for /** (JSDoc opening part)
if (!isJsDocStart(content, start)) {
if (!isJSDocLikeText(content, start)) {
return result;
}
@@ -6338,13 +6293,6 @@ namespace ts {
}
}
function isJsDocStart(content: string, start: number) {
return content.charCodeAt(start) === CharacterCodes.slash &&
content.charCodeAt(start + 1) === CharacterCodes.asterisk &&
content.charCodeAt(start + 2) === CharacterCodes.asterisk &&
content.charCodeAt(start + 3) !== CharacterCodes.asterisk;
}
function createJSDocComment(): JSDoc {
const result = <JSDoc>createNode(SyntaxKind.JSDocComment, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
@@ -6502,6 +6450,10 @@ namespace ts {
}
function parseBracketNameInPropertyAndParamTag(): { name: EntityName, isBracketed: boolean } {
if (token() === SyntaxKind.NoSubstitutionTemplateLiteral) {
// a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
return { name: createIdentifier(/*isIdentifier*/ true), isBracketed: false };
}
// Looking for something like '[foo]', 'foo', '[foo.bar]' or 'foo.bar'
const isBracketed = parseOptional(SyntaxKind.OpenBracketToken);
const name = parseJSDocEntityName();
@@ -6545,7 +6497,7 @@ namespace ts {
const result = target === PropertyLikeParse.Parameter ?
<JSDocParameterTag>createNode(SyntaxKind.JSDocParameterTag, atToken.pos) :
<JSDocPropertyTag>createNode(SyntaxKind.JSDocPropertyTag, atToken.pos);
const nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name);
const nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target);
if (nestedTypeLiteral) {
typeExpression = nestedTypeLiteral;
isNameFirst = true;
@@ -6559,15 +6511,17 @@ namespace ts {
return finishNode(result);
}
function parseNestedTypeLiteral(typeExpression: JSDocTypeExpression, name: EntityName) {
function parseNestedTypeLiteral(typeExpression: JSDocTypeExpression, name: EntityName, target: PropertyLikeParse) {
if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
const typeLiteralExpression = <JSDocTypeExpression>createNode(SyntaxKind.JSDocTypeExpression, scanner.getTokenPos());
let child: JSDocParameterTag | false;
let child: JSDocPropertyLikeTag | JSDocTypeTag | false;
let jsdocTypeLiteral: JSDocTypeLiteral;
const start = scanner.getStartPos();
let children: JSDocParameterTag[];
while (child = tryParse(() => parseChildParameterOrPropertyTag(PropertyLikeParse.Parameter, name))) {
children = append(children, child);
let children: JSDocPropertyLikeTag[];
while (child = tryParse(() => parseChildParameterOrPropertyTag(target, name))) {
if (child.kind === SyntaxKind.JSDocParameterTag || child.kind === SyntaxKind.JSDocPropertyTag) {
children = append(children, child);
}
}
if (children) {
jsdocTypeLiteral = <JSDocTypeLiteral>createNode(SyntaxKind.JSDocTypeLiteral, start);
@@ -6583,7 +6537,7 @@ namespace ts {
function parseReturnTag(atToken: AtToken, tagName: Identifier): JSDocReturnTag {
if (forEach(tags, t => t.kind === SyntaxKind.JSDocReturnTag)) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, Diagnostics._0_tag_already_specified, tagName.escapedText);
parseErrorAt(tagName.pos, scanner.getTokenPos(), Diagnostics._0_tag_already_specified, tagName.escapedText);
}
const result = <JSDocReturnTag>createNode(SyntaxKind.JSDocReturnTag, atToken.pos);
@@ -6595,7 +6549,7 @@ namespace ts {
function parseTypeTag(atToken: AtToken, tagName: Identifier): JSDocTypeTag {
if (forEach(tags, t => t.kind === SyntaxKind.JSDocTypeTag)) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, Diagnostics._0_tag_already_specified, tagName.escapedText);
parseErrorAt(tagName.pos, scanner.getTokenPos(), Diagnostics._0_tag_already_specified, tagName.escapedText);
}
const result = <JSDocTypeTag>createNode(SyntaxKind.JSDocTypeTag, atToken.pos);
@@ -6671,7 +6625,7 @@ namespace ts {
let jsdocTypeLiteral: JSDocTypeLiteral;
let childTypeTag: JSDocTypeTag;
const start = scanner.getStartPos();
while (child = tryParse(() => parseChildParameterOrPropertyTag(PropertyLikeParse.Property))) {
while (child = tryParse(() => parseChildPropertyTag())) {
if (!jsdocTypeLiteral) {
jsdocTypeLiteral = <JSDocTypeLiteral>createNode(SyntaxKind.JSDocTypeLiteral, start);
}
@@ -6731,8 +6685,10 @@ namespace ts {
return a.escapedText === b.escapedText;
}
function parseChildParameterOrPropertyTag(target: PropertyLikeParse.Property): JSDocTypeTag | JSDocPropertyTag | false;
function parseChildParameterOrPropertyTag(target: PropertyLikeParse.Parameter, name: EntityName): JSDocParameterTag | false;
function parseChildPropertyTag() {
return parseChildParameterOrPropertyTag(PropertyLikeParse.Property) as JSDocTypeTag | JSDocPropertyTag | false;
}
function parseChildParameterOrPropertyTag(target: PropertyLikeParse, name?: EntityName): JSDocTypeTag | JSDocPropertyTag | JSDocParameterTag | false {
let canParseTag = true;
let seenAsterisk = false;
@@ -6805,7 +6761,7 @@ namespace ts {
function parseTemplateTag(atToken: AtToken, tagName: Identifier): JSDocTemplateTag | undefined {
if (some(tags, isJSDocTemplateTag)) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, Diagnostics._0_tag_already_specified, tagName.escapedText);
parseErrorAt(tagName.pos, scanner.getTokenPos(), Diagnostics._0_tag_already_specified, tagName.escapedText);
}
// Type parameter list looks like '@template T,U,V'
@@ -7013,7 +6969,7 @@ namespace ts {
forEachChild(node, visitNode, visitArray);
if (hasJSDocNodes(node)) {
for (const jsDocComment of node.jsDoc) {
forEachChild(jsDocComment, visitNode, visitArray);
visitNode(<IncrementalNode><Node>jsDocComment);
}
}
checkNodePositions(node, aggressiveChecks);
@@ -7119,10 +7075,16 @@ namespace ts {
function checkNodePositions(node: Node, aggressiveChecks: boolean) {
if (aggressiveChecks) {
let pos = node.pos;
forEachChild(node, child => {
const visitNode = (child: Node) => {
Debug.assert(child.pos >= pos);
pos = child.end;
});
};
if (hasJSDocNodes(node)) {
for (const jsDocComment of node.jsDoc) {
visitNode(jsDocComment);
}
}
forEachChild(node, visitNode);
Debug.assert(pos <= node.end);
}
}
@@ -7160,7 +7122,11 @@ namespace ts {
// Adjust the pos or end (or both) of the intersecting element accordingly.
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
forEachChild(child, visitNode, visitArray);
if (hasJSDocNodes(child)) {
for (const jsDocComment of child.jsDoc) {
visitNode(<IncrementalNode><Node>jsDocComment);
}
}
checkNodePositions(child, aggressiveChecks);
return;
}
@@ -7238,7 +7204,7 @@ namespace ts {
forEachChild(sourceFile, visit);
if (lastNodeEntirelyBeforePosition) {
const lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition);
const lastChildOfLastEntireNodeBeforePosition = getLastDescendant(lastNodeEntirelyBeforePosition);
if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) {
bestResult = lastChildOfLastEntireNodeBeforePosition;
}
@@ -7246,9 +7212,9 @@ namespace ts {
return bestResult;
function getLastChild(node: Node): Node {
function getLastDescendant(node: Node): Node {
while (true) {
const lastChild = getLastChildWorker(node);
const lastChild = getLastChild(node);
if (lastChild) {
node = lastChild;
}
@@ -7258,16 +7224,6 @@ namespace ts {
}
}
function getLastChildWorker(node: Node): Node | undefined {
let last: Node;
forEachChild(node, child => {
if (nodeIsPresent(child)) {
last = child;
}
});
return last;
}
function visit(child: Node) {
if (nodeIsMissing(child)) {
// Missing nodes are effectively invisible to us. We never even consider them
+79 -76
View File
@@ -198,6 +198,7 @@ namespace ts {
export function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[] {
const diagnostics = [
...program.getConfigFileParsingDiagnostics(),
...program.getOptionsDiagnostics(cancellationToken),
...program.getSyntacticDiagnostics(sourceFile, cancellationToken),
...program.getGlobalDiagnostics(cancellationToken),
@@ -454,6 +455,12 @@ namespace ts {
}
}
export function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): ReadonlyArray<Diagnostic> {
return configFileParseResult.options.configFile ?
configFileParseResult.options.configFile.parseDiagnostics.concat(configFileParseResult.errors) :
configFileParseResult.errors;
}
/**
* Determined if source file needs to be re-created even if its text hasn't changed
*/
@@ -485,9 +492,10 @@ namespace ts {
* @param options - The compiler options which should be used.
* @param host - The host interacts with the underlying file system.
* @param oldProgram - Reuses an old program structure.
* @param configFileParsingDiagnostics - error during config file parsing
* @returns A 'Program' object.
*/
export function createProgram(rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program {
export function createProgram(rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): Program {
let program: Program;
let files: SourceFile[] = [];
let commonSourceDirectory: string;
@@ -538,7 +546,7 @@ namespace ts {
let resolveModuleNamesWorker: (moduleNames: string[], containingFile: string, reusedNames?: string[]) => ResolvedModuleFull[];
const hasInvalidatedResolution = host.hasInvalidatedResolution || returnFalse;
if (host.resolveModuleNames) {
resolveModuleNamesWorker = (moduleNames, containingFile, reusedNames) => host.resolveModuleNames(checkAllDefined(moduleNames), containingFile, reusedNames).map(resolved => {
resolveModuleNamesWorker = (moduleNames, containingFile, reusedNames) => host.resolveModuleNames(Debug.assertEachDefined(moduleNames), containingFile, reusedNames).map(resolved => {
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
if (!resolved || (resolved as ResolvedModuleFull).extension !== undefined) {
return resolved as ResolvedModuleFull;
@@ -551,16 +559,16 @@ namespace ts {
else {
moduleResolutionCache = createModuleResolutionCache(currentDirectory, x => host.getCanonicalFileName(x));
const loader = (moduleName: string, containingFile: string) => resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule;
resolveModuleNamesWorker = (moduleNames, containingFile) => loadWithLocalCache(checkAllDefined(moduleNames), containingFile, loader);
resolveModuleNamesWorker = (moduleNames, containingFile) => loadWithLocalCache(Debug.assertEachDefined(moduleNames), containingFile, loader);
}
let resolveTypeReferenceDirectiveNamesWorker: (typeDirectiveNames: string[], containingFile: string) => ResolvedTypeReferenceDirective[];
if (host.resolveTypeReferenceDirectives) {
resolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile) => host.resolveTypeReferenceDirectives(checkAllDefined(typeDirectiveNames), containingFile);
resolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile) => host.resolveTypeReferenceDirectives(Debug.assertEachDefined(typeDirectiveNames), containingFile);
}
else {
const loader = (typesRef: string, containingFile: string) => resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective;
resolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile) => loadWithLocalCache(checkAllDefined(typeReferenceDirectiveNames), containingFile, loader);
resolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile) => loadWithLocalCache(Debug.assertEachDefined(typeReferenceDirectiveNames), containingFile, loader);
}
// Map from a stringified PackageId to the source file with that id.
@@ -665,7 +673,8 @@ namespace ts {
getSourceFileFromReference,
sourceFileToPackageName,
redirectTargetsSet,
isEmittedFile
isEmittedFile,
getConfigFileParsingDiagnostics
};
verifyCompilerOptions();
@@ -1458,8 +1467,10 @@ namespace ts {
case SyntaxKind.CallExpression:
case SyntaxKind.NewExpression:
case SyntaxKind.ExpressionWithTypeArguments:
case SyntaxKind.JsxSelfClosingElement:
case SyntaxKind.JsxOpeningElement:
// Check type arguments
if (nodes === (<CallExpression | NewExpression | ExpressionWithTypeArguments>parent).typeArguments) {
if (nodes === (<CallExpression | NewExpression | ExpressionWithTypeArguments | JsxOpeningLikeElement>parent).typeArguments) {
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
return;
}
@@ -1566,6 +1577,10 @@ namespace ts {
return sortAndDeduplicateDiagnostics(getDiagnosticsProducingTypeChecker().getGlobalDiagnostics().slice());
}
function getConfigFileParsingDiagnostics(): ReadonlyArray<Diagnostic> {
return configFileParsingDiagnostics || emptyArray;
}
function processRootFile(fileName: string, isDefaultLib: boolean) {
processSourceFile(normalizePath(fileName), isDefaultLib, /*packageId*/ undefined);
}
@@ -1574,10 +1589,10 @@ namespace ts {
return a.fileName === b.fileName;
}
function moduleNameIsEqualTo(a: StringLiteral | Identifier, b: StringLiteral | Identifier): boolean {
return a.kind === SyntaxKind.StringLiteral
? b.kind === SyntaxKind.StringLiteral && a.text === b.text
: b.kind === SyntaxKind.Identifier && a.escapedText === b.escapedText;
function moduleNameIsEqualTo(a: StringLiteralLike | Identifier, b: StringLiteralLike | Identifier): boolean {
return a.kind === SyntaxKind.Identifier
? b.kind === SyntaxKind.Identifier && a.escapedText === b.escapedText
: b.kind === SyntaxKind.StringLiteral && a.text === b.text;
}
function collectExternalModuleReferences(file: SourceFile): void {
@@ -1589,7 +1604,7 @@ namespace ts {
const isExternalModuleFile = isExternalModule(file);
// file.imports may not be undefined if there exists dynamic import
let imports: StringLiteral[];
let imports: StringLiteralLike[] | undefined;
let moduleAugmentations: (StringLiteral | Identifier)[];
let ambientModules: string[];
@@ -1600,7 +1615,7 @@ namespace ts {
&& !file.isDeclarationFile) {
// synthesize 'import "tslib"' declaration
const externalHelpersModuleReference = createLiteral(externalHelpersModuleNameText);
const importDecl = createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*importClause*/ undefined);
const importDecl = createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference);
addEmitFlags(importDecl, EmitFlags.NeverApplyImportHelper);
externalHelpersModuleReference.parent = importDecl;
importDecl.parent = file;
@@ -1621,66 +1636,55 @@ namespace ts {
return;
function collectModuleReferences(node: Statement, inAmbientModule: boolean): void {
switch (node.kind) {
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ExportDeclaration:
const moduleNameExpr = getExternalModuleName(node);
if (!moduleNameExpr || !isStringLiteral(moduleNameExpr)) {
break;
if (isAnyImportOrReExport(node)) {
const moduleNameExpr = getExternalModuleName(node);
// TypeScript 1.0 spec (April 2014): 12.1.6
// An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference other external modules
// only through top - level external module names. Relative external module names are not permitted.
if (moduleNameExpr && isStringLiteral(moduleNameExpr) && moduleNameExpr.text && (!inAmbientModule || !isExternalModuleNameRelative(moduleNameExpr.text))) {
imports = append(imports, moduleNameExpr);
}
}
else if (isModuleDeclaration(node)) {
if (isAmbientModule(node) && (inAmbientModule || hasModifier(node, ModifierFlags.Ambient) || file.isDeclarationFile)) {
const nameText = getTextOfIdentifierOrLiteral(node.name);
// Ambient module declarations can be interpreted as augmentations for some existing external modules.
// This will happen in two cases:
// - if current file is external module then module augmentation is a ambient module declaration defined in the top level scope
// - if current file is not external module then module augmentation is an ambient module declaration with non-relative module name
// immediately nested in top level ambient module declaration .
if (isExternalModuleFile || (inAmbientModule && !isExternalModuleNameRelative(nameText))) {
(moduleAugmentations || (moduleAugmentations = [])).push(node.name);
}
if (!moduleNameExpr.text) {
break;
}
// TypeScript 1.0 spec (April 2014): 12.1.6
// An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference other external modules
// only through top - level external module names. Relative external module names are not permitted.
if (!inAmbientModule || !isExternalModuleNameRelative(moduleNameExpr.text)) {
(imports || (imports = [])).push(moduleNameExpr);
}
break;
case SyntaxKind.ModuleDeclaration:
if (isAmbientModule(<ModuleDeclaration>node) && (inAmbientModule || hasModifier(node, ModifierFlags.Ambient) || file.isDeclarationFile)) {
const moduleName = (<ModuleDeclaration>node).name;
const nameText = getTextOfIdentifierOrLiteral(moduleName);
// Ambient module declarations can be interpreted as augmentations for some existing external modules.
// This will happen in two cases:
// - if current file is external module then module augmentation is a ambient module declaration defined in the top level scope
// - if current file is not external module then module augmentation is an ambient module declaration with non-relative module name
// immediately nested in top level ambient module declaration .
if (isExternalModuleFile || (inAmbientModule && !isExternalModuleNameRelative(nameText))) {
(moduleAugmentations || (moduleAugmentations = [])).push(moduleName);
else if (!inAmbientModule) {
if (file.isDeclarationFile) {
// for global .d.ts files record name of ambient module
(ambientModules || (ambientModules = [])).push(nameText);
}
else if (!inAmbientModule) {
if (file.isDeclarationFile) {
// for global .d.ts files record name of ambient module
(ambientModules || (ambientModules = [])).push(nameText);
}
// An AmbientExternalModuleDeclaration declares an external module.
// This type of declaration is permitted only in the global module.
// The StringLiteral must specify a top - level external module name.
// Relative external module names are not permitted
// An AmbientExternalModuleDeclaration declares an external module.
// This type of declaration is permitted only in the global module.
// The StringLiteral must specify a top - level external module name.
// Relative external module names are not permitted
// NOTE: body of ambient module is always a module block, if it exists
const body = <ModuleBlock>(<ModuleDeclaration>node).body;
if (body) {
for (const statement of body.statements) {
collectModuleReferences(statement, /*inAmbientModule*/ true);
}
// NOTE: body of ambient module is always a module block, if it exists
const body = <ModuleBlock>(<ModuleDeclaration>node).body;
if (body) {
for (const statement of body.statements) {
collectModuleReferences(statement, /*inAmbientModule*/ true);
}
}
}
}
}
}
function collectDynamicImportOrRequireCalls(node: Node): void {
if (isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) {
(imports || (imports = [])).push(<StringLiteral>(<CallExpression>node).arguments[0]);
if (isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true)) {
imports = append(imports, node.arguments[0]);
}
// we have to check the argument list has length of 1. We will still have to process these even though we have parsing error.
else if (isImportCall(node) && node.arguments.length === 1 && node.arguments[0].kind === SyntaxKind.StringLiteral) {
(imports || (imports = [])).push(<StringLiteral>(<CallExpression>node).arguments[0]);
else if (isImportCall(node) && node.arguments.length === 1 && isStringLiteralLike(node.arguments[0])) {
imports = append(imports, node.arguments[0] as StringLiteralLike);
}
else {
forEachChild(node, collectDynamicImportOrRequireCalls);
@@ -2122,9 +2126,9 @@ namespace ts {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile");
}
if (options.mapRoot && !options.sourceMap) {
if (options.mapRoot && !(options.sourceMap || options.declarationMap)) {
// Error to specify --mapRoot without --sourcemap
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap");
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "mapRoot", "sourceMap", "declarationMap");
}
if (options.declarationDir) {
@@ -2136,6 +2140,10 @@ namespace ts {
}
}
if (options.declarationMap && !options.declaration) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationMap", "declaration");
}
if (options.lib && options.noLib) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib");
}
@@ -2201,7 +2209,7 @@ namespace ts {
if (options.emitDeclarationOnly) {
if (!options.declaration) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDeclarationOnly", "declarations");
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDeclarationOnly", "declaration");
}
if (options.noEmit) {
@@ -2310,21 +2318,21 @@ namespace ts {
return emptyArray;
}
function createDiagnosticForOptionName(message: DiagnosticMessage, option1: string, option2?: string) {
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2);
function createDiagnosticForOptionName(message: DiagnosticMessage, option1: string, option2?: string, option3?: string) {
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2, option3);
}
function createOptionValueDiagnostic(option1: string, message: DiagnosticMessage, arg0: string) {
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0);
}
function createDiagnosticForOption(onKey: boolean, option1: string, option2: string, message: DiagnosticMessage, arg0: string | number, arg1?: string | number) {
function createDiagnosticForOption(onKey: boolean, option1: string, option2: string, message: DiagnosticMessage, arg0: string | number, arg1?: string | number, arg2?: string | number) {
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax ||
!createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1);
!createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2);
if (needCompilerDiagnostic) {
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1));
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
}
}
@@ -2343,10 +2351,10 @@ namespace ts {
return _compilerOptionsObjectLiteralSyntax;
}
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral: ObjectLiteralExpression, onKey: boolean, key1: string, key2: string, message: DiagnosticMessage, arg0: string | number, arg1?: string | number): boolean {
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral: ObjectLiteralExpression, onKey: boolean, key1: string, key2: string, message: DiagnosticMessage, arg0: string | number, arg1?: string | number, arg2?: string | number): boolean {
const props = getPropertyAssignment(objectLiteral, key1, key2);
for (const prop of props) {
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1));
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2));
}
return !!props.length;
}
@@ -2420,11 +2428,6 @@ namespace ts {
}
}
function checkAllDefined(names: string[]): string[] {
Debug.assert(names.every(name => name !== undefined), "A name is undefined.", () => JSON.stringify(names));
return names;
}
function getModuleNames({ imports, moduleAugmentations }: SourceFile): string[] {
const res = imports.map(i => i.text);
for (const aug of moduleAugmentations) {
+28 -4
View File
@@ -361,9 +361,13 @@ namespace ts {
return { dir: rootDir, dirPath: rootPath };
}
let dir = getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory()));
let dirPath = getDirectoryPath(failedLookupLocationPath);
return getDirectoryToWatchFromFailedLookupLocationDirectory(
getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
getDirectoryPath(failedLookupLocationPath)
);
}
function getDirectoryToWatchFromFailedLookupLocationDirectory(dir: string, dirPath: Path) {
// If directory path contains node module, get the most parent node_modules directory for watching
while (stringContains(dirPath, "/node_modules/")) {
dir = getDirectoryPath(dir);
@@ -588,7 +592,8 @@ namespace ts {
// Some file or directory in the watching directory is created
// Return early if it does not have any of the watching extension or not the custom failed lookup path
const dirOfFileOrDirectory = getDirectoryPath(fileOrDirectoryPath);
if (isNodeModulesAtTypesDirectory(dirOfFileOrDirectory) || isNodeModulesDirectory(dirOfFileOrDirectory)) {
if (isNodeModulesAtTypesDirectory(fileOrDirectoryPath) || isNodeModulesDirectory(fileOrDirectoryPath) ||
isNodeModulesAtTypesDirectory(dirOfFileOrDirectory) || isNodeModulesDirectory(dirOfFileOrDirectory)) {
// Invalidate any resolution from this directory
isChangedFailedLookupLocation = location => {
const locationPath = resolutionHost.toPath(location);
@@ -620,7 +625,19 @@ namespace ts {
clearMap(typeRootsWatches, closeFileWatcher);
}
function createTypeRootsWatch(_typeRootPath: string, typeRoot: string): FileWatcher {
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot: string, typeRootPath: Path): Path | undefined {
if (allFilesHaveInvalidatedResolution) {
return undefined;
}
if (isInDirectoryPath(rootPath, typeRootPath)) {
return rootPath;
}
const { dirPath, ignore } = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath);
return !ignore && directoryWatchesOfFailedLookups.has(dirPath) && dirPath;
}
function createTypeRootsWatch(typeRootPath: Path, typeRoot: string): FileWatcher {
// Create new watch and recursive info
return resolutionHost.watchTypeRootsDirectory(typeRoot, fileOrDirectory => {
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
@@ -633,6 +650,13 @@ namespace ts {
// We could potentially store more data here about whether it was/would be really be used or not
// and with that determine to trigger compilation but for now this is enough
resolutionHost.onChangedAutomaticTypeDirectiveNames();
// Since directory watchers invoked are flaky, the failed lookup location events might not be triggered
// So handle to failed lookup locations here as well to ensure we are invalidating resolutions
const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath);
if (dirPath && invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath)) {
resolutionHost.onInvalidatedResolution();
}
}, WatchDirectoryFlags.Recursive);
}
+12 -5
View File
@@ -33,8 +33,8 @@ namespace ts {
reScanTemplateToken(): SyntaxKind;
scanJsxIdentifier(): SyntaxKind;
scanJsxAttributeValue(): SyntaxKind;
reScanJsxToken(): SyntaxKind;
scanJsxToken(): SyntaxKind;
reScanJsxToken(): JsxTokenSyntaxKind;
scanJsxToken(): JsxTokenSyntaxKind;
scanJSDocToken(): JsDocSyntaxKind;
scan(): SyntaxKind;
getText(): string;
@@ -330,7 +330,7 @@ namespace ts {
return result;
}
export function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number {
export function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number {
return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character, sourceFile.text);
}
@@ -1836,12 +1836,12 @@ namespace ts {
return token = scanTemplateAndSetTokenValue();
}
function reScanJsxToken(): SyntaxKind {
function reScanJsxToken(): JsxTokenSyntaxKind {
pos = tokenPos = startPos;
return token = scanJsxToken();
}
function scanJsxToken(): SyntaxKind {
function scanJsxToken(): JsxTokenSyntaxKind {
startPos = tokenPos = pos;
if (pos >= end) {
@@ -1974,6 +1974,13 @@ namespace ts {
return token = SyntaxKind.CommaToken;
case CharacterCodes.dot:
return token = SyntaxKind.DotToken;
case CharacterCodes.backtick:
while (pos < end && text.charCodeAt(pos) !== CharacterCodes.backtick) {
pos++;
}
tokenValue = text.substring(tokenPos + 1, pos);
pos++;
return token = SyntaxKind.NoSubstitutionTemplateLiteral;
}
if (isIdentifierStart(ch, ScriptTarget.Latest)) {
+21 -11
View File
@@ -10,7 +10,7 @@ namespace ts {
* @param sourceMapFilePath The path to the output source map file.
* @param sourceFileOrBundle The input source file or bundle for the program.
*/
initialize(filePath: string, sourceMapFilePath: string, sourceFileOrBundle: SourceFile | Bundle): void;
initialize(filePath: string, sourceMapFilePath: string, sourceFileOrBundle: SourceFile | Bundle, sourceMapOutput?: SourceMapData[]): void;
/**
* Reset the SourceMapWriter to an empty state.
@@ -62,11 +62,6 @@ namespace ts {
* Gets the SourceMappingURL for the source map.
*/
getSourceMappingURL(): string;
/**
* Gets test data for source maps.
*/
getSourceMapData(): SourceMapData;
}
// Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans
@@ -78,8 +73,16 @@ namespace ts {
sourceIndex: 0
};
export function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter): SourceMapWriter {
const compilerOptions = host.getCompilerOptions();
export interface SourceMapOptions {
sourceMap?: boolean;
inlineSourceMap?: boolean;
inlineSources?: boolean;
sourceRoot?: string;
mapRoot?: string;
extendedDiagnostics?: boolean;
}
export function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter, compilerOptions: SourceMapOptions = host.getCompilerOptions()): SourceMapWriter {
const extendedDiagnostics = compilerOptions.extendedDiagnostics;
let currentSource: SourceMapSource;
let currentSourceText: string;
@@ -95,12 +98,12 @@ namespace ts {
// Source map data
let sourceMapData: SourceMapData;
let sourceMapDataList: SourceMapData[];
let disabled: boolean = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap);
return {
initialize,
reset,
getSourceMapData: () => sourceMapData,
setSourceFile,
emitPos,
emitNodeWithSourceMap,
@@ -123,7 +126,7 @@ namespace ts {
* @param sourceMapFilePath The path to the output source map file.
* @param sourceFileOrBundle The input source file or bundle for the program.
*/
function initialize(filePath: string, sourceMapFilePath: string, sourceFileOrBundle: SourceFile | Bundle) {
function initialize(filePath: string, sourceMapFilePath: string, sourceFileOrBundle: SourceFile | Bundle, outputSourceMapDataList?: SourceMapData[]) {
if (disabled) {
return;
}
@@ -131,6 +134,7 @@ namespace ts {
if (sourceMapData) {
reset();
}
sourceMapDataList = outputSourceMapDataList;
currentSource = undefined;
currentSourceText = undefined;
@@ -199,6 +203,11 @@ namespace ts {
return;
}
// Record source map data for the test harness.
if (sourceMapDataList) {
sourceMapDataList.push(sourceMapData);
}
currentSource = undefined;
sourceMapDir = undefined;
sourceMapSourceIndex = undefined;
@@ -206,6 +215,7 @@ namespace ts {
lastEncodedSourceMapSpan = undefined;
lastEncodedNameIndex = undefined;
sourceMapData = undefined;
sourceMapDataList = undefined;
}
// Encoding for sourcemap span
@@ -465,7 +475,7 @@ namespace ts {
if (compilerOptions.inlineSourceMap) {
// Encode the sourceMap into the sourceMap url
const base64SourceMapText = convertToBase64(getText());
const base64SourceMapText = base64encode(sys, getText());
return sourceMapData.jsSourceMappingURL = `data:application/json;base64,${base64SourceMapText}`;
}
else {
+54 -17
View File
@@ -334,9 +334,10 @@ namespace ts {
/*@internal*/
export interface RecursiveDirectoryWatcherHost {
watchDirectory: HostWatchDirectory;
getAccessileSortedChildDirectories(path: string): ReadonlyArray<string>;
getAccessibleSortedChildDirectories(path: string): ReadonlyArray<string>;
directoryExists(dir: string): boolean;
filePathComparer: Comparer<string>;
realpath(s: string): string;
}
/**
@@ -392,9 +393,14 @@ namespace ts {
function watchChildDirectories(parentDir: string, existingChildWatches: ChildWatches, callback: DirectoryWatcherCallback): ChildWatches {
let newChildWatches: DirectoryWatcher[] | undefined;
enumerateInsertsAndDeletes<string, DirectoryWatcher>(
host.directoryExists(parentDir) ? host.getAccessileSortedChildDirectories(parentDir) : emptyArray,
host.directoryExists(parentDir) ? mapDefined(host.getAccessibleSortedChildDirectories(parentDir), child => {
const childFullName = getNormalizedAbsolutePath(child, parentDir);
// Filter our the symbolic link directories since those arent included in recursive watch
// which is same behaviour when recursive: true is passed to fs.watch
return host.filePathComparer(childFullName, host.realpath(childFullName)) === Comparison.EqualTo ? childFullName : undefined;
}) : emptyArray,
existingChildWatches,
(child, childWatcher) => host.filePathComparer(getNormalizedAbsolutePath(child, parentDir), childWatcher.dirName),
(child, childWatcher) => host.filePathComparer(child, childWatcher.dirName),
createAndAddChildDirectoryWatcher,
closeFileWatcher,
addChildDirectoryWatcher
@@ -406,7 +412,7 @@ namespace ts {
* Create new childDirectoryWatcher and add it to the new ChildDirectoryWatcher list
*/
function createAndAddChildDirectoryWatcher(childName: string) {
const result = createDirectoryWatcher(getNormalizedAbsolutePath(childName, parentDir), callback);
const result = createDirectoryWatcher(childName, callback);
addChildDirectoryWatcher(result);
}
@@ -456,6 +462,9 @@ namespace ts {
setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
clearTimeout?(timeoutId: any): void;
clearScreen?(): void;
/*@internal*/ setBlocking?(): void;
base64decode?(input: string): string;
base64encode?(input: string): string;
}
export interface FileWatcher {
@@ -527,6 +536,11 @@ namespace ts {
_crypto = undefined;
}
const Buffer: {
new (input: string, encoding?: string): any;
from?(input: string, encoding?: string): any;
} = require("buffer").Buffer;
const nodeVersion = getNodeMajorVersion();
const isNode4OrLater = nodeVersion >= 4;
@@ -593,14 +607,7 @@ namespace ts {
exit(exitCode?: number): void {
process.exit(exitCode);
},
realpath(path: string): string {
try {
return _fs.realpathSync(path);
}
catch {
return path;
}
},
realpath,
debugMode: some(<string[]>process.execArgv, arg => /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg)),
tryEnableSourceMapsForHost() {
try {
@@ -614,6 +621,21 @@ namespace ts {
clearTimeout,
clearScreen: () => {
process.stdout.write("\x1Bc");
},
setBlocking: () => {
if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) {
process.stdout._handle.setBlocking(true);
}
},
base64decode: Buffer.from ? input => {
return Buffer.from(input, "base64").toString("utf8");
} : input => {
return new Buffer(input, "base64").toString("utf8");
},
base64encode: Buffer.from ? input => {
return Buffer.from(input).toString("base64");
} : input => {
return new Buffer(input).toString("base64");
}
};
return nodeSystem;
@@ -676,8 +698,9 @@ namespace ts {
const watchDirectoryRecursively = createRecursiveDirectoryWatcher({
filePathComparer: useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive,
directoryExists,
getAccessileSortedChildDirectories: path => getAccessibleFileSystemEntries(path).directories,
watchDirectory
getAccessibleSortedChildDirectories: path => getAccessibleFileSystemEntries(path).directories,
watchDirectory,
realpath
});
return (directoryName, callback, recursive) => {
@@ -746,12 +769,17 @@ namespace ts {
};
function fileChanged(curr: any, prev: any) {
// previous event kind check is to ensure we recongnize the file as previously also missing when it is restored or renamed twice (that is it disappears and reappears)
// In such case, prevTime returned is same as prev time of event when file was deleted as per node documentation
const isPreviouslyDeleted = +prev.mtime === 0 || eventKind === FileWatcherEventKind.Deleted;
if (+curr.mtime === 0) {
if (isPreviouslyDeleted) {
// Already deleted file, no need to callback again
return;
}
eventKind = FileWatcherEventKind.Deleted;
}
// previous event kind check is to ensure we send created event when file is restored or renamed twice (that is it disappears and reappears)
// since in that case the prevTime returned is same as prev time of event when file was deleted as per node documentation
else if (+prev.mtime === 0 || eventKind === FileWatcherEventKind.Deleted) {
else if (isPreviouslyDeleted) {
eventKind = FileWatcherEventKind.Created;
}
// If there is no change in modified time, ignore the event
@@ -1015,6 +1043,15 @@ namespace ts {
return filter<string>(_fs.readdirSync(path), dir => fileSystemEntryExists(combinePaths(path, dir), FileSystemEntryKind.Directory));
}
function realpath(path: string): string {
try {
return _fs.realpathSync(path);
}
catch {
return path;
}
}
function getModifiedTime(path: string) {
try {
return _fs.statSync(path).mtime;
+7 -1
View File
@@ -11,6 +11,7 @@
/// <reference path="transformers/module/module.ts" />
/// <reference path="transformers/module/system.ts" />
/// <reference path="transformers/module/es2015.ts" />
/// <reference path="transformers/declarations.ts" />
/* @internal */
namespace ts {
@@ -104,6 +105,7 @@ namespace ts {
let onSubstituteNode: TransformationContext["onSubstituteNode"] = (_, node) => node;
let onEmitNode: TransformationContext["onEmitNode"] = (hint, node, callback) => callback(hint, node);
let state = TransformationState.Uninitialized;
const diagnostics: Diagnostic[] = [];
// The transformation context is provided to each transformer as part of transformer
// initialization.
@@ -134,6 +136,9 @@ namespace ts {
Debug.assert(state < TransformationState.Initialized, "Cannot modify transformation hooks after initialization has completed.");
Debug.assert(value !== undefined, "Value must not be 'undefined'");
onEmitNode = value;
},
addDiagnostic(diag) {
diagnostics.push(diag);
}
};
@@ -163,7 +168,8 @@ namespace ts {
transformed,
substituteNode,
emitNodeWithNotification,
dispose
dispose,
diagnostics
};
function transformRoot(node: T) {
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,469 @@
/* @internal */
namespace ts {
export type GetSymbolAccessibilityDiagnostic = (symbolAccessibilityResult: SymbolAccessibilityResult) => (SymbolAccessibilityDiagnostic | undefined);
export interface SymbolAccessibilityDiagnostic {
errorNode: Node;
diagnosticMessage: DiagnosticMessage;
typeName?: DeclarationName | QualifiedName;
}
export type DeclarationDiagnosticProducing =
| VariableDeclaration
| PropertyDeclaration
| PropertySignature
| BindingElement
| SetAccessorDeclaration
| GetAccessorDeclaration
| ConstructSignatureDeclaration
| CallSignatureDeclaration
| MethodDeclaration
| MethodSignature
| FunctionDeclaration
| ParameterDeclaration
| TypeParameterDeclaration
| ExpressionWithTypeArguments
| ImportEqualsDeclaration
| TypeAliasDeclaration
| ConstructorDeclaration
| IndexSignatureDeclaration;
export function canProduceDiagnostics(node: Node): node is DeclarationDiagnosticProducing {
return isVariableDeclaration(node) ||
isPropertyDeclaration(node) ||
isPropertySignature(node) ||
isBindingElement(node) ||
isSetAccessor(node) ||
isGetAccessor(node) ||
isConstructSignatureDeclaration(node) ||
isCallSignatureDeclaration(node) ||
isMethodDeclaration(node) ||
isMethodSignature(node) ||
isFunctionDeclaration(node) ||
isParameter(node) ||
isTypeParameterDeclaration(node) ||
isExpressionWithTypeArguments(node) ||
isImportEqualsDeclaration(node) ||
isTypeAliasDeclaration(node) ||
isConstructorDeclaration(node) ||
isIndexSignatureDeclaration(node);
}
export function createGetSymbolAccessibilityDiagnosticForNodeName(node: DeclarationDiagnosticProducing) {
if (isSetAccessor(node) || isGetAccessor(node)) {
return getAccessorNameVisibilityError;
}
else if (isMethodSignature(node) || isMethodDeclaration(node)) {
return getMethodNameVisibilityError;
}
else {
return createGetSymbolAccessibilityDiagnosticForNode(node);
}
function getAccessorNameVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult) {
const diagnosticMessage = getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult);
return diagnosticMessage !== undefined ? {
diagnosticMessage,
errorNode: node,
typeName: (node as NamedDeclaration).name
} : undefined;
}
function getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) {
if (hasModifier(node, ModifierFlags.Static)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
}
else {
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
}
}
function getMethodNameVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
const diagnosticMessage = getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult);
return diagnosticMessage !== undefined ? {
diagnosticMessage,
errorNode: node,
typeName: (node as NamedDeclaration).name
} : undefined;
}
function getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) {
if (hasModifier(node, ModifierFlags.Static)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1;
}
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Public_method_0_of_exported_class_has_or_is_using_private_name_1;
}
else {
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Method_0_of_exported_interface_has_or_is_using_private_name_1;
}
}
}
export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationDiagnosticProducing) {
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
return getVariableDeclarationTypeVisibilityError;
}
else if (isSetAccessor(node) || isGetAccessor(node)) {
return getAccessorDeclarationTypeVisibilityError;
}
else if (isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isIndexSignatureDeclaration(node)) {
return getReturnTypeVisibilityError;
}
else if (isParameter(node)) {
if (isParameterPropertyDeclaration(node) && hasModifier(node.parent, ModifierFlags.Private)) {
return getVariableDeclarationTypeVisibilityError;
}
return getParameterDeclarationTypeVisibilityError;
}
else if (isTypeParameterDeclaration(node)) {
return getTypeParameterConstraintVisibilityError;
}
else if (isExpressionWithTypeArguments(node)) {
return getHeritageClauseVisibilityError;
}
else if (isImportEqualsDeclaration(node)) {
return getImportEntityNameVisibilityError;
}
else if (isTypeAliasDeclaration(node)) {
return getTypeAliasDeclarationVisibilityError;
}
else {
Debug.assertNever(node, `Attempted to set a declaration diagnostic context for unhandled node kind: ${(ts as any).SyntaxKind[(node as any).kind]}`);
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) {
if (node.kind === SyntaxKind.VariableDeclaration || node.kind === SyntaxKind.BindingElement) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
}
// This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
// The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all.
else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature ||
(node.kind === SyntaxKind.Parameter && hasModifier(node.parent, ModifierFlags.Private))) {
// TODO(jfreeman): Deal with computed properties in error reporting.
if (hasModifier(node, ModifierFlags.Static)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
else if (node.parent.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.Parameter) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
}
else {
// Interfaces cannot have types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
}
}
}
function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
const diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);
return diagnosticMessage !== undefined ? {
diagnosticMessage,
errorNode: node,
typeName: (node as NamedDeclaration).name
} : undefined;
}
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
let diagnosticMessage: DiagnosticMessage;
if (node.kind === SyntaxKind.SetAccessor) {
// Getters can infer the return type from the returned expression, but setters cannot, so the
// "_from_external_module_1_but_cannot_be_named" case cannot occur.
if (hasModifier(node, ModifierFlags.Static)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1;
}
}
else {
if (hasModifier(node, ModifierFlags.Static)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1;
}
}
return {
diagnosticMessage,
errorNode: (node as NamedDeclaration).name,
typeName: (node as NamedDeclaration).name
};
}
function getReturnTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
let diagnosticMessage: DiagnosticMessage;
switch (node.kind) {
case SyntaxKind.ConstructSignature:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
case SyntaxKind.CallSignature:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
case SyntaxKind.IndexSignature:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
if (hasModifier(node, ModifierFlags.Static)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
}
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0;
}
else {
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
case SyntaxKind.FunctionDeclaration:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 :
Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;
break;
default:
Debug.fail("This is unknown kind for signature: " + node.kind);
}
return {
diagnosticMessage,
errorNode: (node as NamedDeclaration).name || node
};
}
function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
const diagnosticMessage: DiagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);
return diagnosticMessage !== undefined ? {
diagnosticMessage,
errorNode: node,
typeName: (node as NamedDeclaration).name
} : undefined;
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult): DiagnosticMessage {
switch (node.parent.kind) {
case SyntaxKind.Constructor:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
case SyntaxKind.ConstructSignature:
case SyntaxKind.ConstructorType:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
case SyntaxKind.CallSignature:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
case SyntaxKind.IndexSignature:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
if (hasModifier(node.parent, ModifierFlags.Static)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
}
else {
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionType:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;
default:
Debug.fail(`Unknown parent for parameter: ${(ts as any).SyntaxKind[node.parent.kind]}`);
}
}
function getTypeParameterConstraintVisibilityError(): SymbolAccessibilityDiagnostic {
// Type parameter constraints are named by user so we should always be able to name it
let diagnosticMessage: DiagnosticMessage;
switch (node.parent.kind) {
case SyntaxKind.ClassDeclaration:
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
break;
case SyntaxKind.InterfaceDeclaration:
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
case SyntaxKind.ConstructSignature:
diagnosticMessage = Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
case SyntaxKind.CallSignature:
diagnosticMessage = Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
if (hasModifier(node.parent, ModifierFlags.Static)) {
diagnosticMessage = Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
diagnosticMessage = Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
break;
case SyntaxKind.FunctionDeclaration:
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
case SyntaxKind.TypeAliasDeclaration:
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
break;
default:
Debug.fail("This is unknown parent for type parameter: " + node.parent.kind);
}
return {
diagnosticMessage,
errorNode: node,
typeName: (node as NamedDeclaration).name
};
}
function getHeritageClauseVisibilityError(): SymbolAccessibilityDiagnostic {
let diagnosticMessage: DiagnosticMessage;
// Heritage clause is written by user so it can always be named
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
// Class or Interface implemented/extended is inaccessible
diagnosticMessage = (node as ExpressionWithTypeArguments).parent.token === SyntaxKind.ImplementsKeyword ?
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
}
else {
// interface is inaccessible
diagnosticMessage = Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;
}
return {
diagnosticMessage,
errorNode: node,
typeName: getNameOfDeclaration((node as ExpressionWithTypeArguments).parent.parent)
};
}
function getImportEntityNameVisibilityError(): SymbolAccessibilityDiagnostic {
return {
diagnosticMessage: Diagnostics.Import_declaration_0_is_using_private_name_1,
errorNode: node,
typeName: (node as NamedDeclaration).name
};
}
function getTypeAliasDeclarationVisibilityError(): SymbolAccessibilityDiagnostic {
return {
diagnosticMessage: Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,
errorNode: (node as TypeAliasDeclaration).type,
typeName: (node as TypeAliasDeclaration).name
};
}
}
}
+30 -40
View File
@@ -561,7 +561,7 @@ namespace ts {
}
function returnCapturedThis(node: Node): ReturnStatement {
return setOriginalNode(createReturn(createIdentifier("_this")), node);
return setOriginalNode(createReturn(createFileLevelUniqueName("_this")), node);
}
function visitReturnStatement(node: ReturnStatement): Statement {
@@ -779,7 +779,7 @@ namespace ts {
/*asteriskToken*/ undefined,
/*name*/ undefined,
/*typeParameters*/ undefined,
extendsClauseElement ? [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "_super")] : [],
extendsClauseElement ? [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, createFileLevelUniqueName("_super"))] : [],
/*type*/ undefined,
transformClassBody(node, extendsClauseElement)
);
@@ -978,7 +978,7 @@ namespace ts {
&& !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {
statements.push(
createReturn(
createIdentifier("_this")
createFileLevelUniqueName("_this")
)
);
}
@@ -1142,11 +1142,11 @@ namespace ts {
return createLogicalOr(
createLogicalAnd(
createStrictInequality(
createIdentifier("_super"),
createFileLevelUniqueName("_super"),
createNull()
),
createFunctionApply(
createIdentifier("_super"),
createFileLevelUniqueName("_super"),
createActualThis(),
createIdentifier("arguments"),
)
@@ -1452,7 +1452,7 @@ namespace ts {
/*modifiers*/ undefined,
createVariableDeclarationList([
createVariableDeclaration(
"_this",
createFileLevelUniqueName("_this"),
/*type*/ undefined,
initializer
)
@@ -1510,15 +1510,14 @@ namespace ts {
break;
default:
Debug.failBadSyntaxKind(node);
break;
return Debug.failBadSyntaxKind(node);
}
const captureNewTargetStatement = createVariableStatement(
/*modifiers*/ undefined,
createVariableDeclarationList([
createVariableDeclaration(
"_newTarget",
createFileLevelUniqueName("_newTarget"),
/*type*/ undefined,
newTarget
)
@@ -1922,7 +1921,7 @@ namespace ts {
return block;
}
function visitFunctionBodyDownLevel(node: FunctionDeclaration | FunctionExpression) {
function visitFunctionBodyDownLevel(node: FunctionDeclaration | FunctionExpression | AccessorDeclaration) {
const updated = visitFunctionBody(node.body, functionBodyVisitor, context);
return updateBlock(
updated,
@@ -2348,32 +2347,26 @@ namespace ts {
}
}
let bodyLocation: TextRange;
let statementsLocation: TextRange;
if (convertedLoopBodyStatements) {
addRange(statements, convertedLoopBodyStatements);
return createSyntheticBlockForConvertedStatements(addRange(statements, convertedLoopBodyStatements));
}
else {
const statement = visitNode(node.statement, visitor, isStatement, liftToBlock);
if (isBlock(statement)) {
addRange(statements, statement.statements);
bodyLocation = statement;
statementsLocation = statement.statements;
return updateBlock(statement, setTextRange(createNodeArray(concatenate(statements, statement.statements)), statement.statements));
}
else {
statements.push(statement);
return createSyntheticBlockForConvertedStatements(statements);
}
}
}
// The old emitter does not emit source maps for the block.
// We add the location to preserve comments.
function createSyntheticBlockForConvertedStatements(statements: Statement[]) {
return setEmitFlags(
setTextRange(
createBlock(
setTextRange(createNodeArray(statements), statementsLocation),
/*multiLine*/ true
),
bodyLocation,
createBlock(
createNodeArray(statements),
/*multiLine*/ true
),
EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps
);
@@ -3202,18 +3195,15 @@ namespace ts {
convertedLoopState = undefined;
const ancestorFacts = enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes);
let updated: AccessorDeclaration;
if (node.transformFlags & TransformFlags.ContainsCapturedLexicalThis) {
const parameters = visitParameterList(node.parameters, visitor, context);
const body = transformFunctionBody(node);
if (node.kind === SyntaxKind.GetAccessor) {
updated = updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body);
}
else {
updated = updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body);
}
const parameters = visitParameterList(node.parameters, visitor, context);
const body = node.transformFlags & (TransformFlags.ContainsCapturedLexicalThis | TransformFlags.ContainsES2015)
? transformFunctionBody(node)
: visitFunctionBodyDownLevel(node);
if (node.kind === SyntaxKind.GetAccessor) {
updated = updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body);
}
else {
updated = visitEachChild(node, visitor, context);
updated = updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body);
}
exitSubtree(ancestorFacts, HierarchyFacts.PropagateNewTargetMask, HierarchyFacts.None);
convertedLoopState = savedConvertedLoopState;
@@ -3500,7 +3490,7 @@ namespace ts {
actualThis
);
resultingCall = assignToCapturedThis
? createAssignment(createIdentifier("_this"), initializer)
? createAssignment(createFileLevelUniqueName("_this"), initializer)
: initializer;
}
return setOriginalNode(resultingCall, node);
@@ -3821,8 +3811,8 @@ namespace ts {
function visitSuperKeyword(isExpressionOfCall: boolean): LeftHandSideExpression {
return hierarchyFacts & HierarchyFacts.NonStaticClassElement
&& !isExpressionOfCall
? createPropertyAccess(createIdentifier("_super"), "prototype")
: createIdentifier("_super");
? createPropertyAccess(createFileLevelUniqueName("_super"), "prototype")
: createFileLevelUniqueName("_super");
}
function visitMetaProperty(node: MetaProperty) {
@@ -3833,7 +3823,7 @@ namespace ts {
else {
hierarchyFacts |= HierarchyFacts.NewTarget;
}
return createIdentifier("_newTarget");
return createFileLevelUniqueName("_newTarget");
}
return node;
}
@@ -4010,7 +4000,7 @@ namespace ts {
function substituteThisKeyword(node: PrimaryExpression): PrimaryExpression {
if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis
&& hierarchyFacts & HierarchyFacts.CapturesThis) {
return setTextRange(createIdentifier("_this"), node);
return setTextRange(createFileLevelUniqueName("_this"), node);
}
return node;
}
@@ -4062,7 +4052,7 @@ namespace ts {
/*typeArguments*/ undefined,
[
name,
createIdentifier("_super")
createFileLevelUniqueName("_super")
]
);
}
+7 -9
View File
@@ -600,7 +600,7 @@ namespace ts {
return setTextRange(
createPropertyAccess(
createCall(
createIdentifier("_super"),
createFileLevelUniqueName("_super"),
/*typeArguments*/ undefined,
[argumentExpression]
),
@@ -612,7 +612,7 @@ namespace ts {
else {
return setTextRange(
createCall(
createIdentifier("_super"),
createFileLevelUniqueName("_super"),
/*typeArguments*/ undefined,
[argumentExpression]
),
@@ -668,19 +668,17 @@ namespace ts {
export const asyncSuperHelper: EmitHelper = {
name: "typescript:async-super",
scoped: true,
text: `
const _super = name => super[name];
`
text: helperString`
const ${"_super"} = name => super[name];`
};
export const advancedAsyncSuperHelper: EmitHelper = {
name: "typescript:advanced-async-super",
scoped: true,
text: `
const _super = (function (geti, seti) {
text: helperString`
const ${"_super"} = (function (geti, seti) {
const cache = Object.create(null);
return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
})(name => super[name], (name, value) => super[name] = value);
`
})(name => super[name], (name, value) => super[name] = value);`
};
}
+4 -8
View File
@@ -887,8 +887,7 @@ namespace ts {
name: "typescript:await",
scoped: false,
text: `
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
`
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }`
};
function createAwaitHelper(context: TransformationContext, expression: Expression) {
@@ -910,8 +909,7 @@ namespace ts {
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
`
};`
};
function createAsyncGeneratorHelper(context: TransformationContext, generatorFunc: FunctionExpression) {
@@ -940,8 +938,7 @@ namespace ts {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; }; }
};
`
};`
};
function createAsyncDelegatorHelper(context: TransformationContext, expression: Expression, location?: TextRange) {
@@ -965,8 +962,7 @@ namespace ts {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator];
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
};
`
};`
};
function createAsyncValuesHelper(context: TransformationContext, expression: Expression, location?: TextRange) {
+1 -2
View File
@@ -430,8 +430,7 @@ namespace ts {
return visitFunctionExpression(<FunctionExpression>node);
default:
Debug.failBadSyntaxKind(node);
return visitEachChild(node, visitor, context);
return Debug.failBadSyntaxKind(node);
}
}
+2 -3
View File
@@ -72,8 +72,7 @@ namespace ts {
return visitJsxFragment(node, /*isChild*/ true);
default:
Debug.failBadSyntaxKind(node);
return undefined;
return Debug.failBadSyntaxKind(node);
}
}
@@ -182,7 +181,7 @@ namespace ts {
return visitJsxExpression(node);
}
else {
Debug.failBadSyntaxKind(node);
return Debug.failBadSyntaxKind(node);
}
}
+1 -2
View File
@@ -1698,8 +1698,7 @@ namespace ts {
text: `
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
`
}`
};
function createExportStarHelper(context: TransformationContext, module: Expression) {
@@ -913,6 +913,12 @@ namespace ts {
delete deferredExports[id];
return append(statements, node);
}
else {
const original = getOriginalNode(node);
if (isModuleOrEnumDeclaration(original)) {
return append(appendExportsOfDeclaration(statements, original), node);
}
}
return node;
}
+4 -9
View File
@@ -324,8 +324,7 @@ namespace ts {
return node;
default:
Debug.failBadSyntaxKind(node);
return undefined;
return Debug.failBadSyntaxKind(node);
}
}
@@ -531,8 +530,7 @@ namespace ts {
return visitImportEqualsDeclaration(<ImportEqualsDeclaration>node);
default:
Debug.failBadSyntaxKind(node);
return visitEachChild(node, visitor, context);
return Debug.failBadSyntaxKind(node);
}
}
@@ -1870,10 +1868,8 @@ namespace ts {
return createIdentifier("Boolean");
default:
Debug.failBadSyntaxKind((<LiteralTypeNode>node).literal);
break;
return Debug.failBadSyntaxKind((<LiteralTypeNode>node).literal);
}
break;
case SyntaxKind.NumberKeyword:
return createIdentifier("Number");
@@ -1900,8 +1896,7 @@ namespace ts {
break;
default:
Debug.failBadSyntaxKind(node);
break;
return Debug.failBadSyntaxKind(node);
}
return createIdentifier("Object");
+17 -1
View File
@@ -60,7 +60,7 @@ namespace ts {
// import * as x from "mod"
// import { x, y } from "mod"
externalImports.push(<ImportDeclaration>node);
hasImportStarOrImportDefault = getImportNeedsImportStarHelper(<ImportDeclaration>node) || getImportNeedsImportDefaultHelper(<ImportDeclaration>node);
hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(<ImportDeclaration>node) || getImportNeedsImportDefaultHelper(<ImportDeclaration>node);
break;
case SyntaxKind.ImportEqualsDeclaration:
@@ -219,4 +219,20 @@ namespace ts {
isKeyword(expression.kind) ||
isIdentifier(expression);
}
/**
* @param input Template string input strings
* @param args Names which need to be made file-level unique
*/
export function helperString(input: TemplateStringsArray, ...args: string[]) {
return (uniqueName: EmitHelperUniqueNameCallback) => {
let result = "";
for (let i = 0; i < args.length; i++) {
result += input[i];
result += uniqueName(args[i]);
}
result += input[input.length - 1];
return result;
};
}
}
+8 -10
View File
@@ -117,7 +117,7 @@ namespace ts {
createWatchOfConfigFile(configParseResult, commandLineOptions);
}
else {
performCompilation(configParseResult.fileNames, configParseResult.options);
performCompilation(configParseResult.fileNames, configParseResult.options, getConfigFileParsingDiagnostics(configParseResult));
}
}
else {
@@ -139,11 +139,11 @@ namespace ts {
}
}
function performCompilation(rootFileNames: string[], compilerOptions: CompilerOptions) {
function performCompilation(rootFileNames: string[], compilerOptions: CompilerOptions, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>) {
const compilerHost = createCompilerHost(compilerOptions);
enableStatistics(compilerOptions);
const program = createProgram(rootFileNames, compilerOptions, compilerHost);
const program = createProgram(rootFileNames, compilerOptions, compilerHost, /*oldProgram*/ undefined, configFileParsingDiagnostics);
const exitStatus = emitFilesAndReportErrors(program, reportDiagnostic, s => sys.write(s + sys.newLine));
reportStatistics(program);
return sys.exit(exitStatus);
@@ -169,10 +169,7 @@ namespace ts {
function createWatchOfConfigFile(configParseResult: ParsedCommandLine, optionsToExtend: CompilerOptions) {
const watchCompilerHost = createWatchCompilerHostOfConfigFile(configParseResult.options.configFilePath, optionsToExtend, sys, /*createProgram*/ undefined, reportDiagnostic, createWatchStatusReporter(configParseResult.options));
updateWatchCompilationHost(watchCompilerHost);
watchCompilerHost.rootFiles = configParseResult.fileNames;
watchCompilerHost.options = configParseResult.options;
watchCompilerHost.configFileSpecs = configParseResult.configFileSpecs;
watchCompilerHost.configFileWildCardDirectories = configParseResult.wildcardDirectories;
watchCompilerHost.configFileParsingResult = configParseResult;
createWatchProgram(watchCompilerHost);
}
@@ -399,8 +396,9 @@ if (ts.Debug.isDebugging) {
if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) {
ts.sys.tryEnableSourceMapsForHost();
}
declare var process: any;
if (process && process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) {
process.stdout._handle.setBlocking(true);
if (ts.sys.setBlocking) {
ts.sys.setBlocking();
}
ts.executeCommandLine(ts.sys.args);
+2 -1
View File
@@ -31,10 +31,11 @@
"transformers/module/module.ts",
"transformers/module/system.ts",
"transformers/module/es2015.ts",
"transformers/declarations/diagnostics.ts",
"transformers/declarations.ts",
"transformer.ts",
"comments.ts",
"sourcemap.ts",
"declarationEmitter.ts",
"emitter.ts",
"watchUtilities.ts",
"program.ts",
+87 -42
View File
@@ -73,9 +73,19 @@ namespace ts {
| SyntaxKind.CommaToken
| SyntaxKind.DotToken
| SyntaxKind.Identifier
| SyntaxKind.NoSubstitutionTemplateLiteral
| SyntaxKind.Unknown;
// token > SyntaxKind.Identifer => token is a keyword
export type JsxTokenSyntaxKind =
| SyntaxKind.LessThanSlashToken
| SyntaxKind.EndOfFileToken
| SyntaxKind.ConflictMarkerTrivia
| SyntaxKind.JsxText
| SyntaxKind.JsxTextAllWhiteSpaces
| SyntaxKind.OpenBraceToken
| SyntaxKind.LessThanToken;
// token > SyntaxKind.Identifier => token is a keyword
// Also, If you add a new SyntaxKind be sure to keep the `Markers` section at the bottom in sync
export const enum SyntaxKind {
Unknown,
@@ -527,6 +537,7 @@ namespace ts {
TypeScriptModifier = Ambient | Public | Private | Protected | Readonly | Abstract | Const,
ExportDefault = Export | Default,
All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Async | Default | Const
}
export const enum JsxFlags {
@@ -693,6 +704,8 @@ namespace ts {
// Flags
SkipNameGenerationScope = 1 << 3, // Should skip a name generation scope when generating the name for this identifier
ReservedInNestedScopes = 1 << 4, // Reserve the generated name in nested scopes
Optimistic = 1 << 5, // First instance won't use '_#' if there's no conflict
FileLevel = 1 << 6, // Use only the file identifiers list and not generated names to search for conflicts
}
export interface Identifier extends PrimaryExpression, Declaration {
@@ -962,9 +975,9 @@ namespace ts {
export type FunctionLikeDeclaration =
| FunctionDeclaration
| MethodDeclaration
| ConstructorDeclaration
| GetAccessorDeclaration
| SetAccessorDeclaration
| ConstructorDeclaration
| FunctionExpression
| ArrowFunction;
/** @deprecated Use SignatureDeclaration */
@@ -978,7 +991,7 @@ namespace ts {
export interface MethodSignature extends SignatureDeclarationBase, TypeElement {
kind: SyntaxKind.MethodSignature;
parent?: ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
parent?: ObjectTypeDeclaration;
name: PropertyName;
}
@@ -1033,7 +1046,7 @@ namespace ts {
export interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement {
kind: SyntaxKind.IndexSignature;
parent?: ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
parent?: ObjectTypeDeclaration;
}
export interface TypeNode extends Node {
@@ -1756,6 +1769,7 @@ namespace ts {
kind: SyntaxKind.JsxOpeningElement;
parent?: JsxElement;
tagName: JsxTagNameExpression;
typeArguments?: NodeArray<TypeNode>;
attributes: JsxAttributes;
}
@@ -1763,6 +1777,7 @@ namespace ts {
export interface JsxSelfClosingElement extends PrimaryExpression {
kind: SyntaxKind.JsxSelfClosingElement;
tagName: JsxTagNameExpression;
typeArguments?: NodeArray<TypeNode>;
attributes: JsxAttributes;
}
@@ -2012,6 +2027,8 @@ namespace ts {
block: Block;
}
export type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode;
export type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag;
export interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer {
@@ -2557,7 +2574,7 @@ namespace ts {
// Content of this field should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
/* @internal */ resolvedModules: Map<ResolvedModuleFull | undefined>;
/* @internal */ resolvedTypeReferenceDirectiveNames: Map<ResolvedTypeReferenceDirective>;
/* @internal */ imports: ReadonlyArray<StringLiteral>;
/* @internal */ imports: ReadonlyArray<StringLiteralLike>;
// Identifier only if `declare global`
/* @internal */ moduleAugmentations: ReadonlyArray<StringLiteral | Identifier>;
/* @internal */ patternAmbientModules?: PatternAmbientModule[];
@@ -2572,6 +2589,9 @@ namespace ts {
export interface Bundle extends Node {
kind: SyntaxKind.Bundle;
sourceFiles: ReadonlyArray<SourceFile>;
/* @internal */ syntheticFileReferences?: ReadonlyArray<FileReference>;
/* @internal */ syntheticTypeReferences?: ReadonlyArray<FileReference>;
/* @internal */ hasNoDefaultLib?: boolean;
}
export interface JsonSourceFile extends SourceFile {
@@ -2653,6 +2673,7 @@ namespace ts {
getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
getConfigFileParsingDiagnostics(): ReadonlyArray<Diagnostic>;
/**
* Gets a type checker that can be used to semantically analyze source files in the program.
@@ -2760,7 +2781,7 @@ namespace ts {
getCompilerOptions(): CompilerOptions;
getSourceFiles(): ReadonlyArray<SourceFile>;
getSourceFile(fileName: string): SourceFile;
getSourceFile(fileName: string): SourceFile | undefined;
getResolvedTypeReferenceDirectives(): ReadonlyMap<ResolvedTypeReferenceDirective>;
}
@@ -2881,6 +2902,7 @@ namespace ts {
getApparentType(type: Type): Type;
getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined;
getSuggestionForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): string | undefined;
getSuggestionForNonexistentModule(node: Identifier, target: Symbol): string | undefined;
getBaseConstraintOfType(type: Type): Type | undefined;
getDefaultFromTypeParameter(type: Type): Type | undefined;
@@ -3146,6 +3168,18 @@ namespace ts {
/* @internal */
export type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
/* @internal */
export type AnyImportOrReExport = AnyImportSyntax | ExportDeclaration;
/* @internal */
export type AnyValidImportOrReExport =
| (ImportDeclaration | ExportDeclaration) & { moduleSpecifier: StringLiteral }
| ImportEqualsDeclaration & { moduleReference: ExternalModuleReference & { expression: StringLiteral } }
| RequireOrImportCall;
/* @internal */
export type RequireOrImportCall = CallExpression & { arguments: [StringLiteralLike] };
/* @internal */
export interface SymbolVisibilityResult {
accessibility: SymbolAccessibility;
@@ -3191,15 +3225,16 @@ namespace ts {
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
isDeclarationVisible(node: Declaration | AnyImportSyntax): boolean;
isLateBound(node: Declaration): node is LateBoundDeclaration;
collectLinkedAliases(node: Identifier): Node[];
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean | undefined;
isImplementationOfOverload(node: FunctionLike): boolean | undefined;
isRequiredInitializedParameter(node: ParameterDeclaration): boolean;
isOptionalUninitializedParameterProperty(node: ParameterDeclaration): boolean;
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: EmitTextWriter): void;
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: EmitTextWriter): void;
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: EmitTextWriter): void;
createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean): TypeNode;
createReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode;
createTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode;
createLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): Expression;
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, shouldComputeAliasToMarkVisible: boolean): SymbolAccessibilityResult;
isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult;
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
@@ -3213,7 +3248,6 @@ namespace ts {
getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): string[];
getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[];
isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean;
writeLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, writer: EmitTextWriter): void;
getJsxFactoryEntity(location?: Node): EntityName;
}
@@ -3311,7 +3345,7 @@ namespace ts {
escapedName: __String; // Name of symbol
declarations?: Declaration[]; // Declarations associated with this symbol
valueDeclaration?: Declaration; // First value declaration of the symbol
members?: SymbolTable; // Class, interface or literal instance members
members?: SymbolTable; // Class, interface or object literal instance members
exports?: SymbolTable; // Module exports
globalExports?: SymbolTable; // Conditional global UMD exports
/* @internal */ id?: number; // Unique id (used to look up SymbolLinks)
@@ -3819,6 +3853,8 @@ namespace ts {
constraint?: Type;
}
export type TypeVariable = TypeParameter | IndexedAccessType;
// keyof T types (TypeFlags.Index)
export interface IndexType extends InstantiableType {
type: InstantiableType | UnionOrIntersectionType;
@@ -3846,18 +3882,22 @@ namespace ts {
resolvedTrueType?: Type;
resolvedFalseType?: Type;
/* @internal */
resolvedDefaultConstraint?: Type;
/* @internal */
mapper?: TypeMapper;
/* @internal */
combinedMapper?: TypeMapper;
}
// Type parameter substitution (TypeFlags.Substitution)
// Substitution types are created for type parameter references that occur in the true branch
// of a conditional type. For example, in 'T extends string ? Foo<T> : Bar<T>', the reference to
// T in Foo<T> is resolved as a substitution type that substitutes 'string & T' for T. Thus, if
// Foo has a 'string' constraint on its type parameter, T will satisfy it. Substitution types
// disappear upon instantiation (just like type parameters).
// Substitution types are created for type parameters or indexed access types that occur in the
// true branch of a conditional type. For example, in 'T extends string ? Foo<T> : Bar<T>', the
// reference to T in Foo<T> is resolved as a substitution type that substitutes 'string & T' for T.
// Thus, if Foo has a 'string' constraint on its type parameter, T will satisfy it. Substitution
// types disappear upon instantiation (just like type parameters).
export interface SubstitutionType extends InstantiableType {
typeParameter: TypeParameter; // Target type parameter
substitute: Type; // Type to substitute for type parameter
typeVariable: TypeVariable; // Target type variable
substitute: Type; // Type to substitute for type parameter
}
export const enum SignatureKind {
@@ -3866,7 +3906,7 @@ namespace ts {
}
export interface Signature {
declaration: SignatureDeclaration; // Originating declaration
declaration?: SignatureDeclaration; // Originating declaration
typeParameters?: TypeParameter[]; // Type parameters (undefined if non-generic)
parameters: Symbol[]; // Parameters
/* @internal */
@@ -3920,10 +3960,11 @@ namespace ts {
HomomorphicMappedType = 1 << 1, // Reverse inference for homomorphic mapped type
MappedTypeConstraint = 1 << 2, // Reverse inference for mapped type
ReturnType = 1 << 3, // Inference made from return type of generic function
NoConstraints = 1 << 4, // Don't infer from constraints of instantiable types
AlwaysStrict = 1 << 5, // Always use strict rules for contravariant inferences
LiteralKeyof = 1 << 4, // Inference made from a string literal to a keyof T
NoConstraints = 1 << 5, // Don't infer from constraints of instantiable types
AlwaysStrict = 1 << 6, // Always use strict rules for contravariant inferences
PriorityImpliesUnion = ReturnType | MappedTypeConstraint, // These priorities imply that the resulting type should be a union of all candidates
PriorityImpliesCombination = ReturnType | MappedTypeConstraint | LiteralKeyof, // These priorities imply that the resulting type should be a combination of all candidates
}
/* @internal */
@@ -4072,6 +4113,7 @@ namespace ts {
/** configFile is set as non enumerable property so as to avoid checking of json source files */
/* @internal */ readonly configFile?: JsonSourceFile;
declaration?: boolean;
declarationMap?: boolean;
emitDeclarationOnly?: boolean;
declarationDir?: string;
/* @internal */ diagnostics?: boolean;
@@ -4714,12 +4756,17 @@ namespace ts {
}
export interface EmitHelper {
readonly name: string; // A unique name for this helper.
readonly scoped: boolean; // Indicates whether the helper MUST be emitted in the current scope.
readonly text: string; // ES3-compatible raw script text.
readonly priority?: number; // Helpers with a higher priority are emitted earlier than other helpers on the node.
readonly name: string; // A unique name for this helper.
readonly scoped: boolean; // Indicates whether the helper MUST be emitted in the current scope.
readonly text: string | ((node: EmitHelperUniqueNameCallback) => string); // ES3-compatible raw script text, or a function yielding such a string
readonly priority?: number; // Helpers with a higher priority are emitted earlier than other helpers on the node.
}
/* @internal */
export type UniqueNameHandler = (baseName: string, checkFn?: (name: string) => boolean, optimistic?: boolean) => string;
export type EmitHelperUniqueNameCallback = (name: string) => string;
/**
* Used by the checker, this enum keeps track of external emit helpers that should be type
* checked.
@@ -4853,6 +4900,8 @@ namespace ts {
* before returning the `NodeTransformer` callback.
*/
onEmitNode: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void;
/* @internal */ addDiagnostic(diag: Diagnostic): void;
}
export interface TransformationResult<T extends Node> {
@@ -4981,7 +5030,6 @@ namespace ts {
/*@internal*/ onEmitSourceMapOfNode?: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void;
/*@internal*/ onEmitSourceMapOfToken?: (node: Node, token: SyntaxKind, writer: (s: string) => void, pos: number, emitCallback: (token: SyntaxKind, writer: (s: string) => void, pos: number) => number) => number;
/*@internal*/ onEmitSourceMapOfPosition?: (pos: number) => void;
/*@internal*/ onEmitHelpers?: (node: Node, writeLines: (text: string) => void) => void;
/*@internal*/ onSetSourceFile?: (node: SourceFile) => void;
/*@internal*/ onBeforeEmitNodeArray?: (nodes: NodeArray<any>) => void;
/*@internal*/ onAfterEmitNodeArray?: (nodes: NodeArray<any>) => void;
@@ -4993,9 +5041,13 @@ namespace ts {
removeComments?: boolean;
newLine?: NewLineKind;
omitTrailingSemicolon?: boolean;
noEmitHelpers?: boolean;
/*@internal*/ module?: CompilerOptions["module"];
/*@internal*/ target?: CompilerOptions["target"];
/*@internal*/ sourceMap?: boolean;
/*@internal*/ inlineSourceMap?: boolean;
/*@internal*/ extendedDiagnostics?: boolean;
/*@internal*/ onlyPrintJsDocStyle?: boolean;
}
/* @internal */
@@ -5050,14 +5102,7 @@ namespace ts {
// Otherwise, returns all the diagnostics (global and file associated) in this collection.
getDiagnostics(fileName?: string): Diagnostic[];
// Gets a count of how many times this collection has been modified. This value changes
// each time 'add' is called (regardless of whether or not an equivalent diagnostic was
// already in the collection). As such, it can be used as a simple way to tell if any
// operation caused diagnostics to be returned by storing and comparing the return value
// of this method before/after the operation is performed.
getModificationCount(): number;
/* @internal */ reattachFileDiagnostics(newFile: SourceFile): void;
reattachFileDiagnostics(newFile: SourceFile): void;
}
// SyntaxKind.SyntaxList
@@ -5110,10 +5155,10 @@ namespace ts {
// Precomputed Formats
Modifiers = SingleLine | SpaceBetweenSiblings | NoInterveningComments,
HeritageClauses = SingleLine | SpaceBetweenSiblings,
SingleLineTypeLiteralMembers = SingleLine | SpaceBetweenBraces | SpaceBetweenSiblings | Indented,
MultiLineTypeLiteralMembers = MultiLine | Indented,
SingleLineTypeLiteralMembers = SingleLine | SpaceBetweenBraces | SpaceBetweenSiblings,
MultiLineTypeLiteralMembers = MultiLine | Indented | OptionalIfEmpty,
TupleTypeElements = CommaDelimited | SpaceBetweenSiblings | SingleLine | Indented,
TupleTypeElements = CommaDelimited | SpaceBetweenSiblings | SingleLine,
UnionTypeConstituents = BarDelimited | SpaceBetweenSiblings | SingleLine,
IntersectionTypeConstituents = AmpersandDelimited | SpaceBetweenSiblings | SingleLine,
ObjectBindingPatternElements = SingleLine | AllowTrailingComma | SpaceBetweenBraces | CommaDelimited | SpaceBetweenSiblings | NoSpaceIfEmpty,
@@ -5129,12 +5174,12 @@ namespace ts {
VariableDeclarationList = CommaDelimited | SpaceBetweenSiblings | SingleLine,
SingleLineFunctionBodyStatements = SingleLine | SpaceBetweenSiblings | SpaceBetweenBraces,
MultiLineFunctionBodyStatements = MultiLine,
ClassHeritageClauses = SingleLine | SpaceBetweenSiblings,
ClassHeritageClauses = SingleLine,
ClassMembers = Indented | MultiLine,
InterfaceMembers = Indented | MultiLine,
EnumMembers = CommaDelimited | Indented | MultiLine,
CaseBlockClauses = Indented | MultiLine,
NamedImportsOrExportsElements = CommaDelimited | SpaceBetweenSiblings | AllowTrailingComma | SingleLine | SpaceBetweenBraces,
NamedImportsOrExportsElements = CommaDelimited | SpaceBetweenSiblings | AllowTrailingComma | SingleLine | SpaceBetweenBraces | NoSpaceIfEmpty,
JsxElementOrFragmentChildren = SingleLine | NoInterveningComments,
JsxElementAttributes = SingleLine | SpaceBetweenSiblings | NoInterveningComments,
CaseOrDefaultClauseStatements = Indented | MultiLine | NoTrailingNewLine | OptionalIfEmpty,
+404 -169
View File
@@ -229,6 +229,14 @@ namespace ts {
}
}
/**
* Returns a value indicating whether a name is unique globally or within the current file
*/
export function isFileLevelUniqueName(currentSourceFile: SourceFile, name: string, hasGlobalName?: PrintHandlers["hasGlobalName"]): boolean {
return !(hasGlobalName && hasGlobalName(name))
&& !currentSourceFile.identifiers.has(name);
}
// Returns true if this node is missing from the actual source code. A 'missing' node is different
// from 'undefined/defined'. When a node is undefined (which can happen for optional nodes
// in the tree), it is definitely missing. However, a node may be defined, but still be
@@ -274,9 +282,9 @@ namespace ts {
return false;
}
export function isPinnedComment(text: string, comment: CommentRange) {
return text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk &&
text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation;
export function isPinnedComment(text: string, start: number) {
return text.charCodeAt(start + 1) === CharacterCodes.asterisk &&
text.charCodeAt(start + 2) === CharacterCodes.exclamation;
}
export function getTokenPosOfNode(node: Node, sourceFile?: SourceFileLike, includeJsDoc?: boolean): number {
@@ -538,6 +546,10 @@ namespace ts {
}
}
export function isAnyImportOrReExport(node: Node): node is AnyImportOrReExport {
return isAnyImportSyntax(node) || isExportDeclaration(node);
}
// Gets the nearest enclosing block scope container that has the provided node
// as a descendant, that is not the provided node.
export function getEnclosingBlockScopeContainer(node: Node): Node {
@@ -944,7 +956,7 @@ namespace ts {
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
case SyntaxKind.TypeLiteral:
return (<ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode>node).members;
return (<ObjectTypeDeclaration>node).members;
case SyntaxKind.ObjectLiteralExpression:
return (<ObjectLiteralExpression>node).properties;
}
@@ -967,6 +979,10 @@ namespace ts {
return false;
}
export function isVariableLikeOrAccessor(node: Node): node is AccessorDeclaration | VariableLikeDeclaration {
return isVariableLike(node) || isAccessor(node);
}
export function isVariableDeclarationInVariableStatement(node: VariableDeclaration) {
return node.parent.kind === SyntaxKind.VariableDeclarationList
&& node.parent.parent.kind === SyntaxKind.VariableStatement;
@@ -1423,6 +1439,10 @@ namespace ts {
return isInJavaScriptFile(file);
}
export function isSourceFileNotJavaScript(file: SourceFile): boolean {
return !isInJavaScriptFile(file);
}
export function isInJavaScriptFile(node: Node | undefined): boolean {
return node && !!(node.flags & NodeFlags.JavaScriptFile);
}
@@ -1444,9 +1464,9 @@ namespace ts {
* exactly one argument (of the form 'require("name")').
* This function does not test if the node is in a JavaScript file or not.
*/
export function isRequireCall(callExpression: Node, checkArgumentIsStringLiteral: true): callExpression is CallExpression & { expression: Identifier, arguments: [StringLiteralLike] };
export function isRequireCall(callExpression: Node, checkArgumentIsStringLiteral: boolean): callExpression is CallExpression;
export function isRequireCall(callExpression: Node, checkArgumentIsStringLiteral: boolean): callExpression is CallExpression {
export function isRequireCall(callExpression: Node, checkArgumentIsStringLiteralLike: true): callExpression is RequireOrImportCall & { expression: Identifier, arguments: [StringLiteralLike] };
export function isRequireCall(callExpression: Node, checkArgumentIsStringLiteralLike: boolean): callExpression is CallExpression;
export function isRequireCall(callExpression: Node, checkArgumentIsStringLiteralLike: boolean): callExpression is CallExpression {
if (callExpression.kind !== SyntaxKind.CallExpression) {
return false;
}
@@ -1460,14 +1480,14 @@ namespace ts {
return false;
}
const arg = args[0];
return !checkArgumentIsStringLiteral || arg.kind === SyntaxKind.StringLiteral || arg.kind === SyntaxKind.NoSubstitutionTemplateLiteral;
return !checkArgumentIsStringLiteralLike || isStringLiteralLike(arg);
}
export function isSingleOrDoubleQuote(charCode: number) {
return charCode === CharacterCodes.singleQuote || charCode === CharacterCodes.doubleQuote;
}
export function isStringDoubleQuoted(str: StringLiteral, sourceFile: SourceFile): boolean {
export function isStringDoubleQuoted(str: StringLiteralLike, sourceFile: SourceFile): boolean {
return getSourceTextOfNodeFromSourceFile(sourceFile, str).charCodeAt(0) === CharacterCodes.doubleQuote;
}
@@ -1501,7 +1521,7 @@ namespace ts {
*/
export function getAssignedJavascriptInitializer(node: Node) {
if (node && node.parent && isBinaryExpression(node.parent) && node.parent.operatorToken.kind === SyntaxKind.EqualsToken) {
const isPrototypeAssignment = isPropertyAccessExpression(node.parent.left) && node.parent.left.name.escapedText === "prototype";
const isPrototypeAssignment = isPrototypeAccess(node.parent.left);
return getJavascriptInitializer(node.parent.right, isPrototypeAssignment) ||
getDefaultedJavascriptInitializer(node.parent.left as EntityNameExpression, node.parent.right, isPrototypeAssignment);
}
@@ -1621,7 +1641,7 @@ namespace ts {
// F.prototype = { ... }
return SpecialPropertyAssignmentKind.Prototype;
}
else if (isPropertyAccessExpression(lhs.expression) && lhs.expression.name.escapedText === "prototype") {
else if (isPrototypeAccess(lhs.expression)) {
// F.G....prototype.x = expr
return SpecialPropertyAssignmentKind.PrototypeProperty;
}
@@ -1644,27 +1664,39 @@ namespace ts {
return SpecialPropertyAssignmentKind.None;
}
export function isPrototypePropertyAssignment(node: Node): boolean {
return isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === SpecialPropertyAssignmentKind.PrototypeProperty;
}
export function isSpecialPropertyDeclaration(expr: PropertyAccessExpression): boolean {
return isInJavaScriptFile(expr) &&
expr.parent && expr.parent.kind === SyntaxKind.ExpressionStatement &&
!!getJSDocTypeTag(expr.parent);
}
export function getExternalModuleName(node: Node): Expression {
if (node.kind === SyntaxKind.ImportDeclaration) {
return (<ImportDeclaration>node).moduleSpecifier;
export function importFromModuleSpecifier(node: StringLiteralLike): AnyValidImportOrReExport {
switch (node.parent.kind) {
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ExportDeclaration:
return node.parent as AnyValidImportOrReExport;
case SyntaxKind.ExternalModuleReference:
return (node.parent as ExternalModuleReference).parent as AnyValidImportOrReExport;
case SyntaxKind.CallExpression:
return node.parent as AnyValidImportOrReExport;
default:
return Debug.fail(Debug.showSyntaxKind(node));
}
if (node.kind === SyntaxKind.ImportEqualsDeclaration) {
const reference = (<ImportEqualsDeclaration>node).moduleReference;
if (reference.kind === SyntaxKind.ExternalModuleReference) {
return reference.expression;
}
}
if (node.kind === SyntaxKind.ExportDeclaration) {
return (<ExportDeclaration>node).moduleSpecifier;
}
if (isModuleWithStringLiteralName(node)) {
return node.name;
}
export function getExternalModuleName(node: AnyImportOrReExport): Expression {
switch (node.kind) {
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ExportDeclaration:
return node.moduleSpecifier;
case SyntaxKind.ImportEqualsDeclaration:
return node.moduleReference.kind === SyntaxKind.ExternalModuleReference ? node.moduleReference.expression : undefined;
default:
return Debug.assertNever(node);
}
}
@@ -1837,7 +1869,7 @@ namespace ts {
}
export function isRestParameter(node: ParameterDeclaration): boolean {
return node.dotDotDotToken !== undefined;
return node.dotDotDotToken !== undefined || node.type && node.type.kind === SyntaxKind.JSDocVariadicType;
}
export const enum AssignmentKind {
@@ -1938,6 +1970,18 @@ namespace ts {
return false;
}
export type ValueSignatureDeclaration =
| FunctionDeclaration
| MethodDeclaration
| ConstructorDeclaration
| AccessorDeclaration
| FunctionExpression
| ArrowFunction;
export function isValueSignatureDeclaration(node: Node): node is ValueSignatureDeclaration {
return isFunctionExpression(node) || isArrowFunction(node) || isMethodOrAccessor(node) || isFunctionDeclaration(node) || isConstructorDeclaration(node);
}
function walkUp(node: Node, kind: SyntaxKind) {
while (node && node.kind === kind) {
node = node.parent;
@@ -2023,12 +2067,12 @@ namespace ts {
// Name in member declaration or property name in property access
return (<NamedDeclaration | PropertyAccessExpression>parent).name === node;
case SyntaxKind.QualifiedName:
// Name on right hand side of dot in a type query
// Name on right hand side of dot in a type query or type reference
if ((<QualifiedName>parent).right === node) {
while (parent.kind === SyntaxKind.QualifiedName) {
parent = parent.parent;
}
return parent.kind === SyntaxKind.TypeQuery;
return parent.kind === SyntaxKind.TypeQuery || parent.kind === SyntaxKind.TypeReference;
}
return false;
case SyntaxKind.BindingElement:
@@ -2075,6 +2119,13 @@ namespace ts {
return heritageClause ? heritageClause.types : undefined;
}
/** Returns the node in an `extends` or `implements` clause of a class or interface. */
export function getAllSuperTypeNodes(node: Node): ReadonlyArray<TypeNode> {
return isInterfaceDeclaration(node) ? getInterfaceBaseTypeNodes(node) || emptyArray
: isClassLike(node) ? concatenate(singleElementArray(getClassExtendsHeritageClauseElement(node)), getClassImplementsHeritageClauseElements(node)) || emptyArray
: emptyArray;
}
export function getInterfaceBaseTypeNodes(node: InterfaceDeclaration) {
const heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword);
return heritageClause ? heritageClause.types : undefined;
@@ -2378,6 +2429,63 @@ namespace ts {
export function getOperatorPrecedence(nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean) {
switch (nodeKind) {
case SyntaxKind.CommaListExpression:
return 0;
case SyntaxKind.SpreadElement:
return 1;
case SyntaxKind.YieldExpression:
return 2;
case SyntaxKind.ConditionalExpression:
return 4;
case SyntaxKind.BinaryExpression:
switch (operatorKind) {
case SyntaxKind.CommaToken:
return 0;
case SyntaxKind.EqualsToken:
case SyntaxKind.PlusEqualsToken:
case SyntaxKind.MinusEqualsToken:
case SyntaxKind.AsteriskAsteriskEqualsToken:
case SyntaxKind.AsteriskEqualsToken:
case SyntaxKind.SlashEqualsToken:
case SyntaxKind.PercentEqualsToken:
case SyntaxKind.LessThanLessThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
case SyntaxKind.AmpersandEqualsToken:
case SyntaxKind.CaretEqualsToken:
case SyntaxKind.BarEqualsToken:
return 3;
default:
return getBinaryOperatorPrecedence(operatorKind);
}
case SyntaxKind.PrefixUnaryExpression:
case SyntaxKind.TypeOfExpression:
case SyntaxKind.VoidExpression:
case SyntaxKind.DeleteExpression:
case SyntaxKind.AwaitExpression:
return 16;
case SyntaxKind.PostfixUnaryExpression:
return 17;
case SyntaxKind.CallExpression:
return 18;
case SyntaxKind.NewExpression:
return hasArguments ? 19 : 18;
case SyntaxKind.TaggedTemplateExpression:
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
return 19;
case SyntaxKind.ThisKeyword:
case SyntaxKind.SuperKeyword:
case SyntaxKind.Identifier:
@@ -2399,137 +2507,72 @@ namespace ts {
case SyntaxKind.TemplateExpression:
case SyntaxKind.ParenthesizedExpression:
case SyntaxKind.OmittedExpression:
return 19;
case SyntaxKind.TaggedTemplateExpression:
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
return 18;
case SyntaxKind.NewExpression:
return hasArguments ? 18 : 17;
case SyntaxKind.CallExpression:
return 17;
case SyntaxKind.PostfixUnaryExpression:
return 16;
case SyntaxKind.PrefixUnaryExpression:
case SyntaxKind.TypeOfExpression:
case SyntaxKind.VoidExpression:
case SyntaxKind.DeleteExpression:
case SyntaxKind.AwaitExpression:
return 15;
case SyntaxKind.BinaryExpression:
switch (operatorKind) {
case SyntaxKind.ExclamationToken:
case SyntaxKind.TildeToken:
return 15;
case SyntaxKind.AsteriskAsteriskToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
return 14;
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
return 13;
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
return 12;
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.InKeyword:
case SyntaxKind.InstanceOfKeyword:
return 11;
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.ExclamationEqualsEqualsToken:
return 10;
case SyntaxKind.AmpersandToken:
return 9;
case SyntaxKind.CaretToken:
return 8;
case SyntaxKind.BarToken:
return 7;
case SyntaxKind.AmpersandAmpersandToken:
return 6;
case SyntaxKind.BarBarToken:
return 5;
case SyntaxKind.EqualsToken:
case SyntaxKind.PlusEqualsToken:
case SyntaxKind.MinusEqualsToken:
case SyntaxKind.AsteriskAsteriskEqualsToken:
case SyntaxKind.AsteriskEqualsToken:
case SyntaxKind.SlashEqualsToken:
case SyntaxKind.PercentEqualsToken:
case SyntaxKind.LessThanLessThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
case SyntaxKind.AmpersandEqualsToken:
case SyntaxKind.CaretEqualsToken:
case SyntaxKind.BarEqualsToken:
return 3;
case SyntaxKind.CommaToken:
return 0;
default:
return -1;
}
case SyntaxKind.ConditionalExpression:
return 4;
case SyntaxKind.YieldExpression:
return 2;
case SyntaxKind.SpreadElement:
return 1;
case SyntaxKind.CommaListExpression:
return 0;
return 20;
default:
return -1;
}
}
/* @internal */
export function getBinaryOperatorPrecedence(kind: SyntaxKind): number {
switch (kind) {
case SyntaxKind.BarBarToken:
return 5;
case SyntaxKind.AmpersandAmpersandToken:
return 6;
case SyntaxKind.BarToken:
return 7;
case SyntaxKind.CaretToken:
return 8;
case SyntaxKind.AmpersandToken:
return 9;
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsEqualsToken:
return 10;
case SyntaxKind.LessThanToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.InstanceOfKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.AsKeyword:
return 11;
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
return 12;
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
return 13;
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
return 14;
case SyntaxKind.AsteriskAsteriskToken:
return 15;
}
// -1 is lower than all other precedences. Returning it will cause binary expression
// parsing to stop.
return -1;
}
export function createDiagnosticCollection(): DiagnosticCollection {
let nonFileDiagnostics = [] as SortedArray<Diagnostic>;
const filesWithDiagnostics = [] as SortedArray<string>;
const fileDiagnostics = createMap<SortedArray<Diagnostic>>();
let hasReadNonFileDiagnostics = false;
let modificationCount = 0;
return {
add,
getGlobalDiagnostics,
getDiagnostics,
getModificationCount,
reattachFileDiagnostics
};
function getModificationCount() {
return modificationCount;
}
function reattachFileDiagnostics(newFile: SourceFile): void {
forEach(fileDiagnostics.get(newFile.fileName), diagnostic => diagnostic.file = newFile);
}
@@ -2555,7 +2598,6 @@ namespace ts {
}
insertSorted(diagnostics, diagnostic, compareDiagnostics);
modificationCount++;
}
function getGlobalDiagnostics(): Diagnostic[] {
@@ -2798,8 +2840,9 @@ namespace ts {
export interface EmitFileNames {
jsFilePath: string;
sourceMapFilePath: string;
declarationFilePath: string;
sourceMapFilePath: string | undefined;
declarationFilePath: string | undefined;
declarationMapPath: string | undefined;
}
/**
@@ -3110,7 +3153,7 @@ namespace ts {
return currentDetachedCommentInfo;
function isPinnedCommentLocal(comment: CommentRange) {
return isPinnedComment(text, comment);
return isPinnedComment(text, comment.pos);
}
}
@@ -3328,8 +3371,15 @@ namespace ts {
}
export function isEntityNameExpression(node: Node): node is EntityNameExpression {
return node.kind === SyntaxKind.Identifier ||
node.kind === SyntaxKind.PropertyAccessExpression && isEntityNameExpression((<PropertyAccessExpression>node).expression);
return node.kind === SyntaxKind.Identifier || isPropertyAccessEntityNameExpression(node);
}
export function isPropertyAccessEntityNameExpression(node: Node): node is PropertyAccessEntityNameExpression {
return isPropertyAccessExpression(node) && isEntityNameExpression(node.expression);
}
export function isPrototypeAccess(node: Node): node is PropertyAccessExpression {
return isPropertyAccessExpression(node) && node.name.escapedText === "prototype";
}
export function isRightSideOfQualifiedNameOrPropertyAccess(node: Node) {
@@ -3370,7 +3420,7 @@ namespace ts {
for (let i = 0; i < length; i++) {
const charCode = input.charCodeAt(i);
// handel utf8
// handle utf8
if (charCode < 0x80) {
output.push(charCode);
}
@@ -3435,6 +3485,82 @@ namespace ts {
return result;
}
function getStringFromExpandedCharCodes(codes: number[]): string {
let output = "";
let i = 0;
const length = codes.length;
while (i < length) {
const charCode = codes[i];
if (charCode < 0x80) {
output += String.fromCharCode(charCode);
i++;
}
else if ((charCode & 0B11000000) === 0B11000000) {
let value = charCode & 0B00111111;
i++;
let nextCode: number = codes[i];
while ((nextCode & 0B11000000) === 0B10000000) {
value = (value << 6) | (nextCode & 0B00111111);
i++;
nextCode = codes[i];
}
// `value` may be greater than 10FFFF (the maximum unicode codepoint) - JS will just make this into an invalid character for us
output += String.fromCharCode(value);
}
else {
// We don't want to kill the process when decoding fails (due to a following char byte not
// following a leading char), so we just print the (bad) value
output += String.fromCharCode(charCode);
i++;
}
}
return output;
}
export function base64encode(host: { base64encode?(input: string): string }, input: string): string {
if (host.base64encode) {
return host.base64encode(input);
}
return convertToBase64(input);
}
export function base64decode(host: { base64decode?(input: string): string }, input: string): string {
if (host.base64decode) {
return host.base64decode(input);
}
const length = input.length;
const expandedCharCodes: number[] = [];
let i = 0;
while (i < length) {
// Stop decoding once padding characters are present
if (input.charCodeAt(i) === base64Digits.charCodeAt(64)) {
break;
}
// convert 4 input digits into three characters, ignoring padding characters at the end
const ch1 = base64Digits.indexOf(input[i]);
const ch2 = base64Digits.indexOf(input[i + 1]);
const ch3 = base64Digits.indexOf(input[i + 2]);
const ch4 = base64Digits.indexOf(input[i + 3]);
const code1 = ((ch1 & 0B00111111) << 2) | ((ch2 >> 4) & 0B00000011);
const code2 = ((ch2 & 0B00001111) << 4) | ((ch3 >> 2) & 0B00001111);
const code3 = ((ch3 & 0B00000011) << 6) | (ch4 & 0B00111111);
if (code2 === 0 && ch3 !== 0) { // code2 decoded to zero, but ch3 was padding - elide code2 and code3
expandedCharCodes.push(code1);
}
else if (code3 === 0 && ch4 !== 0) { // code3 decoded to zero, but ch4 was padding, elide code3
expandedCharCodes.push(code1, code2);
}
else {
expandedCharCodes.push(code1, code2, code3);
}
i += 4;
}
return getStringFromExpandedCharCodes(expandedCharCodes);
}
const carriageReturnLineFeed = "\r\n";
const lineFeed = "\n";
export function getNewLineCharacter(options: CompilerOptions | PrinterOptions, getNewLine?: () => string): string {
@@ -3839,6 +3965,38 @@ namespace ts {
export function showModuleSpecifier({ moduleSpecifier }: ImportDeclaration): string {
return isStringLiteral(moduleSpecifier) ? moduleSpecifier.text : getTextOfNode(moduleSpecifier);
}
export function getLastChild(node: Node): Node | undefined {
let lastChild: Node | undefined;
forEachChild(node,
child => {
if (nodeIsPresent(child)) lastChild = child;
},
children => {
// As an optimization, jump straight to the end of the list.
for (let i = children.length - 1; i >= 0; i--) {
if (nodeIsPresent(children[i])) {
lastChild = children[i];
break;
}
}
});
return lastChild;
}
/** Add a value to a set, and return true if it wasn't already present. */
export function addToSeen(seen: Map<true>, key: string | number): boolean {
key = String(key);
if (seen.has(key)) {
return false;
}
seen.set(key, true);
return true;
}
export function isObjectTypeDeclaration(node: Node): node is ObjectTypeDeclaration {
return isClassLike(node) || isInterfaceDeclaration(node) || isTypeLiteralNode(node);
}
}
namespace ts {
@@ -3918,6 +4076,12 @@ namespace ts {
return { start, length };
}
/* @internal */
export function createTextRange(pos: number, end: number = pos): TextRange {
Debug.assert(end >= pos);
return { pos, end };
}
export function createTextSpanFromBounds(start: number, end: number) {
return createTextSpan(start, end - start);
}
@@ -4409,13 +4573,13 @@ namespace ts {
* Does not return tags for binding patterns, because JSDoc matches
* parameters by name and binding patterns do not have a name.
*/
export function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray<JSDocParameterTag> | undefined {
export function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray<JSDocParameterTag> {
if (param.name && isIdentifier(param.name)) {
const name = param.name.escapedText;
return getJSDocTags(param.parent).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name);
}
// a binding pattern doesn't have a name, so it's not possible to match it a JSDoc parameter, which is identified by name
return undefined;
return emptyArray;
}
/**
@@ -4425,33 +4589,33 @@ namespace ts {
* for example on a variable declaration whose initializer is a function expression.
*/
export function hasJSDocParameterTags(node: FunctionLikeDeclaration | SignatureDeclaration): boolean {
return !!getFirstJSDocTag(node, SyntaxKind.JSDocParameterTag);
return !!getFirstJSDocTag(node, isJSDocParameterTag);
}
/** Gets the JSDoc augments tag for the node if present */
export function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag | undefined {
return getFirstJSDocTag(node, SyntaxKind.JSDocAugmentsTag) as JSDocAugmentsTag;
return getFirstJSDocTag(node, isJSDocAugmentsTag);
}
/** Gets the JSDoc class tag for the node if present */
export function getJSDocClassTag(node: Node): JSDocClassTag | undefined {
return getFirstJSDocTag(node, SyntaxKind.JSDocClassTag) as JSDocClassTag;
return getFirstJSDocTag(node, isJSDocClassTag);
}
/** Gets the JSDoc return tag for the node if present */
export function getJSDocReturnTag(node: Node): JSDocReturnTag | undefined {
return getFirstJSDocTag(node, SyntaxKind.JSDocReturnTag) as JSDocReturnTag;
return getFirstJSDocTag(node, isJSDocReturnTag);
}
/** Gets the JSDoc template tag for the node if present */
export function getJSDocTemplateTag(node: Node): JSDocTemplateTag | undefined {
return getFirstJSDocTag(node, SyntaxKind.JSDocTemplateTag) as JSDocTemplateTag;
return getFirstJSDocTag(node, isJSDocTemplateTag);
}
/** Gets the JSDoc type tag for the node if present and valid */
export function getJSDocTypeTag(node: Node): JSDocTypeTag | undefined {
// We should have already issued an error if there were multiple type jsdocs, so just use the first one.
const tag = getFirstJSDocTag(node, SyntaxKind.JSDocTypeTag) as JSDocTypeTag;
const tag = getFirstJSDocTag(node, isJSDocTypeTag);
if (tag && tag.typeExpression && tag.typeExpression.type) {
return tag;
}
@@ -4470,12 +4634,9 @@ namespace ts {
* tag directly on the node would be returned.
*/
export function getJSDocType(node: Node): TypeNode | undefined {
let tag: JSDocTypeTag | JSDocParameterTag = getFirstJSDocTag(node, SyntaxKind.JSDocTypeTag) as JSDocTypeTag;
if (!tag && node.kind === SyntaxKind.Parameter) {
const paramTags = getJSDocParameterTags(node as ParameterDeclaration);
if (paramTags) {
tag = find(paramTags, tag => !!tag.typeExpression);
}
let tag: JSDocTypeTag | JSDocParameterTag | undefined = getFirstJSDocTag(node, isJSDocTypeTag);
if (!tag && isParameter(node)) {
tag = find(getJSDocParameterTags(node), tag => !!tag.typeExpression);
}
return tag && tag.typeExpression && tag.typeExpression.type;
@@ -4493,7 +4654,7 @@ namespace ts {
}
/** Get all JSDoc tags related to a node, including those on parent nodes. */
export function getJSDocTags(node: Node): ReadonlyArray<JSDocTag> | undefined {
export function getJSDocTags(node: Node): ReadonlyArray<JSDocTag> {
let tags = (node as JSDocContainer).jsDocCache;
// If cache is 'null', that means we did the work of searching for JSDoc tags and came up with nothing.
if (tags === undefined) {
@@ -4503,17 +4664,14 @@ namespace ts {
}
/** Get the first JSDoc tag of a specified kind, or undefined if not present. */
function getFirstJSDocTag(node: Node, kind: SyntaxKind): JSDocTag | undefined {
const tags = getJSDocTags(node);
return find(tags, doc => doc.kind === kind);
function getFirstJSDocTag<T extends JSDocTag>(node: Node, predicate: (tag: JSDocTag) => tag is T): T | undefined {
return find(getJSDocTags(node), predicate);
}
/** Gets all JSDoc tags of a specified kind, or undefined if not present. */
export function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): ReadonlyArray<JSDocTag> | undefined {
const tags = getJSDocTags(node);
return filter(tags, doc => doc.kind === kind);
export function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): ReadonlyArray<JSDocTag> {
return getJSDocTags(node).filter(doc => doc.kind === kind);
}
}
// Simple node tests of the form `node.kind === SyntaxKind.Foo`.
@@ -5156,6 +5314,10 @@ namespace ts {
return node.kind === SyntaxKind.JSDocAugmentsTag;
}
export function isJSDocClassTag(node: Node): node is JSDocClassTag {
return node.kind === SyntaxKind.JSDocClassTag;
}
export function isJSDocParameterTag(node: Node): node is JSDocParameterTag {
return node.kind === SyntaxKind.JSDocParameterTag;
}
@@ -5282,6 +5444,16 @@ namespace ts {
return false;
}
/* @internal */
export function isParameterPropertyModifier(kind: SyntaxKind): boolean {
return !!(modifierToFlag(kind) & ModifierFlags.ParameterPropertyModifier);
}
/* @internal */
export function isClassMemberModifier(idToken: SyntaxKind): boolean {
return isParameterPropertyModifier(idToken) || idToken === SyntaxKind.StaticKeyword;
}
export function isModifier(node: Node): node is Modifier {
return isModifierKind(node.kind);
}
@@ -5975,6 +6147,45 @@ namespace ts {
return !!(node as HasType).type;
}
/* True if the node could have a type node a `.type` */
/* @internal */
export function couldHaveType(node: Node): node is HasType {
switch (node.kind) {
case SyntaxKind.Parameter:
case SyntaxKind.PropertySignature:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.MethodSignature:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.Constructor:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.CallSignature:
case SyntaxKind.ConstructSignature:
case SyntaxKind.IndexSignature:
case SyntaxKind.TypePredicate:
case SyntaxKind.FunctionType:
case SyntaxKind.ConstructorType:
case SyntaxKind.ParenthesizedType:
case SyntaxKind.TypeOperator:
case SyntaxKind.MappedType:
case SyntaxKind.TypeAssertionExpression:
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
case SyntaxKind.AsExpression:
case SyntaxKind.VariableDeclaration:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.JSDocTypeExpression:
case SyntaxKind.JSDocNullableType:
case SyntaxKind.JSDocNonNullableType:
case SyntaxKind.JSDocOptionalType:
case SyntaxKind.JSDocFunctionType:
case SyntaxKind.JSDocVariadicType:
return true;
}
return false;
}
/** True if has initializer node attached to it. */
/* @internal */
export function hasInitializer(node: Node): node is HasInitializer {
@@ -6007,6 +6218,30 @@ namespace ts {
return node.kind === SyntaxKind.TypeReference || node.kind === SyntaxKind.ExpressionWithTypeArguments;
}
const MAX_SMI_X86 = 0x3fff_ffff;
/* @internal */
export function guessIndentation(lines: string[]) {
let indentation = MAX_SMI_X86;
for (const line of lines) {
if (!line.length) {
continue;
}
let i = 0;
for (; i < line.length && i < indentation; i++) {
if (!isWhiteSpaceLike(line.charCodeAt(i))) {
break;
}
}
if (i < indentation) {
indentation = i;
}
if (indentation === 0) {
return 0;
}
}
return indentation === MAX_SMI_X86 ? undefined : indentation;
}
export function isStringLiteralLike(node: Node): node is StringLiteralLike {
return node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NoSubstitutionTemplateLiteral;
}
+6 -4
View File
@@ -821,11 +821,13 @@ namespace ts {
case SyntaxKind.JsxSelfClosingElement:
return updateJsxSelfClosingElement(<JsxSelfClosingElement>node,
visitNode((<JsxSelfClosingElement>node).tagName, visitor, isJsxTagNameExpression),
nodesVisitor((<JsxSelfClosingElement>node).typeArguments, visitor, isTypeNode),
visitNode((<JsxSelfClosingElement>node).attributes, visitor, isJsxAttributes));
case SyntaxKind.JsxOpeningElement:
return updateJsxOpeningElement(<JsxOpeningElement>node,
visitNode((<JsxOpeningElement>node).tagName, visitor, isJsxTagNameExpression),
nodesVisitor((<JsxSelfClosingElement>node).typeArguments, visitor, isTypeNode),
visitNode((<JsxOpeningElement>node).attributes, visitor, isJsxAttributes));
case SyntaxKind.JsxClosingElement:
@@ -1544,11 +1546,11 @@ namespace ts {
export namespace Debug {
let isDebugInfoEnabled = false;
export const failBadSyntaxKind = shouldAssert(AssertionLevel.Normal)
? (node: Node, message?: string): never => fail(
export function failBadSyntaxKind(node: Node, message?: string): never {
return fail(
`${message || "Unexpected node."}\r\nNode ${formatSyntaxKind(node.kind)} was unexpected.`,
failBadSyntaxKind)
: noop as () => never; // TODO: GH#22091
failBadSyntaxKind);
}
export const assertEachNode = shouldAssert(AssertionLevel.Normal)
? (nodes: Node[], test: (node: Node) => boolean, message?: string): void => assert(
+58 -43
View File
@@ -31,7 +31,8 @@ namespace ts {
};
}
const nonClearingMessageCodes: number[] = [
/** @internal */
export const nonClearingMessageCodes: number[] = [
Diagnostics.Compilation_complete_Watching_for_file_changes.code,
Diagnostics.Found_1_error.code,
Diagnostics.Found_0_errors.code
@@ -76,10 +77,8 @@ namespace ts {
/** Parses config file using System interface */
export function parseConfigFileWithSystem(configFileName: string, optionsToExtend: CompilerOptions, system: System, reportDiagnostic: DiagnosticReporter) {
const host: ParseConfigFileHost = <any>system;
host.onConfigFileDiagnostic = reportDiagnostic;
host.onUnRecoverableConfigFileDiagnostic = diagnostic => reportUnrecoverableDiagnostic(sys, reportDiagnostic, diagnostic);
const result = getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host);
host.onConfigFileDiagnostic = undefined;
host.onUnRecoverableConfigFileDiagnostic = undefined;
return result;
}
@@ -104,13 +103,8 @@ namespace ts {
}
const result = parseJsonText(configFileName, configFileText);
result.parseDiagnostics.forEach(diagnostic => host.onConfigFileDiagnostic(diagnostic));
const cwd = host.getCurrentDirectory();
const configParseResult = parseJsonSourceFileConfigFileContent(result, host, getNormalizedAbsolutePath(getDirectoryPath(configFileName), cwd), optionsToExtend, getNormalizedAbsolutePath(configFileName, cwd));
configParseResult.errors.forEach(diagnostic => host.onConfigFileDiagnostic(diagnostic));
return configParseResult;
return parseJsonSourceFileConfigFileContent(result, host, getNormalizedAbsolutePath(getDirectoryPath(configFileName), cwd), optionsToExtend, getNormalizedAbsolutePath(configFileName, cwd));
}
/**
@@ -124,6 +118,7 @@ namespace ts {
getOptionsDiagnostics(): ReadonlyArray<Diagnostic>;
getGlobalDiagnostics(): ReadonlyArray<Diagnostic>;
getSemanticDiagnostics(): ReadonlyArray<Diagnostic>;
getConfigFileParsingDiagnostics(): ReadonlyArray<Diagnostic>;
emit(): EmitResult;
}
@@ -134,16 +129,18 @@ namespace ts {
*/
export function emitFilesAndReportErrors(program: ProgramToEmitFilesAndReportErrors, reportDiagnostic: DiagnosticReporter, reportSummary?: ReportEmitErrorSummary, writeFileName?: (s: string) => void) {
// First get and report any syntactic errors.
const diagnostics = program.getSyntacticDiagnostics().slice();
const diagnostics = program.getConfigFileParsingDiagnostics().slice();
const configFileParsingDiagnosticsLength = diagnostics.length;
addRange(diagnostics, program.getSyntacticDiagnostics());
let reportSemanticDiagnostics = false;
// If we didn't have any syntactic errors, then also try getting the global and
// semantic errors.
if (diagnostics.length === 0) {
if (diagnostics.length === configFileParsingDiagnosticsLength) {
addRange(diagnostics, program.getOptionsDiagnostics());
addRange(diagnostics, program.getGlobalDiagnostics());
if (diagnostics.length === 0) {
if (diagnostics.length === configFileParsingDiagnosticsLength) {
reportSemanticDiagnostics = true;
}
}
@@ -234,12 +231,14 @@ namespace ts {
function emitFilesAndReportErrorUsingBuilder(builderProgram: BuilderProgram) {
const compilerOptions = builderProgram.getCompilerOptions();
const newLine = getNewLineCharacter(compilerOptions, () => system.newLine);
const reportSummary = (errorCount: number) => {
if (errorCount === 1) {
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_1_error, errorCount), sys.newLine, compilerOptions);
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_1_error, errorCount), newLine, compilerOptions);
}
else {
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_0_errors, errorCount, errorCount), sys.newLine, compilerOptions);
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_0_errors, errorCount, errorCount), newLine, compilerOptions);
}
};
@@ -261,7 +260,6 @@ namespace ts {
export function createWatchCompilerHostOfConfigFile<T extends BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram>(configFileName: string, optionsToExtend: CompilerOptions | undefined, system: System, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHostOfConfigFile<T> {
reportDiagnostic = reportDiagnostic || createDiagnosticReporter(system);
const host = createWatchCompilerHost(system, createProgram, reportDiagnostic, reportWatchStatus) as WatchCompilerHostOfConfigFile<T>;
host.onConfigFileDiagnostic = reportDiagnostic;
host.onUnRecoverableConfigFileDiagnostic = diagnostic => reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic);
host.configFileName = configFileName;
host.optionsToExtend = optionsToExtend;
@@ -282,7 +280,8 @@ namespace ts {
namespace ts {
export type DiagnosticReporter = (diagnostic: Diagnostic) => void;
export type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void;
export type CreateProgram<T extends BuilderProgram> = (rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: T) => T;
/** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */
export type CreateProgram<T extends BuilderProgram> = (rootNames: ReadonlyArray<string> | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>) => T;
export interface WatchCompilerHost<T extends BuilderProgram> {
/**
* Used to create the program when need for program creation or recreation detected
@@ -368,11 +367,6 @@ namespace ts {
* Reports config file diagnostics
*/
export interface ConfigFileDiagnosticsReporter {
/**
* Reports the diagnostics in reading/writing or parsing of the config file
*/
onConfigFileDiagnostic: DiagnosticReporter;
/**
* Reports unrecoverable error when parsing config file
*/
@@ -401,11 +395,8 @@ namespace ts {
*/
/*@internal*/
export interface WatchCompilerHostOfConfigFile<T extends BuilderProgram> extends WatchCompilerHost<T> {
rootFiles?: string[];
options?: CompilerOptions;
optionsToExtend?: CompilerOptions;
configFileSpecs?: ConfigFileSpecs;
configFileWildCardDirectories?: MapLike<WatchDirectoryFlags>;
configFileParsingResult?: ParsedCommandLine;
}
export interface Watch<T> {
@@ -483,7 +474,10 @@ namespace ts {
const getCurrentDirectory = () => currentDirectory;
const readFile: (path: string, encoding?: string) => string | undefined = (path, encoding) => host.readFile(path, encoding);
const { configFileName, optionsToExtend: optionsToExtendForConfigFile = {}, createProgram } = host;
let { rootFiles: rootFileNames, options: compilerOptions, configFileSpecs, configFileWildCardDirectories } = host;
let { rootFiles: rootFileNames, options: compilerOptions } = host;
let configFileSpecs: ConfigFileSpecs;
let configFileParsingDiagnostics: ReadonlyArray<Diagnostic> | undefined;
let hasChangedConfigFileParsingErrors = false;
const cachedDirectoryStructureHost = configFileName && createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames);
if (cachedDirectoryStructureHost && host.onCachedDirectoryStructureHostCreate) {
@@ -496,13 +490,22 @@ namespace ts {
fileExists: path => host.fileExists(path),
readFile,
getCurrentDirectory,
onConfigFileDiagnostic: host.onConfigFileDiagnostic,
onUnRecoverableConfigFileDiagnostic: host.onUnRecoverableConfigFileDiagnostic
};
// From tsc we want to get already parsed result and hence check for rootFileNames
if (configFileName && !rootFileNames) {
parseConfigFile();
let newLine = updateNewLine();
reportWatchDiagnostic(Diagnostics.Starting_compilation_in_watch_mode);
if (configFileName) {
newLine = getNewLineCharacter(optionsToExtendForConfigFile, () => host.getNewLine());
if (host.configFileParsingResult) {
setConfigFileParsingResult(host.configFileParsingResult);
}
else {
Debug.assert(!rootFileNames);
parseConfigFile();
}
newLine = updateNewLine();
}
const trace = host.trace && ((s: string) => { host.trace(s + newLine); });
@@ -512,7 +515,6 @@ namespace ts {
const { watchFile, watchFilePath, watchDirectory: watchDirectoryWorker } = getWatchFactory(watchLogLevel, writeLog);
const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);
let newLine = updateNewLine();
writeLog(`Current directory: ${currentDirectory} CaseSensitiveFileNames: ${useCaseSensitiveFileNames}`);
if (configFileName) {
@@ -569,7 +571,6 @@ namespace ts {
((typeDirectiveNames, containingFile) => resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile));
const userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
reportWatchDiagnostic(Diagnostics.Starting_compilation_in_watch_mode);
synchronizeProgram();
// Update the wild card directory watch
@@ -601,6 +602,10 @@ namespace ts {
// All resolutions are invalid if user provided resolutions
const hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames)) {
if (hasChangedConfigFileParsingErrors) {
builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics);
hasChangedConfigFileParsingErrors = false;
}
return builderProgram;
}
@@ -613,10 +618,11 @@ namespace ts {
const needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !program;
hasChangedCompilerOptions = false;
hasChangedConfigFileParsingErrors = false;
resolutionCache.startCachingPerDirectoryResolution();
compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram);
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics);
resolutionCache.finishCachingPerDirectoryResolution();
// Update watches
@@ -653,7 +659,7 @@ namespace ts {
}
function updateNewLine() {
return getNewLineCharacter(compilerOptions, () => host.getNewLine());
return getNewLineCharacter(compilerOptions || optionsToExtendForConfigFile, () => host.getNewLine());
}
function toPath(fileName: string) {
@@ -783,7 +789,7 @@ namespace ts {
function reportWatchDiagnostic(message: DiagnosticMessage) {
if (host.onWatchStatusChange) {
host.onWatchStatusChange(createCompilerDiagnostic(message), newLine, compilerOptions);
host.onWatchStatusChange(createCompilerDiagnostic(message), newLine, compilerOptions || optionsToExtendForConfigFile);
}
}
@@ -824,8 +830,13 @@ namespace ts {
function reloadFileNamesFromConfigFile() {
const result = getFileNamesFromConfigSpecs(configFileSpecs, getDirectoryPath(configFileName), compilerOptions, parseConfigFileHost);
if (!configFileSpecs.filesSpecs && result.fileNames.length === 0) {
host.onConfigFileDiagnostic(getErrorForNoInputFiles(configFileSpecs, configFileName));
if (result.fileNames.length) {
configFileParsingDiagnostics = filter(configFileParsingDiagnostics, error => !isErrorNoInputFiles(error));
hasChangedConfigFileParsingErrors = true;
}
else if (!configFileSpecs.filesSpecs && !some(configFileParsingDiagnostics, isErrorNoInputFiles)) {
configFileParsingDiagnostics = configFileParsingDiagnostics!.concat(getErrorForNoInputFiles(configFileSpecs, configFileName));
hasChangedConfigFileParsingErrors = true;
}
rootFileNames = result.fileNames;
@@ -849,11 +860,15 @@ namespace ts {
}
function parseConfigFile() {
const configParseResult = getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost);
rootFileNames = configParseResult.fileNames;
compilerOptions = configParseResult.options;
configFileSpecs = configParseResult.configFileSpecs;
configFileWildCardDirectories = configParseResult.wildcardDirectories;
setConfigFileParsingResult(getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost));
}
function setConfigFileParsingResult(configFileParseResult: ParsedCommandLine) {
rootFileNames = configFileParseResult.fileNames;
compilerOptions = configFileParseResult.options;
configFileSpecs = configFileParseResult.configFileSpecs;
configFileParsingDiagnostics = getConfigFileParsingDiagnostics(configFileParseResult);
hasChangedConfigFileParsingErrors = true;
}
function onSourceFileChange(fileName: string, eventKind: FileWatcherEventKind, path: Path) {
@@ -899,10 +914,10 @@ namespace ts {
}
function watchConfigFileWildCardDirectories() {
if (configFileWildCardDirectories) {
if (configFileSpecs) {
updateWatchingWildcardDirectories(
watchedWildcardDirectories || (watchedWildcardDirectories = createMap()),
createMapFromTemplate(configFileWildCardDirectories),
createMapFromTemplate(configFileSpecs.wildcardDirectories),
watchWildcardDirectory
);
}
+1 -1
View File
@@ -148,7 +148,7 @@ class CompilerBaselineRunner extends RunnerBase {
// Source maps?
it("Correct sourcemap content for " + fileName, () => {
if (options.sourceMap || options.inlineSourceMap) {
if (options.sourceMap || options.inlineSourceMap || options.declarationMap) {
Harness.Baseline.runBaseline(justName.replace(/\.tsx?$/, ".sourcemap.txt"), () => {
const record = result.getSourceMapRecord();
if ((options.noEmitOnError && result.errors.length !== 0) || record === undefined) {
+79 -81
View File
@@ -365,7 +365,6 @@ namespace FourSlash {
function memoWrap(ls: ts.LanguageService, target: TestState): ts.LanguageService {
const cacheableMembers: (keyof typeof ls)[] = [
"getCompletionsAtPosition",
"getCompletionEntryDetails",
"getCompletionEntrySymbol",
"getQuickInfoAtPosition",
@@ -435,7 +434,7 @@ namespace FourSlash {
}
}
private markerName(m: Marker): string {
public markerName(m: Marker): string {
return ts.forEachEntry(this.testData.markerPositions, (marker, name) => {
if (marker === m) {
return name;
@@ -833,7 +832,12 @@ namespace FourSlash {
}
}
public verifyCompletionsAt(markerName: string, expected: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntry>, options?: FourSlashInterface.CompletionsAtOptions) {
public verifyCompletionsAt(markerName: string | ReadonlyArray<string>, expected: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntry>, options?: FourSlashInterface.CompletionsAtOptions) {
if (typeof markerName !== "string") {
for (const m of markerName) this.verifyCompletionsAt(m, expected, options);
return;
}
this.goToMarker(markerName);
const actualCompletions = this.getCompletionListAtCaret(options);
@@ -841,8 +845,8 @@ namespace FourSlash {
this.raiseError(`No completions at position '${this.currentCaretPosition}'.`);
}
if (options && options.isNewIdentifierLocation !== undefined && actualCompletions.isNewIdentifierLocation !== options.isNewIdentifierLocation) {
this.raiseError(`Expected 'isNewIdentifierLocation' to be ${options.isNewIdentifierLocation}, got ${actualCompletions.isNewIdentifierLocation}`);
if (actualCompletions.isNewIdentifierLocation !== (options && options.isNewIdentifierLocation || false)) {
this.raiseError(`Expected 'isNewIdentifierLocation' to be ${options && options.isNewIdentifierLocation}, got ${actualCompletions.isNewIdentifierLocation}`);
}
const actual = actualCompletions.entries;
@@ -1100,10 +1104,10 @@ namespace FourSlash {
references: ranges.map<ts.ReferenceEntry>(r => {
const { isWriteAccess = false, isDefinition = false, isInString } = (r.marker && r.marker.data || {}) as { isWriteAccess?: boolean, isDefinition?: boolean, isInString?: true };
return {
isWriteAccess,
isDefinition,
fileName: r.fileName,
textSpan: ts.createTextSpanFromRange(r),
isWriteAccess,
isDefinition,
...(isInString ? { isInString: true } : undefined),
};
}),
@@ -1119,7 +1123,7 @@ namespace FourSlash {
const fullActual = ts.map<ts.ReferencedSymbol, ReferenceGroupJson>(this.findReferencesAtCaret(), ({ definition, references }, i) => {
const text = definition.displayParts.map(d => d.text).join("");
return {
definition: typeof fullExpected[i].definition === "string" ? text : { text, range: definition.textSpan },
definition: fullExpected.length > i && typeof fullExpected[i].definition === "string" ? text : { text, range: definition.textSpan },
references,
};
});
@@ -1228,8 +1232,8 @@ Actual: ${stringify(fullActual)}`);
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition, options);
}
private getCompletionEntryDetails(entryName: string, source?: string): ts.CompletionEntryDetails {
return this.languageService.getCompletionEntryDetails(this.activeFile.fileName, this.currentCaretPosition, entryName, this.formatCodeSettings, source);
private getCompletionEntryDetails(entryName: string, source?: string, preferences?: ts.UserPreferences): ts.CompletionEntryDetails {
return this.languageService.getCompletionEntryDetails(this.activeFile.fileName, this.currentCaretPosition, entryName, this.formatCodeSettings, source, preferences);
}
private getReferencesAtCaret() {
@@ -1601,7 +1605,7 @@ Actual: ${stringify(fullActual)}`);
});
}
public baselineGetEmitOutput() {
public baselineGetEmitOutput(insertResultsIntoVfs?: boolean) {
// Find file to be emitted
const emitFiles: FourSlashFile[] = []; // List of FourSlashFile that has emitThisFile flag on
@@ -1650,6 +1654,9 @@ Actual: ${stringify(fullActual)}`);
for (const outputFile of emitOutput.outputFiles) {
const fileName = "FileName : " + outputFile.name + Harness.IO.newLine();
resultString = resultString + fileName + outputFile.text;
if (insertResultsIntoVfs) {
this.languageServiceAdapterHost.addScript(ts.getNormalizedAbsolutePath(outputFile.name, "/"), outputFile.text, /*isRootFile*/ true);
}
}
resultString += Harness.IO.newLine();
});
@@ -1728,8 +1735,8 @@ Actual: ${stringify(fullActual)}`);
Harness.IO.log(stringify(sigHelp));
}
public printCompletionListMembers(options: ts.GetCompletionsAtPositionOptions | undefined) {
const completions = this.getCompletionListAtCaret(options);
public printCompletionListMembers(preferences: ts.UserPreferences | undefined) {
const completions = this.getCompletionListAtCaret(preferences);
this.printMembersOrCompletions(completions);
}
@@ -1827,7 +1834,7 @@ Actual: ${stringify(fullActual)}`);
}
else if (prevChar === " " && /A-Za-z_/.test(ch)) {
/* Completions */
this.languageService.getCompletionsAtPosition(this.activeFile.fileName, offset, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
this.languageService.getCompletionsAtPosition(this.activeFile.fileName, offset, ts.defaultPreferences);
}
if (i % checkCadence === 0) {
@@ -2402,14 +2409,14 @@ Actual: ${stringify(fullActual)}`);
public applyCodeActionFromCompletion(markerName: string, options: FourSlashInterface.VerifyCompletionActionOptions) {
this.goToMarker(markerName);
const actualCompletion = this.getCompletionListAtCaret({ includeExternalModuleExports: true, includeInsertTextCompletions: false }).entries.find(e =>
const actualCompletion = this.getCompletionListAtCaret({ ...ts.defaultPreferences, includeCompletionsForModuleExports: true }).entries.find(e =>
e.name === options.name && e.source === options.source);
if (!actualCompletion.hasAction) {
this.raiseError(`Completion for ${options.name} does not have an associated action.`);
}
const details = this.getCompletionEntryDetails(options.name, actualCompletion.source);
const details = this.getCompletionEntryDetails(options.name, actualCompletion.source, options.preferences);
if (details.codeActions.length !== 1) {
this.raiseError(`Expected one code action, got ${details.codeActions.length}`);
}
@@ -2450,12 +2457,14 @@ Actual: ${stringify(fullActual)}`);
this.verifyRangeIs(expectedText, includeWhiteSpace);
}
public verifyCodeFixAll(options: FourSlashInterface.VerifyCodeFixAllOptions): void {
const { fixId, newFileContent } = options;
const fixIds = ts.mapDefined(this.getCodeFixes(this.activeFile.fileName), a => a.fixId);
ts.Debug.assert(ts.contains(fixIds, fixId), "No available code fix has that group id.", () => `Expected '${fixId}'. Available action ids: ${fixIds}`);
const { changes, commands } = this.languageService.getCombinedCodeFix({ type: "file", fileName: this.activeFile.fileName }, fixId, this.formatCodeSettings);
assert.deepEqual(commands, options.commands);
public verifyCodeFixAll({ fixId, fixAllDescription, newFileContent, commands: expectedCommands }: FourSlashInterface.VerifyCodeFixAllOptions): void {
const fixWithId = ts.find(this.getCodeFixes(this.activeFile.fileName), a => a.fixId === fixId);
ts.Debug.assert(fixWithId !== undefined, "No available code fix has that group id.", () =>
`Expected '${fixId}'. Available action ids: ${ts.mapDefined(this.getCodeFixes(this.activeFile.fileName), a => a.fixId)}`);
ts.Debug.assertEqual(fixWithId.fixAllDescription, fixAllDescription);
const { changes, commands } = this.languageService.getCombinedCodeFix({ type: "file", fileName: this.activeFile.fileName }, fixId, this.formatCodeSettings, ts.defaultPreferences);
assert.deepEqual(commands, expectedCommands);
assert(changes.every(c => c.fileName === this.activeFile.fileName), "TODO: support testing codefixes that touch multiple files");
this.applyChanges(changes);
this.verifyCurrentFileContent(newFileContent);
@@ -2483,7 +2492,7 @@ Actual: ${stringify(fullActual)}`);
public verifyCodeFix(options: FourSlashInterface.VerifyCodeFixOptions) {
const fileName = this.activeFile.fileName;
const actions = this.getCodeFixes(fileName, options.errorCode);
const actions = this.getCodeFixes(fileName, options.errorCode, options.preferences);
let index = options.index;
if (index === undefined) {
if (!(actions && actions.length === 1)) {
@@ -2522,7 +2531,7 @@ Actual: ${stringify(fullActual)}`);
* Rerieves a codefix satisfying the parameters, or undefined if no such codefix is found.
* @param fileName Path to file where error should be retrieved from.
*/
private getCodeFixes(fileName: string, errorCode?: number): ts.CodeFixAction[] {
private getCodeFixes(fileName: string, errorCode?: number, preferences: ts.UserPreferences = ts.defaultPreferences): ts.CodeFixAction[] {
const diagnosticsForCodeFix = this.getDiagnostics(fileName, /*includeSuggestions*/ true).map(diagnostic => ({
start: diagnostic.start,
length: diagnostic.length,
@@ -2534,7 +2543,7 @@ Actual: ${stringify(fullActual)}`);
return;
}
return this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.start + diagnostic.length, [diagnostic.code], this.formatCodeSettings);
return this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.start + diagnostic.length, [diagnostic.code], this.formatCodeSettings, preferences);
});
}
@@ -2560,7 +2569,7 @@ Actual: ${stringify(fullActual)}`);
}
}
public verifyImportFixAtPosition(expectedTextArray: string[], errorCode?: number) {
public verifyImportFixAtPosition(expectedTextArray: string[], errorCode: number | undefined, preferences: ts.UserPreferences | undefined) {
const { fileName } = this.activeFile;
const ranges = this.getRanges().filter(r => r.fileName === fileName);
if (ranges.length !== 1) {
@@ -2568,7 +2577,7 @@ Actual: ${stringify(fullActual)}`);
}
const range = ts.first(ranges);
const codeFixes = this.getCodeFixes(fileName, errorCode);
const codeFixes = this.getCodeFixes(fileName, errorCode, preferences);
if (codeFixes.length === 0) {
if (expectedTextArray.length !== 0) {
@@ -2857,7 +2866,7 @@ Actual: ${stringify(fullActual)}`);
}
public verifyRangesWithSameTextAreDocumentHighlights() {
this.rangesByText().forEach(ranges => this.verifyRangesAreDocumentHighlights(ranges));
this.rangesByText().forEach(ranges => this.verifyRangesAreDocumentHighlights(ranges, /*options*/ undefined));
}
public verifyDocumentHighlightsOf(startRange: Range, ranges: Range[], options: FourSlashInterface.VerifyDocumentHighlightsOptions | undefined) {
@@ -2866,9 +2875,9 @@ Actual: ${stringify(fullActual)}`);
this.verifyDocumentHighlights(ranges, fileNames);
}
public verifyRangesAreDocumentHighlights(ranges?: Range[]) {
public verifyRangesAreDocumentHighlights(ranges: Range[] | undefined, options: FourSlashInterface.VerifyDocumentHighlightsOptions | undefined) {
ranges = ranges || this.getRanges();
const fileNames = unique(ranges, range => range.fileName);
const fileNames = options && options.filesToSearch || unique(ranges, range => range.fileName);
for (const range of ranges) {
this.goToRangeStart(range);
this.verifyDocumentHighlights(ranges, fileNames);
@@ -2938,7 +2947,7 @@ Actual: ${stringify(fullActual)}`);
public verifyApplicableRefactorAvailableAtMarker(negative: boolean, markerName: string) {
const marker = this.getMarkerByName(markerName);
const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, marker.position);
const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, marker.position, ts.defaultPreferences);
const isAvailable = applicableRefactors && applicableRefactors.length > 0;
if (negative && isAvailable) {
this.raiseError(`verifyApplicableRefactorAvailableAtMarker failed - expected no refactor at marker ${markerName} but found some.`);
@@ -2958,7 +2967,7 @@ Actual: ${stringify(fullActual)}`);
public verifyRefactorAvailable(negative: boolean, name: string, actionName?: string) {
const selection = this.getSelection();
let refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, selection) || [];
let refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, selection, ts.defaultPreferences) || [];
refactors = refactors.filter(r => r.name === name && (actionName === undefined || r.actions.some(a => a.name === actionName)));
const isAvailable = refactors.length > 0;
@@ -2980,7 +2989,7 @@ Actual: ${stringify(fullActual)}`);
public verifyRefactor({ name, actionName, refactors }: FourSlashInterface.VerifyRefactorOptions) {
const selection = this.getSelection();
const actualRefactors = (this.languageService.getApplicableRefactors(this.activeFile.fileName, selection) || ts.emptyArray)
const actualRefactors = (this.languageService.getApplicableRefactors(this.activeFile.fileName, selection, ts.defaultPreferences) || ts.emptyArray)
.filter(r => r.name === name && r.actions.some(a => a.name === actionName));
this.assertObjectsEqual(actualRefactors, refactors);
}
@@ -2991,7 +3000,7 @@ Actual: ${stringify(fullActual)}`);
throw new Error("Exactly one refactor range is allowed per test.");
}
const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, { pos: ranges[0].pos, end: ranges[0].end });
const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, ts.first(ranges), ts.defaultPreferences);
const isAvailable = applicableRefactors && applicableRefactors.length > 0;
if (negative && isAvailable) {
this.raiseError(`verifyApplicableRefactorAvailableForRange failed - expected no refactor but found some.`);
@@ -3003,7 +3012,7 @@ Actual: ${stringify(fullActual)}`);
public applyRefactor({ refactorName, actionName, actionDescription, newContent: newContentWithRenameMarker }: FourSlashInterface.ApplyRefactorOptions) {
const range = this.getSelection();
const refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, range);
const refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, range, ts.defaultPreferences);
const refactorsWithName = refactors.filter(r => r.name === refactorName);
if (refactorsWithName.length === 0) {
this.raiseError(`The expected refactor: ${refactorName} is not available at the marker location.\nAvailable refactors: ${refactors.map(r => r.name)}`);
@@ -3017,7 +3026,7 @@ Actual: ${stringify(fullActual)}`);
this.raiseError(`Expected action description to be ${JSON.stringify(actionDescription)}, got: ${JSON.stringify(action.description)}`);
}
const editInfo = this.languageService.getEditsForRefactor(this.activeFile.fileName, this.formatCodeSettings, range, refactorName, actionName);
const editInfo = this.languageService.getEditsForRefactor(this.activeFile.fileName, this.formatCodeSettings, range, refactorName, actionName, ts.defaultPreferences);
for (const edit of editInfo.edits) {
this.applyEdits(edit.fileName, edit.textChanges, /*isFormattingEdit*/ false);
}
@@ -3062,14 +3071,14 @@ Actual: ${stringify(fullActual)}`);
formattingOptions = formattingOptions || this.formatCodeSettings;
const markerPos = this.getMarkerByName(markerName).position;
const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, markerPos);
const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, markerPos, ts.defaultPreferences);
const applicableRefactorToApply = ts.find(applicableRefactors, refactor => refactor.name === refactorNameToApply);
if (!applicableRefactorToApply) {
this.raiseError(`The expected refactor: ${refactorNameToApply} is not available at the marker location.`);
}
const editInfo = this.languageService.getEditsForRefactor(this.activeFile.fileName, formattingOptions, markerPos, refactorNameToApply, actionName);
const editInfo = this.languageService.getEditsForRefactor(this.activeFile.fileName, formattingOptions, markerPos, refactorNameToApply, actionName, ts.defaultPreferences);
for (const edit of editInfo.edits) {
this.applyEdits(edit.fileName, edit.textChanges, /*isFormattingEdit*/ false);
@@ -3180,9 +3189,7 @@ Actual: ${stringify(fullActual)}`);
eq(item.hasAction, hasAction, "hasAction");
eq(item.isRecommended, options && options.isRecommended, "isRecommended");
eq(item.insertText, options && options.insertText, "insertText");
if (options && options.replacementSpan) { // TODO: GH#21679
eq(item.replacementSpan, options && options.replacementSpan && ts.createTextSpanFromRange(options.replacementSpan), "replacementSpan");
}
eq(item.replacementSpan, options && options.replacementSpan && ts.createTextSpanFromRange(options.replacementSpan), "replacementSpan");
}
private findFile(indexOrName: string | number) {
@@ -3333,12 +3340,14 @@ ${code}
const ranges: Range[] = [];
// Stuff related to the subfile we're parsing
let currentFileContent: string;
let currentFileContent: string | undefined;
let currentFileName = fileName;
let currentFileSymlinks: string[] | undefined;
let currentFileOptions: { [s: string]: string } = {};
function nextFile() {
if (currentFileContent === undefined) return;
const file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges);
file.fileOptions = currentFileOptions;
file.symlinks = currentFileSymlinks;
@@ -3353,25 +3362,13 @@ ${code}
}
for (let line of lines) {
const lineLength = line.length;
if (lineLength > 0 && line.charAt(lineLength - 1) === "\r") {
line = line.substr(0, lineLength - 1);
if (line.length > 0 && line.charAt(line.length - 1) === "\r") {
line = line.substr(0, line.length - 1);
}
if (line.substr(0, 4) === "////") {
// Subfile content line
// Append to the current subfile content, inserting a newline needed
if (currentFileContent === undefined) {
currentFileContent = "";
}
else {
// End-of-line
currentFileContent = currentFileContent + "\n";
}
currentFileContent = currentFileContent + line.substr(4);
const text = line.substr(4);
currentFileContent = currentFileContent === undefined ? text : currentFileContent + "\n" + text;
}
else if (line.substr(0, 2) === "//") {
// Comment line, check for global/file @options and record them
@@ -3389,10 +3386,7 @@ ${code}
switch (key) {
case MetadataOptionNames.fileName:
// Found an @FileName directive, if this is not the first then create a new subfile
if (currentFileContent) {
nextFile();
}
nextFile();
currentFileName = ts.isRootedDiskPath(value) ? value : basePath + "/" + value;
currentFileOptions[key] = value;
break;
@@ -3406,15 +3400,11 @@ ${code}
}
}
}
else if (line === "" || lineLength === 0) {
// Previously blank lines between fourslash content caused it to be considered as 2 files,
// Remove this behavior since it just causes errors now
}
else {
// Empty line or code line, terminate current subfile if there is one
if (currentFileContent) {
nextFile();
}
// Previously blank lines between fourslash content caused it to be considered as 2 files,
// Remove this behavior since it just causes errors now
else if (line !== "") {
// Code line, terminate current subfile if there is one
nextFile();
}
}
@@ -3768,6 +3758,10 @@ namespace FourSlashInterface {
return this.state.getMarkerByName(name);
}
public markerName(m: FourSlash.Marker) {
return this.state.markerName(m);
}
public ranges(): FourSlash.Range[] {
return this.state.getRanges();
}
@@ -3810,6 +3804,7 @@ namespace FourSlashInterface {
this.state.goToEachMarker(markers, typeof a === "function" ? a : b);
}
public rangeStart(range: FourSlash.Range) {
this.state.goToRangeStart(range);
}
@@ -3998,7 +3993,7 @@ namespace FourSlashInterface {
super(state);
}
public completionsAt(markerName: string, completions: ReadonlyArray<ExpectedCompletionEntry>, options?: CompletionsAtOptions) {
public completionsAt(markerName: string | ReadonlyArray<string>, completions: ReadonlyArray<ExpectedCompletionEntry>, options?: CompletionsAtOptions) {
this.state.verifyCompletionsAt(markerName, completions, options);
}
@@ -4167,8 +4162,8 @@ namespace FourSlashInterface {
this.state.baselineCurrentFileNameOrDottedNameSpans();
}
public baselineGetEmitOutput() {
this.state.baselineGetEmitOutput();
public baselineGetEmitOutput(insertResultsIntoVfs?: boolean) {
this.state.baselineGetEmitOutput(insertResultsIntoVfs);
}
public baselineQuickInfo() {
@@ -4229,8 +4224,8 @@ namespace FourSlashInterface {
this.state.applyCodeActionFromCompletion(markerName, options);
}
public importFixAtPosition(expectedTextArray: string[], errorCode?: number): void {
this.state.verifyImportFixAtPosition(expectedTextArray, errorCode);
public importFixAtPosition(expectedTextArray: string[], errorCode?: number, preferences?: ts.UserPreferences): void {
this.state.verifyImportFixAtPosition(expectedTextArray, errorCode, preferences);
}
public navigationBar(json: any, options?: { checkSpans?: boolean }) {
@@ -4281,8 +4276,8 @@ namespace FourSlashInterface {
this.state.verifyRangesAreRenameLocations(options);
}
public rangesAreDocumentHighlights(ranges?: FourSlash.Range[]) {
this.state.verifyRangesAreDocumentHighlights(ranges);
public rangesAreDocumentHighlights(ranges?: FourSlash.Range[], options?: VerifyDocumentHighlightsOptions) {
this.state.verifyRangesAreDocumentHighlights(ranges, options);
}
public rangesWithSameTextAreDocumentHighlights() {
@@ -4436,7 +4431,7 @@ namespace FourSlashInterface {
this.state.printCurrentSignatureHelp();
}
public printCompletionListMembers(options: ts.GetCompletionsAtPositionOptions | undefined) {
public printCompletionListMembers(options: ts.UserPreferences | undefined) {
this.state.printCompletionListMembers(options);
}
@@ -4633,11 +4628,11 @@ namespace FourSlashInterface {
}
export type ExpectedCompletionEntry = string | { name: string, insertText?: string, replacementSpan?: FourSlash.Range };
export interface CompletionsAtOptions extends ts.GetCompletionsAtPositionOptions {
export interface CompletionsAtOptions extends Partial<ts.UserPreferences> {
isNewIdentifierLocation?: boolean;
}
export interface VerifyCompletionListContainsOptions extends ts.GetCompletionsAtPositionOptions {
export interface VerifyCompletionListContainsOptions extends ts.UserPreferences {
sourceDisplay: string;
isRecommended?: true;
insertText?: string;
@@ -4658,6 +4653,7 @@ namespace FourSlashInterface {
description: string;
errorCode?: number;
index?: number;
preferences?: ts.UserPreferences;
}
export interface VerifyCodeFixAvailableOptions {
@@ -4667,6 +4663,7 @@ namespace FourSlashInterface {
export interface VerifyCodeFixAllOptions {
fixId: string;
fixAllDescription: string;
newFileContent: string;
commands: ReadonlyArray<{}>;
}
@@ -4681,6 +4678,7 @@ namespace FourSlashInterface {
name: string;
source?: string;
description: string;
preferences?: ts.UserPreferences;
}
export interface Diagnostic {
+10 -5
View File
@@ -1632,14 +1632,15 @@ namespace Harness {
}
export function doSourcemapBaseline(baselinePath: string, options: ts.CompilerOptions, result: CompilerResult, harnessSettings: TestCaseParser.CompilerSettings) {
const declMaps = ts.getAreDeclarationMapsEnabled(options);
if (options.inlineSourceMap) {
if (result.sourceMaps.length > 0) {
if (result.sourceMaps.length > 0 && !declMaps) {
throw new Error("No sourcemap files should be generated if inlineSourceMaps was set.");
}
return;
}
else if (options.sourceMap) {
if (result.sourceMaps.length !== result.files.length) {
else if (options.sourceMap || declMaps) {
if (result.sourceMaps.length !== (result.files.length * (declMaps && options.sourceMap ? 2 : 1))) {
throw new Error("Number of sourcemap files should be same as js files.");
}
@@ -1806,6 +1807,10 @@ namespace Harness {
return ts.endsWith(fileName, ".js.map") || ts.endsWith(fileName, ".jsx.map");
}
export function isDTSMap(fileName: string) {
return ts.endsWith(fileName, ".d.ts.map");
}
/** Contains the code and errors of a compilation and some helper methods to check its status. */
export class CompilerResult {
public files: GeneratedFile[] = [];
@@ -1826,7 +1831,7 @@ namespace Harness {
// .js file, add to files
this.files.push(emittedFile);
}
else if (isJSMap(emittedFile.fileName)) {
else if (isJSMap(emittedFile.fileName) || isDTSMap(emittedFile.fileName)) {
this.sourceMaps.push(emittedFile);
}
else {
@@ -1839,7 +1844,7 @@ namespace Harness {
public getSourceMapRecord() {
if (this.sourceMapData && this.sourceMapData.length > 0) {
return SourceMapRecorder.getSourceMapRecord(this.sourceMapData, this.program, this.files);
return SourceMapRecorder.getSourceMapRecord(this.sourceMapData, this.program, this.files, this.declFilesCode);
}
}
}
+4 -4
View File
@@ -420,11 +420,11 @@ namespace Harness.LanguageService {
getEncodedSemanticClassifications(fileName: string, span: ts.TextSpan): ts.Classifications {
return unwrapJSONCallResult(this.shim.getEncodedSemanticClassifications(fileName, span.start, span.length));
}
getCompletionsAtPosition(fileName: string, position: number, options: ts.GetCompletionsAtPositionOptions | undefined): ts.CompletionInfo {
return unwrapJSONCallResult(this.shim.getCompletionsAtPosition(fileName, position, options));
getCompletionsAtPosition(fileName: string, position: number, preferences: ts.UserPreferences | undefined): ts.CompletionInfo {
return unwrapJSONCallResult(this.shim.getCompletionsAtPosition(fileName, position, preferences));
}
getCompletionEntryDetails(fileName: string, position: number, entryName: string, options: ts.FormatCodeOptions | undefined, source: string | undefined): ts.CompletionEntryDetails {
return unwrapJSONCallResult(this.shim.getCompletionEntryDetails(fileName, position, entryName, JSON.stringify(options), source));
getCompletionEntryDetails(fileName: string, position: number, entryName: string, formatOptions: ts.FormatCodeOptions | undefined, source: string | undefined, preferences: ts.UserPreferences | undefined): ts.CompletionEntryDetails {
return unwrapJSONCallResult(this.shim.getCompletionEntryDetails(fileName, position, entryName, JSON.stringify(formatOptions), source, preferences));
}
getCompletionEntrySymbol(): ts.Symbol {
throw new Error("getCompletionEntrySymbol not implemented across the shim layer.");
+2 -2
View File
@@ -144,7 +144,7 @@ namespace Harness.Parallel.Host {
let closedWorkers = 0;
for (let i = 0; i < workerCount; i++) {
// TODO: Just send the config over the IPC channel or in the command line arguments
const config: TestConfig = { light: lightMode, listenForWork: true, runUnitTests };
const config: TestConfig = { light: lightMode, listenForWork: true, runUnitTests, stackTraceLimit };
const configPath = ts.combinePaths(taskConfigsFolder, `task-config${i}.json`);
IO.writeFile(configPath, JSON.stringify(config));
const child = fork(__filename, [`--config="${configPath}"`]);
@@ -384,7 +384,7 @@ namespace Harness.Parallel.Host {
};
}
describe = ts.noop as any; // Disable unit tests
(global as any).describe = ts.noop as any; // Disable unit tests
return;
}
+3 -3
View File
@@ -25,10 +25,10 @@ namespace Harness.Parallel.Worker {
(global as any).before = undefined;
(global as any).after = undefined;
(global as any).beforeEach = undefined;
describe = ((name, callback) => {
(global as any).describe = ((name, callback) => {
testList.push({ name, callback, kind: "suite" });
}) as Mocha.IContextDefinition;
it = ((name, callback) => {
(global as any).it = ((name, callback) => {
if (!testList) {
throw new Error("Tests must occur within a describe block");
}
@@ -251,7 +251,7 @@ namespace Harness.Parallel.Worker {
});
if (!runUnitTests) {
// ensure unit tests do not get run
describe = ts.noop as any;
(global as any).describe = ts.noop;
}
else {
initialized = true;
+5 -2
View File
@@ -88,6 +88,7 @@ let testConfigContent =
let taskConfigsFolder: string;
let workerCount: number;
let runUnitTests: boolean | undefined;
let stackTraceLimit: number | "full" | undefined;
let noColors = false;
interface TestConfig {
@@ -132,9 +133,11 @@ function handleTestConfig() {
if (testConfig.stackTraceLimit === "full") {
(<any>Error).stackTraceLimit = Infinity;
stackTraceLimit = testConfig.stackTraceLimit;
}
else if ((+testConfig.stackTraceLimit | 0) > 0) {
(<any>Error).stackTraceLimit = testConfig.stackTraceLimit;
(<any>Error).stackTraceLimit = +testConfig.stackTraceLimit | 0;
stackTraceLimit = +testConfig.stackTraceLimit | 0;
}
if (testConfig.listenForWork) {
return true;
@@ -242,7 +245,7 @@ function beginTests() {
if (!runUnitTests) {
// patch `describe` to skip unit tests
describe = ts.noop as any;
(global as any).describe = ts.noop;
}
}
+19 -2
View File
@@ -434,14 +434,31 @@ namespace Harness.SourceMapRecorder {
}
}
export function getSourceMapRecord(sourceMapDataList: ts.SourceMapData[], program: ts.Program, jsFiles: Compiler.GeneratedFile[]) {
export function getSourceMapRecord(sourceMapDataList: ts.SourceMapData[], program: ts.Program, jsFiles: Compiler.GeneratedFile[], declarationFiles: Compiler.GeneratedFile[]) {
const sourceMapRecorder = new Compiler.WriterAggregator();
for (let i = 0; i < sourceMapDataList.length; i++) {
const sourceMapData = sourceMapDataList[i];
let prevSourceFile: ts.SourceFile;
let currentFile: Compiler.GeneratedFile;
if (ts.endsWith(sourceMapData.sourceMapFile, ts.Extension.Dts)) {
if (sourceMapDataList.length > jsFiles.length) {
currentFile = declarationFiles[Math.floor(i / 2)]; // When both kinds of source map are present, they alternate js/dts
}
else {
currentFile = declarationFiles[i];
}
}
else {
if (sourceMapDataList.length > jsFiles.length) {
currentFile = jsFiles[Math.floor(i / 2)];
}
else {
currentFile = jsFiles[i];
}
}
SourceMapSpanWriter.initializeSourceMapSpanWriter(sourceMapRecorder, sourceMapData, jsFiles[i]);
SourceMapSpanWriter.initializeSourceMapSpanWriter(sourceMapRecorder, sourceMapData, currentFile);
for (const decodedSourceMapping of sourceMapData.sourceMapDecodedMappings) {
const currentSourceFile = program.getSourceFile(sourceMapData.inputSourceFileNames[decodedSourceMapping.sourceIndex]);
if (currentSourceFile !== prevSourceFile) {
+3 -1
View File
@@ -39,10 +39,11 @@
"../compiler/transformers/module/module.ts",
"../compiler/transformers/module/system.ts",
"../compiler/transformers/module/es2015.ts",
"../compiler/transformers/declarations/diagnostics.ts",
"../compiler/transformers/declarations.ts",
"../compiler/transformer.ts",
"../compiler/comments.ts",
"../compiler/sourcemap.ts",
"../compiler/declarationEmitter.ts",
"../compiler/emitter.ts",
"../compiler/program.ts",
"../compiler/builder.ts",
@@ -94,6 +95,7 @@
"../server/session.ts",
"../server/client.ts",
"../server/editorServices.ts",
"./unittests/base64.ts",
"./unittests/incrementalParser.ts",
"./unittests/jsDocParsing.ts",
"./unittests/services/colorization.ts",
+23
View File
@@ -0,0 +1,23 @@
/// <reference path="../harness.ts" />
namespace ts {
describe("base64", () => {
describe("base64decode", () => {
it("can decode input strings correctly without needing a host implementation", () => {
const tests = [
// "a",
// "this is a test",
// " !\"#$ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
"日本語",
"🐱",
"\x00\x01",
"\t\n\r\\\"\'\u0062",
"====",
"",
];
for (const test of tests) {
assert.equal(base64decode({}, convertToBase64(test)), test);
}
});
});
});
}
@@ -127,6 +127,7 @@ namespace ts {
endPosition: selectionRange.end,
host: notImplementedHost,
formatContext: formatting.getFormatContext(testFormatOptions),
preferences: defaultPreferences,
};
const rangeToExtract = refactor.extractSymbol.getRangeToExtract(sourceFile, createTextSpanFromRange(selectionRange));
assert.equal(rangeToExtract.errors, undefined, rangeToExtract.errors && "Range error: " + rangeToExtract.errors[0].messageText);
@@ -190,6 +191,7 @@ namespace ts {
endPosition: selectionRange.end,
host: notImplementedHost,
formatContext: formatting.getFormatContext(testFormatOptions),
preferences: defaultPreferences,
};
const rangeToExtract = refactor.extractSymbol.getRangeToExtract(sourceFile, createTextSpanFromRange(selectionRange));
assert.isUndefined(rangeToExtract.errors, rangeToExtract.errors && "Range error: " + rangeToExtract.errors[0].messageText);
@@ -30,5 +30,7 @@ namespace ts {
initTSConfigCorrectly("Initialized TSConfig with incorrect compiler option", ["--init", "--someNonExistOption"]);
initTSConfigCorrectly("Initialized TSConfig with incorrect compiler option value", ["--init", "--lib", "nonExistLib,es5,es2015.promise"]);
initTSConfigCorrectly("Initialized TSConfig with advanced options", ["--init", "--declaration", "--declarationDir", "lib", "--skipLibCheck", "--noErrorTruncation"]);
});
}
+2 -2
View File
@@ -111,8 +111,6 @@ namespace ts {
}
describe("parsesIncorrectly", () => {
parsesIncorrectly("emptyComment", "/***/");
parsesIncorrectly("threeAsterisks", "/*** */");
parsesIncorrectly("multipleTypes",
`/**
* @type {number}
@@ -152,6 +150,8 @@ namespace ts {
});
describe("parsesCorrectly", () => {
parsesCorrectly("threeAsterisks", "/*** */");
parsesCorrectly("emptyComment", "/***/");
parsesCorrectly("noLeadingAsterisk",
`/**
@type {number}
+1 -1
View File
@@ -16,7 +16,7 @@ namespace ts {
export function checkResolvedModuleWithFailedLookupLocations(actual: ResolvedModuleWithFailedLookupLocations, expectedResolvedModule: ResolvedModuleFull, expectedFailedLookupLocations: string[]): void {
assert.isTrue(actual.resolvedModule !== undefined, "module should be resolved");
checkResolvedModule(actual.resolvedModule, expectedResolvedModule);
assert.deepEqual(actual.failedLookupLocations, expectedFailedLookupLocations);
assert.deepEqual(actual.failedLookupLocations, expectedFailedLookupLocations, `Failed lookup locations should match - expected has ${expectedFailedLookupLocations.length}, actual has ${actual.failedLookupLocations.length}`);
}
export function createResolvedModule(resolvedFileName: string, isExternalLibraryImport = false): ResolvedModuleFull {
+34 -2
View File
@@ -193,10 +193,20 @@ export const Other = 1;
content: "function F() { }",
};
const languageService = makeLanguageService(testFile);
const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, testFormatOptions);
const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, testFormatOptions, defaultPreferences);
assert.isEmpty(changes);
});
testOrganizeImports("Renamed_used",
{
path: "/test.ts",
content: `
import { F1 as EffOne, F2 as EffTwo } from "lib";
EffOne();
`,
},
libFile);
testOrganizeImports("Simple",
{
path: "/test.ts",
@@ -329,6 +339,28 @@ F1();
},
libFile);
testOrganizeImports("UnusedHeaderComment",
{
path: "/test.ts",
content: `
// Header
import { F1 } from "lib";
`,
},
libFile);
testOrganizeImports("SortHeaderComment",
{
path: "/test.ts",
content: `
// Header
import "lib2";
import "lib1";
`,
},
{ path: "/lib1.ts", content: "" },
{ path: "/lib2.ts", content: "" });
testOrganizeImports("AmbientModule",
{
path: "/test.ts",
@@ -403,7 +435,7 @@ import { React, Other } from "react";
function runBaseline(baselinePath: string, testFile: TestFSWithWatch.FileOrFolder, ...otherFiles: TestFSWithWatch.FileOrFolder[]) {
const { path: testPath, content: testContent } = testFile;
const languageService = makeLanguageService(testFile, ...otherFiles);
const changes = languageService.organizeImports({ type: "file", fileName: testPath }, testFormatOptions);
const changes = languageService.organizeImports({ type: "file", fileName: testPath }, testFormatOptions, defaultPreferences);
assert.equal(changes.length, 1);
assert.equal(changes[0].fileName, testPath);
+51 -39
View File
@@ -16,41 +16,43 @@ namespace ts {
const printsCorrectly = makePrintsCorrectly("printsFileCorrectly");
// Avoid eagerly creating the sourceFile so that `createSourceFile` doesn't run unless one of these tests is run.
let sourceFile: SourceFile;
before(() => sourceFile = createSourceFile("source.ts", `
interface A<T> {
// comment1
readonly prop?: T;
before(() => {
sourceFile = createSourceFile("source.ts", `
interface A<T> {
// comment1
readonly prop?: T;
// comment2
method(): void;
// comment2
method(): void;
// comment3
new <T>(): A<T>;
// comment3
new <T>(): A<T>;
// comment4
<T>(): A<T>;
}
// comment4
<T>(): A<T>;
}
// comment5
type B = number | string | object;
type C = A<number> & { x: string; }; // comment6
// comment5
type B = number | string | object;
type C = A<number> & { x: string; }; // comment6
// comment7
enum E1 {
// comment8
first
}
// comment7
enum E1 {
// comment8
first
}
const enum E2 {
second
}
const enum E2 {
second
}
// comment9
console.log(1 + 2);
// comment9
console.log(1 + 2);
// comment10
function functionWithDefaultArgValue(argument: string = "defaultValue"): void { }
`, ScriptTarget.ES2015));
// comment10
function functionWithDefaultArgValue(argument: string = "defaultValue"): void { }
`, ScriptTarget.ES2015);
});
printsCorrectly("default", {}, printer => printer.printFile(sourceFile));
printsCorrectly("removeComments", { removeComments: true }, printer => printer.printFile(sourceFile));
@@ -60,25 +62,35 @@ namespace ts {
// github #18071
printsCorrectly("regularExpressionLiteral", {}, printer => printer.printFile(createSourceFile("source.ts", "let regex = /abc/;", ScriptTarget.ES2017)));
// github #22239
printsCorrectly("importStatementRemoveComments", { removeComments: true }, printer => printer.printFile(createSourceFile("source.ts", "import {foo} from 'foo';", ScriptTarget.ESNext)));
printsCorrectly("classHeritageClauses", {}, printer => printer.printFile(createSourceFile(
"source.ts",
`class A extends B implements C implements D {}`,
ScriptTarget.ES2017
)));
});
describe("printBundle", () => {
const printsCorrectly = makePrintsCorrectly("printsBundleCorrectly");
let bundle: Bundle;
before(() => bundle = createBundle([
createSourceFile("a.ts", `
/*! [a.ts] */
before(() => {
bundle = createBundle([
createSourceFile("a.ts", `
/*! [a.ts] */
// comment0
const a = 1;
`, ScriptTarget.ES2015),
createSourceFile("b.ts", `
/*! [b.ts] */
// comment0
const a = 1;
`, ScriptTarget.ES2015),
createSourceFile("b.ts", `
/*! [b.ts] */
// comment1
const b = 2;
`, ScriptTarget.ES2015)
]));
// comment1
const b = 2;
`, ScriptTarget.ES2015)
]);
});
printsCorrectly("default", {}, printer => printer.printBundle(bundle));
printsCorrectly("removeComments", { removeComments: true }, printer => printer.printBundle(bundle));
});
+5 -1
View File
@@ -145,7 +145,7 @@ namespace ts.server {
session.onMessage(JSON.stringify(configureRequest));
assert.equal(session.getProjectService().getFormatCodeOptions().indentStyle, IndentStyle.Block);
assert.equal(session.getProjectService().getFormatCodeOptions("" as NormalizedPath).indentStyle, IndentStyle.Block);
const setOptionsRequest: protocol.SetCompilerOptionsForInferredProjectsRequest = {
command: CommandNames.CompilerOptionsForInferredProjects,
@@ -421,13 +421,17 @@ namespace ts.server {
// Disable sourcemap support for the duration of the test, as sourcemapping the errors generated during this test is slow and not something we care to test
let oldPrepare: AnyFunction;
let oldStackTraceLimit: number;
before(() => {
oldStackTraceLimit = (Error as any).stackTraceLimit;
oldPrepare = (Error as any).prepareStackTrace;
delete (Error as any).prepareStackTrace;
(Error as any).stackTraceLimit = 10;
});
after(() => {
(Error as any).prepareStackTrace = oldPrepare;
(Error as any).stackTraceLimit = oldStackTraceLimit;
});
const command = "testhandler";
+148 -41
View File
@@ -72,22 +72,29 @@ namespace ts.tscWatch {
checkOutputDoesNotContain(host, expectedNonAffectedFiles);
}
const elapsedRegex = /^Elapsed:: [0-9]+ms/;
function checkOutputErrors(
host: WatchedSystem,
preErrorsWatchDiagnostic: DiagnosticMessage | undefined,
logsBeforeWatchDiagnostic: string[] | undefined,
preErrorsWatchDiagnostic: Diagnostic,
logsBeforeErrors: string[] | undefined,
errors: ReadonlyArray<Diagnostic>,
...postErrorsWatchDiagnostics: DiagnosticMessage[]
disableConsoleClears?: boolean | undefined,
...postErrorsWatchDiagnostics: Diagnostic[]
) {
let screenClears = 0;
const outputs = host.getOutput();
const expectedOutputCount = (preErrorsWatchDiagnostic ? 1 : 0) + errors.length + postErrorsWatchDiagnostics.length;
assert.equal(outputs.length, expectedOutputCount);
const expectedOutputCount = 2 + errors.length + postErrorsWatchDiagnostics.length +
(logsBeforeWatchDiagnostic ? logsBeforeWatchDiagnostic.length : 0) + (logsBeforeErrors ? logsBeforeErrors.length : 0);
assert.equal(outputs.length, expectedOutputCount, JSON.stringify(outputs));
let index = 0;
if (preErrorsWatchDiagnostic) {
assertWatchDiagnostic(preErrorsWatchDiagnostic);
}
forEach(logsBeforeWatchDiagnostic, log => assertLog("logsBeforeWatchDiagnostic", log));
assertWatchDiagnostic(preErrorsWatchDiagnostic);
forEach(logsBeforeErrors, log => assertLog("logBeforeError", log));
// Verify errors
forEach(errors, assertDiagnostic);
forEach(postErrorsWatchDiagnostics, assertWatchDiagnostic);
assert.equal(host.screenClears.length, screenClears, "Expected number of screen clears");
host.clearOutput();
function assertDiagnostic(diagnostic: Diagnostic) {
@@ -96,35 +103,67 @@ namespace ts.tscWatch {
index++;
}
function assertWatchDiagnostic(diagnosticMessage: DiagnosticMessage) {
const expected = getWatchDiagnosticWithoutDate(diagnosticMessage);
function assertLog(caption: string, expected: string) {
const actual = outputs[index];
assert.equal(actual.replace(elapsedRegex, ""), expected.replace(elapsedRegex, ""), getOutputAtFailedMessage(caption, expected));
index++;
}
function assertWatchDiagnostic(diagnostic: Diagnostic) {
const expected = getWatchDiagnosticWithoutDate(diagnostic);
if (!disableConsoleClears && !contains(nonClearingMessageCodes, diagnostic.code)) {
assert.equal(host.screenClears[screenClears], index, `Expected screen clear at this diagnostic: ${expected}`);
screenClears++;
}
assert.isTrue(endsWith(outputs[index], expected), getOutputAtFailedMessage("Watch diagnostic", expected));
index++;
}
function getOutputAtFailedMessage(caption: string, expectedOutput: string) {
return `Expected ${caption}: ${expectedOutput} at ${index} in ${JSON.stringify(outputs)}`;
return `Expected ${caption}: ${JSON.stringify(expectedOutput)} at ${index} in ${JSON.stringify(outputs)}`;
}
function getWatchDiagnosticWithoutDate(diagnosticMessage: DiagnosticMessage) {
return ` - ${flattenDiagnosticMessageText(getLocaleSpecificMessage(diagnosticMessage), host.newLine)}${host.newLine + host.newLine + host.newLine}`;
function getWatchDiagnosticWithoutDate(diagnostic: Diagnostic) {
return ` - ${flattenDiagnosticMessageText(diagnostic.messageText, host.newLine)}${host.newLine + host.newLine + host.newLine}`;
}
}
function checkOutputErrorsInitial(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>) {
checkOutputErrors(host, Diagnostics.Starting_compilation_in_watch_mode, errors, Diagnostics.Compilation_complete_Watching_for_file_changes);
function checkOutputErrorsInitial(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, disableConsoleClears?: boolean, logsBeforeErrors?: string[]) {
checkOutputErrors(
host,
/*logsBeforeWatchDiagnostic*/ undefined,
createCompilerDiagnostic(Diagnostics.Starting_compilation_in_watch_mode),
logsBeforeErrors,
errors,
disableConsoleClears,
errors.length === 1
? createCompilerDiagnostic(Diagnostics.Found_1_error)
: createCompilerDiagnostic(Diagnostics.Found_0_errors, errors.length),
createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
}
function checkOutputErrorsInitialWithConfigErrors(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>) {
checkOutputErrors(host, /*preErrorsWatchDiagnostic*/ undefined, errors, Diagnostics.Starting_compilation_in_watch_mode, Diagnostics.Compilation_complete_Watching_for_file_changes);
function checkOutputErrorsIncremental(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) {
checkOutputErrors(
host,
logsBeforeWatchDiagnostic,
createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation),
logsBeforeErrors,
errors,
disableConsoleClears,
errors.length === 1
? createCompilerDiagnostic(Diagnostics.Found_1_error)
: createCompilerDiagnostic(Diagnostics.Found_0_errors, errors.length),
createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
}
function checkOutputErrorsIncremental(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>) {
checkOutputErrors(host, Diagnostics.File_change_detected_Starting_incremental_compilation, errors, Diagnostics.Compilation_complete_Watching_for_file_changes);
}
function checkOutputErrorsIncrementalWithExit(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, expectedExitCode: ExitStatus) {
checkOutputErrors(host, Diagnostics.File_change_detected_Starting_incremental_compilation, errors);
function checkOutputErrorsIncrementalWithExit(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, expectedExitCode: ExitStatus, disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) {
checkOutputErrors(
host,
logsBeforeWatchDiagnostic,
createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation),
logsBeforeErrors,
errors,
disableConsoleClears);
assert.equal(host.exitCode, expectedExitCode);
}
@@ -897,7 +936,7 @@ namespace ts.tscWatch {
const host = createWatchedSystem([file, configFile, libFile]);
const watch = createWatchOfConfigFile(configFile.path, host);
checkOutputErrorsInitialWithConfigErrors(host, [
checkOutputErrorsInitial(host, [
getUnknownCompilerOption(watch(), configFile, "foo"),
getUnknownCompilerOption(watch(), configFile, "allowJS")
]);
@@ -2113,6 +2152,28 @@ declare module "fs" {
};
}
});
it("works when renaming node_modules folder that already contains @types folder", () => {
const currentDirectory = "/user/username/projects/myproject";
const file: FileOrFolder = {
path: `${currentDirectory}/a.ts`,
content: `import * as q from "qqq";`
};
const module: FileOrFolder = {
path: `${currentDirectory}/node_modules2/@types/qqq/index.d.ts`,
content: "export {}"
};
const files = [file, module, libFile];
const host = createWatchedSystem(files, { currentDirectory });
const watch = createWatchOfFilesAndCompilerOptions([file.path], host);
checkProgramActualFiles(watch(), [file.path, libFile.path]);
checkOutputErrorsInitial(host, [getDiagnosticModuleNotFoundOfFile(watch(), file, "qqq")]);
host.renameFolder(`${currentDirectory}/node_modules2`, `${currentDirectory}/node_modules`);
host.runQueuedTimeoutCallbacks();
checkProgramActualFiles(watch(), [file.path, libFile.path, `${currentDirectory}/node_modules/@types/qqq/index.d.ts`]);
checkOutputErrorsIncremental(host, emptyArray);
});
});
describe("tsc-watch with when module emit is specified as node", () => {
@@ -2161,30 +2222,32 @@ declare module "fs" {
path: "f.ts",
content: ""
};
const files = [file];
const files = [file, libFile];
const disableConsoleClear = options.diagnostics || options.extendedDiagnostics || options.preserveWatchOutput;
const host = createWatchedSystem(files);
let clearCount: number | undefined;
checkConsoleClears();
createWatchOfFilesAndCompilerOptions([file.path], host, options);
checkConsoleClears();
checkOutputErrorsInitial(host, emptyArray, disableConsoleClear, options.extendedDiagnostics && [
"Current directory: / CaseSensitiveFileNames: false\n",
"Synchronizing program\n",
"CreatingProgramWith::\n",
" roots: [\"f.ts\"]\n",
" options: {\"extendedDiagnostics\":true}\n",
"FileWatcher:: Added:: WatchInfo: f.ts 250 \n",
"FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 \n"
]);
file.content = "//";
host.reloadFS(files);
host.runQueuedTimeoutCallbacks();
checkConsoleClears();
function checkConsoleClears() {
if (clearCount === undefined || options.preserveWatchOutput) {
clearCount = 0;
}
else if (!options.diagnostics && !options.extendedDiagnostics) {
clearCount++;
}
host.checkScreenClears(clearCount);
return clearCount;
}
checkOutputErrorsIncremental(host, emptyArray, disableConsoleClear, options.extendedDiagnostics && [
"FileWatcher:: Triggered with /f.ts1:: WatchInfo: f.ts 250 \n",
"Elapsed:: 0ms FileWatcher:: Triggered with /f.ts1:: WatchInfo: f.ts 250 \n"
], options.extendedDiagnostics && [
"Synchronizing program\n",
"CreatingProgramWith::\n",
" roots: [\"f.ts\"]\n",
" options: {\"extendedDiagnostics\":true}\n"
]);
}
it("without --diagnostics or --extendedDiagnostics", () => {
@@ -2336,6 +2399,50 @@ declare module "fs" {
it("uses non recursive dynamic polling when renaming file in subfolder", () => {
verifyRenamingFileInSubFolder(TestFSWithWatch.Tsc_WatchDirectory.DynamicPolling);
});
it("when there are symlinks to folders in recursive folders", () => {
const cwd = "/home/user/projects/myproject";
const file1: FileOrFolder = {
path: `${cwd}/src/file.ts`,
content: `import * as a from "a"`
};
const tsconfig: FileOrFolder = {
path: `${cwd}/tsconfig.json`,
content: `{ "compilerOptions": { "extendedDiagnostics": true, "traceResolution": true }}`
};
const realA: FileOrFolder = {
path: `${cwd}/node_modules/reala/index.d.ts`,
content: `export {}`
};
const realB: FileOrFolder = {
path: `${cwd}/node_modules/realb/index.d.ts`,
content: `export {}`
};
const symLinkA: FileOrFolder = {
path: `${cwd}/node_modules/a`,
symLink: `${cwd}/node_modules/reala`
};
const symLinkB: FileOrFolder = {
path: `${cwd}/node_modules/b`,
symLink: `${cwd}/node_modules/realb`
};
const symLinkBInA: FileOrFolder = {
path: `${cwd}/node_modules/reala/node_modules/b`,
symLink: `${cwd}/node_modules/b`
};
const symLinkAInB: FileOrFolder = {
path: `${cwd}/node_modules/realb/node_modules/a`,
symLink: `${cwd}/node_modules/a`
};
const files = [file1, tsconfig, realA, realB, symLinkA, symLinkB, symLinkBInA, symLinkAInB];
const environmentVariables = createMap<string>();
environmentVariables.set("TSC_WATCHDIRECTORY", TestFSWithWatch.Tsc_WatchDirectory.NonRecursiveWatchDirectory);
const host = createWatchedSystem(files, { environmentVariables, currentDirectory: cwd });
createWatchOfConfigFile("tsconfig.json", host);
checkWatchedDirectories(host, emptyArray, /*recursive*/ true);
checkWatchedDirectories(host, [cwd, `${cwd}/node_modules`, `${cwd}/node_modules/@types`, `${cwd}/node_modules/reala`, `${cwd}/node_modules/realb`,
`${cwd}/node_modules/reala/node_modules`, `${cwd}/node_modules/realb/node_modules`, `${cwd}/src`], /*recursive*/ false);
});
});
});
}
+181 -11
View File
@@ -168,11 +168,12 @@ namespace ts.projectSystem {
readonly session: TestSession;
readonly service: server.ProjectService;
readonly host: TestServerHost;
constructor(files: FileOrFolder[]) {
constructor(files: FileOrFolder[], suppressDiagnosticEvents?: boolean) {
this.host = createServerHost(files);
this.session = createSession(this.host, {
canUseEvents: true,
eventHandler: event => this.events.push(event),
suppressDiagnosticEvents,
});
this.service = this.session.getProjectService();
}
@@ -485,6 +486,12 @@ namespace ts.projectSystem {
checkNthEvent(session, server.toEvent("projectsUpdatedInBackground", { openFiles }), 0, /*isMostRecent*/ true);
}
function checkNoDiagnosticEvents(session: TestSession) {
for (const event of session.events) {
assert.isFalse(event.event.endsWith("Diag"), JSON.stringify(event));
}
}
function checkNthEvent(session: TestSession, expectedEvent: protocol.Event, index: number, isMostRecent: boolean) {
const events = session.events;
assert.deepEqual(events[index], expectedEvent);
@@ -1327,13 +1334,13 @@ namespace ts.projectSystem {
service.checkNumberOfProjects({ externalProjects: 1 });
checkProjectActualFiles(service.externalProjects[0], [f1.path, f2.path, libFile.path]);
const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 2, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 2, defaultPreferences);
// should contain completions for string
assert.isTrue(completions1.entries.some(e => e.name === "charAt"), "should contain 'charAt'");
assert.isFalse(completions1.entries.some(e => e.name === "toExponential"), "should not contain 'toExponential'");
service.closeClientFile(f2.path);
const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 2, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 2, defaultPreferences);
// should contain completions for string
assert.isFalse(completions2.entries.some(e => e.name === "charAt"), "should not contain 'charAt'");
assert.isTrue(completions2.entries.some(e => e.name === "toExponential"), "should contain 'toExponential'");
@@ -1359,11 +1366,11 @@ namespace ts.projectSystem {
service.checkNumberOfProjects({ externalProjects: 1 });
checkProjectActualFiles(service.externalProjects[0], [f1.path, f2.path, libFile.path]);
const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0, defaultPreferences);
assert.isTrue(completions1.entries.some(e => e.name === "somelongname"), "should contain 'somelongname'");
service.closeClientFile(f2.path);
const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0, defaultPreferences);
assert.isFalse(completions2.entries.some(e => e.name === "somelongname"), "should not contain 'somelongname'");
const sf2 = service.externalProjects[0].getLanguageService().getProgram().getSourceFile(f2.path);
assert.equal(sf2.text, "");
@@ -1968,7 +1975,7 @@ namespace ts.projectSystem {
// Check identifiers defined in HTML content are available in .ts file
const project = configuredProjectAt(projectService, 0);
let completions = project.getLanguageService().getCompletionsAtPosition(file1.path, 1, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
let completions = project.getLanguageService().getCompletionsAtPosition(file1.path, 1, defaultPreferences);
assert(completions && completions.entries[0].name === "hello", `expected entry hello to be in completion list`);
// Close HTML file
@@ -1982,7 +1989,7 @@ namespace ts.projectSystem {
checkProjectActualFiles(configuredProjectAt(projectService, 0), [file1.path, file2.path, config.path]);
// Check identifiers defined in HTML content are not available in .ts file
completions = project.getLanguageService().getCompletionsAtPosition(file1.path, 5, { includeExternalModuleExports: false, includeInsertTextCompletions: false });
completions = project.getLanguageService().getCompletionsAtPosition(file1.path, 5, defaultPreferences);
assert(completions && completions.entries[0].name !== "hello", `unexpected hello entry in completion list`);
});
@@ -2635,7 +2642,7 @@ namespace ts.projectSystem {
assert.equal(lastEvent.data.project, project, "project name");
assert.isFalse(lastEvent.data.languageServiceEnabled, "Language service state");
const options = projectService.getFormatCodeOptions();
const options = projectService.getFormatCodeOptions(f1.path as server.NormalizedPath);
const edits = project.getLanguageService().getFormattingEditsForDocument(f1.path, options);
assert.deepEqual(edits, [{ span: createTextSpan(/*start*/ 7, /*length*/ 3), newText: " " }]);
});
@@ -3580,7 +3587,7 @@ namespace ts.projectSystem {
const projectService = createProjectService(host);
projectService.openClientFile(f1.path);
const defaultSettings = projectService.getFormatCodeOptions();
const defaultSettings = projectService.getFormatCodeOptions(f1.path as server.NormalizedPath);
// set global settings
const newGlobalSettings1 = clone(defaultSettings);
@@ -4074,6 +4081,63 @@ namespace ts.projectSystem {
session.clearMessages();
});
it("suppressed diagnostic events", () => {
const file: FileOrFolder = {
path: "/a.ts",
content: "1 = 2;",
};
const host = createServerHost([file]);
const session = createSession(host, { canUseEvents: true, suppressDiagnosticEvents: true });
const service = session.getProjectService();
session.executeCommandSeq<protocol.OpenRequest>({
command: server.CommandNames.Open,
arguments: { file: file.path, fileContent: file.content },
});
checkNumberOfProjects(service, { inferredProjects: 1 });
host.checkTimeoutQueueLength(0);
checkNoDiagnosticEvents(session);
session.clearMessages();
let expectedSequenceId = session.getNextSeq();
session.executeCommandSeq<protocol.GeterrRequest>({
command: server.CommandNames.Geterr,
arguments: {
delay: 0,
files: [file.path],
}
});
host.checkTimeoutQueueLength(0);
checkNoDiagnosticEvents(session);
checkCompleteEvent(session, 1, expectedSequenceId);
session.clearMessages();
expectedSequenceId = session.getNextSeq();
session.executeCommandSeq<protocol.GeterrForProjectRequest>({
command: server.CommandNames.Geterr,
arguments: {
delay: 0,
file: file.path,
}
});
host.checkTimeoutQueueLength(0);
checkNoDiagnosticEvents(session);
checkCompleteEvent(session, 1, expectedSequenceId);
session.clearMessages();
});
function createDiagnostic(start: protocol.Location, end: protocol.Location, message: DiagnosticMessage, args: ReadonlyArray<string> = []): protocol.Diagnostic {
return { start, end, text: formatStringFromArgs(message.message, args), code: message.code, category: diagnosticCategoryName(message), source: undefined };
}
@@ -4149,7 +4213,7 @@ namespace ts.projectSystem {
serverEventManager.checkSingleConfigFileDiagEvent(configFile.path, configFile.path);
});
it("are not generated when the config file doesnot include file opened and config file has errors", () => {
it("are not generated when the config file does not include file opened and config file has errors", () => {
const file = {
path: "/a/b/app.ts",
content: "let x = 10"
@@ -4173,7 +4237,26 @@ namespace ts.projectSystem {
serverEventManager.hasZeroEvent("configFileDiag");
});
it("are not generated when the config file doesnot include file opened and doesnt contain any errors", () => {
it("are not generated when the config file has errors but suppressDiagnosticEvents is true", () => {
const file = {
path: "/a/b/app.ts",
content: "let x = 10"
};
const configFile = {
path: "/a/b/tsconfig.json",
content: `{
"compilerOptions": {
"foo": "bar",
"allowJS": true
}
}`
};
const serverEventManager = new TestServerEventManager([file, configFile], /*suppressDiagnosticEvents*/ true);
openFilesForSession([file], serverEventManager.session);
serverEventManager.hasZeroEvent("configFileDiag");
});
it("are not generated when the config file does not include file opened and doesnt contain any errors", () => {
const file = {
path: "/a/b/app.ts",
content: "let x = 10"
@@ -6045,6 +6128,55 @@ namespace ts.projectSystem {
});
});
describe("Subfolder invalidations correctly include parent folder failed lookup locations", () => {
function runFailedLookupTest(resolution: "Node" | "Classic") {
const projectLocation = "/proj";
const file1: FileOrFolder = {
path: `${projectLocation}/foo/boo/app.ts`,
content: `import * as debug from "debug"`
};
const file2: FileOrFolder = {
path: `${projectLocation}/foo/boo/moo/app.ts`,
content: `import * as debug from "debug"`
};
const tsconfig: FileOrFolder = {
path: `${projectLocation}/tsconfig.json`,
content: JSON.stringify({
files: ["foo/boo/app.ts", "foo/boo/moo/app.ts"],
moduleResolution: resolution
})
};
const files = [file1, file2, tsconfig, libFile];
const host = createServerHost(files);
const service = createProjectService(host);
service.openClientFile(file1.path);
const project = service.configuredProjects.get(tsconfig.path);
checkProjectActualFiles(project, files.map(f => f.path));
assert.deepEqual(project.getLanguageService().getSemanticDiagnostics(file1.path).map(diag => diag.messageText), ["Cannot find module 'debug'."]);
assert.deepEqual(project.getLanguageService().getSemanticDiagnostics(file2.path).map(diag => diag.messageText), ["Cannot find module 'debug'."]);
const debugTypesFile: FileOrFolder = {
path: `${projectLocation}/node_modules/debug/index.d.ts`,
content: "export {}"
};
files.push(debugTypesFile);
host.reloadFS(files);
host.runQueuedTimeoutCallbacks();
checkProjectActualFiles(project, files.map(f => f.path));
assert.deepEqual(project.getLanguageService().getSemanticDiagnostics(file1.path).map(diag => diag.messageText), []);
assert.deepEqual(project.getLanguageService().getSemanticDiagnostics(file2.path).map(diag => diag.messageText), []);
}
it("Includes the parent folder FLLs in node module resolution mode", () => {
runFailedLookupTest("Node");
});
it("Includes the parent folder FLLs in classic module resolution mode", () => {
runFailedLookupTest("Classic");
});
});
describe("Verify npm install in directory with tsconfig file works when", () => {
function verifyNpmInstall(timeoutDuringPartialInstallation: boolean) {
const root = "/user/username/rootfolder/otherfolder";
@@ -6211,6 +6343,44 @@ namespace ts.projectSystem {
verifyNpmInstall(/*timeoutDuringPartialInstallation*/ false);
});
});
it("when node_modules dont receive event for the @types file addition", () => {
const projectLocation = "/user/username/folder/myproject";
const app: FileOrFolder = {
path: `${projectLocation}/app.ts`,
content: `import * as debug from "debug"`
};
const tsconfig: FileOrFolder = {
path: `${projectLocation}/tsconfig.json`,
content: ""
};
const files = [app, tsconfig, libFile];
const host = createServerHost(files);
const service = createProjectService(host);
service.openClientFile(app.path);
const project = service.configuredProjects.get(tsconfig.path);
checkProjectActualFiles(project, files.map(f => f.path));
assert.deepEqual(project.getLanguageService().getSemanticDiagnostics(app.path).map(diag => diag.messageText), ["Cannot find module 'debug'."]);
const debugTypesFile: FileOrFolder = {
path: `${projectLocation}/node_modules/@types/debug/index.d.ts`,
content: "export {}"
};
files.push(debugTypesFile);
// Do not invoke recursive directory watcher for anything other than node_module/@types
const invoker = host.invokeWatchedDirectoriesRecursiveCallback;
host.invokeWatchedDirectoriesRecursiveCallback = (fullPath, relativePath) => {
if (fullPath.endsWith("@types")) {
invoker.call(host, fullPath, relativePath);
}
};
host.reloadFS(files);
host.runQueuedTimeoutCallbacks();
checkProjectActualFiles(project, files.map(f => f.path));
assert.deepEqual(project.getLanguageService().getSemanticDiagnostics(app.path).map(diag => diag.messageText), []);
});
});
describe("tsserverProjectSystem ProjectsChangedInBackground", () => {
+57 -34
View File
@@ -88,7 +88,7 @@ interface Array<T> {}`
}
interface Folder extends FSEntry {
entries: FSEntry[];
entries: SortedArray<FSEntry>;
}
interface SymLink extends FSEntry {
@@ -276,17 +276,19 @@ interface Array<T> {}`
DynamicPolling = "RecursiveDirectoryUsingDynamicPriorityPolling"
}
const timeIncrements = 1000;
export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, ModuleResolutionHost {
args: string[] = [];
private readonly output: string[] = [];
private fs: Map<FSEntry> = createMap<FSEntry>();
private time = timeIncrements;
getCanonicalFileName: (s: string) => string;
private toPath: (f: string) => Path;
private timeoutCallbacks = new Callbacks();
private immediateCallbacks = new Callbacks();
private screenClears = 0;
readonly screenClears: number[] = [];
readonly watchedDirectories = createMultiMap<TestDirectoryWatcher>();
readonly watchedDirectoriesRecursive = createMultiMap<TestDirectoryWatcher>();
@@ -310,18 +312,20 @@ interface Array<T> {}`
const watchDirectory: HostWatchDirectory = (directory, cb) => this.watchFile(directory, () => cb(directory), PollingInterval.Medium);
this.customRecursiveWatchDirectory = createRecursiveDirectoryWatcher({
directoryExists: path => this.directoryExists(path),
getAccessileSortedChildDirectories: path => this.getDirectories(path),
getAccessibleSortedChildDirectories: path => this.getDirectories(path),
filePathComparer: this.useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive,
watchDirectory
watchDirectory,
realpath: s => this.realpath(s)
});
}
else if (tscWatchDirectory === Tsc_WatchDirectory.NonRecursiveWatchDirectory) {
const watchDirectory: HostWatchDirectory = (directory, cb) => this.watchDirectory(directory, fileName => cb(fileName), /*recursive*/ false);
this.customRecursiveWatchDirectory = createRecursiveDirectoryWatcher({
directoryExists: path => this.directoryExists(path),
getAccessileSortedChildDirectories: path => this.getDirectories(path),
getAccessibleSortedChildDirectories: path => this.getDirectories(path),
filePathComparer: this.useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive,
watchDirectory
watchDirectory,
realpath: s => this.realpath(s)
});
}
else if (tscWatchDirectory === Tsc_WatchDirectory.DynamicPolling) {
@@ -329,9 +333,10 @@ interface Array<T> {}`
const watchDirectory: HostWatchDirectory = (directory, cb) => watchFile(directory, () => cb(directory), PollingInterval.Medium);
this.customRecursiveWatchDirectory = createRecursiveDirectoryWatcher({
directoryExists: path => this.directoryExists(path),
getAccessileSortedChildDirectories: path => this.getDirectories(path),
getAccessibleSortedChildDirectories: path => this.getDirectories(path),
filePathComparer: this.useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive,
watchDirectory
watchDirectory,
realpath: s => this.realpath(s)
});
}
}
@@ -355,6 +360,11 @@ interface Array<T> {}`
return s;
}
private now() {
this.time += timeIncrements;
return new Date(this.time);
}
reloadFS(fileOrFolderList: ReadonlyArray<FileOrFolder>, options?: Partial<ReloadWatchInvokeOptions>) {
const mapNewLeaves = createMap<true>();
const isNewFs = this.fs.size === 0;
@@ -381,8 +391,8 @@ interface Array<T> {}`
}
else {
currentEntry.content = fileOrDirectory.content;
currentEntry.modifiedTime = new Date();
this.fs.get(getDirectoryPath(currentEntry.path)).modifiedTime = new Date();
currentEntry.modifiedTime = this.now();
this.fs.get(getDirectoryPath(currentEntry.path)).modifiedTime = this.now();
if (options && options.invokeDirectoryWatcherInsteadOfFileChanged) {
this.invokeDirectoryWatcher(getDirectoryPath(currentEntry.fullPath), currentEntry.fullPath);
}
@@ -406,7 +416,7 @@ interface Array<T> {}`
}
else {
// Folder update: Nothing to do.
currentEntry.modifiedTime = new Date();
currentEntry.modifiedTime = this.now();
}
}
}
@@ -448,16 +458,24 @@ interface Array<T> {}`
this.addFileOrFolderInFolder(baseFolder, newFolder);
// Invoke watches for files in the folder as deleted (from old path)
for (const entry of folder.entries) {
Debug.assert(isFile(entry));
this.renameFolderEntries(folder, newFolder);
}
private renameFolderEntries(oldFolder: Folder, newFolder: Folder) {
for (const entry of oldFolder.entries) {
this.fs.delete(entry.path);
this.invokeFileWatcher(entry.fullPath, FileWatcherEventKind.Deleted);
entry.fullPath = combinePaths(newFullPath, getBaseFileName(entry.fullPath));
entry.fullPath = combinePaths(newFolder.fullPath, getBaseFileName(entry.fullPath));
entry.path = this.toPath(entry.fullPath);
newFolder.entries.push(entry);
if (newFolder !== oldFolder) {
newFolder.entries.push(entry);
}
this.fs.set(entry.path, entry);
this.invokeFileWatcher(entry.fullPath, FileWatcherEventKind.Created);
if (isFolder(entry)) {
this.renameFolderEntries(entry, entry);
}
}
}
@@ -504,8 +522,8 @@ interface Array<T> {}`
}
private addFileOrFolderInFolder(folder: Folder, fileOrDirectory: File | Folder | SymLink, ignoreWatch?: boolean) {
folder.entries.push(fileOrDirectory);
folder.modifiedTime = new Date();
insertSorted(folder.entries, fileOrDirectory, (a, b) => compareStringsCaseSensitive(getBaseFileName(a.path), getBaseFileName(b.path)));
folder.modifiedTime = this.now();
this.fs.set(fileOrDirectory.path, fileOrDirectory);
if (ignoreWatch) {
@@ -520,7 +538,7 @@ interface Array<T> {}`
const baseFolder = this.fs.get(basePath) as Folder;
if (basePath !== fileOrDirectory.path) {
Debug.assert(!!baseFolder);
baseFolder.modifiedTime = new Date();
baseFolder.modifiedTime = this.now();
filterMutate(baseFolder.entries, entry => entry !== fileOrDirectory);
}
this.fs.delete(fileOrDirectory.path);
@@ -532,8 +550,8 @@ interface Array<T> {}`
// Invoke directory and recursive directory watcher for the folder
// Here we arent invoking recursive directory watchers for the base folders
// since that is something we would want to do for both file as well as folder we are deleting
invokeWatcherCallbacks(this.watchedDirectories.get(fileOrDirectory.path), cb => this.directoryCallback(cb, relativePath));
invokeWatcherCallbacks(this.watchedDirectoriesRecursive.get(fileOrDirectory.path), cb => this.directoryCallback(cb, relativePath));
this.invokeWatchedDirectoriesCallback(fileOrDirectory.fullPath, relativePath);
this.invokeWatchedDirectoriesRecursiveCallback(fileOrDirectory.fullPath, relativePath);
}
if (basePath !== fileOrDirectory.path) {
@@ -546,9 +564,17 @@ interface Array<T> {}`
}
}
private invokeFileWatcher(fileFullPath: string, eventKind: FileWatcherEventKind) {
const callbacks = this.watchedFiles.get(this.toPath(fileFullPath));
invokeWatcherCallbacks(callbacks, ({ cb }) => cb(fileFullPath, eventKind));
// For overriding the methods
invokeWatchedDirectoriesCallback(folderFullPath: string, relativePath: string) {
invokeWatcherCallbacks(this.watchedDirectories.get(this.toPath(folderFullPath)), cb => this.directoryCallback(cb, relativePath));
}
invokeWatchedDirectoriesRecursiveCallback(folderFullPath: string, relativePath: string) {
invokeWatcherCallbacks(this.watchedDirectoriesRecursive.get(this.toPath(folderFullPath)), cb => this.directoryCallback(cb, relativePath));
}
invokeFileWatcher(fileFullPath: string, eventKind: FileWatcherEventKind, useFileNameInCallback?: boolean) {
invokeWatcherCallbacks(this.watchedFiles.get(this.toPath(fileFullPath)), ({ cb, fileName }) => cb(useFileNameInCallback ? fileName : fileFullPath, eventKind));
}
private getRelativePathToDirectory(directoryFullPath: string, fileFullPath: string) {
@@ -561,8 +587,8 @@ interface Array<T> {}`
private invokeDirectoryWatcher(folderFullPath: string, fileName: string) {
const relativePath = this.getRelativePathToDirectory(folderFullPath, fileName);
// Folder is changed when the directory watcher is invoked
invokeWatcherCallbacks(this.watchedFiles.get(this.toPath(folderFullPath)), ({ cb, fileName }) => cb(fileName, FileWatcherEventKind.Changed));
invokeWatcherCallbacks(this.watchedDirectories.get(this.toPath(folderFullPath)), cb => this.directoryCallback(cb, relativePath));
this.invokeFileWatcher(folderFullPath, FileWatcherEventKind.Changed, /*useFileNameInCallback*/ true);
this.invokeWatchedDirectoriesCallback(folderFullPath, relativePath);
this.invokeRecursiveDirectoryWatcher(folderFullPath, fileName);
}
@@ -575,7 +601,7 @@ interface Array<T> {}`
*/
private invokeRecursiveDirectoryWatcher(fullPath: string, fileName: string) {
const relativePath = this.getRelativePathToDirectory(fullPath, fileName);
invokeWatcherCallbacks(this.watchedDirectoriesRecursive.get(this.toPath(fullPath)), cb => this.directoryCallback(cb, relativePath));
this.invokeWatchedDirectoriesRecursiveCallback(fullPath, relativePath);
const basePath = getDirectoryPath(fullPath);
if (this.getCanonicalFileName(fullPath) !== this.getCanonicalFileName(basePath)) {
this.invokeRecursiveDirectoryWatcher(basePath, fileName);
@@ -587,7 +613,7 @@ interface Array<T> {}`
return {
path: this.toPath(fullPath),
fullPath,
modifiedTime: new Date()
modifiedTime: this.now()
};
}
@@ -606,7 +632,7 @@ interface Array<T> {}`
private toFolder(path: string): Folder {
const folder = this.toFsEntry(path) as Folder;
folder.entries = [];
folder.entries = [] as SortedArray<FSEntry>;
return folder;
}
@@ -626,7 +652,7 @@ interface Array<T> {}`
const realpath = this.realpath(path);
if (path !== realpath) {
return this.getRealFsEntry(isFsEntry, realpath as Path);
return this.getRealFsEntry(isFsEntry, this.toPath(realpath));
}
return undefined;
@@ -755,7 +781,7 @@ interface Array<T> {}`
}
clearScreen(): void {
this.screenClears += 1;
this.screenClears.push(this.output.length);
}
checkTimeoutQueueLengthAndRun(expected: number) {
@@ -795,10 +821,6 @@ interface Array<T> {}`
this.immediateCallbacks.unregister(timeoutId);
}
checkScreenClears(expected: number): void {
assert.equal(this.screenClears, expected);
}
createDirectory(directoryName: string): void {
const folder = this.toFolder(directoryName);
@@ -832,6 +854,7 @@ interface Array<T> {}`
clearOutput() {
clear(this.output);
this.screenClears.length = 0;
}
realpath(s: string): string {
+30 -24
View File
@@ -3285,6 +3285,7 @@ interface DOMTokenList {
contains(token: string): boolean;
item(index: number): string | null;
remove(...tokens: string[]): void;
replace(oldToken: string, newToken: string): void;
toString(): string;
toggle(token: string, force?: boolean): boolean;
[index: number]: string;
@@ -3532,10 +3533,10 @@ interface DocumentEventMap extends GlobalEventHandlersEventMap {
"submit": Event;
"suspend": Event;
"timeupdate": Event;
"touchcancel": Event;
"touchend": Event;
"touchmove": Event;
"touchstart": Event;
"touchcancel": TouchEvent;
"touchend": TouchEvent;
"touchmove": TouchEvent;
"touchstart": TouchEvent;
"volumechange": Event;
"waiting": Event;
"webkitfullscreenchange": Event;
@@ -3654,7 +3655,7 @@ interface Document extends Node, GlobalEventHandlers, ParentNode, DocumentEvent
/**
* Contains information about the current URL.
*/
location: Location | string;
location: Location;
msCSSOMElementFloatMetrics: boolean;
msCapsLockWarningOff: boolean;
/**
@@ -3949,10 +3950,10 @@ interface Document extends Node, GlobalEventHandlers, ParentNode, DocumentEvent
* @param ev The event.
*/
ontimeupdate: ((this: Document, ev: Event) => any) | null;
ontouchcancel: ((this: Document, ev: Event) => any) | null;
ontouchend: ((this: Document, ev: Event) => any) | null;
ontouchmove: ((this: Document, ev: Event) => any) | null;
ontouchstart: ((this: Document, ev: Event) => any) | null;
ontouchcancel: ((this: Document, ev: TouchEvent) => any) | null;
ontouchend: ((this: Document, ev: TouchEvent) => any) | null;
ontouchmove: ((this: Document, ev: TouchEvent) => any) | null;
ontouchstart: ((this: Document, ev: TouchEvent) => any) | null;
onvisibilitychange: (this: Document, ev: Event) => any;
/**
* Occurs when the volume is changed, or playback is muted or unmuted.
@@ -4138,6 +4139,7 @@ interface Document extends Node, GlobalEventHandlers, ParentNode, DocumentEvent
* @param y The y-offset
*/
elementFromPoint(x: number, y: number): Element;
elementsFromPoint(x: number, y: number): Element[];
evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;
/**
* Executes a command on the current document, current selection, or the given range.
@@ -4312,6 +4314,7 @@ interface DocumentEvent {
createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent;
createEvent(eventInterface: "StorageEvent"): StorageEvent;
createEvent(eventInterface: "TextEvent"): TextEvent;
createEvent(eventInterface: "TouchEvent"): TouchEvent;
createEvent(eventInterface: "TrackEvent"): TrackEvent;
createEvent(eventInterface: "TransitionEvent"): TransitionEvent;
createEvent(eventInterface: "UIEvent"): UIEvent;
@@ -4431,10 +4434,10 @@ interface ElementEventMap extends GlobalEventHandlersEventMap {
"MSPointerOut": Event;
"MSPointerOver": Event;
"MSPointerUp": Event;
"touchcancel": Event;
"touchend": Event;
"touchmove": Event;
"touchstart": Event;
"touchcancel": TouchEvent;
"touchend": TouchEvent;
"touchmove": TouchEvent;
"touchstart": TouchEvent;
"webkitfullscreenchange": Event;
"webkitfullscreenerror": Event;
}
@@ -4473,10 +4476,10 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, ParentNod
onmspointerout: ((this: Element, ev: Event) => any) | null;
onmspointerover: ((this: Element, ev: Event) => any) | null;
onmspointerup: ((this: Element, ev: Event) => any) | null;
ontouchcancel: ((this: Element, ev: Event) => any) | null;
ontouchend: ((this: Element, ev: Event) => any) | null;
ontouchmove: ((this: Element, ev: Event) => any) | null;
ontouchstart: ((this: Element, ev: Event) => any) | null;
ontouchcancel: ((this: Element, ev: TouchEvent) => any) | null;
ontouchend: ((this: Element, ev: TouchEvent) => any) | null;
ontouchmove: ((this: Element, ev: TouchEvent) => any) | null;
ontouchstart: ((this: Element, ev: TouchEvent) => any) | null;
onwebkitfullscreenchange: ((this: Element, ev: Event) => any) | null;
onwebkitfullscreenerror: ((this: Element, ev: Event) => any) | null;
outerHTML: string;
@@ -6131,6 +6134,7 @@ interface HTMLImageElement extends HTMLElement {
readonly complete: boolean;
crossOrigin: string | null;
readonly currentSrc: string;
decoding: "async" | "sync" | "auto";
/**
* Sets or retrieves the height of the object.
*/
@@ -14742,7 +14746,7 @@ interface WebSocket extends EventTarget {
readonly readyState: number;
readonly url: string;
close(code?: number, reason?: string): void;
send(data: string | ArrayBuffer | Blob | ArrayBufferView): void;
send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
readonly CLOSED: number;
readonly CLOSING: number;
readonly CONNECTING: number;
@@ -14868,10 +14872,10 @@ interface WindowEventMap extends GlobalEventHandlersEventMap {
"submit": Event;
"suspend": Event;
"timeupdate": Event;
"touchcancel": Event;
"touchend": Event;
"touchmove": Event;
"touchstart": Event;
"touchcancel": TouchEvent;
"touchend": TouchEvent;
"touchmove": TouchEvent;
"touchstart": TouchEvent;
"unload": Event;
"volumechange": Event;
"vrdisplayactivate": Event;
@@ -14909,7 +14913,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
readonly innerWidth: number;
readonly isSecureContext: boolean;
readonly length: number;
location: Location | string;
location: Location;
readonly locationbar: BarProp;
readonly menubar: BarProp;
readonly msContentScript: ExtensionScriptApis;
@@ -15059,6 +15063,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
msWriteProfilerMark(profilerMarkName: string): void;
open(url?: string, target?: string, features?: string, replace?: boolean): Window | null;
postMessage(message: any, targetOrigin: string, transfer?: any[]): void;
print(): void;
prompt(message?: string, _default?: string): string | null;
releaseEvents(): void;
requestAnimationFrame(callback: FrameRequestCallback): number;
@@ -15718,7 +15723,7 @@ declare var innerHeight: number;
declare var innerWidth: number;
declare var isSecureContext: boolean;
declare var length: number;
declare var location: Location | string;
declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msContentScript: ExtensionScriptApis;
@@ -15868,6 +15873,7 @@ declare function moveTo(x?: number, y?: number): void;
declare function msWriteProfilerMark(profilerMarkName: string): void;
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window | null;
declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void;
declare function print(): void;
declare function prompt(message?: string, _default?: string): string | null;
declare function releaseEvents(): void;
declare function requestAnimationFrame(callback: FrameRequestCallback): number;

Some files were not shown because too many files have changed in this diff Show More