typescript 4.8.0-dev.20220804 → 4.8.0-dev.20220807

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "Soubor {0} se nenašel.",
703
703
  "File_Management_6245": "Správa souborů",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "Zjistila se změna souboru. Spouští se přírůstková kompilace...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "Soubor je modul CommonJS, protože {0} nemá pole type",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "Soubor je modul CommonJS, protože {0} má pole type, jehož hodnota není module",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "Soubor je modul CommonJS, protože se nenašel package.json",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "Soubor je modul ECMAScript, protože {0} má pole type s hodnotou module",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "Soubor je modul CommonJS; může být převeden na modul ES.",
706
710
  "File_is_default_library_for_target_specified_here_1426": "Soubor je výchozí knihovna pro cíl, který se zadal na tomto místě.",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "Soubor je vstupní bod knihovny typů, která se zadala na tomto místě.",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "Die Datei \"{0}\" wurde nicht gefunden.",
703
703
  "File_Management_6245": "Dateiverwaltung",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "Es wurde eine Dateiänderung erkannt. Die inkrementelle Kompilierung wird gestartet...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "Die Datei ist ein CommonJS-Modul, da '{0}' nicht das Feld „Typ“ aufweist",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "Die Datei ist ein CommonJS-Modul, da '{0}' das Feld „Typ“ aufweist, dessen Wert nicht „Modul“ ist",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "Die Datei ist ein CommonJS-Modul, da „package.json“ nicht gefunden wurde",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "Die Datei ist ein ECMAScript-Modul, da '{0}' das Feld „Typ“ mit dem Wert „Modul“ aufweist.",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "Die Datei ist ein CommonJS-Modul und kann möglicherweise in ein ES-Modul konvertiert werden.",
706
710
  "File_is_default_library_for_target_specified_here_1426": "Die Datei ist die Standardbibliothek für das hier angegebene Ziel.",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "Die Datei ist ein Einstiegspunkt der hier angegebenen Typbibliothek.",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "Archivo '{0}' no encontrado.",
703
703
  "File_Management_6245": "Administración de archivos",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "Se detectó un cambio de archivo. Iniciando la compilación incremental...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "El archivo es un módulo CommonJS porque “{0}” no tiene el campo “type”",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "El archivo es el módulo CommonJS porque “{0}” tiene el campo “type” cuyo valor no es “module”.",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "El archivo es un módulo CommonJS porque no se encontró “package.json”",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "El archivo es un módulo ECMAScript porque “{0}” tiene el campo “type” con el valor “module”",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "El archivo es un módulo CommonJS; se puede convertir en un módulo ES.",
706
710
  "File_is_default_library_for_target_specified_here_1426": "El archivo es la biblioteca predeterminada para el destino que se especifica aquí.",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "El archivo es el punto de entrada de la biblioteca de tipos que se especifica aquí.",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "Fichier '{0}' introuvable.",
703
703
  "File_Management_6245": "Gestion de fichiers",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "Modification de fichier détectée. Démarrage de la compilation incrémentielle...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "Le fichier est un module CommonJS, car « {0} » n’a pas de champ « type »",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "Le fichier est un module CommonJS, car « {0} » a un champ « type » dont la valeur n’est pas « module »",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "Le fichier est un module CommonJS, car « package.json » est introuvable",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "Le fichier est un module ECMAScript, car « {0} » a un champ « type » avec la valeur « module »",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "Le fichier est un module CommonJS ; il peut être converti en module ES.",
706
710
  "File_is_default_library_for_target_specified_here_1426": "Le fichier représente la bibliothèque par défaut de la cible spécifiée ici.",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "Le fichier représente le point d'entrée de la bibliothèque de types spécifiée ici.",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "Il file '{0}' non è stato trovato.",
703
703
  "File_Management_6245": "Gestione dei file",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "È stata rilevata una modifica ai file. Verrà avviata la compilazione incrementale...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "Il file è un modulo CommonJS perché '{0}' non contiene il campo \"type\"",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "Il file è un modulo CommonJS perché '{0}' contiene il campo \"type\" il cui valore non è \"module\"",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "Il file è un modulo CommonJS perché 'package.json' non è stato trovato",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "Il file è un modulo ECMAScript perché '{0}' contiene il campo \"type\" con valore \"module\"",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "Il file è un modulo CommonJS e può essere convertito in un modulo ES6.",
706
710
  "File_is_default_library_for_target_specified_here_1426": "Il file è la libreria predefinita per la destinazione specificata in questo punto.",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "Il file è il punto di ingresso della libreria dei tipi specificata in questo punto.",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "ファイル '{0}' が見つかりません。",
703
703
  "File_Management_6245": "ファイルの管理",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "ファイルの変更が検出されました。インクリメンタル コンパイルを開始しています...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "'{0}' にはフィールド \"type\" がないため、ファイルは CommonJS モジュールです",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "'{0}' にフィールド \"type\" があり、値が \"module\" ではないため、ファイルは CommonJS モジュールです。",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "\"package.json\" が見つからなかったため、ファイルは CommonJS モジュールです",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "'{0}' には値 \"module\" のフィールド \"type\" があるため、ファイルは ECMAScript モジュールです。",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "ファイルは CommonJS モジュールです。ES モジュールに変換される可能性があります。",
706
710
  "File_is_default_library_for_target_specified_here_1426": "ファイルはこちらで指定されたターゲットの既定のライブラリです。",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "ファイルはこちらで指定されたタイプ ライブラリのエントリ ポイントです。",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "파일 '{0}'을(를) 찾을 수 없습니다.",
703
703
  "File_Management_6245": "파일 관리",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "파일 변경이 검색되었습니다. 증분 컴파일을 시작하는 중...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "'{0}'에 \"type\" 필드가 없으므로 파일이 CommonJS 모듈입니다.",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "'{0}'에 값이 \"module\"이 아닌 \"type\" 필드가 있으므로 파일이 CommonJS 모듈입니다.",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "'package.json'을 찾을 수 없으므로 파일이 CommonJS 모듈입니다.",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "'{0}'에 값이 \"module\"인 \"type\" 필드가 있으므로 파일이 ECMAScript 모듈입니다.",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "파일이 CommonJS 모듈입니다. ES 모듈로 변환될 수 있습니다.",
706
710
  "File_is_default_library_for_target_specified_here_1426": "파일은 여기에 지정된 대상의 기본 라이브러리입니다.",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "파일은 여기에 지정된 형식 라이브러리의 진입점입니다.",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "Nie można odnaleźć pliku '{0}'.",
703
703
  "File_Management_6245": "Zarządzanie plikami",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "Wykryto zmianę pliku. Trwa rozpoczynanie kompilacji przyrostowej...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "Plik jest modułem CommonJS, ponieważ element „{0}” nie ma pola „type”",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "Plik jest modułem CommonJS, ponieważ element „{0}” ma pole „type”, którego wartość nie jest „module”",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "Plik jest modułem CommonJS, ponieważ nie znaleziono pliku „package.json”",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "Plik jest modułem ECMAScript, ponieważ element „{0}” ma pole „type” z wartością „module”",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "Plik jest modułem CommonJS; może zostać przekonwertowany na moduł ES.",
706
710
  "File_is_default_library_for_target_specified_here_1426": "Plik to domyślna biblioteka dla elementu docelowego określonego w tym miejscu.",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "Plik to punkt wejścia biblioteki typów określonej w tym miejscu.",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "Arquivo '{0}' não encontrado.",
703
703
  "File_Management_6245": "Gerenciamento de Arquivos",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "Alteração do arquivo detectada. Iniciando compilação incremental...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "O arquivo é um módulo CommonJS porque '{0}' não tem o campo \"type\"",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "O arquivo é o módulo CommonJS porque '{0}' tem o campo \"type\" cujo valor não é \"module\"",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "O arquivo é um módulo CommonJS porque 'package.json' não foi encontrado",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "O arquivo é o módulo ECMAScript porque '{0}' tem o campo \"type\" com o valor \"module\"",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "O arquivo é um módulo CommonJS; ele pode ser convertido em um módulo ES.",
706
710
  "File_is_default_library_for_target_specified_here_1426": "O arquivo é a biblioteca padrão para o destino especificado aqui.",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "O arquivo é o ponto de entrada da biblioteca de tipos especificada aqui.",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "Файл \"{0}\" не найден.",
703
703
  "File_Management_6245": "Управление файлами",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "Обнаружено изменение в файле. Запускается инкрементная компиляция...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "Файл является модулем CommonJS, так как \"{0}\" не содержит поле \"type\"",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "Файл является модулем CommonJS, так как \"{0}\" содержит поле \"type\", значение которого отличается от \"module\"",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "Файл является модулем CommonJS, так как \"package.json\" не найден",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "Файл является модулем ECMAScript, так как \"{0}\" содержит поле \"type\" со значением \"module\"",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "Файл является модулем CommonJS. Его можно преобразовать в модуль ES.",
706
710
  "File_is_default_library_for_target_specified_here_1426": "Файл является библиотекой по умолчанию для указанного здесь целевого объекта.",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "Файл является точкой входа для указанной здесь библиотеки типов.",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "'{0}' dosyası bulunamadı.",
703
703
  "File_Management_6245": "Dosya Yönetimi",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "Dosya değişikliği algılandı. Artımlı derleme başlatılıyor...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "'{0}', \"type\" alanına sahip olmadığından dosya CommonJS modülüdür",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "'{0}', değeri \"module\" olmayan \"type\" alanına sahip olduğundan dosya CommonJS modülüdür",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "'package.json' bulunamadığından dosya CommonJS modülüdür",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "'{0}', değeri \"module\" olan \"type\" alanına sahip olduğundan dosya ECMAScript modülüdür",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "Bir CommonJS modülü olan dosya bir ES modülüne dönüştürülebilir.",
706
710
  "File_is_default_library_for_target_specified_here_1426": "Burada dosya, belirtilen hedef için varsayılan kitaplıktır.",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "Burada dosya, belirtilen tür kitaplığının giriş noktasıdır.",
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220804";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220807";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -5732,7 +5732,7 @@ var ts;
5732
5732
  File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
5733
5733
  File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
5734
5734
  The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
5735
- Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
5735
+ Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead."),
5736
5736
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
5737
5737
  An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
5738
5738
  An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
@@ -5740,6 +5740,11 @@ var ts;
5740
5740
  auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
5741
5741
  An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
5742
5742
  Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
5743
+ The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead: diag(1479, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479", "The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"{0}\")' call instead."),
5744
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module: diag(1480, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480", "To convert this file to an ECMAScript module, change its file extension to '{0}' or create a local package.json file with `{ \"type\": \"module\" }`."),
5745
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1: diag(1481, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481", "To convert this file to an ECMAScript module, change its file extension to '{0}', or add the field `\"type\": \"module\"` to '{1}'."),
5746
+ To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0: diag(1482, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482", "To convert this file to an ECMAScript module, add the field `\"type\": \"module\"` to '{0}'."),
5747
+ To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", "To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`."),
5743
5748
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
5744
5749
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
5745
5750
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", undefined, true),
@@ -42488,7 +42493,34 @@ var ts;
42488
42493
  var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
42489
42494
  var overrideClause = overrideClauseHost && ts.isImportTypeNode(overrideClauseHost) ? (_g = overrideClauseHost.assertions) === null || _g === void 0 ? void 0 : _g.assertClause : overrideClauseHost === null || overrideClauseHost === void 0 ? void 0 : overrideClauseHost.assertClause;
42490
42495
  if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
42491
- error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
42496
+ if (ts.findAncestor(location, ts.isImportEqualsDeclaration)) {
42497
+ error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
42498
+ }
42499
+ else {
42500
+ var diagnosticDetails = void 0;
42501
+ var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
42502
+ if (ext === ".ts" || ext === ".js" || ext === ".tsx" || ext === ".jsx") {
42503
+ var scope = currentSourceFile.packageJsonScope;
42504
+ var targetExt = ext === ".ts" ? ".mts" : ext === ".js" ? ".mjs" : undefined;
42505
+ if (scope && !scope.packageJsonContent.type) {
42506
+ if (targetExt) {
42507
+ diagnosticDetails = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json"));
42508
+ }
42509
+ else {
42510
+ diagnosticDetails = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0, ts.combinePaths(scope.packageDirectory, "package.json"));
42511
+ }
42512
+ }
42513
+ else {
42514
+ if (targetExt) {
42515
+ diagnosticDetails = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module, targetExt);
42516
+ }
42517
+ else {
42518
+ diagnosticDetails = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module);
42519
+ }
42520
+ }
42521
+ }
42522
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, ts.chainDiagnosticMessages(diagnosticDetails, ts.Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead, moduleReference)));
42523
+ }
42492
42524
  }
42493
42525
  }
42494
42526
  return getMergedSymbol(sourceFile.symbol);
@@ -61176,12 +61208,15 @@ var ts;
61176
61208
  if (contextualReturnType) {
61177
61209
  var functionFlags = ts.getFunctionFlags(func);
61178
61210
  if (functionFlags & 1) {
61179
- var use = functionFlags & 2 ? 2 : 1;
61180
- var iterationTypes = getIterationTypesOfIterable(contextualReturnType, use, undefined);
61181
- if (!iterationTypes) {
61211
+ var isAsyncGenerator_1 = (functionFlags & 2) !== 0;
61212
+ if (contextualReturnType.flags & 1048576) {
61213
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1, type, isAsyncGenerator_1); });
61214
+ }
61215
+ var iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1, contextualReturnType, (functionFlags & 2) !== 0);
61216
+ if (!iterationReturnType) {
61182
61217
  return undefined;
61183
61218
  }
61184
- contextualReturnType = iterationTypes.returnType;
61219
+ contextualReturnType = iterationReturnType;
61185
61220
  }
61186
61221
  if (functionFlags & 2) {
61187
61222
  var contextualAwaitedType = mapType(contextualReturnType, getAwaitedTypeNoAlias);
@@ -61206,9 +61241,13 @@ var ts;
61206
61241
  var functionFlags = ts.getFunctionFlags(func);
61207
61242
  var contextualReturnType = getContextualReturnType(func, contextFlags);
61208
61243
  if (contextualReturnType) {
61244
+ var isAsyncGenerator_2 = (functionFlags & 2) !== 0;
61245
+ if (!node.asteriskToken && contextualReturnType.flags & 1048576) {
61246
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1, type, isAsyncGenerator_2); });
61247
+ }
61209
61248
  return node.asteriskToken
61210
61249
  ? contextualReturnType
61211
- : getIterationTypeOfGeneratorFunctionReturnType(0, contextualReturnType, (functionFlags & 2) !== 0);
61250
+ : getIterationTypeOfGeneratorFunctionReturnType(0, contextualReturnType, isAsyncGenerator_2);
61212
61251
  }
61213
61252
  }
61214
61253
  return undefined;
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = ts.versionMajorMinor + ".0-dev.20220804";
112
+ ts.version = ts.versionMajorMinor + ".0-dev.20220807";
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -8576,7 +8576,7 @@ var ts;
8576
8576
  File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
8577
8577
  File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
8578
8578
  The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
8579
- Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
8579
+ Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead."),
8580
8580
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
8581
8581
  An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
8582
8582
  An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
@@ -8584,6 +8584,11 @@ var ts;
8584
8584
  auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
8585
8585
  An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
8586
8586
  Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
8587
+ The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead: diag(1479, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479", "The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"{0}\")' call instead."),
8588
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module: diag(1480, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480", "To convert this file to an ECMAScript module, change its file extension to '{0}' or create a local package.json file with `{ \"type\": \"module\" }`."),
8589
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1: diag(1481, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481", "To convert this file to an ECMAScript module, change its file extension to '{0}', or add the field `\"type\": \"module\"` to '{1}'."),
8590
+ To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0: diag(1482, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482", "To convert this file to an ECMAScript module, add the field `\"type\": \"module\"` to '{0}'."),
8591
+ To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", "To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`."),
8587
8592
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
8588
8593
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
8589
8594
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -51693,7 +51698,40 @@ var ts;
51693
51698
  // An override clause will take effect for type-only imports and import types, and allows importing the types across formats, regardless of
51694
51699
  // normal mode restrictions
51695
51700
  if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
51696
- error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
51701
+ if (ts.findAncestor(location, ts.isImportEqualsDeclaration)) {
51702
+ // ImportEquals in a ESM file resolving to another ESM file
51703
+ error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
51704
+ }
51705
+ else {
51706
+ // CJS file resolving to an ESM file
51707
+ var diagnosticDetails = void 0;
51708
+ var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
51709
+ if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
51710
+ var scope = currentSourceFile.packageJsonScope;
51711
+ var targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : undefined;
51712
+ if (scope && !scope.packageJsonContent.type) {
51713
+ if (targetExt) {
51714
+ diagnosticDetails = ts.chainDiagnosticMessages(
51715
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json"));
51716
+ }
51717
+ else {
51718
+ diagnosticDetails = ts.chainDiagnosticMessages(
51719
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0, ts.combinePaths(scope.packageDirectory, "package.json"));
51720
+ }
51721
+ }
51722
+ else {
51723
+ if (targetExt) {
51724
+ diagnosticDetails = ts.chainDiagnosticMessages(
51725
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module, targetExt);
51726
+ }
51727
+ else {
51728
+ diagnosticDetails = ts.chainDiagnosticMessages(
51729
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module);
51730
+ }
51731
+ }
51732
+ }
51733
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, ts.chainDiagnosticMessages(diagnosticDetails, ts.Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead, moduleReference)));
51734
+ }
51697
51735
  }
51698
51736
  }
51699
51737
  // merged symbol is module declaration symbol combined with all augmentations
@@ -73201,12 +73239,15 @@ var ts;
73201
73239
  if (contextualReturnType) {
73202
73240
  var functionFlags = ts.getFunctionFlags(func);
73203
73241
  if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
73204
- var use = functionFlags & 2 /* Async */ ? 2 /* AsyncGeneratorReturnType */ : 1 /* GeneratorReturnType */;
73205
- var iterationTypes = getIterationTypesOfIterable(contextualReturnType, use, /*errorNode*/ undefined);
73206
- if (!iterationTypes) {
73242
+ var isAsyncGenerator_1 = (functionFlags & 2 /* Async */) !== 0;
73243
+ if (contextualReturnType.flags & 1048576 /* Union */) {
73244
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_1); });
73245
+ }
73246
+ var iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
73247
+ if (!iterationReturnType) {
73207
73248
  return undefined;
73208
73249
  }
73209
- contextualReturnType = iterationTypes.returnType;
73250
+ contextualReturnType = iterationReturnType;
73210
73251
  // falls through to unwrap Promise for AsyncGenerators
73211
73252
  }
73212
73253
  if (functionFlags & 2 /* Async */) { // Async function or AsyncGenerator function
@@ -73233,9 +73274,13 @@ var ts;
73233
73274
  var functionFlags = ts.getFunctionFlags(func);
73234
73275
  var contextualReturnType = getContextualReturnType(func, contextFlags);
73235
73276
  if (contextualReturnType) {
73277
+ var isAsyncGenerator_2 = (functionFlags & 2 /* Async */) !== 0;
73278
+ if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
73279
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_2); });
73280
+ }
73236
73281
  return node.asteriskToken
73237
73282
  ? contextualReturnType
73238
- : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
73283
+ : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator_2);
73239
73284
  }
73240
73285
  }
73241
73286
  return undefined;
@@ -156635,7 +156680,7 @@ var ts;
156635
156680
  return undefined;
156636
156681
  return { kind: 4 /* JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent };
156637
156682
  }
156638
- if (ts.isIdentifier(token) && ts.isCallExpression(parent)) {
156683
+ if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) {
156639
156684
  return { kind: 2 /* Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: sourceFile };
156640
156685
  }
156641
156686
  if (!ts.isPropertyAccessExpression(parent))
@@ -303,7 +303,7 @@ var ts;
303
303
  // The following is baselined as a literal template type without intervention
304
304
  /** The version of the TypeScript compiler release */
305
305
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
306
- ts.version = ts.versionMajorMinor + ".0-dev.20220804";
306
+ ts.version = ts.versionMajorMinor + ".0-dev.20220807";
307
307
  /* @internal */
308
308
  var Comparison;
309
309
  (function (Comparison) {
@@ -8770,7 +8770,7 @@ var ts;
8770
8770
  File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
8771
8771
  File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
8772
8772
  The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
8773
- Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
8773
+ Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead."),
8774
8774
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
8775
8775
  An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
8776
8776
  An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
@@ -8778,6 +8778,11 @@ var ts;
8778
8778
  auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
8779
8779
  An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
8780
8780
  Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
8781
+ The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead: diag(1479, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479", "The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"{0}\")' call instead."),
8782
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module: diag(1480, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480", "To convert this file to an ECMAScript module, change its file extension to '{0}' or create a local package.json file with `{ \"type\": \"module\" }`."),
8783
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1: diag(1481, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481", "To convert this file to an ECMAScript module, change its file extension to '{0}', or add the field `\"type\": \"module\"` to '{1}'."),
8784
+ To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0: diag(1482, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482", "To convert this file to an ECMAScript module, add the field `\"type\": \"module\"` to '{0}'."),
8785
+ To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", "To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`."),
8781
8786
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
8782
8787
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
8783
8788
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -51887,7 +51892,40 @@ var ts;
51887
51892
  // An override clause will take effect for type-only imports and import types, and allows importing the types across formats, regardless of
51888
51893
  // normal mode restrictions
51889
51894
  if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
51890
- error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
51895
+ if (ts.findAncestor(location, ts.isImportEqualsDeclaration)) {
51896
+ // ImportEquals in a ESM file resolving to another ESM file
51897
+ error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
51898
+ }
51899
+ else {
51900
+ // CJS file resolving to an ESM file
51901
+ var diagnosticDetails = void 0;
51902
+ var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
51903
+ if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
51904
+ var scope = currentSourceFile.packageJsonScope;
51905
+ var targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : undefined;
51906
+ if (scope && !scope.packageJsonContent.type) {
51907
+ if (targetExt) {
51908
+ diagnosticDetails = ts.chainDiagnosticMessages(
51909
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json"));
51910
+ }
51911
+ else {
51912
+ diagnosticDetails = ts.chainDiagnosticMessages(
51913
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0, ts.combinePaths(scope.packageDirectory, "package.json"));
51914
+ }
51915
+ }
51916
+ else {
51917
+ if (targetExt) {
51918
+ diagnosticDetails = ts.chainDiagnosticMessages(
51919
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module, targetExt);
51920
+ }
51921
+ else {
51922
+ diagnosticDetails = ts.chainDiagnosticMessages(
51923
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module);
51924
+ }
51925
+ }
51926
+ }
51927
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, ts.chainDiagnosticMessages(diagnosticDetails, ts.Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead, moduleReference)));
51928
+ }
51891
51929
  }
51892
51930
  }
51893
51931
  // merged symbol is module declaration symbol combined with all augmentations
@@ -73395,12 +73433,15 @@ var ts;
73395
73433
  if (contextualReturnType) {
73396
73434
  var functionFlags = ts.getFunctionFlags(func);
73397
73435
  if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
73398
- var use = functionFlags & 2 /* Async */ ? 2 /* AsyncGeneratorReturnType */ : 1 /* GeneratorReturnType */;
73399
- var iterationTypes = getIterationTypesOfIterable(contextualReturnType, use, /*errorNode*/ undefined);
73400
- if (!iterationTypes) {
73436
+ var isAsyncGenerator_1 = (functionFlags & 2 /* Async */) !== 0;
73437
+ if (contextualReturnType.flags & 1048576 /* Union */) {
73438
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_1); });
73439
+ }
73440
+ var iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
73441
+ if (!iterationReturnType) {
73401
73442
  return undefined;
73402
73443
  }
73403
- contextualReturnType = iterationTypes.returnType;
73444
+ contextualReturnType = iterationReturnType;
73404
73445
  // falls through to unwrap Promise for AsyncGenerators
73405
73446
  }
73406
73447
  if (functionFlags & 2 /* Async */) { // Async function or AsyncGenerator function
@@ -73427,9 +73468,13 @@ var ts;
73427
73468
  var functionFlags = ts.getFunctionFlags(func);
73428
73469
  var contextualReturnType = getContextualReturnType(func, contextFlags);
73429
73470
  if (contextualReturnType) {
73471
+ var isAsyncGenerator_2 = (functionFlags & 2 /* Async */) !== 0;
73472
+ if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
73473
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_2); });
73474
+ }
73430
73475
  return node.asteriskToken
73431
73476
  ? contextualReturnType
73432
- : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
73477
+ : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator_2);
73433
73478
  }
73434
73479
  }
73435
73480
  return undefined;
@@ -157248,7 +157293,7 @@ var ts;
157248
157293
  return undefined;
157249
157294
  return { kind: 4 /* JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent };
157250
157295
  }
157251
- if (ts.isIdentifier(token) && ts.isCallExpression(parent)) {
157296
+ if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) {
157252
157297
  return { kind: 2 /* Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: sourceFile };
157253
157298
  }
157254
157299
  if (!ts.isPropertyAccessExpression(parent))
package/lib/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220804";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220807";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8761,7 +8761,7 @@ var ts;
8761
8761
  File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
8762
8762
  File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
8763
8763
  The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
8764
- Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
8764
+ Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead."),
8765
8765
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
8766
8766
  An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
8767
8767
  An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
@@ -8769,6 +8769,11 @@ var ts;
8769
8769
  auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
8770
8770
  An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
8771
8771
  Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
8772
+ The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead: diag(1479, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479", "The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"{0}\")' call instead."),
8773
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module: diag(1480, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480", "To convert this file to an ECMAScript module, change its file extension to '{0}' or create a local package.json file with `{ \"type\": \"module\" }`."),
8774
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1: diag(1481, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481", "To convert this file to an ECMAScript module, change its file extension to '{0}', or add the field `\"type\": \"module\"` to '{1}'."),
8775
+ To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0: diag(1482, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482", "To convert this file to an ECMAScript module, add the field `\"type\": \"module\"` to '{0}'."),
8776
+ To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", "To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`."),
8772
8777
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
8773
8778
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
8774
8779
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -51878,7 +51883,40 @@ var ts;
51878
51883
  // An override clause will take effect for type-only imports and import types, and allows importing the types across formats, regardless of
51879
51884
  // normal mode restrictions
51880
51885
  if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
51881
- error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
51886
+ if (ts.findAncestor(location, ts.isImportEqualsDeclaration)) {
51887
+ // ImportEquals in a ESM file resolving to another ESM file
51888
+ error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
51889
+ }
51890
+ else {
51891
+ // CJS file resolving to an ESM file
51892
+ var diagnosticDetails = void 0;
51893
+ var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
51894
+ if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
51895
+ var scope = currentSourceFile.packageJsonScope;
51896
+ var targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : undefined;
51897
+ if (scope && !scope.packageJsonContent.type) {
51898
+ if (targetExt) {
51899
+ diagnosticDetails = ts.chainDiagnosticMessages(
51900
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json"));
51901
+ }
51902
+ else {
51903
+ diagnosticDetails = ts.chainDiagnosticMessages(
51904
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0, ts.combinePaths(scope.packageDirectory, "package.json"));
51905
+ }
51906
+ }
51907
+ else {
51908
+ if (targetExt) {
51909
+ diagnosticDetails = ts.chainDiagnosticMessages(
51910
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module, targetExt);
51911
+ }
51912
+ else {
51913
+ diagnosticDetails = ts.chainDiagnosticMessages(
51914
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module);
51915
+ }
51916
+ }
51917
+ }
51918
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, ts.chainDiagnosticMessages(diagnosticDetails, ts.Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead, moduleReference)));
51919
+ }
51882
51920
  }
51883
51921
  }
51884
51922
  // merged symbol is module declaration symbol combined with all augmentations
@@ -73386,12 +73424,15 @@ var ts;
73386
73424
  if (contextualReturnType) {
73387
73425
  var functionFlags = ts.getFunctionFlags(func);
73388
73426
  if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
73389
- var use = functionFlags & 2 /* Async */ ? 2 /* AsyncGeneratorReturnType */ : 1 /* GeneratorReturnType */;
73390
- var iterationTypes = getIterationTypesOfIterable(contextualReturnType, use, /*errorNode*/ undefined);
73391
- if (!iterationTypes) {
73427
+ var isAsyncGenerator_1 = (functionFlags & 2 /* Async */) !== 0;
73428
+ if (contextualReturnType.flags & 1048576 /* Union */) {
73429
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_1); });
73430
+ }
73431
+ var iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
73432
+ if (!iterationReturnType) {
73392
73433
  return undefined;
73393
73434
  }
73394
- contextualReturnType = iterationTypes.returnType;
73435
+ contextualReturnType = iterationReturnType;
73395
73436
  // falls through to unwrap Promise for AsyncGenerators
73396
73437
  }
73397
73438
  if (functionFlags & 2 /* Async */) { // Async function or AsyncGenerator function
@@ -73418,9 +73459,13 @@ var ts;
73418
73459
  var functionFlags = ts.getFunctionFlags(func);
73419
73460
  var contextualReturnType = getContextualReturnType(func, contextFlags);
73420
73461
  if (contextualReturnType) {
73462
+ var isAsyncGenerator_2 = (functionFlags & 2 /* Async */) !== 0;
73463
+ if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
73464
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_2); });
73465
+ }
73421
73466
  return node.asteriskToken
73422
73467
  ? contextualReturnType
73423
- : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
73468
+ : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator_2);
73424
73469
  }
73425
73470
  }
73426
73471
  return undefined;
@@ -157239,7 +157284,7 @@ var ts;
157239
157284
  return undefined;
157240
157285
  return { kind: 4 /* JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent };
157241
157286
  }
157242
- if (ts.isIdentifier(token) && ts.isCallExpression(parent)) {
157287
+ if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) {
157243
157288
  return { kind: 2 /* Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: sourceFile };
157244
157289
  }
157245
157290
  if (!ts.isPropertyAccessExpression(parent))
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220804";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220807";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8761,7 +8761,7 @@ var ts;
8761
8761
  File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
8762
8762
  File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
8763
8763
  The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
8764
- Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
8764
+ Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead."),
8765
8765
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
8766
8766
  An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
8767
8767
  An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
@@ -8769,6 +8769,11 @@ var ts;
8769
8769
  auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
8770
8770
  An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
8771
8771
  Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
8772
+ The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead: diag(1479, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479", "The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"{0}\")' call instead."),
8773
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module: diag(1480, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480", "To convert this file to an ECMAScript module, change its file extension to '{0}' or create a local package.json file with `{ \"type\": \"module\" }`."),
8774
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1: diag(1481, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481", "To convert this file to an ECMAScript module, change its file extension to '{0}', or add the field `\"type\": \"module\"` to '{1}'."),
8775
+ To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0: diag(1482, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482", "To convert this file to an ECMAScript module, add the field `\"type\": \"module\"` to '{0}'."),
8776
+ To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", "To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`."),
8772
8777
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
8773
8778
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
8774
8779
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -51878,7 +51883,40 @@ var ts;
51878
51883
  // An override clause will take effect for type-only imports and import types, and allows importing the types across formats, regardless of
51879
51884
  // normal mode restrictions
51880
51885
  if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
51881
- error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
51886
+ if (ts.findAncestor(location, ts.isImportEqualsDeclaration)) {
51887
+ // ImportEquals in a ESM file resolving to another ESM file
51888
+ error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
51889
+ }
51890
+ else {
51891
+ // CJS file resolving to an ESM file
51892
+ var diagnosticDetails = void 0;
51893
+ var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
51894
+ if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
51895
+ var scope = currentSourceFile.packageJsonScope;
51896
+ var targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : undefined;
51897
+ if (scope && !scope.packageJsonContent.type) {
51898
+ if (targetExt) {
51899
+ diagnosticDetails = ts.chainDiagnosticMessages(
51900
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json"));
51901
+ }
51902
+ else {
51903
+ diagnosticDetails = ts.chainDiagnosticMessages(
51904
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0, ts.combinePaths(scope.packageDirectory, "package.json"));
51905
+ }
51906
+ }
51907
+ else {
51908
+ if (targetExt) {
51909
+ diagnosticDetails = ts.chainDiagnosticMessages(
51910
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module, targetExt);
51911
+ }
51912
+ else {
51913
+ diagnosticDetails = ts.chainDiagnosticMessages(
51914
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module);
51915
+ }
51916
+ }
51917
+ }
51918
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, ts.chainDiagnosticMessages(diagnosticDetails, ts.Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead, moduleReference)));
51919
+ }
51882
51920
  }
51883
51921
  }
51884
51922
  // merged symbol is module declaration symbol combined with all augmentations
@@ -73386,12 +73424,15 @@ var ts;
73386
73424
  if (contextualReturnType) {
73387
73425
  var functionFlags = ts.getFunctionFlags(func);
73388
73426
  if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
73389
- var use = functionFlags & 2 /* Async */ ? 2 /* AsyncGeneratorReturnType */ : 1 /* GeneratorReturnType */;
73390
- var iterationTypes = getIterationTypesOfIterable(contextualReturnType, use, /*errorNode*/ undefined);
73391
- if (!iterationTypes) {
73427
+ var isAsyncGenerator_1 = (functionFlags & 2 /* Async */) !== 0;
73428
+ if (contextualReturnType.flags & 1048576 /* Union */) {
73429
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_1); });
73430
+ }
73431
+ var iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
73432
+ if (!iterationReturnType) {
73392
73433
  return undefined;
73393
73434
  }
73394
- contextualReturnType = iterationTypes.returnType;
73435
+ contextualReturnType = iterationReturnType;
73395
73436
  // falls through to unwrap Promise for AsyncGenerators
73396
73437
  }
73397
73438
  if (functionFlags & 2 /* Async */) { // Async function or AsyncGenerator function
@@ -73418,9 +73459,13 @@ var ts;
73418
73459
  var functionFlags = ts.getFunctionFlags(func);
73419
73460
  var contextualReturnType = getContextualReturnType(func, contextFlags);
73420
73461
  if (contextualReturnType) {
73462
+ var isAsyncGenerator_2 = (functionFlags & 2 /* Async */) !== 0;
73463
+ if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
73464
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_2); });
73465
+ }
73421
73466
  return node.asteriskToken
73422
73467
  ? contextualReturnType
73423
- : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
73468
+ : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator_2);
73424
73469
  }
73425
73470
  }
73426
73471
  return undefined;
@@ -157239,7 +157284,7 @@ var ts;
157239
157284
  return undefined;
157240
157285
  return { kind: 4 /* JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent };
157241
157286
  }
157242
- if (ts.isIdentifier(token) && ts.isCallExpression(parent)) {
157287
+ if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) {
157243
157288
  return { kind: 2 /* Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: sourceFile };
157244
157289
  }
157245
157290
  if (!ts.isPropertyAccessExpression(parent))
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220804";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220807";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -8556,7 +8556,7 @@ var ts;
8556
8556
  File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
8557
8557
  File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
8558
8558
  The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
8559
- Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
8559
+ Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead."),
8560
8560
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
8561
8561
  An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
8562
8562
  An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
@@ -8564,6 +8564,11 @@ var ts;
8564
8564
  auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
8565
8565
  An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
8566
8566
  Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
8567
+ The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead: diag(1479, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479", "The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"{0}\")' call instead."),
8568
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module: diag(1480, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480", "To convert this file to an ECMAScript module, change its file extension to '{0}' or create a local package.json file with `{ \"type\": \"module\" }`."),
8569
+ To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1: diag(1481, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481", "To convert this file to an ECMAScript module, change its file extension to '{0}', or add the field `\"type\": \"module\"` to '{1}'."),
8570
+ To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0: diag(1482, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482", "To convert this file to an ECMAScript module, add the field `\"type\": \"module\"` to '{0}'."),
8571
+ To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", "To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`."),
8567
8572
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
8568
8573
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
8569
8574
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -51673,7 +51678,40 @@ var ts;
51673
51678
  // An override clause will take effect for type-only imports and import types, and allows importing the types across formats, regardless of
51674
51679
  // normal mode restrictions
51675
51680
  if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
51676
- error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
51681
+ if (ts.findAncestor(location, ts.isImportEqualsDeclaration)) {
51682
+ // ImportEquals in a ESM file resolving to another ESM file
51683
+ error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
51684
+ }
51685
+ else {
51686
+ // CJS file resolving to an ESM file
51687
+ var diagnosticDetails = void 0;
51688
+ var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
51689
+ if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
51690
+ var scope = currentSourceFile.packageJsonScope;
51691
+ var targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : undefined;
51692
+ if (scope && !scope.packageJsonContent.type) {
51693
+ if (targetExt) {
51694
+ diagnosticDetails = ts.chainDiagnosticMessages(
51695
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json"));
51696
+ }
51697
+ else {
51698
+ diagnosticDetails = ts.chainDiagnosticMessages(
51699
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0, ts.combinePaths(scope.packageDirectory, "package.json"));
51700
+ }
51701
+ }
51702
+ else {
51703
+ if (targetExt) {
51704
+ diagnosticDetails = ts.chainDiagnosticMessages(
51705
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module, targetExt);
51706
+ }
51707
+ else {
51708
+ diagnosticDetails = ts.chainDiagnosticMessages(
51709
+ /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module);
51710
+ }
51711
+ }
51712
+ }
51713
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, ts.chainDiagnosticMessages(diagnosticDetails, ts.Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead, moduleReference)));
51714
+ }
51677
51715
  }
51678
51716
  }
51679
51717
  // merged symbol is module declaration symbol combined with all augmentations
@@ -73181,12 +73219,15 @@ var ts;
73181
73219
  if (contextualReturnType) {
73182
73220
  var functionFlags = ts.getFunctionFlags(func);
73183
73221
  if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
73184
- var use = functionFlags & 2 /* Async */ ? 2 /* AsyncGeneratorReturnType */ : 1 /* GeneratorReturnType */;
73185
- var iterationTypes = getIterationTypesOfIterable(contextualReturnType, use, /*errorNode*/ undefined);
73186
- if (!iterationTypes) {
73222
+ var isAsyncGenerator_1 = (functionFlags & 2 /* Async */) !== 0;
73223
+ if (contextualReturnType.flags & 1048576 /* Union */) {
73224
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_1); });
73225
+ }
73226
+ var iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
73227
+ if (!iterationReturnType) {
73187
73228
  return undefined;
73188
73229
  }
73189
- contextualReturnType = iterationTypes.returnType;
73230
+ contextualReturnType = iterationReturnType;
73190
73231
  // falls through to unwrap Promise for AsyncGenerators
73191
73232
  }
73192
73233
  if (functionFlags & 2 /* Async */) { // Async function or AsyncGenerator function
@@ -73213,9 +73254,13 @@ var ts;
73213
73254
  var functionFlags = ts.getFunctionFlags(func);
73214
73255
  var contextualReturnType = getContextualReturnType(func, contextFlags);
73215
73256
  if (contextualReturnType) {
73257
+ var isAsyncGenerator_2 = (functionFlags & 2 /* Async */) !== 0;
73258
+ if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
73259
+ contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_2); });
73260
+ }
73216
73261
  return node.asteriskToken
73217
73262
  ? contextualReturnType
73218
- : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
73263
+ : getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator_2);
73219
73264
  }
73220
73265
  }
73221
73266
  return undefined;
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "找不到文件“{0}”。",
703
703
  "File_Management_6245": "文件管理",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "检测到文件更改。正在启动增量编译...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "文件是 CommonJS 模块,因为“{0}”没有字段 “type”",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "文件是 CommonJS 模块,因为“{0}”具有值不是 “module” 的字段 “type”",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "文件是 CommonJS 模块,因为找不到 “package.json”",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "文件是 ECMAScript 模块,因为“{0}”具有值为 “module” 的字段 “type”",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "文件是 CommonJS 模块; 它可能会转换为 ES 模块。",
706
710
  "File_is_default_library_for_target_specified_here_1426": "文件是此处指定的目标的默认库。",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "文件是此处指定的类型库的入口点。",
@@ -702,6 +702,10 @@
702
702
  "File_0_not_found_6053": "找不到檔案 '{0}'。",
703
703
  "File_Management_6245": "檔案管理",
704
704
  "File_change_detected_Starting_incremental_compilation_6032": "偵測到檔案變更。正在啟動累加編譯...",
705
+ "File_is_CommonJS_module_because_0_does_not_have_field_type_1460": "檔案是 CommonJS 模組,因為 '{0}' 沒有 \"type\" 欄位",
706
+ "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459": "檔案是 CommonJS 模組,因為 '{0}' 具有值不是 \"module\" 的 \"type\" 欄位",
707
+ "File_is_CommonJS_module_because_package_json_was_not_found_1461": "檔案是 CommonJS 模組,因為找不到 'package.json'",
708
+ "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458": "檔案是 ECMAScript 模組,因為 '{0}' 具有值不是 \"module\" 的 \"type\" 欄位",
705
709
  "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "檔案為 CommonJS 模組; 其可轉換為 ES 模組。",
706
710
  "File_is_default_library_for_target_specified_here_1426": "檔案是此處指定目標的預設程式庫。",
707
711
  "File_is_entry_point_of_type_library_specified_here_1419": "檔案是此處指定型別程式庫的進入點。",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.8.0-dev.20220804",
5
+ "version": "4.8.0-dev.20220807",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [