diff --git a/lib/it/diagnosticMessages.generated.json b/lib/it/diagnosticMessages.generated.json
index 9f8ef7d48f4..51981810ba2 100644
--- a/lib/it/diagnosticMessages.generated.json
+++ b/lib/it/diagnosticMessages.generated.json
@@ -355,7 +355,7 @@
"Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017": "L'elemento contiene implicitamente un tipo 'any' perché al tipo '{0}' non è assegnata alcuna firma dell'indice.",
"Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164": "Crea un BOM (Byte Order Mark) UTF-8 all'inizio dei file di output.",
"Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Crea un unico file con i mapping di origine invece di file separati.",
- "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Crea l'origine unitamente alle mappe di origine all'interno di un unico file. Richiede l'impostazione di '--inlineSourceMap' o '--sourceMap'.",
+ "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Crea l'origine unitamente ai mapping di origine all'interno di un unico file. Richiede l'impostazione di '--inlineSourceMap' o '--sourceMap'.",
"Enable_all_strict_type_checking_options_6180": "Abilita tutte le opzioni per i controlli del tipo strict.",
"Enable_project_compilation_6302": "Abilitare la compilazione dei progetti",
"Enable_strict_checking_of_function_types_6186": "Abilita il controllo tassativo dei tipi funzione.",
@@ -445,7 +445,7 @@
"Function_overload_must_be_static_2387": "L'overload della funzione deve essere statico.",
"Function_overload_must_not_be_static_2388": "L'overload della funzione non deve essere statico.",
"Generate_get_and_set_accessors_95046": "Generare le funzioni di accesso 'get' e 'set'",
- "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Genera un sourcemap per ogni file '.d.ts' corrispondente.",
+ "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Genera un mapping di origine per ogni file '.d.ts' corrispondente.",
"Generates_corresponding_d_ts_file_6002": "Genera il file '.d.ts' corrispondente.",
"Generates_corresponding_map_file_6043": "Genera il file '.map' corrispondente.",
"Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Il tipo del generatore è implicitamente '{0}' perché non contiene alcun valore. Provare a specificare un tipo restituito.",
diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts
index 1c6feca6e61..48637e9de17 100644
--- a/lib/lib.es5.d.ts
+++ b/lib/lib.es5.d.ts
@@ -32,7 +32,7 @@ declare var Infinity: number;
declare function eval(x: string): any;
/**
- * Converts A string to an integer.
+ * Converts a string to an integer.
* @param s A string to convert into a number.
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
diff --git a/lib/ru/diagnosticMessages.generated.json b/lib/ru/diagnosticMessages.generated.json
index 90d11ced277..468fd47b888 100644
--- a/lib/ru/diagnosticMessages.generated.json
+++ b/lib/ru/diagnosticMessages.generated.json
@@ -355,7 +355,7 @@
"Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017": "Элемент неявно имеет тип any, так как тип \"{0}\" не содержит сигнатуру индекса.",
"Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164": "Порождать метку порядка байтов UTF-8 в начале выходных файлов.",
"Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151": "Порождать один файл с сопоставлениями источников, а не создавать отдельный файл.",
- "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Порождать источник вместе с sourcemap в одном файле (нужно задать параметр --inlineSourceMap или --sourceMap).",
+ "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152": "Порождать источник вместе с сопоставителями с исходным кодом в одном файле (нужно задать параметр --inlineSourceMap или --sourceMap).",
"Enable_all_strict_type_checking_options_6180": "Включить все параметры строгой проверки типов.",
"Enable_project_compilation_6302": "Включить компиляцию проекта",
"Enable_strict_checking_of_function_types_6186": "Включение строгой проверки типов функций.",
@@ -445,7 +445,7 @@
"Function_overload_must_be_static_2387": "Перегрузка функции должна быть статической.",
"Function_overload_must_not_be_static_2388": "Перегрузка функции не должна быть статической.",
"Generate_get_and_set_accessors_95046": "Создать методы доступа get и set",
- "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Создает sourcemap для каждого соответствующего файла \".d.ts\".",
+ "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000": "Создает сопоставитель с исходным кодом для каждого соответствующего файла \".d.ts\".",
"Generates_corresponding_d_ts_file_6002": "Создает соответствующий D.TS-файл.",
"Generates_corresponding_map_file_6043": "Создает соответствующий файл с расширением \".map\".",
"Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025": "Генератор неявно имеет тип \"{0}\", поскольку он не предоставляет никаких значений. Рекомендуется указать тип возвращаемого значения.",
diff --git a/lib/tsc.js b/lib/tsc.js
index 8dc544f67ea..510ceb2b17a 100644
--- a/lib/tsc.js
+++ b/lib/tsc.js
@@ -67,7 +67,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
var ts;
(function (ts) {
ts.versionMajorMinor = "3.6";
- ts.version = ts.versionMajorMinor + ".0-beta";
+ ts.version = ts.versionMajorMinor + ".1-rc";
})(ts || (ts = {}));
(function (ts) {
ts.emptyArray = [];
@@ -1054,6 +1054,18 @@ var ts;
return keys;
}
ts.getOwnKeys = getOwnKeys;
+ function getAllKeys(obj) {
+ var result = [];
+ do {
+ var names = Object.getOwnPropertyNames(obj);
+ for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
+ var name = names_1[_i];
+ pushIfUnique(result, name);
+ }
+ } while (obj = Object.getPrototypeOf(obj));
+ return result;
+ }
+ ts.getAllKeys = getAllKeys;
function getOwnValues(sparseArray) {
var values = [];
for (var key in sparseArray) {
@@ -2016,6 +2028,40 @@ var ts;
})(performance = ts.performance || (ts.performance = {}));
})(ts || (ts = {}));
var ts;
+(function (ts) {
+ var nullLogger = {
+ logEvent: ts.noop,
+ logErrEvent: ts.noop,
+ logPerfEvent: ts.noop,
+ logInfoEvent: ts.noop,
+ logStartCommand: ts.noop,
+ logStopCommand: ts.noop,
+ logStartUpdateProgram: ts.noop,
+ logStopUpdateProgram: ts.noop,
+ logStartUpdateGraph: ts.noop,
+ logStopUpdateGraph: ts.noop,
+ logStartResolveModule: ts.noop,
+ logStopResolveModule: ts.noop,
+ logStartParseSourceFile: ts.noop,
+ logStopParseSourceFile: ts.noop,
+ logStartReadFile: ts.noop,
+ logStopReadFile: ts.noop,
+ logStartBindFile: ts.noop,
+ logStopBindFile: ts.noop,
+ logStartScheduledOperation: ts.noop,
+ logStopScheduledOperation: ts.noop,
+ };
+ var etwModule;
+ try {
+ etwModule = require("@microsoft/typescript-etw");
+ }
+ catch (e) {
+ etwModule = undefined;
+ }
+ ts.perfLogger = etwModule ? etwModule : nullLogger;
+ ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
+})(ts || (ts = {}));
+var ts;
(function (ts) {
var versionRegExp = /^(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i;
@@ -2352,7 +2398,7 @@ var ts;
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
ModuleKind[ModuleKind["System"] = 4] = "System";
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
- ModuleKind[ModuleKind["ESNext"] = 6] = "ESNext";
+ ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
ts.commentPragmas = {
"reference": {
@@ -2602,6 +2648,37 @@ var ts;
}
}
ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
+ function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
+ var cache = ts.createMap();
+ var callbacksCache = ts.createMultiMap();
+ var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
+ return function (fileName, callback, pollingInterval) {
+ var path = toCanonicalFileName(fileName);
+ var existing = cache.get(path);
+ if (existing) {
+ existing.refCount++;
+ }
+ else {
+ cache.set(path, {
+ watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval),
+ refCount: 1
+ });
+ }
+ callbacksCache.add(path, callback);
+ return {
+ close: function () {
+ var watcher = ts.Debug.assertDefined(cache.get(path));
+ callbacksCache.remove(path, callback);
+ watcher.refCount--;
+ if (watcher.refCount)
+ return;
+ cache.delete(path);
+ ts.closeFileWatcherOf(watcher);
+ }
+ };
+ };
+ }
+ ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
function onWatchedFileStat(watchedFile, modifiedTime) {
var oldTime = watchedFile.mtime.getTime();
var newTime = modifiedTime.getTime();
@@ -2622,6 +2699,7 @@ var ts;
}
ts.getFileWatcherEventKind = getFileWatcherEventKind;
ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
+ ts.sysLog = ts.noop;
function createRecursiveDirectoryWatcher(host) {
var cache = ts.createMap();
var callbackCache = ts.createMultiMap();
@@ -2734,11 +2812,13 @@ var ts;
var Buffer = require("buffer").Buffer;
var nodeVersion = getNodeMajorVersion();
var isNode4OrLater = nodeVersion >= 4;
+ var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
var platform = _os.platform();
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
var useNonPollingWatchers = process.env.TSC_NONPOLLING_WATCHER;
var tscWatchFile = process.env.TSC_WATCHFILE;
var tscWatchDirectory = process.env.TSC_WATCHDIRECTORY;
+ var fsWatchFile = createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames);
var dynamicPollingWatchFile;
var nodeSystem = {
args: process.argv.slice(2),
@@ -2861,7 +2941,7 @@ var ts;
}
return useNonPollingWatchers ?
createNonPollingWatchFile() :
- function (fileName, callback) { return fsWatchFile(fileName, callback); };
+ function (fileName, callback) { return fsWatchFile(fileName, callback, undefined); };
}
function getWatchDirectory() {
var fsSupportsRecursive = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
@@ -2930,7 +3010,7 @@ var ts;
return watcher;
}
}
- function fsWatchFile(fileName, callback, pollingInterval) {
+ function fsWatchFileWorker(fileName, callback, pollingInterval) {
_fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
var eventKind;
return {
@@ -2978,6 +3058,12 @@ var ts;
}
function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingWatchFile, pollingInterval) {
var options;
+ var lastDirectoryPartWithDirectorySeparator;
+ var lastDirectoryPart;
+ if (isLinuxOrMacOs) {
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
+ }
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
watchMissingFileSystemEntry() :
watchPresentFileSystemEntry();
@@ -2988,6 +3074,7 @@ var ts;
}
};
function invokeCallbackAndUpdateWatcher(createWatcher) {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
callback("rename", "");
if (watcher) {
watcher.close();
@@ -3004,7 +3091,9 @@ var ts;
}
}
try {
- var presentWatcher = _fs.watch(fileOrDirectory, options, callback);
+ var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
+ callbackChangingToMissingFileSystemEntry :
+ callback);
presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
return presentWatcher;
}
@@ -3012,7 +3101,17 @@ var ts;
return watchPresentFileSystemEntryWithFsWatchFile();
}
}
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
+ return event === "rename" &&
+ (!relativeName ||
+ relativeName === lastDirectoryPart ||
+ relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length) &&
+ !fileSystemEntryExists(fileOrDirectory, entryKind) ?
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
+ callback(event, relativeName);
+ }
function watchPresentFileSystemEntryWithFsWatchFile() {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
return fallbackPollingWatchFile(fileOrDirectory, createFileWatcherCallback(callback), pollingInterval);
}
function watchMissingFileSystemEntry() {
@@ -3038,7 +3137,7 @@ var ts;
function createWatchDirectoryUsing(fsWatchFile) {
return function (directoryName, callback) { return fsWatchFile(directoryName, function () { return callback(directoryName); }, PollingInterval.Medium); };
}
- function readFile(fileName, _encoding) {
+ function readFileWorker(fileName, _encoding) {
if (!fileExists(fileName)) {
return undefined;
}
@@ -3061,7 +3160,14 @@ var ts;
}
return buffer.toString("utf8");
}
+ function readFile(fileName, _encoding) {
+ ts.perfLogger.logStartReadFile(fileName);
+ var file = readFileWorker(fileName, _encoding);
+ ts.perfLogger.logStopReadFile();
+ return file;
+ }
function writeFile(fileName, data, writeByteOrderMark) {
+ ts.perfLogger.logEvent("WriteFile: " + fileName);
if (writeByteOrderMark) {
data = byteOrderMarkIndicator + data;
}
@@ -3077,6 +3183,7 @@ var ts;
}
}
function getAccessibleFileSystemEntries(path) {
+ ts.perfLogger.logEvent("ReadDir: " + (path || "."));
try {
var entries = _fs.readdirSync(path || ".").sort();
var files = [];
@@ -3130,6 +3237,7 @@ var ts;
return fileSystemEntryExists(path, 1);
}
function getDirectories(path) {
+ ts.perfLogger.logEvent("ReadDir: " + path);
return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1); });
}
function realpath(path) {
@@ -3311,7 +3419,6 @@ var ts;
A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."),
Invalid_reference_directive_syntax: diag(1084, ts.DiagnosticCategory.Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, ts.DiagnosticCategory.Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."),
- An_accessor_cannot_be_declared_in_an_ambient_context: diag(1086, ts.DiagnosticCategory.Error, "An_accessor_cannot_be_declared_in_an_ambient_context_1086", "An accessor cannot be declared in an ambient context."),
_0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."),
_0_modifier_cannot_appear_on_a_parameter: diag(1090, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."),
Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."),
@@ -3464,6 +3571,7 @@ var ts;
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
+ Keywords_cannot_contain_escape_characters: diag(1260, ts.DiagnosticCategory.Error, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -3496,7 +3604,7 @@ var ts;
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
- The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_option_1343", "The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options."),
+ The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system_1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'esnext' or 'system'."),
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness"),
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
@@ -4617,11 +4725,13 @@ var ts;
_a.of = 148,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18, "}": 19, "(": 20, ")": 21, "[": 22, "]": 23, ".": 24, "...": 25, ";": 26, ",": 27, "<": 28, ">": 30, "<=": 31, ">=": 32, "==": 33, "!=": 34, "===": 35, "!==": 36, "=>": 37, "+": 38, "-": 39, "**": 41, "*": 40, "/": 42, "%": 43, "++": 44, "--": 45, "<<": 46, "": 29, ">>": 47, ">>>": 48, "&": 49, "|": 50, "^": 51, "!": 52, "~": 53, "&&": 54, "||": 55, "?": 56, ":": 57, "=": 60, "+=": 61, "-=": 62, "*=": 63, "**=": 64, "/=": 65, "%=": 66, "<<=": 67, ">>=": 68, ">>>=": 69, "&=": 70, "|=": 71, "^=": 72, "@": 58 }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18, "}": 19, "(": 20, ")": 21, "[": 22, "]": 23, ".": 24, "...": 25, ";": 26, ",": 27, "<": 28, ">": 30, "<=": 31, ">=": 32, "==": 33, "!=": 34, "===": 35, "!==": 36, "=>": 37, "+": 38, "-": 39, "**": 41, "*": 40, "/": 42, "%": 43, "++": 44, "--": 45, "<<": 46, "": 29, ">>": 47, ">>>": 48, "&": 49, "|": 50, "^": 51, "!": 52, "~": 53, "&&": 54, "||": 55, "?": 56, ":": 57, "=": 60, "+=": 61, "-=": 62, "*=": 63, "**=": 64, "/=": 65, "%=": 66, "<<=": 67, ">>=": 68, ">>>=": 69, "&=": 70, "|=": 71, "^=": 72, "@": 58, "`": 59 }));
var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
+ var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3133, 3160, 3162, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101];
+ var unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3328, 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7673, 7675, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65071, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69376, 69404, 69415, 69415, 69424, 69456, 69600, 69622, 69632, 69702, 69734, 69743, 69759, 69818, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69958, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70096, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70206, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70751, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71680, 71738, 71840, 71913, 71935, 71935, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123584, 123641, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101, 917760, 917999];
function lookupInUnicodeMap(code, map) {
if (code < map[0]) {
return false;
@@ -4645,15 +4755,17 @@ var ts;
return false;
}
function isUnicodeIdentifierStart(code, languageVersion) {
- return languageVersion >= 1 ?
- lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierStart);
+ return languageVersion >= 2 ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierStart) :
+ languageVersion === 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierStart);
}
ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;
function isUnicodeIdentifierPart(code, languageVersion) {
- return languageVersion >= 1 ?
- lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierPart);
+ return languageVersion >= 2 ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierPart) :
+ languageVersion === 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierPart);
}
function makeReverseMap(source) {
var result = [];
@@ -5076,11 +5188,12 @@ var ts;
}
ts.isIdentifierPart = isIdentifierPart;
function isIdentifierText(name, languageVersion) {
- if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {
+ var ch = codePointAt(name, 0);
+ if (!isIdentifierStart(ch, languageVersion)) {
return false;
}
- for (var i = 1; i < name.length; i++) {
- if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {
+ for (var i = charSize(ch); i < name.length; i += charSize(ch)) {
+ if (!isIdentifierPart(ch = codePointAt(name, i), languageVersion)) {
return false;
}
}
@@ -5106,6 +5219,7 @@ var ts;
getTokenPos: function () { return tokenPos; },
getTokenText: function () { return text.substring(tokenPos, pos); },
getTokenValue: function () { return tokenValue; },
+ hasUnicodeEscape: function () { return (tokenFlags & 1024) !== 0; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1) !== 0; },
isIdentifier: function () { return token === 73 || token > 109; },
@@ -5232,7 +5346,7 @@ var ts;
}
}
function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
- if (!isIdentifierStart(text.charCodeAt(pos), languageVersion)) {
+ if (!isIdentifierStart(codePointAt(text, pos), languageVersion)) {
return;
}
var identifierStart = pos;
@@ -5422,6 +5536,7 @@ var ts;
pos++;
return scanExtendedUnicodeEscape();
}
+ tokenFlags |= 1024;
return scanHexadecimalEscape(4);
case 120:
return scanHexadecimalEscape(2);
@@ -5494,21 +5609,41 @@ var ts;
}
return -1;
}
+ function peekExtendedUnicodeEscape() {
+ if (languageVersion >= 2 && codePointAt(text, pos + 1) === 117 && codePointAt(text, pos + 2) === 123) {
+ var start_2 = pos;
+ pos += 3;
+ var escapedValueString = scanMinimumNumberOfHexDigits(1, false);
+ var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
+ pos = start_2;
+ return escapedValue;
+ }
+ return -1;
+ }
function scanIdentifierParts() {
var result = "";
var start = pos;
while (pos < end) {
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
if (isIdentifierPart(ch, languageVersion)) {
- pos++;
+ pos += charSize(ch);
}
else if (ch === 92) {
+ ch = peekExtendedUnicodeEscape();
+ if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8;
+ result += scanExtendedUnicodeEscape();
+ start = pos;
+ continue;
+ }
ch = peekUnicodeEscape();
if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
break;
}
+ tokenFlags |= 1024;
result += text.substring(start, pos);
- result += String.fromCharCode(ch);
+ result += utf16EncodeAsString(ch);
pos += 6;
start = pos;
}
@@ -5595,7 +5730,7 @@ var ts;
if (pos >= end) {
return token = 1;
}
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) {
pos = scanShebangTrivia(text, pos);
if (skipTrivia) {
@@ -5950,9 +6085,17 @@ var ts;
pos++;
return token = 58;
case 92:
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
var cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
pos += 6;
+ tokenFlags |= 1024;
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
return token = getIdentifierToken();
}
@@ -5961,9 +6104,9 @@ var ts;
return token = 0;
default:
if (isIdentifierStart(ch, languageVersion)) {
- pos++;
- while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))
- pos++;
+ pos += charSize(ch);
+ while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion))
+ pos += charSize(ch);
tokenValue = text.substring(tokenPos, pos);
if (ch === 92) {
tokenValue += scanIdentifierParts();
@@ -5971,16 +6114,16 @@ var ts;
return token = getIdentifierToken();
}
else if (isWhiteSpaceSingleLine(ch)) {
- pos++;
+ pos += charSize(ch);
continue;
}
else if (isLineBreak(ch)) {
tokenFlags |= 1;
- pos++;
+ pos += charSize(ch);
continue;
}
error(ts.Diagnostics.Invalid_character);
- pos++;
+ pos += charSize(ch);
return token = 0;
}
}
@@ -6111,17 +6254,19 @@ var ts;
}
function scanJsxIdentifier() {
if (tokenIsIdentifierOrKeyword(token)) {
- var firstCharPosition = pos;
while (pos < end) {
var ch = text.charCodeAt(pos);
- if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
+ if (ch === 45) {
+ tokenValue += "-";
pos++;
+ continue;
}
- else {
+ var oldPos = pos;
+ tokenValue += scanIdentifierParts();
+ if (pos === oldPos) {
break;
}
}
- tokenValue += text.substring(firstCharPosition, pos);
}
return token;
}
@@ -6142,8 +6287,8 @@ var ts;
if (pos >= end) {
return token = 1;
}
- var ch = text.charCodeAt(pos);
- pos++;
+ var ch = codePointAt(text, pos);
+ pos += charSize(ch);
switch (ch) {
case 9:
case 11:
@@ -6181,12 +6326,33 @@ var ts;
return token = 24;
case 96:
return token = 59;
- }
- if (isIdentifierStart(ch, 8)) {
- while (isIdentifierPart(text.charCodeAt(pos), 8) && pos < end) {
+ case 92:
+ pos--;
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
+ var cookedChar = peekUnicodeEscape();
+ if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
+ pos += 6;
+ tokenFlags |= 1024;
+ tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
pos++;
- }
+ return token = 0;
+ }
+ if (isIdentifierStart(ch, languageVersion)) {
+ var char = ch;
+ while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion))
+ pos += charSize(char);
tokenValue = text.substring(tokenPos, pos);
+ if (char === 92) {
+ tokenValue += scanIdentifierParts();
+ }
return token = getIdentifierToken();
}
else {
@@ -6267,6 +6433,26 @@ var ts;
}
}
ts.createScanner = createScanner;
+ var codePointAt = String.prototype.codePointAt ? function (s, i) { return s.codePointAt(i); } : function codePointAt(str, i) {
+ var size = str.length;
+ if (i < 0 || i >= size) {
+ return undefined;
+ }
+ var first = str.charCodeAt(i);
+ if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) {
+ var second = str.charCodeAt(i + 1);
+ if (second >= 0xDC00 && second <= 0xDFFF) {
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
+ }
+ }
+ return first;
+ };
+ function charSize(ch) {
+ if (ch >= 0x10000) {
+ return 2;
+ }
+ return 1;
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -6662,7 +6848,7 @@ var ts;
if (includeJsDoc && ts.hasJSDocNodes(node)) {
return getTokenPosOfNode(node.jsDoc[0]);
}
- if (node.kind === 313 && node._children.length > 0) {
+ if (node.kind === 314 && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -6712,12 +6898,16 @@ var ts;
return emitNode && emitNode.flags || 0;
}
ts.getEmitFlags = getEmitFlags;
+ var escapeNoSubstitutionTemplateLiteralText = ts.compose(escapeString, escapeTemplateSubstitution);
+ var escapeNonAsciiNoSubstitutionTemplateLiteralText = ts.compose(escapeNonAsciiString, escapeTemplateSubstitution);
function getLiteralText(node, sourceFile, neverAsciiEscape) {
if (!nodeIsSynthesized(node) && node.parent && !((ts.isNumericLiteral(node) && node.numericLiteralFlags & 512) ||
ts.isBigIntLiteral(node))) {
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
}
- var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216) ? escapeString : escapeNonAsciiString;
+ var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216) ?
+ node.kind === 14 ? escapeNoSubstitutionTemplateLiteralText : escapeString :
+ node.kind === 14 ? escapeNonAsciiNoSubstitutionTemplateLiteralText : escapeNonAsciiString;
switch (node.kind) {
case 10:
if (node.singleQuote) {
@@ -6815,6 +7005,34 @@ var ts;
return ts.isExternalModule(node) || compilerOptions.isolatedModules || ((ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS) && !!node.commonJsModuleIndicator);
}
ts.isEffectiveExternalModule = isEffectiveExternalModule;
+ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
+ switch (node.scriptKind) {
+ case 1:
+ case 3:
+ case 2:
+ case 4:
+ break;
+ default:
+ return false;
+ }
+ if (node.isDeclarationFile) {
+ return false;
+ }
+ if (ts.getStrictOptionValue(compilerOptions, "alwaysStrict")) {
+ return true;
+ }
+ if (ts.startsWithUseStrict(node.statements)) {
+ return true;
+ }
+ if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
+ if (ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
+ return true;
+ }
+ return !compilerOptions.noImplicitUseStrict;
+ }
+ return false;
+ }
+ ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile;
function isBlockScope(node, parentNode) {
switch (node.kind) {
case 285:
@@ -6840,9 +7058,9 @@ var ts;
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 304:
- case 311:
- case 299:
+ case 305:
+ case 312:
+ case 300:
return true;
default:
ts.assertType(node);
@@ -6863,7 +7081,7 @@ var ts;
case 210:
case 242:
case 243:
- case 310:
+ case 311:
case 240:
case 157:
case 158:
@@ -7078,6 +7296,12 @@ var ts;
return n.kind === 192 && n.expression.kind === 93;
}
ts.isImportCall = isImportCall;
+ function isImportMeta(n) {
+ return ts.isMetaProperty(n)
+ && n.keywordToken === 93
+ && n.name.escapedText === "meta";
+ }
+ ts.isImportMeta = isImportMeta;
function isLiteralImportTypeNode(n) {
return ts.isImportTypeNode(n) && ts.isLiteralTypeNode(n.argument) && ts.isStringLiteral(n.argument.literal);
}
@@ -7158,7 +7382,7 @@ var ts;
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
case 151:
return node === parent.constraint;
- case 310:
+ case 311:
return node === parent.constraint;
case 155:
case 154:
@@ -8092,7 +8316,7 @@ var ts;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 311 || node.kind === 304;
+ return node.kind === 312 || node.kind === 305 || node.kind === 306;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -8500,6 +8724,10 @@ var ts;
return isKeyword(token) && !isContextualKeyword(token);
}
ts.isNonContextualKeyword = isNonContextualKeyword;
+ function isFutureReservedKeyword(token) {
+ return 110 <= token && token <= 118;
+ }
+ ts.isFutureReservedKeyword = isFutureReservedKeyword;
function isStringANonContextualKeyword(name) {
var token = ts.stringToToken(name);
return token !== undefined && isNonContextualKeyword(token);
@@ -8726,7 +8954,7 @@ var ts;
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 316:
+ case 317:
return 0;
case 209:
return 1;
@@ -8909,6 +9137,10 @@ var ts;
}
}
ts.createDiagnosticCollection = createDiagnosticCollection;
+ var templateSubstitutionRegExp = /\$\{/g;
+ function escapeTemplateSubstitution(str) {
+ return str.replace(templateSubstitutionRegExp, "\\${");
+ }
var doubleQuoteEscapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
var singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
var backtickQuoteEscapedCharsRegExp = /[\\\`\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
@@ -9244,6 +9476,7 @@ var ts;
return accessor.parameters[hasThis ? 1 : 0];
}
}
+ ts.getSetAccessorValueParameter = getSetAccessorValueParameter;
function getSetAccessorTypeAnnotationNode(accessor) {
var parameter = getSetAccessorValueParameter(accessor);
return parameter && parameter.type;
@@ -9340,7 +9573,7 @@ var ts;
}
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 298 && tag.parent.tags.some(isJSDocTypeAlias));
}
function getEffectiveSetAccessorTypeAnnotationNode(node) {
var parameter = getSetAccessorValueParameter(node);
@@ -10001,8 +10234,8 @@ var ts;
map.clear();
}
ts.clearMap = clearMap;
- function mutateMap(map, newMap, options) {
- var createNewValue = options.createNewValue, onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
+ function mutateMapSkippingNewValues(map, newMap, options) {
+ var onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
map.forEach(function (existingValue, key) {
var valueInNewMap = newMap.get(key);
if (valueInNewMap === undefined) {
@@ -10013,6 +10246,11 @@ var ts;
onExistingValue(existingValue, valueInNewMap, key);
}
});
+ }
+ ts.mutateMapSkippingNewValues = mutateMapSkippingNewValues;
+ function mutateMap(map, newMap, options) {
+ mutateMapSkippingNewValues(map, newMap, options);
+ var createNewValue = options.createNewValue;
newMap.forEach(function (valueInNewMap, key) {
if (!map.has(key)) {
map.set(key, createNewValue(key, valueInNewMap));
@@ -10144,7 +10382,7 @@ var ts;
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 8:
+ case 99:
return "lib.esnext.full.d.ts";
case 7:
return "lib.es2020.full.d.ts";
@@ -10438,6 +10676,9 @@ var ts;
break;
case 222:
var expr = hostNode.expression;
+ if (expr.kind === 205 && expr.operatorToken.kind === 60) {
+ expr = expr.left;
+ }
switch (expr.kind) {
case 190:
return expr.name;
@@ -10475,8 +10716,8 @@ var ts;
switch (declaration.kind) {
case 73:
return declaration;
- case 312:
- case 306: {
+ case 313:
+ case 307: {
var name = declaration.name;
if (name.kind === 149) {
return name.right;
@@ -10500,8 +10741,10 @@ var ts;
return undefined;
}
}
- case 311:
+ case 312:
return getNameOfJSDocTypedef(declaration);
+ case 306:
+ return nameForNamelessJSDocTypedef(declaration);
case 255: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
@@ -10645,7 +10888,7 @@ var ts;
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 297);
+ ts.Debug.assert(node.parent.kind === 298);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -10907,7 +11150,7 @@ var ts;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 315) {
+ while (node.kind === 316) {
node = node.expression;
}
return node;
@@ -11310,73 +11553,73 @@ var ts;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 297;
+ return node.kind === 298;
}
ts.isJSDoc = isJSDoc;
function isJSDocAuthorTag(node) {
- return node.kind === 302;
+ return node.kind === 303;
}
ts.isJSDocAuthorTag = isJSDocAuthorTag;
function isJSDocAugmentsTag(node) {
- return node.kind === 301;
+ return node.kind === 302;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 303;
+ return node.kind === 304;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 305;
+ return node.kind === 306;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 308;
+ return node.kind === 309;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 306;
+ return node.kind === 307;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 307;
+ return node.kind === 308;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 309;
+ return node.kind === 310;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 310;
+ return node.kind === 311;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 311;
+ return node.kind === 312;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 312;
+ return node.kind === 313;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 312 || node.kind === 306;
+ return node.kind === 313 || node.kind === 307;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 298;
+ return node.kind === 299;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 304;
+ return node.kind === 305;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 299;
+ return node.kind === 300;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
(function (ts) {
function isSyntaxList(n) {
- return n.kind === 313;
+ return n.kind === 314;
}
ts.isSyntaxList = isSyntaxList;
function isNode(node) {
@@ -11506,7 +11749,7 @@ var ts;
switch (kind) {
case 156:
case 161:
- case 299:
+ case 300:
case 162:
case 163:
case 166:
@@ -11761,8 +12004,8 @@ var ts;
case 209:
case 213:
case 211:
+ case 317:
case 316:
- case 315:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -11775,11 +12018,11 @@ var ts;
}
ts.isAssertionExpression = isAssertionExpression;
function isPartiallyEmittedExpression(node) {
- return node.kind === 315;
+ return node.kind === 316;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
function isNotEmittedStatement(node) {
- return node.kind === 314;
+ return node.kind === 315;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
function isNotEmittedOrPartiallyEmittedNode(node) {
@@ -11879,9 +12122,9 @@ var ts;
|| kind === 243
|| kind === 151
|| kind === 238
- || kind === 311
- || kind === 304
- || kind === 312;
+ || kind === 312
+ || kind === 305
+ || kind === 313;
}
function isDeclarationStatementKind(kind) {
return kind === 240
@@ -11916,13 +12159,13 @@ var ts;
|| kind === 220
|| kind === 225
|| kind === 232
- || kind === 314
- || kind === 318
- || kind === 317;
+ || kind === 315
+ || kind === 319
+ || kind === 318;
}
function isDeclaration(node) {
if (node.kind === 151) {
- return (node.parent && node.parent.kind !== 310) || ts.isInJSFile(node);
+ return (node.parent && node.parent.kind !== 311) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -12000,15 +12243,15 @@ var ts;
}
ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
function isJSDocNode(node) {
- return node.kind >= 289 && node.kind <= 312;
+ return node.kind >= 289 && node.kind <= 313;
}
ts.isJSDocNode = isJSDocNode;
function isJSDocCommentContainingNode(node) {
- return node.kind === 297 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 298 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
function isJSDocTag(node) {
- return node.kind >= 300 && node.kind <= 312;
+ return node.kind >= 301 && node.kind <= 313;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
@@ -13782,7 +14025,7 @@ var ts;
return visitNode(cbNode, node.expression);
case 259:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 316:
+ case 317:
return visitNodes(cbNode, cbNodes, node.elements);
case 261:
return visitNode(cbNode, node.openingElement) ||
@@ -13820,26 +14063,26 @@ var ts;
case 295:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 297:
+ case 298:
return visitNodes(cbNode, cbNodes, node.tags);
- case 306:
- case 312:
+ case 307:
+ case 313:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 302:
+ case 303:
return visitNode(cbNode, node.tagName);
- case 301:
+ case 302:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 310:
+ case 311:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 311:
+ case 312:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
node.typeExpression.kind === 289
@@ -13847,26 +14090,26 @@ var ts;
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 304:
+ case 305:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 307:
- case 309:
case 308:
- case 305:
+ case 310:
+ case 309:
+ case 306:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 299:
+ case 300:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 298:
+ case 299:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 300:
- case 303:
+ case 301:
+ case 304:
return visitNode(cbNode, node.tagName);
- case 315:
+ case 316:
return visitNode(cbNode, node.expression);
}
}
@@ -13875,12 +14118,14 @@ var ts;
if (setParentNodes === void 0) { setParentNodes = false; }
ts.performance.mark("beforeParse");
var result;
+ ts.perfLogger.logStartParseSourceFile(fileName);
if (languageVersion === 100) {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, 6);
}
else {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind);
}
+ ts.perfLogger.logStopParseSourceFile();
ts.performance.mark("afterParse");
ts.performance.measure("Parse", "beforeParse", "afterParse");
return result;
@@ -13919,7 +14164,7 @@ var ts;
ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
var Parser;
(function (Parser) {
- var scanner = ts.createScanner(8, true);
+ var scanner = ts.createScanner(99, true);
var disallowInAndDecoratorContext = 2048 | 8192;
var NodeConstructor;
var TokenConstructor;
@@ -13934,6 +14179,7 @@ var ts;
var identifiers;
var identifierCount;
var parsingContext;
+ var notParenthesizedArrow;
var contextFlags;
var parseErrorBeforeNextFinishedNode = false;
function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) {
@@ -14059,6 +14305,7 @@ var ts;
identifiers = undefined;
syntaxCursor = undefined;
sourceText = undefined;
+ notParenthesizedArrow = undefined;
}
function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {
var isDeclarationFile = isDeclarationFileName(fileName);
@@ -14230,9 +14477,15 @@ var ts;
function token() {
return currentToken;
}
- function nextToken() {
+ function nextTokenWithoutCheck() {
return currentToken = scanner.scan();
}
+ function nextToken() {
+ if (ts.isKeyword(currentToken) && (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape())) {
+ parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), ts.Diagnostics.Keywords_cannot_contain_escape_characters);
+ }
+ return nextTokenWithoutCheck();
+ }
function nextTokenJSDoc() {
return currentToken = scanner.scanJsDocToken();
}
@@ -14432,7 +14685,7 @@ var ts;
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
- nextToken();
+ nextTokenWithoutCheck();
return finishNode(node);
}
var reportAtCurrentPosition = token() === 1;
@@ -15145,6 +15398,23 @@ var ts;
}
function parseJSDocType() {
scanner.setInJSDocType(true);
+ var moduleSpecifier = parseOptionalToken(131);
+ if (moduleSpecifier) {
+ var moduleTag = createNode(297, moduleSpecifier.pos);
+ terminate: while (true) {
+ switch (token()) {
+ case 19:
+ case 1:
+ case 27:
+ case 5:
+ break terminate;
+ default:
+ nextTokenJSDoc();
+ }
+ }
+ scanner.setInJSDocType(false);
+ return finishNode(moduleTag);
+ }
var dotdotdot = parseOptionalToken(25);
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
@@ -16052,7 +16322,15 @@ var ts;
}
}
function parsePossibleParenthesizedArrowFunctionExpressionHead() {
- return parseParenthesizedArrowFunctionExpressionHead(false);
+ var tokenPos = scanner.getTokenPos();
+ if (notParenthesizedArrow && notParenthesizedArrow.has(tokenPos.toString())) {
+ return undefined;
+ }
+ var result = parseParenthesizedArrowFunctionExpressionHead(false);
+ if (!result) {
+ (notParenthesizedArrow || (notParenthesizedArrow = ts.createMap())).set(tokenPos.toString(), true);
+ }
+ return result;
}
function tryParseAsyncSimpleArrowFunctionExpression() {
if (token() === 122) {
@@ -17985,8 +18263,8 @@ var ts;
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 8, undefined, 1);
- sourceFile = createSourceFile("file.js", 8, 1, false);
+ initializeState(content, 99, undefined, 1);
+ sourceFile = createSourceFile("file.js", 99, 1, false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -18007,9 +18285,9 @@ var ts;
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 8, undefined, 1);
+ initializeState(content, 99, undefined, 1);
sourceFile = { languageVariant: 0, text: content };
- var jsDoc = parseJSDocCommentWorker(start, length);
+ var jsDoc = doInsideOfContext(2097152, function () { return parseJSDocCommentWorker(start, length); });
var diagnostics = parseDiagnostics;
clearState();
return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined;
@@ -18020,7 +18298,7 @@ var ts;
var saveToken = currentToken;
var saveParseDiagnosticsLength = parseDiagnostics.length;
var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
- var comment = parseJSDocCommentWorker(start, length);
+ var comment = doInsideOfContext(2097152, function () { return parseJSDocCommentWorker(start, length); });
if (comment) {
comment.parent = parent;
}
@@ -18132,7 +18410,7 @@ var ts;
}
}
function createJSDocComment() {
- var result = createNode(297, start);
+ var result = createNode(298, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -18322,7 +18600,7 @@ var ts;
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(300, start);
+ var result = createNode(301, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -18382,8 +18660,8 @@ var ts;
typeExpression = tryParseTypeExpression();
}
var result = target === 1 ?
- createNode(312, start) :
- createNode(306, start);
+ createNode(313, start) :
+ createNode(307, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -18403,15 +18681,15 @@ var ts;
var typeLiteralExpression = createNode(289, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
- var start_2 = scanner.getStartPos();
+ var start_3 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 306 || child.kind === 312) {
+ if (child.kind === 307 || child.kind === 313) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(298, start_2);
+ jsdocTypeLiteral = createNode(299, start_3);
jsdocTypeLiteral.jsDocPropertyTags = children;
if (typeExpression.type.kind === 170) {
jsdocTypeLiteral.isArrayType = true;
@@ -18425,7 +18703,7 @@ var ts;
if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307, start);
+ var result = createNode(308, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
@@ -18434,13 +18712,13 @@ var ts;
if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(309, start);
+ var result = createNode(310, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(true);
return finishNode(result);
}
function parseAuthorTag(start, tagName, indent) {
- var result = createNode(302, start);
+ var result = createNode(303, start);
result.tagName = tagName;
var authorInfoWithEmail = tryParse(function () { return tryParseAuthorNameAndEmail(); });
if (!authorInfoWithEmail) {
@@ -18494,7 +18772,7 @@ var ts;
}
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(301, start);
+ var result = createNode(302, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
@@ -18521,19 +18799,19 @@ var ts;
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(303, start);
+ var tag = createNode(304, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(308, start);
+ var tag = createNode(309, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(305, start);
+ var tag = createNode(306, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(true);
skipWhitespace();
@@ -18542,7 +18820,7 @@ var ts;
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(311, start);
+ var typedefTag = createNode(312, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -18556,9 +18834,9 @@ var ts;
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(298, start);
+ jsdocTypeLiteral = createNode(299, start);
}
- if (child.kind === 309) {
+ if (child.kind === 310) {
if (childTypeTag) {
break;
}
@@ -18603,14 +18881,14 @@ var ts;
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(304, start);
+ var callbackTag = createNode(305, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(299, start);
+ var jsdocSignature = createNode(300, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -18618,7 +18896,7 @@ var ts;
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 307) {
+ if (tag && tag.kind === 308) {
return tag;
}
}
@@ -18663,7 +18941,7 @@ var ts;
case 58:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 306 || child.kind === 312) &&
+ if (child && (child.kind === 307 || child.kind === 313) &&
target !== 4 &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -18732,7 +19010,7 @@ var ts;
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27));
- var result = createNode(310, start);
+ var result = createNode(311, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
@@ -18764,16 +19042,19 @@ var ts;
if (!ts.tokenIsIdentifierOrKeyword(token())) {
return createMissingNode(73, !message, message || ts.Diagnostics.Identifier_expected);
}
+ identifierCount++;
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
var result = createNode(73, pos);
- result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
+ if (token() !== 73) {
+ result.originalKeywordKind = token();
+ }
+ result.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
finishNode(result, end);
nextTokenJSDoc();
return result;
}
}
- JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker;
})(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {}));
})(Parser || (Parser = {}));
var IncrementalParser;
@@ -19467,7 +19748,7 @@ var ts;
es2018: 5,
es2019: 6,
es2020: 7,
- esnext: 8,
+ esnext: 99,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
@@ -20736,10 +21017,10 @@ var ts;
var config = __assign({ compilerOptions: __assign({}, ts.arrayFrom(optionMap.entries()).reduce(function (prev, cur) {
var _a;
return (__assign({}, prev, (_a = {}, _a[cur[0]] = cur[1], _a)));
- }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath, originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
+ }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath ? r.originalPath : "", originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
include: filterSameAsDefaultInclude(configParseResult.configFileSpecs.validatedIncludeSpecs),
exclude: configParseResult.configFileSpecs.validatedExcludeSpecs
- } : {}), { compilerOnSave: !!configParseResult.compileOnSave ? true : undefined });
+ } : {}), { compileOnSave: !!configParseResult.compileOnSave ? true : undefined });
return config;
}
ts.convertToTSConfig = convertToTSConfig;
@@ -22011,6 +22292,7 @@ var ts;
trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
}
}
+ ts.perfLogger.logStartResolveModule(moduleName);
switch (moduleResolution) {
case ts.ModuleResolutionKind.NodeJs:
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
@@ -22021,6 +22303,9 @@ var ts;
default:
return ts.Debug.fail("Unexpected moduleResolution: " + moduleResolution);
}
+ if (result && result.resolvedModule)
+ ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
+ ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
if (perFolderCache) {
perFolderCache.set(moduleName, result);
if (!ts.isExternalModuleNameRelative(moduleName)) {
@@ -22684,7 +22969,9 @@ var ts;
var binder = createBinder();
function bindSourceFile(file, options) {
ts.performance.mark("beforeBind");
+ ts.perfLogger.logStartBindFile("" + file.fileName);
binder(file, options);
+ ts.perfLogger.logStopBindFile();
ts.performance.mark("afterBind");
ts.performance.measure("Bind", "beforeBind", "afterBind");
}
@@ -22783,7 +23070,7 @@ var ts;
if (symbol.constEnumOnlyModule && (symbol.flags & (16 | 32 | 256))) {
symbol.constEnumOnlyModule = false;
}
- if (symbolFlags & 67220415) {
+ if (symbolFlags & 111551) {
setValueDeclaration(symbol, node);
}
}
@@ -22823,7 +23110,7 @@ var ts;
return "__constructor";
case 166:
case 161:
- case 299:
+ case 300:
return "__call";
case 167:
case 162:
@@ -22944,10 +23231,10 @@ var ts;
if (ts.isJSDocTypeAlias(node))
ts.Debug.assert(ts.isInJSFile(node));
if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32)) || ts.isJSDocTypeAlias(node)) {
- if (ts.hasModifier(node, 512) && !getDeclarationName(node)) {
+ if (!container.locals || (ts.hasModifier(node, 512) && !getDeclarationName(node))) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
}
- var exportKind = symbolFlags & 67220415 ? 1048576 : 0;
+ var exportKind = symbolFlags & 111551 ? 1048576 : 0;
var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes);
local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
node.localSymbol = local;
@@ -23149,8 +23436,9 @@ var ts;
case 192:
bindCallExpressionFlow(node);
break;
- case 311:
- case 304:
+ case 312:
+ case 305:
+ case 306:
bindJSDocTypeAlias(node);
break;
case 285: {
@@ -23762,7 +24050,7 @@ var ts;
}
function bindJSDocTypeAlias(node) {
node.tagName.parent = node;
- if (node.fullName) {
+ if (node.kind !== 306 && node.fullName) {
setParentPointers(node, node.fullName);
}
}
@@ -23793,7 +24081,7 @@ var ts;
case 244:
case 189:
case 169:
- case 298:
+ case 299:
case 269:
return 1;
case 242:
@@ -23814,7 +24102,7 @@ var ts;
case 159:
case 160:
case 161:
- case 299:
+ case 300:
case 295:
case 166:
case 162:
@@ -23857,7 +24145,7 @@ var ts;
case 244:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
case 169:
- case 298:
+ case 299:
case 189:
case 242:
case 269:
@@ -23866,7 +24154,7 @@ var ts;
case 167:
case 161:
case 162:
- case 299:
+ case 300:
case 163:
case 157:
case 156:
@@ -23877,8 +24165,8 @@ var ts;
case 197:
case 198:
case 295:
- case 311:
- case 304:
+ case 312:
+ case 305:
case 243:
case 182:
return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);
@@ -24028,9 +24316,20 @@ var ts;
currentFlow = { flags: 2 };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 73) {
+ var declName = ts.getNameOfDeclaration(typeAlias);
+ if ((ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName) && declName && ts.isPropertyAccessEntityNameExpression(declName.parent)) {
+ var isTopLevel = isTopLevelNamespaceAssignment(declName.parent);
+ if (isTopLevel) {
+ bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
+ var oldContainer = container;
+ container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
+ declareModuleMember(typeAlias, 524288, 788968);
+ container = oldContainer;
+ }
+ }
+ else if (ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName || typeAlias.fullName.kind === 73) {
parent = typeAlias.parent;
- bindBlockScopedDeclaration(typeAlias, 524288, 67897832);
+ bindBlockScopedDeclaration(typeAlias, 524288, 788968);
}
else {
bind(typeAlias.fullName);
@@ -24047,7 +24346,8 @@ var ts;
node.originalKeywordKind >= 110 &&
node.originalKeywordKind <= 118 &&
!ts.isIdentifierName(node) &&
- !(node.flags & 4194304)) {
+ !(node.flags & 4194304) &&
+ !(node.flags & 2097152)) {
if (!file.parseDiagnostics.length) {
file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));
}
@@ -24242,7 +24542,7 @@ var ts;
while (parentNode && !ts.isJSDocTypeAlias(parentNode)) {
parentNode = parentNode.parent;
}
- bindBlockScopedDeclaration(parentNode, 524288, 67897832);
+ bindBlockScopedDeclaration(parentNode, 524288, 788968);
break;
}
case 101:
@@ -24262,7 +24562,7 @@ var ts;
file.commonJsModuleIndicator &&
ts.isModuleExportsPropertyAccessExpression(node) &&
!lookupSymbolForNameWorker(blockScopeContainer, "module")) {
- declareSymbol(file.locals, undefined, node.expression, 1 | 134217728, 67220414);
+ declareSymbol(file.locals, undefined, node.expression, 1 | 134217728, 111550);
}
break;
case 205:
@@ -24327,29 +24627,29 @@ var ts;
case 277:
return bindPropertyOrMethodOrAccessor(node, 4, 0);
case 279:
- return bindPropertyOrMethodOrAccessor(node, 8, 68008959);
+ return bindPropertyOrMethodOrAccessor(node, 8, 900095);
case 161:
case 162:
case 163:
return declareSymbolAndAddToSymbolTable(node, 131072, 0);
case 157:
case 156:
- return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 67212223);
+ return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 103359);
case 240:
return bindFunctionDeclaration(node);
case 158:
return declareSymbolAndAddToSymbolTable(node, 16384, 0);
case 159:
- return bindPropertyOrMethodOrAccessor(node, 32768, 67154879);
+ return bindPropertyOrMethodOrAccessor(node, 32768, 46015);
case 160:
- return bindPropertyOrMethodOrAccessor(node, 65536, 67187647);
+ return bindPropertyOrMethodOrAccessor(node, 65536, 78783);
case 166:
case 295:
- case 299:
+ case 300:
case 167:
return bindFunctionOrConstructorType(node);
case 169:
- case 298:
+ case 299:
case 182:
return bindAnonymousTypeWorker(node);
case 189:
@@ -24380,9 +24680,9 @@ var ts;
inStrictMode = true;
return bindClassLikeDeclaration(node);
case 242:
- return bindBlockScopedDeclaration(node, 64, 67897736);
+ return bindBlockScopedDeclaration(node, 64, 788872);
case 243:
- return bindBlockScopedDeclaration(node, 524288, 67897832);
+ return bindBlockScopedDeclaration(node, 524288, 788968);
case 244:
return bindEnumDeclaration(node);
case 245:
@@ -24413,21 +24713,22 @@ var ts;
}
case 246:
return updateStrictModeStatementList(node.statements);
- case 306:
- if (node.parent.kind === 299) {
+ case 307:
+ if (node.parent.kind === 300) {
return bindParameter(node);
}
- if (node.parent.kind !== 298) {
+ if (node.parent.kind !== 299) {
break;
}
- case 312:
+ case 313:
var propTag = node;
var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 ?
4 | 16777216 :
4;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0);
- case 311:
- case 304:
+ case 312:
+ case 305:
+ case 306:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -24583,7 +24884,7 @@ var ts;
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 | 1048576, 0);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1, 67220414);
+ declareSymbolAndAddToSymbolTable(node, 1, 111550);
}
break;
default:
@@ -24647,7 +24948,7 @@ var ts;
bindPropertyAssignment(node.expression, node, false);
}
function bindPotentiallyMissingNamespaces(namespaceSymbol, entityName, isToplevel, isPrototypeProperty) {
- if (isToplevel && !isPrototypeProperty && (!namespaceSymbol || !(namespaceSymbol.flags & 1920))) {
+ if (isToplevel && !isPrototypeProperty) {
var flags_1 = 1536 | 67108864;
var excludeFlags_1 = 110735 & ~67108864;
namespaceSymbol = forEachIdentifierInEntityName(entityName, namespaceSymbol, function (id, symbol, parent) {
@@ -24673,14 +24974,17 @@ var ts;
(namespaceSymbol.exports || (namespaceSymbol.exports = ts.createSymbolTable()));
var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedExpandoInitializer(declaration));
var includes = isMethod ? 8192 : 4;
- var excludes = isMethod ? 67212223 : 0;
+ var excludes = isMethod ? 103359 : 0;
declareSymbol(symbolTable, namespaceSymbol, declaration, includes | 67108864, excludes & ~67108864);
}
+ function isTopLevelNamespaceAssignment(propertyAccess) {
+ return ts.isBinaryExpression(propertyAccess.parent)
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285
+ : propertyAccess.parent.parent.kind === 285;
+ }
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
- var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285
- : propertyAccess.parent.parent.kind === 285;
+ var isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -24739,7 +25043,7 @@ var ts;
}
function bindClassLikeDeclaration(node) {
if (node.kind === 241) {
- bindBlockScopedDeclaration(node, 32, 68008383);
+ bindBlockScopedDeclaration(node, 32, 899503);
}
else {
var bindingName = node.name ? node.name.escapedText : "__class";
@@ -24762,30 +25066,27 @@ var ts;
}
function bindEnumDeclaration(node) {
return ts.isEnumConst(node)
- ? bindBlockScopedDeclaration(node, 128, 68008831)
- : bindBlockScopedDeclaration(node, 256, 68008191);
+ ? bindBlockScopedDeclaration(node, 128, 899967)
+ : bindBlockScopedDeclaration(node, 256, 899327);
}
function bindVariableDeclarationOrBindingElement(node) {
if (inStrictMode) {
checkStrictModeEvalOrArguments(node, node.name);
}
if (!ts.isBindingPattern(node.name)) {
- var isEnum = ts.isInJSFile(node) && !!ts.getJSDocEnumTag(node);
- var enumFlags = (isEnum ? 256 : 0);
- var enumExcludes = (isEnum ? 68008191 : 0);
if (ts.isBlockOrCatchScoped(node)) {
- bindBlockScopedDeclaration(node, 2 | enumFlags, 67220415 | enumExcludes);
+ bindBlockScopedDeclaration(node, 2, 111551);
}
else if (ts.isParameterDeclaration(node)) {
- declareSymbolAndAddToSymbolTable(node, 1, 67220415);
+ declareSymbolAndAddToSymbolTable(node, 1, 111551);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 | enumFlags, 67220414 | enumExcludes);
+ declareSymbolAndAddToSymbolTable(node, 1, 111550);
}
}
}
function bindParameter(node) {
- if (node.kind === 306 && container.kind !== 299) {
+ if (node.kind === 307 && container.kind !== 300) {
return;
}
if (inStrictMode && !(node.flags & 4194304)) {
@@ -24795,7 +25096,7 @@ var ts;
bindAnonymousDeclaration(node, 1, "__" + node.parent.parameters.indexOf(node));
}
else {
- declareSymbolAndAddToSymbolTable(node, 1, 67220415);
+ declareSymbolAndAddToSymbolTable(node, 1, 111551);
}
if (ts.isParameterPropertyDeclaration(node)) {
var classDeclaration = node.parent.parent;
@@ -24811,10 +25112,10 @@ var ts;
checkStrictModeFunctionName(node);
if (inStrictMode) {
checkStrictModeFunctionDeclaration(node);
- bindBlockScopedDeclaration(node, 16, 67219887);
+ bindBlockScopedDeclaration(node, 16, 110991);
}
else {
- declareSymbolAndAddToSymbolTable(node, 16, 67219887);
+ declareSymbolAndAddToSymbolTable(node, 16, 110991);
}
}
function bindFunctionExpression(node) {
@@ -24852,10 +25153,10 @@ var ts;
if (!container_1.locals) {
container_1.locals = ts.createSymbolTable();
}
- declareSymbol(container_1.locals, undefined, node, 262144, 67635688);
+ declareSymbol(container_1.locals, undefined, node, 262144, 526824);
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144, 67635688);
+ declareSymbolAndAddToSymbolTable(node, 262144, 526824);
}
}
else if (node.parent.kind === 177) {
@@ -24864,14 +25165,14 @@ var ts;
if (!container_2.locals) {
container_2.locals = ts.createSymbolTable();
}
- declareSymbol(container_2.locals, undefined, node, 262144, 67635688);
+ declareSymbol(container_2.locals, undefined, node, 262144, 526824);
}
else {
bindAnonymousDeclaration(node, 262144, getDeclarationName(node));
}
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144, 67635688);
+ declareSymbolAndAddToSymbolTable(node, 262144, 526824);
}
}
function shouldReportErrorOnModuleDeclaration(node) {
@@ -25378,7 +25679,7 @@ var ts;
break;
case 195:
case 213:
- case 315:
+ case 316:
transformFlags |= 1;
excludeFlags = 536870912;
break;
@@ -25610,7 +25911,7 @@ var ts;
return 536875008;
case 195:
case 213:
- case 315:
+ case 316:
case 196:
case 99:
return 536870912;
@@ -25796,6 +26097,27 @@ var ts;
var nextNodeId = 1;
var nextMergeId = 1;
var nextFlowId = 1;
+ var typeofEQFacts = ts.createMapFromTemplate({
+ string: 1,
+ number: 2,
+ bigint: 4,
+ boolean: 8,
+ symbol: 16,
+ undefined: 65536,
+ object: 32,
+ function: 64
+ });
+ var typeofNEFacts = ts.createMapFromTemplate({
+ string: 256,
+ number: 512,
+ bigint: 1024,
+ boolean: 2048,
+ symbol: 4096,
+ undefined: 524288,
+ object: 8192,
+ function: 16384
+ });
+ var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
function getNodeId(node) {
if (!node.id) {
node.id = nextNodeId;
@@ -26098,7 +26420,7 @@ var ts;
cancellationToken = ct;
checkSourceFile(file);
ts.Debug.assert(!!(getNodeLinks(file).flags & 1));
- diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.get(file.fileName));
+ diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
if (!file.isDeclarationFile && (!unusedIsError(0) || !unusedIsError(1))) {
addUnusedDiagnostics();
}
@@ -26309,27 +26631,7 @@ var ts;
var potentialNewTargetCollisions = [];
var awaitedTypeStack = [];
var diagnostics = ts.createDiagnosticCollection();
- var suggestionDiagnostics = ts.createMultiMap();
- var typeofEQFacts = ts.createMapFromTemplate({
- string: 1,
- number: 2,
- bigint: 4,
- boolean: 8,
- symbol: 16,
- undefined: 65536,
- object: 32,
- function: 64
- });
- var typeofNEFacts = ts.createMapFromTemplate({
- string: 256,
- number: 512,
- bigint: 1024,
- boolean: 2048,
- symbol: 4096,
- undefined: 524288,
- object: 8192,
- function: 16384
- });
+ var suggestionDiagnostics = ts.createDiagnosticCollection();
var typeofTypesByName = ts.createMapFromTemplate({
string: stringType,
number: numberType,
@@ -26349,7 +26651,6 @@ var ts;
var enumRelation = ts.createMap();
var builtinGlobals = ts.createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
- var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
initializeTypeChecker();
return checker;
function getJsxNamespace(location) {
@@ -26412,7 +26713,7 @@ var ts;
diagnostics.add(diagnostic);
}
else {
- suggestionDiagnostics.add(diagnostic.file.fileName, __assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
+ suggestionDiagnostics.add(__assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
}
}
function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
@@ -26438,35 +26739,35 @@ var ts;
function getExcludedSymbolFlags(flags) {
var result = 0;
if (flags & 2)
- result |= 67220415;
+ result |= 111551;
if (flags & 1)
- result |= 67220414;
+ result |= 111550;
if (flags & 4)
result |= 0;
if (flags & 8)
- result |= 68008959;
+ result |= 900095;
if (flags & 16)
- result |= 67219887;
+ result |= 110991;
if (flags & 32)
- result |= 68008383;
+ result |= 899503;
if (flags & 64)
- result |= 67897736;
+ result |= 788872;
if (flags & 256)
- result |= 68008191;
+ result |= 899327;
if (flags & 128)
- result |= 68008831;
+ result |= 899967;
if (flags & 512)
result |= 110735;
if (flags & 8192)
- result |= 67212223;
+ result |= 103359;
if (flags & 32768)
- result |= 67154879;
+ result |= 46015;
if (flags & 65536)
- result |= 67187647;
+ result |= 78783;
if (flags & 262144)
- result |= 67635688;
+ result |= 526824;
if (flags & 524288)
- result |= 67897832;
+ result |= 788968;
if (flags & 2097152)
result |= 2097152;
return result;
@@ -26686,8 +26987,8 @@ var ts;
function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) {
var constructorDeclaration = parameter.parent;
var classDeclaration = parameter.parent.parent;
- var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 67220415);
- var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 67220415);
+ var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 111551);
+ var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 111551);
if (parameterSymbol && propertySymbol) {
return [parameterSymbol, propertySymbol];
}
@@ -26826,7 +27127,7 @@ var ts;
if (result = lookup(location.locals, name, meaning)) {
var useResult = true;
if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
- if (meaning & result.flags & 67897832 && lastLocation.kind !== 297) {
+ if (meaning & result.flags & 788968 && lastLocation.kind !== 298) {
useResult = result.flags & 262144
? lastLocation === location.type ||
lastLocation.kind === 152 ||
@@ -26899,7 +27200,7 @@ var ts;
if (!ts.hasModifier(location, 32)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
- if (lookup(ctor.locals, name, meaning & 67220415)) {
+ if (lookup(ctor.locals, name, meaning & 111551)) {
propertyWithInvalidInitializer = location;
}
}
@@ -26908,7 +27209,7 @@ var ts;
case 241:
case 210:
case 242:
- if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 67897832)) {
+ if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 788968)) {
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
result = undefined;
break;
@@ -26930,7 +27231,7 @@ var ts;
case 212:
if (lastLocation === location.expression && location.parent.token === 87) {
var container = location.parent.parent;
- if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832))) {
+ if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 788968))) {
if (nameNotFoundMessage) {
error(errorLocation, ts.Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
}
@@ -26941,7 +27242,7 @@ var ts;
case 150:
grandparent = location.parent.parent;
if (ts.isClassLike(grandparent) || grandparent.kind === 242) {
- if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832)) {
+ if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
return undefined;
}
@@ -26982,8 +27283,9 @@ var ts;
location = location.parent;
}
break;
- case 311:
- case 304:
+ case 312:
+ case 305:
+ case 306:
location = ts.getJSDocHost(location);
break;
case 152:
@@ -27063,19 +27365,19 @@ var ts;
}
if (errorLocation &&
(meaning & 2 ||
- ((meaning & 32 || meaning & 384) && (meaning & 67220415) === 67220415))) {
+ ((meaning & 32 || meaning & 384) && (meaning & 111551) === 111551))) {
var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
if (exportOrLocalSymbol.flags & 2 || exportOrLocalSymbol.flags & 32 || exportOrLocalSymbol.flags & 384) {
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
}
}
- if (result && isInExternalModule && (meaning & 67220415) === 67220415 && !(originalLocation.flags & 2097152)) {
+ if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 2097152)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
}
}
- if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415) === 67220415) {
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 111551) === 111551) {
var candidate = getMergedSymbol(getLateBoundSymbol(result));
var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializer)) {
@@ -27180,9 +27482,9 @@ var ts;
}
}
function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
- var namespaceMeaning = 1920 | (ts.isInJSFile(errorLocation) ? 67220415 : 0);
+ var namespaceMeaning = 1920 | (ts.isInJSFile(errorLocation) ? 111551 : 0);
if (meaning === namespaceMeaning) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 & ~namespaceMeaning, undefined, undefined, false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 & ~namespaceMeaning, undefined, undefined, false));
var parent = errorLocation.parent;
if (symbol) {
if (ts.isQualifiedName(parent)) {
@@ -27201,8 +27503,8 @@ var ts;
return false;
}
function checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning) {
- if (meaning & (67897832 & ~1920)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, ~67897832 & 67220415, undefined, undefined, false));
+ if (meaning & (788968 & ~1920)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, ~788968 & 111551, undefined, undefined, false));
if (symbol && !(symbol.flags & 1920)) {
error(errorLocation, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here, ts.unescapeLeadingUnderscores(name));
return true;
@@ -27211,12 +27513,12 @@ var ts;
return false;
}
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 & ~1024)) {
+ if (meaning & (111551 & ~1024)) {
if (name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never") {
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
return true;
}
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 & ~67220415, undefined, undefined, false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 & ~111551, undefined, undefined, false));
if (symbol && !(symbol.flags & 1024)) {
var message = isES2015OrLaterConstructorName(name)
? ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later
@@ -27240,15 +27542,15 @@ var ts;
return false;
}
function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 & ~1024 & ~67897832)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~67220415, undefined, undefined, false));
+ if (meaning & (111551 & ~1024 & ~788968)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~111551, undefined, undefined, false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
return true;
}
}
- else if (meaning & (67897832 & ~1024 & ~67220415)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, (512 | 1024) & ~67897832, undefined, undefined, false));
+ else if (meaning & (788968 & ~1024 & ~111551)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, (512 | 1024) & ~788968, undefined, undefined, false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
return true;
@@ -27258,7 +27560,7 @@ var ts;
}
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 || result.flags & 32 || result.flags & 384));
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -27376,7 +27678,7 @@ var ts;
if (valueSymbol === unknownSymbol && typeSymbol === unknownSymbol) {
return unknownSymbol;
}
- if (valueSymbol.flags & (67897832 | 1920)) {
+ if (valueSymbol.flags & (788968 | 1920)) {
return valueSymbol;
}
var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName);
@@ -27463,7 +27765,7 @@ var ts;
if (ts.isClassExpression(expression)) {
return checkExpression(expression).symbol;
}
- var aliasLike = resolveEntityName(expression, 67220415 | 67897832 | 1920, true, dontResolveAlias);
+ var aliasLike = resolveEntityName(expression, 111551 | 788968 | 1920, true, dontResolveAlias);
if (aliasLike) {
return aliasLike;
}
@@ -27482,7 +27784,7 @@ var ts;
case 254:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
case 258:
- return getTargetOfExportSpecifier(node, 67220415 | 67897832 | 1920, dontRecursivelyResolve);
+ return getTargetOfExportSpecifier(node, 111551 | 788968 | 1920, dontRecursivelyResolve);
case 255:
case 205:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
@@ -27493,7 +27795,7 @@ var ts;
}
}
function isNonLocalAlias(symbol, excludes) {
- if (excludes === void 0) { excludes = 67220415 | 67897832 | 1920; }
+ if (excludes === void 0) { excludes = 111551 | 788968 | 1920; }
if (!symbol)
return false;
return (symbol.flags & (2097152 | excludes)) === 2097152 || !!(symbol.flags & 2097152 && symbol.flags & 67108864);
@@ -27527,7 +27829,7 @@ var ts;
var target = resolveAlias(symbol);
if (target) {
var markAlias = target === unknownSymbol ||
- ((target.flags & 67220415) && !isConstEnumOrConstEnumOnlyModule(target));
+ ((target.flags & 111551) && !isConstEnumOrConstEnumOnlyModule(target));
if (markAlias) {
markAliasSymbolAsReferenced(symbol);
}
@@ -27540,14 +27842,11 @@ var ts;
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 255) {
- checkExpressionCached(node.expression);
- }
- else if (node.kind === 258) {
- checkExpressionCached(node.propertyName || node.name);
- }
- else if (ts.isInternalModuleImportEqualsDeclaration(node)) {
- checkExpressionCached(node.moduleReference);
+ if (ts.isInternalModuleImportEqualsDeclaration(node)) {
+ var target = resolveSymbol(symbol);
+ if (target === unknownSymbol || target.flags & 111551) {
+ checkExpressionCached(node.moduleReference);
+ }
}
}
}
@@ -27560,7 +27859,7 @@ var ts;
}
else {
ts.Debug.assert(entityName.parent.kind === 249);
- return resolveEntityName(entityName, 67220415 | 67897832 | 1920, false, dontResolveAlias);
+ return resolveEntityName(entityName, 111551 | 788968 | 1920, false, dontResolveAlias);
}
}
function getFullyQualifiedName(symbol, containingLocation) {
@@ -27570,7 +27869,7 @@ var ts;
if (ts.nodeIsMissing(name)) {
return undefined;
}
- var namespaceMeaning = 1920 | (ts.isInJSFile(name) ? meaning & 67220415 : 0);
+ var namespaceMeaning = 1920 | (ts.isInJSFile(name) ? meaning & 111551 : 0);
var symbol;
if (name.kind === 73) {
var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
@@ -28032,7 +28331,7 @@ var ts;
return getMergedSymbol(symbol && (symbol.flags & 1048576) !== 0 ? symbol.exportSymbol : symbol);
}
function symbolIsValue(symbol) {
- return !!(symbol.flags & 67220415 || symbol.flags & 2097152 && resolveAlias(symbol).flags & 67220415);
+ return !!(symbol.flags & 111551 || symbol.flags & 2097152 && resolveAlias(symbol).flags & 111551);
}
function findConstructorDeclaration(node) {
var members = node.members;
@@ -28133,7 +28432,7 @@ var ts;
return callback(globals);
}
function getQualifiedLeftMeaning(rightMeaning) {
- return rightMeaning === 67220415 ? 67220415 : 1920;
+ return rightMeaning === 111551 ? 111551 : 1920;
}
function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) {
if (visitedSymbolTablesMap === void 0) { visitedSymbolTablesMap = ts.createMap(); }
@@ -28230,11 +28529,11 @@ var ts;
return false;
}
function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67897832, false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 788968, false);
return access.accessibility === 0;
}
function isValueSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67220415, false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 111551, false);
return access.accessibility === 0;
}
function isAnySymbolAccessible(symbols, enclosingDeclaration, initialSymbol, meaning, shouldComputeAliasesToMakeVisible) {
@@ -28260,7 +28559,7 @@ var ts;
}
var containers = getContainersOfSymbol(symbol, enclosingDeclaration);
var firstDecl = ts.first(symbol.declarations);
- if (!ts.length(containers) && meaning & 67220415 && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
+ if (!ts.length(containers) && meaning & 111551 && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
containers = [getSymbolOfNode(firstDecl.parent)];
}
@@ -28353,14 +28652,14 @@ var ts;
if (entityName.parent.kind === 168 ||
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
entityName.parent.kind === 150) {
- meaning = 67220415 | 1048576;
+ meaning = 111551 | 1048576;
}
else if (entityName.kind === 149 || entityName.kind === 190 ||
entityName.parent.kind === 249) {
meaning = 1920;
}
else {
- meaning = 67897832;
+ meaning = 788968;
}
var firstIdentifier = getFirstIdentifier(entityName);
var symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, undefined, undefined, false);
@@ -28530,14 +28829,14 @@ var ts;
}
if (type.flags & 1024 && !(type.flags & 1048576)) {
var parentSymbol = getParentOfSymbol(type.symbol);
- var parentName = symbolToTypeNode(parentSymbol, context, 67897832);
+ var parentName = symbolToTypeNode(parentSymbol, context, 788968);
var enumLiteralName = getDeclaredTypeOfSymbol(parentSymbol) === type
? parentName
: appendReferenceToType(parentName, ts.createTypeReferenceNode(ts.symbolName(type.symbol), undefined));
return enumLiteralName;
}
if (type.flags & 1056) {
- return symbolToTypeNode(type.symbol, context, 67897832);
+ return symbolToTypeNode(type.symbol, context, 788968);
}
if (type.flags & 128) {
context.approximateLength += (type.value.length + 2);
@@ -28560,7 +28859,7 @@ var ts;
if (!(context.flags & 1048576)) {
if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
context.approximateLength += 6;
- return symbolToTypeNode(type.symbol, context, 67220415);
+ return symbolToTypeNode(type.symbol, context, 111551);
}
if (context.tracker.reportInaccessibleUniqueSymbolError) {
context.tracker.reportInaccessibleUniqueSymbolError();
@@ -28622,14 +28921,14 @@ var ts;
return ts.createTypeReferenceNode(ts.createIdentifier(ts.idText(name)), undefined);
}
return type.symbol
- ? symbolToTypeNode(type.symbol, context, 67897832)
+ ? symbolToTypeNode(type.symbol, context, 788968)
: ts.createTypeReferenceNode(ts.createIdentifier("?"), undefined);
}
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32))
return ts.createTypeReferenceNode(ts.createIdentifier(""), typeArgumentNodes);
- return symbolToTypeNode(type.aliasSymbol, context, 67897832, typeArgumentNodes);
+ return symbolToTypeNode(type.aliasSymbol, context, 788968, typeArgumentNodes);
}
if (type.flags & (1048576 | 2097152)) {
var types = type.flags & 1048576 ? formatUnionTypes(type.types) : type.types;
@@ -28704,18 +29003,18 @@ var ts;
var isConstructorObject = ts.getObjectFlags(type) & 16 && type.symbol && type.symbol.flags & 32;
id = (isConstructorObject ? "+" : "") + getSymbolId(symbol);
if (isJSConstructor(symbol.valueDeclaration)) {
- var isInstanceType = type === getInferredClassType(symbol) ? 67897832 : 67220415;
+ var isInstanceType = type === getInferredClassType(symbol) ? 788968 : 111551;
return symbolToTypeNode(symbol, context, isInstanceType);
}
else if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 && context.flags & 2048) ||
symbol.flags & (384 | 512) ||
shouldWriteTypeOfFunctionSymbol()) {
- return symbolToTypeNode(symbol, context, 67220415);
+ return symbolToTypeNode(symbol, context, 111551);
}
else if (context.visitedTypes && context.visitedTypes.has(typeId)) {
var typeAlias = getTypeAliasForTypeLiteral(type);
if (typeAlias) {
- return symbolToTypeNode(typeAlias, context, 67897832);
+ return symbolToTypeNode(typeAlias, context, 788968);
}
else {
return createElidedInformationPlaceholder(context);
@@ -28841,7 +29140,7 @@ var ts;
var typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
var flags_2 = context.flags;
context.flags |= 16;
- var ref = symbolToTypeNode(parent, context, 67897832, typeArgumentSlice);
+ var ref = symbolToTypeNode(parent, context, 788968, typeArgumentSlice);
context.flags = flags_2;
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
}
@@ -28854,7 +29153,7 @@ var ts;
}
var flags = context.flags;
context.flags |= 16;
- var finalRef = symbolToTypeNode(type.symbol, context, 67897832, typeArgumentNodes);
+ var finalRef = symbolToTypeNode(type.symbol, context, 788968, typeArgumentNodes);
context.flags = flags;
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
}
@@ -28967,7 +29266,7 @@ var ts;
trackComputedName(decl.name, saveEnclosingDeclaration, context);
}
}
- var propertyName = symbolToName(propertySymbol, context, 67220415, true);
+ var propertyName = symbolToName(propertySymbol, context, 111551, true);
context.approximateLength += (ts.symbolName(propertySymbol).length + 1);
context.enclosingDeclaration = saveEnclosingDeclaration;
var optionalToken = propertySymbol.flags & 16777216 ? ts.createToken(56) : undefined;
@@ -29108,7 +29407,7 @@ var ts;
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 306);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 307);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -29149,9 +29448,9 @@ var ts;
if (!context.tracker.trackSymbol)
return;
var firstIdentifier = getFirstIdentifier(node.expression);
- var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 67220415 | 1048576, undefined, undefined, true);
+ var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 111551 | 1048576, undefined, undefined, true);
if (name) {
- context.tracker.trackSymbol(name, enclosingDeclaration, 67220415);
+ context.tracker.trackSymbol(name, enclosingDeclaration, 111551);
}
}
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
@@ -29294,7 +29593,7 @@ var ts;
}
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384));
- var isTypeOf = meaning === 67220415;
+ var isTypeOf = meaning === 111551;
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
var typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context);
@@ -29369,7 +29668,7 @@ var ts;
}
}
function typeParameterShadowsNameInScope(escapedName, context) {
- return !!resolveName(context.enclosingDeclaration, escapedName, 67897832, undefined, escapedName, false);
+ return !!resolveName(context.enclosingDeclaration, escapedName, 788968, undefined, escapedName, false);
}
function typeParameterToName(type, context) {
if (context.flags & 4 && context.typeParameterNames) {
@@ -29378,7 +29677,7 @@ var ts;
return cached;
}
}
- var result = symbolToName(type.symbol, context, 67897832, true);
+ var result = symbolToName(type.symbol, context, 788968, true);
if (context.flags & 4) {
var rawtext = result.escapedText;
var i = 0;
@@ -29594,8 +29893,9 @@ var ts;
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 304:
- case 311:
+ case 305:
+ case 312:
+ case 306:
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
case 187:
return isDeclarationVisible(node.parent.parent);
@@ -29663,10 +29963,10 @@ var ts;
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
if (node.parent && node.parent.kind === 255) {
- exportSymbol = resolveName(node, node.escapedText, 67220415 | 67897832 | 1920 | 2097152, undefined, node, false);
+ exportSymbol = resolveName(node, node.escapedText, 111551 | 788968 | 1920 | 2097152, undefined, node, false);
}
else if (node.parent.kind === 258) {
- exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 | 67897832 | 1920 | 2097152);
+ exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 | 788968 | 1920 | 2097152);
}
var result;
if (exportSymbol) {
@@ -29686,7 +29986,7 @@ var ts;
if (ts.isInternalModuleImportEqualsDeclaration(declaration)) {
var internalModuleReference = declaration.moduleReference;
var firstIdentifier = getFirstIdentifier(internalModuleReference);
- var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 67220415 | 67897832 | 1920, undefined, undefined, false);
+ var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 111551 | 788968 | 1920, undefined, undefined, false);
if (importSymbol) {
buildVisibleNodeList(importSymbol.declarations);
}
@@ -30015,7 +30315,7 @@ var ts;
}
return undefined;
}
- function getWidenedTypeFromAssignmentDeclaration(symbol, resolvedSymbol) {
+ function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
var container = ts.getAssignedExpandoInitializer(symbol.valueDeclaration);
if (container) {
var tag = ts.getJSDocTypeTag(container);
@@ -30047,7 +30347,7 @@ var ts;
}
}
if (!ts.isCallExpression(expression)) {
- jsdocType = getJSDocTypeFromAssignmentDeclaration(jsdocType, expression, symbol, declaration);
+ jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
}
if (!jsdocType) {
(types || (types = [])).push((ts.isBinaryExpression(expression) || ts.isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
@@ -30093,8 +30393,8 @@ var ts;
type.objectFlags |= 16384;
return type;
}
- function getJSDocTypeFromAssignmentDeclaration(declaredType, expression, _symbol, declaration) {
- var typeNode = ts.getJSDocType(expression.parent);
+ function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) {
+ var typeNode = ts.getEffectiveTypeAnnotationNode(expression.parent);
if (typeNode) {
var type = getWidenedType(getTypeFromTypeNode(typeNode));
if (!declaredType) {
@@ -30104,6 +30404,12 @@ var ts;
errorNextVariableOrPropertyDeclarationMustHaveSameType(undefined, declaredType, declaration, type);
}
}
+ if (symbol.parent) {
+ var typeNode_2 = ts.getEffectiveTypeAnnotationNode(symbol.parent.valueDeclaration);
+ if (typeNode_2) {
+ return getTypeOfPropertyOfType(getTypeFromTypeNode(typeNode_2), symbol.escapedName);
+ }
+ }
return declaredType;
}
function getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) {
@@ -30336,7 +30642,7 @@ var ts;
}
else if (ts.isInJSFile(declaration) &&
(ts.isCallExpression(declaration) || ts.isBinaryExpression(declaration) || ts.isPropertyAccessExpression(declaration) && ts.isBinaryExpression(declaration.parent))) {
- type = getWidenedTypeFromAssignmentDeclaration(symbol);
+ type = getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (ts.isJSDocPropertyLikeTag(declaration)
|| ts.isPropertyAccessExpression(declaration)
@@ -30350,7 +30656,7 @@ var ts;
return getTypeOfFuncClassEnumModule(symbol);
}
type = ts.isBinaryExpression(declaration.parent) ?
- getWidenedTypeFromAssignmentDeclaration(symbol) :
+ getWidenedTypeForAssignmentDeclaration(symbol) :
tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
}
else if (ts.isPropertyAssignment(declaration)) {
@@ -30445,7 +30751,9 @@ var ts;
}
else {
if (setter) {
- errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ if (!isPrivateWithinAmbient(setter)) {
+ errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ }
}
else {
ts.Debug.assert(!!getter, "there must existed getter as we are current checking either setter or getter in this function");
@@ -30499,7 +30807,7 @@ var ts;
}
else if (declaration.kind === 205 ||
declaration.kind === 190 && declaration.parent.kind === 205) {
- return getWidenedTypeFromAssignmentDeclaration(symbol);
+ return getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
var resolvedModule = resolveExternalModuleSymbol(symbol);
@@ -30508,7 +30816,7 @@ var ts;
return errorType;
}
var exportEquals = getMergedSymbol(symbol.exports.get("export="));
- var type_2 = getWidenedTypeFromAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
+ var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
if (!popTypeResolution()) {
return reportCircularityError(symbol);
}
@@ -30532,7 +30840,7 @@ var ts;
var links = getSymbolLinks(symbol);
if (!links.type) {
var targetSymbol = resolveAlias(symbol);
- links.type = targetSymbol.flags & 67220415
+ links.type = targetSymbol.flags & 111551
? getTypeOfSymbol(targetSymbol)
: errorType;
}
@@ -30649,9 +30957,10 @@ var ts;
case 197:
case 198:
case 243:
- case 310:
case 311:
- case 304:
+ case 312:
+ case 306:
+ case 305:
case 182:
case 176:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
@@ -30883,7 +31192,7 @@ var ts;
for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {
var node = baseTypeNodes_1[_b];
if (ts.isEntityNameExpression(node.expression)) {
- var baseSymbol = resolveEntityName(node.expression, 67897832, true);
+ var baseSymbol = resolveEntityName(node.expression, 788968, true);
if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {
return false;
}
@@ -30923,9 +31232,10 @@ var ts;
if (!pushTypeResolution(symbol, 2)) {
return errorType;
}
- var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 243;
- });
+ var declaration = ts.find(symbol.declarations, ts.isTypeAlias);
+ if (!declaration) {
+ return ts.Debug.fail("Type alias symbol with no valid declaration found");
+ }
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
var type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
if (popTypeResolution()) {
@@ -30938,7 +31248,7 @@ var ts;
}
else {
type = errorType;
- error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
+ error(ts.isJSDocEnumTag(declaration) ? declaration : declaration.name || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
links.declaredType = type;
}
@@ -31202,7 +31512,7 @@ var ts;
else {
symbol.declarations.push(member);
}
- if (symbolFlags & 67220415) {
+ if (symbolFlags & 111551) {
if (!symbol.valueDeclaration || symbol.valueDeclaration.kind !== member.kind) {
symbol.valueDeclaration = member;
}
@@ -31453,7 +31763,7 @@ var ts;
}
var result;
for (var i = 0; i < signatureLists.length; i++) {
- var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true, true);
+ var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, false, true);
if (!match) {
return undefined;
}
@@ -31472,7 +31782,7 @@ var ts;
}
for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {
var signature = _a[_i];
- if (!result || !findMatchingSignature(result, signature, false, true, true)) {
+ if (!result || !findMatchingSignature(result, signature, false, false, true)) {
var unionSignatures = findMatchingSignatures(signatureLists, signature, i);
if (unionSignatures) {
var s = signature;
@@ -31480,7 +31790,7 @@ var ts;
var thisParameter = signature.thisParameter;
var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
if (firstThisParameterOfUnionSignatures) {
- var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2);
+ var thisType = getIntersectionType(ts.mapDefined(unionSignatures, function (sig) { return sig.thisParameter && getTypeOfSymbol(sig.thisParameter); }));
thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
@@ -31518,7 +31828,7 @@ var ts;
if (!left || !right) {
return left || right;
}
- var thisType = getUnionType([getTypeOfSymbol(left), getTypeOfSymbol(right)], 2);
+ var thisType = getIntersectionType([getTypeOfSymbol(left), getTypeOfSymbol(right)]);
return createSymbolWithType(left, thisType);
}
function combineUnionParameters(left, right) {
@@ -32235,7 +32545,7 @@ var ts;
t.flags & 2097152 ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 ? globalStringType :
t.flags & 296 ? globalNumberType :
- t.flags & 2112 ? getGlobalBigIntType(languageVersion >= 8) :
+ t.flags & 2112 ? getGlobalBigIntType(languageVersion >= 99) :
t.flags & 528 ? globalBooleanType :
t.flags & 12288 ? getGlobalESSymbolType(languageVersion >= 2) :
t.flags & 67108864 ? emptyObjectType :
@@ -32550,7 +32860,7 @@ var ts;
var paramSymbol = param.symbol;
var type = ts.isJSDocParameterTag(param) ? (param.typeExpression && param.typeExpression.type) : param.type;
if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) {
- var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 67220415, undefined, undefined, false);
+ var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 111551, undefined, undefined, false);
paramSymbol = resolvedSymbol;
}
if (i === 0 && paramSymbol.escapedName === "this") {
@@ -33077,33 +33387,20 @@ var ts;
if (type) {
return type;
}
- var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
- if (enumTag) {
- var links = getNodeLinks(enumTag);
- if (!pushTypeResolution(enumTag, 5)) {
- return errorType;
- }
- var type_4 = enumTag.typeExpression ? getTypeFromTypeNode(enumTag.typeExpression) : errorType;
- if (!popTypeResolution()) {
- type_4 = errorType;
- error(node, ts.Diagnostics.Enum_type_0_circularly_references_itself, symbolToString(symbol));
- }
- return (links.resolvedEnumType = type_4);
- }
var res = tryGetDeclaredTypeOfSymbol(symbol);
if (res) {
return checkNoTypeArguments(node, symbol) ?
res.flags & 262144 ? getConstrainedTypeVariable(res, node) : getRegularTypeOfLiteralType(res) :
errorType;
}
- if (!(symbol.flags & 67220415 && isJSDocTypeReference(node))) {
+ if (!(symbol.flags & 111551 && isJSDocTypeReference(node))) {
return errorType;
}
var jsdocType = getJSDocTypeReference(node, symbol, typeArguments);
if (jsdocType) {
return jsdocType;
}
- resolveTypeReferenceName(getTypeReferenceName(node), 67897832);
+ resolveTypeReferenceName(getTypeReferenceName(node), 788968);
return getTypeOfSymbol(symbol);
}
function getJSDocTypeReference(node, symbol, typeArguments) {
@@ -33162,7 +33459,7 @@ var ts;
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 297) {
+ while (node && !ts.isStatement(node) && node.kind !== 298) {
var parent = node.parent;
if (parent.kind === 176 && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
@@ -33240,10 +33537,10 @@ var ts;
if (!links.resolvedType) {
var symbol = void 0;
var type = void 0;
- var meaning = 67897832;
+ var meaning = 788968;
if (isJSDocTypeReference(node)) {
type = getIntendedTypeFromJSDocTypeReference(node);
- meaning |= 67220415;
+ meaning |= 111551;
}
if (!type) {
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
@@ -33292,10 +33589,10 @@ var ts;
return type;
}
function getGlobalValueSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67220415, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
+ return getGlobalSymbol(name, 111551, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
}
function getGlobalTypeSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67897832, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
+ return getGlobalSymbol(name, 788968, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
}
function getGlobalSymbol(name, meaning, diagnostic) {
return resolveName(undefined, name, meaning, diagnostic, name, false);
@@ -33363,7 +33660,7 @@ var ts;
}
function getGlobalTypeOrUndefined(name, arity) {
if (arity === void 0) { arity = 0; }
- var symbol = getGlobalSymbol(name, 67897832, undefined);
+ var symbol = getGlobalSymbol(name, 788968, undefined);
return symbol && getTypeOfGlobalSymbol(symbol, arity);
}
function getGlobalExtractSymbol() {
@@ -33692,7 +33989,7 @@ var ts;
if (isEmptyAnonymousObjectType(type)) {
if (!(includes & 8388608)) {
includes |= 8388608;
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
}
else {
@@ -33700,11 +33997,11 @@ var ts;
if (type === wildcardType)
includes |= 4194304;
}
- else if ((strictNullChecks || !(flags & 98304)) && !ts.contains(typeSet, type)) {
+ else if ((strictNullChecks || !(flags & 98304)) && !typeSet.has(type.id.toString())) {
if (type.flags & 109440 && includes & 109440) {
includes |= 67108864;
}
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
includes |= flags & 68943871;
}
@@ -33792,8 +34089,9 @@ var ts;
return result;
}
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
- var typeSet = [];
- var includes = addTypesToIntersection(typeSet, 0, types);
+ var typeMembershipMap = ts.createMap();
+ var includes = addTypesToIntersection(typeMembershipMap, 0, types);
+ var typeSet = ts.arrayFrom(typeMembershipMap.values());
if (includes & 131072 ||
strictNullChecks && includes & 98304 && includes & (524288 | 67108864 | 8388608) ||
includes & 67108864 && includes & (67238908 & ~67108864) ||
@@ -34407,7 +34705,7 @@ var ts;
links.resolvedSymbol = unknownSymbol;
return links.resolvedType = errorType;
}
- var targetMeaning = node.isTypeOf ? 67220415 : node.flags & 2097152 ? 67220415 | 67897832 : 67897832;
+ var targetMeaning = node.isTypeOf ? 111551 : node.flags & 2097152 ? 111551 | 788968 : 788968;
var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
if (!innerModuleSymbol) {
links.resolvedSymbol = unknownSymbol;
@@ -34436,7 +34734,7 @@ var ts;
resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
}
else {
- var errorMessage = targetMeaning === 67220415
+ var errorMessage = targetMeaning === 111551
? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here
: ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
error(node, errorMessage, node.argument.literal.text);
@@ -34450,7 +34748,7 @@ var ts;
function resolveImportSymbolType(node, links, symbol, meaning) {
var resolvedSymbol = resolveSymbol(symbol);
links.resolvedSymbol = resolvedSymbol;
- if (meaning === 67220415) {
+ if (meaning === 111551) {
return links.resolvedType = getTypeOfSymbol(symbol);
}
else {
@@ -34733,9 +35031,9 @@ var ts;
case 166:
case 167:
case 169:
- case 298:
- case 295:
case 299:
+ case 295:
+ case 300:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 180:
return getTypeFromTypeOperatorNode(node);
@@ -34934,7 +35232,8 @@ var ts;
}
function maybeTypeParameterReference(node) {
return !(node.kind === 149 ||
- node.parent.kind === 165 && node.parent.typeArguments && node === node.parent.typeName);
+ node.parent.kind === 165 && node.parent.typeArguments && node === node.parent.typeName ||
+ node.parent.kind === 184 && node.parent.typeArguments && node === node.parent.qualifier);
}
function isTypeParameterPossiblyReferenced(tp, node) {
if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) {
@@ -36049,7 +36348,7 @@ var ts;
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096);
- var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768);
+ var isPerformingExcessPropertyChecks = !isApparentIntersectionConstituent && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768);
if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
@@ -36059,11 +36358,11 @@ var ts;
return 0;
}
}
- if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
+ var isPerformingCommonPropertyChecks = relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 | 524288 | 2097152) && source !== globalObjectType &&
target.flags & (524288 | 2097152) && isWeakType(target) &&
- (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)) &&
- !hasCommonProperties(source, target, isComparingJsxAttributes)) {
+ (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
+ if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
if (reportErrors) {
var calls = getSignaturesOfType(source, 0);
var constructs = getSignaturesOfType(source, 1);
@@ -36088,9 +36387,9 @@ var ts;
else {
if (target.flags & 1048576) {
result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068) && !(target.flags & 131068));
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
var discriminantType = findMatchingDiscriminantType(source, target) || filterPrimitivesIfContainsNonPrimitive(target);
- if (!propertiesRelatedTo(source, discriminantType, reportErrors, undefined)) {
+ if (!propertiesRelatedTo(source, discriminantType, reportErrors, undefined, isIntersectionConstituent)) {
return 0;
}
}
@@ -36098,8 +36397,8 @@ var ts;
else if (target.flags & 2097152) {
isIntersectionConstituent = true;
result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
- if (result && isPerformingExcessPropertyChecks) {
- if (!propertiesRelatedTo(source, target, reportErrors, undefined)) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
+ if (!propertiesRelatedTo(source, target, reportErrors, undefined, false)) {
return 0;
}
}
@@ -36375,7 +36674,7 @@ var ts;
}
return result;
}
- function typeArgumentsRelatedTo(sources, targets, variances, reportErrors) {
+ function typeArgumentsRelatedTo(sources, targets, variances, reportErrors, isIntersectionConstituent) {
if (sources === void 0) { sources = ts.emptyArray; }
if (targets === void 0) { targets = ts.emptyArray; }
if (variances === void 0) { variances = ts.emptyArray; }
@@ -36395,21 +36694,21 @@ var ts;
related = relation === identityRelation ? isRelatedTo(s, t, false) : compareTypesIdentical(s, t);
}
else if (variance === 1) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, undefined, isIntersectionConstituent);
}
else if (variance === 2) {
- related = isRelatedTo(t, s, reportErrors);
+ related = isRelatedTo(t, s, reportErrors, undefined, isIntersectionConstituent);
}
else if (variance === 3) {
related = isRelatedTo(t, s, false);
if (!related) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, undefined, isIntersectionConstituent);
}
}
else {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, undefined, isIntersectionConstituent);
if (related) {
- related &= isRelatedTo(t, s, reportErrors);
+ related &= isRelatedTo(t, s, reportErrors, undefined, isIntersectionConstituent);
}
}
if (!related) {
@@ -36537,7 +36836,7 @@ var ts;
source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
!(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
var variances = getAliasVariances(source.aliasSymbol);
- var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances);
+ var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -36691,10 +36990,13 @@ var ts;
if (relation !== identityRelation) {
source = getApparentType(source);
}
+ else if (isGenericMappedType(source)) {
+ return 0;
+ }
if (ts.getObjectFlags(source) & 4 && ts.getObjectFlags(target) & 4 && source.target === target.target &&
!(ts.getObjectFlags(source) & 8192 || ts.getObjectFlags(target) & 8192)) {
var variances = getVariances(source.target);
- var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances);
+ var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -36712,7 +37014,7 @@ var ts;
}
if (source.flags & (524288 | 2097152) && target.flags & 524288) {
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors, undefined);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, undefined, isIntersectionConstituent);
if (result) {
result &= signaturesRelatedTo(source, target, 0, reportStructuralErrors);
if (result) {
@@ -36743,8 +37045,8 @@ var ts;
}
}
return 0;
- function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
- if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
+ function relateVariances(sourceTypeArguments, targetTypeArguments, variances, isIntersectionConstituent) {
+ if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors, isIntersectionConstituent)) {
return result;
}
if (ts.some(variances, function (v) { return !!(v & 24); })) {
@@ -36825,7 +37127,7 @@ var ts;
return "continue-outer";
if (sourceProperty === targetProperty)
return "continue";
- var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, false);
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, false, false);
if (!related) {
return "continue-outer";
}
@@ -36852,7 +37154,7 @@ var ts;
var result = -1;
for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
var type = matchingTypes_1[_b];
- result &= propertiesRelatedTo(source, type, false, excludedProperties);
+ result &= propertiesRelatedTo(source, type, false, excludedProperties, false);
if (result) {
result &= signaturesRelatedTo(source, type, 0, false);
if (result) {
@@ -36887,7 +37189,7 @@ var ts;
}
return result || properties;
}
- function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48);
var source = getTypeOfSourceProperty(sourceProp);
if (ts.getCheckFlags(targetProp) & 65536 && !getSymbolLinks(targetProp).type) {
@@ -36921,10 +37223,10 @@ var ts;
return result_7;
}
else {
- return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors, undefined, isIntersectionConstituent);
}
}
- function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 || targetPropFlags & 8) {
@@ -36961,7 +37263,7 @@ var ts;
}
return 0;
}
- var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
@@ -36976,7 +37278,7 @@ var ts;
}
return related;
}
- function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties, isIntersectionConstituent) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target, excludedProperties);
}
@@ -37062,7 +37364,7 @@ var ts;
if (!(targetProp.flags & 4194304)) {
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp && sourceProp !== targetProp) {
- var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, isIntersectionConstituent);
if (!related) {
return 0;
}
@@ -37273,23 +37575,24 @@ var ts;
}
}
function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue) {
- var match;
+ var discriminable = target.types.map(function (_) { return undefined; });
for (var _i = 0, discriminators_1 = discriminators; _i < discriminators_1.length; _i++) {
var _a = discriminators_1[_i], getDiscriminatingType = _a[0], propertyName = _a[1];
+ var i = 0;
for (var _b = 0, _c = target.types; _b < _c.length; _b++) {
var type = _c[_b];
var targetType = getTypeOfPropertyOfType(type, propertyName);
if (targetType && related(getDiscriminatingType(), targetType)) {
- if (match) {
- if (type === match)
- continue;
- return defaultValue;
- }
- match = type;
+ discriminable[i] = discriminable[i] === undefined ? true : discriminable[i];
}
+ else {
+ discriminable[i] = false;
+ }
+ i++;
}
}
- return match || defaultValue;
+ var match = discriminable.indexOf(true);
+ return match === -1 || discriminable.indexOf(true, match + 1) !== -1 ? defaultValue : target.types[match];
}
function isWeakType(type) {
if (type.flags & 524288) {
@@ -37976,7 +38279,7 @@ var ts;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
param.parent.parameters.indexOf(param) > -1 &&
- (resolveName(param, param.name.escapedText, 67897832, undefined, param.name.escapedText, true) ||
+ (resolveName(param, param.name.escapedText, 788968, undefined, param.name.escapedText, true) ||
param.name.originalKeywordKind && ts.isTypeNodeKind(param.name.originalKeywordKind))) {
var newName = "arg" + param.parent.parameters.indexOf(param);
errorOrSuggestion(noImplicitAny, declaration, ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, ts.declarationNameToString(param.name));
@@ -38135,7 +38438,7 @@ var ts;
objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
objectFlags & 16 && type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && type.symbol.declarations ||
objectFlags & 32 ||
- type.flags & 3145728 && couldUnionOrIntersectionContainTypeVariables(type));
+ type.flags & 3145728 && !(type.flags & 1024) && couldUnionOrIntersectionContainTypeVariables(type));
}
function couldUnionOrIntersectionContainTypeVariables(type) {
if (type.couldContainTypeVariables === undefined) {
@@ -38271,6 +38574,8 @@ var ts;
var visited;
var bivariant = false;
var propagationType;
+ var inferenceMatch = false;
+ var inferenceIncomplete = false;
var allowComplexConstraintInference = true;
inferFromTypes(originalSource, originalTarget);
function inferFromTypes(source, target) {
@@ -38288,32 +38593,42 @@ var ts;
inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
return;
}
- if (source.flags & 1048576 && target.flags & 1048576 && !(source.flags & 1024 && target.flags & 1024) ||
- source.flags & 2097152 && target.flags & 2097152) {
- if (source === target) {
- for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
- var t = _a[_i];
- inferFromTypes(t, t);
- }
- return;
+ if (source === target && source.flags & 3145728) {
+ for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ inferFromTypes(t, t);
}
- var matchingTypes = void 0;
- for (var _b = 0, _c = source.types; _b < _c.length; _b++) {
- var t = _c[_b];
- if (typeIdenticalToSomeType(t, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t);
- inferFromTypes(t, t);
- }
- else if (t.flags & (256 | 128)) {
- var b = getBaseTypeOfLiteralType(t);
- if (typeIdenticalToSomeType(b, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t, b);
- }
+ return;
+ }
+ if (target.flags & 1048576) {
+ if (source.flags & 1048576) {
+ var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
+ var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
}
+ source = getUnionType(sources);
+ target = getUnionType(targets);
}
- if (matchingTypes) {
- source = removeTypesFromUnionOrIntersection(source, matchingTypes);
- target = removeTypesFromUnionOrIntersection(target, matchingTypes);
+ else {
+ if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
+ return;
+ if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
+ return;
+ }
+ }
+ else if (target.flags & 2097152 && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
+ if (source.flags & 2097152) {
+ var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
+ }
+ source = getIntersectionType(sources);
+ target = getIntersectionType(targets);
+ }
+ else if (!(source.flags & 1048576)) {
+ if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
+ return;
}
}
else if (target.flags & (8388608 | 33554432)) {
@@ -38350,25 +38665,26 @@ var ts;
clearCachedInferences(inferences);
}
}
+ inferenceMatch = true;
return;
}
else {
var simplified = getSimplifiedType(target, false);
if (simplified !== target) {
- inferFromTypesOnce(source, simplified);
+ invokeOnce(source, simplified, inferFromTypes);
}
else if (target.flags & 8388608) {
var indexType = getSimplifiedType(target.indexType, false);
if (indexType.flags & 63176704) {
var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, false), indexType, false);
if (simplified_1 && simplified_1 !== target) {
- inferFromTypesOnce(source, simplified_1);
+ invokeOnce(source, simplified_1, inferFromTypes);
}
}
}
}
}
- if (ts.getObjectFlags(source) & 4 && ts.getObjectFlags(target) & 4 && source.target === target.target) {
+ if (ts.getObjectFlags(source) & 4 && ts.getObjectFlags(target) & 4 && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
inferFromTypeArguments(source.typeArguments || ts.emptyArray, target.typeArguments || ts.emptyArray, getVariances(source.target));
}
else if (source.flags & 4194304 && target.flags & 4194304) {
@@ -38397,15 +38713,15 @@ var ts;
}
else if (target.flags & 16777216 && !contravariant) {
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
- inferToMultipleTypes(source, targetTypes, false);
+ inferToMultipleTypes(source, targetTypes, target.flags);
}
else if (target.flags & 3145728) {
- inferToMultipleTypes(source, target.types, !!(target.flags & 2097152));
+ inferToMultipleTypes(source, target.types, target.flags);
}
else if (source.flags & 1048576) {
var sourceTypes = source.types;
- for (var _d = 0, sourceTypes_3 = sourceTypes; _d < sourceTypes_3.length; _d++) {
- var sourceType = sourceTypes_3[_d];
+ for (var _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) {
+ var sourceType = sourceTypes_3[_e];
inferFromTypes(sourceType, target);
}
}
@@ -38419,34 +38735,59 @@ var ts;
source = apparentSource;
}
if (source.flags & (524288 | 2097152)) {
- var key = source.id + "," + target.id;
- if (visited && visited.get(key)) {
- return;
- }
- (visited || (visited = ts.createMap())).set(key, true);
- var isNonConstructorObject = target.flags & 524288 &&
- !(ts.getObjectFlags(target) & 16 && target.symbol && target.symbol.flags & 32);
- var symbol = isNonConstructorObject ? target.symbol : undefined;
- if (symbol) {
- if (ts.contains(symbolStack, symbol)) {
- return;
- }
- (symbolStack || (symbolStack = [])).push(symbol);
- inferFromObjectTypes(source, target);
- symbolStack.pop();
- }
- else {
- inferFromObjectTypes(source, target);
+ invokeOnce(source, target, inferFromObjectTypes);
+ }
+ }
+ }
+ function invokeOnce(source, target, action) {
+ var key = source.id + "," + target.id;
+ var status = visited && visited.get(key);
+ if (status !== undefined) {
+ if (status & 1)
+ inferenceMatch = true;
+ if (status & 2)
+ inferenceIncomplete = true;
+ return;
+ }
+ (visited || (visited = ts.createMap())).set(key, 0);
+ var saveInferenceMatch = inferenceMatch;
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceMatch = false;
+ inferenceIncomplete = false;
+ action(source, target);
+ visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0));
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ }
+ function inferFromMatchingType(source, targets, matches) {
+ var matched = false;
+ for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
+ var t = targets_1[_i];
+ if (matches(source, t)) {
+ inferFromTypes(source, t);
+ matched = true;
+ }
+ }
+ return matched;
+ }
+ function inferFromMatchingTypes(sources, targets, matches) {
+ var matchedSources;
+ var matchedTargets;
+ for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
+ var t = targets_2[_i];
+ for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
+ var s = sources_1[_a];
+ if (matches(s, t)) {
+ inferFromTypes(s, t);
+ matchedSources = ts.appendIfUnique(matchedSources, s);
+ matchedTargets = ts.appendIfUnique(matchedTargets, t);
}
}
}
- function inferFromTypesOnce(source, target) {
- var key = source.id + "," + target.id;
- if (!visited || !visited.get(key)) {
- (visited || (visited = ts.createMap())).set(key, true);
- inferFromTypes(source, target);
- }
- }
+ return [
+ matchedSources ? ts.filter(sources, function (t) { return !ts.contains(matchedSources, t); }) : sources,
+ matchedTargets ? ts.filter(targets, function (t) { return !ts.contains(matchedTargets, t); }) : targets,
+ ];
}
function inferFromTypeArguments(sourceTypes, targetTypes, variances) {
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
@@ -38480,22 +38821,57 @@ var ts;
}
return undefined;
}
- function inferToMultipleTypes(source, targets, isIntersection) {
+ function inferToMultipleTypes(source, targets, targetFlags) {
var typeVariableCount = 0;
- for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
- var t = targets_1[_i];
- if (getInferenceInfoForType(t)) {
- typeVariableCount++;
+ if (targetFlags & 1048576) {
+ var nakedTypeVariable = void 0;
+ var sources = source.flags & 1048576 ? source.types : [source];
+ var matched_1 = new Array(sources.length);
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceIncomplete = false;
+ for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
+ var t = targets_3[_i];
+ if (getInferenceInfoForType(t)) {
+ nakedTypeVariable = t;
+ typeVariableCount++;
+ }
+ else {
+ for (var i = 0; i < sources.length; i++) {
+ var saveInferenceMatch = inferenceMatch;
+ inferenceMatch = false;
+ inferFromTypes(sources[i], t);
+ if (inferenceMatch)
+ matched_1[i] = true;
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ }
+ }
}
- else {
- inferFromTypes(source, t);
+ var inferenceComplete = !inferenceIncomplete;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ if (typeVariableCount === 1 && inferenceComplete) {
+ var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; });
+ if (unmatched.length) {
+ inferFromTypes(getUnionType(unmatched), nakedTypeVariable);
+ return;
+ }
}
}
- if (isIntersection ? typeVariableCount === 1 : typeVariableCount !== 0) {
+ else {
+ for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
+ var t = targets_4[_a];
+ if (getInferenceInfoForType(t)) {
+ typeVariableCount++;
+ }
+ else {
+ inferFromTypes(source, t);
+ }
+ }
+ }
+ if (targetFlags & 2097152 ? typeVariableCount === 1 : typeVariableCount > 0) {
var savePriority = priority;
priority |= 1;
- for (var _a = 0, targets_2 = targets; _a < targets_2.length; _a++) {
- var t = targets_2[_a];
+ for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
+ var t = targets_5[_b];
if (getInferenceInfoForType(t)) {
inferFromTypes(source, t);
}
@@ -38545,6 +38921,23 @@ var ts;
return false;
}
function inferFromObjectTypes(source, target) {
+ var isNonConstructorObject = target.flags & 524288 &&
+ !(ts.getObjectFlags(target) & 16 && target.symbol && target.symbol.flags & 32);
+ var symbol = isNonConstructorObject ? target.symbol : undefined;
+ if (symbol) {
+ if (ts.contains(symbolStack, symbol)) {
+ inferenceIncomplete = true;
+ return;
+ }
+ (symbolStack || (symbolStack = [])).push(symbol);
+ inferFromObjectTypesWorker(source, target);
+ symbolStack.pop();
+ }
+ else {
+ inferFromObjectTypesWorker(source, target);
+ }
+ }
+ function inferFromObjectTypesWorker(source, target) {
if (isGenericMappedType(source) && isGenericMappedType(target)) {
inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target));
inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
@@ -38639,24 +39032,12 @@ var ts;
}
}
}
- function typeIdenticalToSomeType(type, types) {
- for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
- var t = types_11[_i];
- if (isTypeIdenticalTo(t, type)) {
- return true;
- }
- }
- return false;
+ function isTypeOrBaseIdenticalTo(s, t) {
+ return isTypeIdenticalTo(s, t) || !!(s.flags & (128 | 256)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t);
}
- function removeTypesFromUnionOrIntersection(type, typesToRemove) {
- var reducedTypes = [];
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (!typeIdenticalToSomeType(t, typesToRemove)) {
- reducedTypes.push(t);
- }
- }
- return type.flags & 1048576 ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);
+ function isTypeCloselyMatchedBy(s, t) {
+ return !!(s.flags & 524288 && t.flags & 524288 && s.symbol && s.symbol === t.symbol ||
+ s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol);
}
function hasPrimitiveConstraint(type) {
var constraint = getConstraintOfTypeParameter(type);
@@ -38789,7 +39170,7 @@ var ts;
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 | 1048576, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node), false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
+ resolveName(node, node.escapedText, 111551 | 1048576, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node), false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
}
@@ -38965,8 +39346,8 @@ var ts;
}
function getTypeFactsOfTypes(types) {
var result = 0;
- for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
- var t = types_12[_i];
+ for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
+ var t = types_11[_i];
result |= getTypeFacts(t);
}
return result;
@@ -39323,8 +39704,8 @@ var ts;
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var t = types_13[_i];
+ for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
+ var t = types_12[_i];
if (!(t.flags & 131072)) {
if (!(ts.getObjectFlags(t) & 256)) {
return false;
@@ -40122,8 +40503,11 @@ var ts;
}
return type;
}
+ function isExportOrExportExpression(location) {
+ return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); });
+ }
function markAliasReferenced(symbol, location) {
- if (isNonLocalAlias(symbol, 67220415) && !isInTypeQuery(location) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {
+ if (isNonLocalAlias(symbol, 111551) && !isInTypeQuery(location) && ((compilerOptions.preserveConstEnums && isExportOrExportExpression(location)) || !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol)))) {
markAliasSymbolAsReferenced(symbol);
}
}
@@ -40825,6 +41209,15 @@ var ts;
}
return false;
}
+ function getContextualIterationType(kind, functionDecl) {
+ var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2);
+ var contextualReturnType = getContextualReturnType(functionDecl);
+ if (contextualReturnType) {
+ return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
+ || undefined;
+ }
+ return undefined;
+ }
function getContextualReturnType(functionDecl) {
var returnType = getReturnTypeFromAnnotation(functionDecl);
if (returnType) {
@@ -40902,7 +41295,7 @@ var ts;
}
else if (ts.isIdentifier(lhs.expression)) {
var id = lhs.expression;
- var parentSymbol = resolveName(id, id.escapedText, 67220415, undefined, id.escapedText, true);
+ var parentSymbol = resolveName(id, id.escapedText, 111551, undefined, id.escapedText, true);
if (parentSymbol) {
var annotated = ts.getEffectiveTypeAnnotationNode(parentSymbol.valueDeclaration);
if (annotated) {
@@ -41069,9 +41462,12 @@ var ts;
return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 268 && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
function getApparentTypeOfContextualType(node, contextFlags) {
- var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
- if (contextualType) {
- var apparentType = mapType(contextualType, getApparentType, true);
+ var contextualType = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, contextFlags) :
+ getContextualType(node, contextFlags);
+ var instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
+ if (instantiatedType) {
+ var apparentType = mapType(instantiatedType, getApparentType, true);
if (apparentType.flags & 1048576) {
if (ts.isObjectLiteralExpression(node)) {
return discriminateContextualTypeByObjectMembers(node, apparentType);
@@ -41318,9 +41714,7 @@ var ts;
if (typeTagSignature) {
return typeTagSignature;
}
- var type = ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node, 1) :
- getApparentTypeOfContextualType(node, 1);
+ var type = getApparentTypeOfContextualType(node, 1);
if (!type) {
return undefined;
}
@@ -41329,8 +41723,8 @@ var ts;
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var current = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var current = types_13[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -41788,7 +42182,7 @@ var ts;
function getJsxType(name, location) {
var namespace = getJsxNamespaceAt(location);
var exports = namespace && getExportsOfSymbol(namespace);
- var typeSymbol = exports && getSymbol(exports, name, 67897832);
+ var typeSymbol = exports && getSymbol(exports, name, 788968);
return typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType;
}
function getIntrinsicTagSymbol(node) {
@@ -41844,7 +42238,7 @@ var ts;
return getGlobalSymbol(JsxNames.JSX, 1920, undefined);
}
function getNameFromJsxElementAttributesContainer(nameOfAttribPropContainer, jsxNamespace) {
- var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 67897832);
+ var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 788968);
var jsxElementAttribPropInterfaceType = jsxElementAttribPropInterfaceSym && getDeclaredTypeOfSymbol(jsxElementAttribPropInterfaceSym);
var propertiesOfJsxElementAttribPropInterface = jsxElementAttribPropInterfaceType && getPropertiesOfType(jsxElementAttribPropInterfaceType);
if (propertiesOfJsxElementAttribPropInterface) {
@@ -41861,7 +42255,7 @@ var ts;
return undefined;
}
function getJsxLibraryManagedAttributes(jsxNamespace) {
- return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 67897832);
+ return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 788968);
}
function getJsxElementPropertiesName(jsxNamespace) {
return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace);
@@ -41988,10 +42382,10 @@ var ts;
var reactRefErr = diagnostics && compilerOptions.jsx === 2 ? ts.Diagnostics.Cannot_find_name_0 : undefined;
var reactNamespace = getJsxNamespace(node);
var reactLocation = isNodeOpeningLikeElement ? node.tagName : node;
- var reactSym = resolveName(reactLocation, reactNamespace, 67220415, reactRefErr, reactNamespace, true);
+ var reactSym = resolveName(reactLocation, reactNamespace, 111551, reactRefErr, reactNamespace, true);
if (reactSym) {
reactSym.isReferenced = 67108863;
- if (reactSym.flags & 2097152 && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) {
+ if (reactSym.flags & 2097152) {
markAliasSymbolAsReferenced(reactSym);
}
}
@@ -42257,7 +42651,7 @@ var ts;
}
function checkPropertyNotUsedBeforeDeclaration(prop, node, right) {
var valueDeclaration = prop.valueDeclaration;
- if (!valueDeclaration) {
+ if (!valueDeclaration || ts.getSourceFileOfNode(node).isDeclarationFile) {
return;
}
var diagnosticMessage;
@@ -42369,7 +42763,7 @@ var ts;
return prop !== undefined && prop.valueDeclaration && ts.hasModifier(prop.valueDeclaration, 32);
}
function getSuggestedSymbolForNonexistentProperty(name, containingType) {
- return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 67220415);
+ return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 111551);
}
function getSuggestionForNonexistentProperty(name, containingType) {
var suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
@@ -43582,8 +43976,8 @@ var ts;
if (apparentType.flags & 1048576) {
var types = apparentType.types;
var hasSignatures = false;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var constituent = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var constituent = types_14[_i];
var signatures = getSignaturesOfType(constituent, kind);
if (signatures.length !== 0) {
hasSignatures = true;
@@ -43719,8 +44113,8 @@ var ts;
function createSignatureForJSXIntrinsic(node, result) {
var namespace = getJsxNamespaceAt(node);
var exports = namespace && getExportsOfSymbol(namespace);
- var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832);
- var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832, node);
+ var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968);
+ var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968, node);
var declaration = ts.createFunctionTypeNode(undefined, [ts.createParameter(undefined, undefined, undefined, "props", undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, undefined) : ts.createKeywordTypeNode(121));
var parameterSymbol = createSymbol(1, "props");
parameterSymbol.type = result;
@@ -43904,7 +44298,7 @@ var ts;
if (!globalESSymbol) {
return false;
}
- return globalESSymbol === resolveName(left, "Symbol", 67220415, undefined, undefined, false);
+ return globalESSymbol === resolveName(left, "Symbol", 111551, undefined, undefined, false);
}
function checkImportCallExpression(node) {
if (!checkGrammarArguments(node.arguments))
@@ -43960,7 +44354,7 @@ var ts;
}
if (!ts.isIdentifier(node.expression))
return ts.Debug.fail();
- var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 67220415, undefined, undefined, true);
+ var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 111551, undefined, undefined, true);
if (resolvedRequire === requireSymbol) {
return true;
}
@@ -44067,8 +44461,8 @@ var ts;
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 8 || moduleKind < ts.ModuleKind.ESNext) {
- error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
+ error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system);
}
var file = ts.getSourceFileOfNode(node);
ts.Debug.assert(!!(file.flags & 1048576), "Containing file is missing import meta node flag.");
@@ -44344,7 +44738,7 @@ var ts;
nextType && isUnitType(nextType)) {
var contextualType = !contextualSignature ? undefined :
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
- getReturnTypeOfSignature(contextualSignature);
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
if (isGenerator) {
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0, isAsync);
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1, isAsync);
@@ -44362,7 +44756,7 @@ var ts;
nextType = getWidenedType(nextType);
}
if (isGenerator) {
- return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || unknownType, isAsync);
+ return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || getContextualIterationType(2, func) || unknownType, isAsync);
}
else {
return isAsync
@@ -44452,8 +44846,8 @@ var ts;
var operandType = getTypeOfExpression(node.expression.expression);
var witnesses = getSwitchClauseTypeOfWitnesses(node);
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, true);
- var type_5 = getBaseConstraintOfType(operandType) || operandType;
- return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072);
+ var type_4 = getBaseConstraintOfType(operandType) || operandType;
+ return !!(filterType(type_4, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072);
}
var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
@@ -44767,7 +45161,11 @@ var ts;
}
}
var operandType = checkExpression(node.expression);
- return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ var awaitedType = checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ if (awaitedType === operandType && awaitedType !== errorType && !(operandType.flags & 3)) {
+ addErrorOrSuggestion(false, ts.createDiagnosticForNode(node, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
+ }
+ return awaitedType;
}
function checkPrefixUnaryExpression(node) {
var operandType = checkExpression(node.operand);
@@ -44847,8 +45245,8 @@ var ts;
}
if (type.flags & 3145728) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -44946,7 +45344,7 @@ var ts;
error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
else {
- if (languageVersion < 8) {
+ if (languageVersion < 99) {
checkExternalEmitHelpers(property, 4);
}
var nonRestNames = [];
@@ -45283,7 +45681,7 @@ var ts;
var propType = getTypeOfSymbol(prop);
if (propType.symbol && propType.symbol.flags & 32) {
var name = prop.escapedName;
- var symbol = resolveName(prop.valueDeclaration, name, 67897832, undefined, name, false);
+ var symbol = resolveName(prop.valueDeclaration, name, 788968, undefined, name, false);
if (symbol && symbol.declarations.some(ts.isJSDocTypedefTag)) {
grammarErrorOnNode(symbol.declarations[0], ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
return grammarErrorOnNode(prop.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
@@ -45417,7 +45815,7 @@ var ts;
}
var isAsync = (functionFlags & 2) !== 0;
if (node.asteriskToken) {
- if (isAsync && languageVersion < 8) {
+ if (isAsync && languageVersion < 99) {
checkExternalEmitHelpers(node, 53248);
}
if (!isAsync && languageVersion < 2 && compilerOptions.downlevelIteration) {
@@ -45443,7 +45841,7 @@ var ts;
return getIterationTypeOfGeneratorFunctionReturnType(2, returnType, isAsync)
|| anyType;
}
- return anyType;
+ return getContextualIterationType(2, func) || anyType;
}
function checkConditionalExpression(node, checkMode) {
checkTruthinessExpression(node.condition);
@@ -45731,7 +46129,8 @@ var ts;
var ok = (node.parent.kind === 190 && node.parent.expression === node) ||
(node.parent.kind === 191 && node.parent.expression === node) ||
((node.kind === 73 || node.kind === 149) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 168 && node.parent.exprName === node));
+ (node.parent.kind === 168 && node.parent.exprName === node)) ||
+ (node.parent.kind === 258 && (compilerOptions.preserveConstEnums || node.flags & 4194304));
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -45981,7 +46380,7 @@ var ts;
}
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4)) {
- if ((functionFlags & 3) === 3 && languageVersion < 8) {
+ if ((functionFlags & 3) === 3 && languageVersion < 99) {
checkExternalEmitHelpers(node, 12288);
}
if ((functionFlags & 3) === 2 && languageVersion < 4) {
@@ -46063,7 +46462,7 @@ var ts;
addName(names, name, memberName, 3);
break;
case 157:
- addName(names, name, memberName, 4);
+ addName(names, name, memberName, 8);
break;
}
}
@@ -46072,8 +46471,8 @@ var ts;
function addName(names, location, name, meaning) {
var prev = names.get(name);
if (prev) {
- if (prev & 4) {
- if (meaning !== 4) {
+ if (prev & 8) {
+ if (meaning !== 8) {
error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));
}
}
@@ -46575,6 +46974,7 @@ var ts;
}
var duplicateFunctionDeclaration = false;
var multipleConstructorImplementation = false;
+ var hasNonAmbientClass = false;
for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
var current = declarations_4[_i];
var node = current;
@@ -46583,6 +46983,9 @@ var ts;
if (inAmbientContextOrInterface) {
previousDeclaration = undefined;
}
+ if ((node.kind === 241 || node.kind === 210) && !inAmbientContext) {
+ hasNonAmbientClass = true;
+ }
if (node.kind === 240 || node.kind === 157 || node.kind === 156 || node.kind === 158) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
@@ -46624,6 +47027,11 @@ var ts;
error(ts.getNameOfDeclaration(declaration), ts.Diagnostics.Duplicate_function_implementation);
});
}
+ if (hasNonAmbientClass && !isConstructor && symbol.flags & 16) {
+ ts.forEach(declarations, function (declaration) {
+ addDuplicateDeclarationError(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Duplicate_identifier_0, ts.symbolName(symbol), ts.filter(declarations, function (d) { return d !== declaration; }));
+ });
+ }
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&
!ts.hasModifier(lastSeenNonAmbientDeclaration, 128) && !lastSeenNonAmbientDeclaration.questionToken) {
reportImplementationExpectedError(lastSeenNonAmbientDeclaration);
@@ -46698,8 +47106,9 @@ var ts;
switch (d.kind) {
case 242:
case 243:
- case 311:
- case 304:
+ case 312:
+ case 305:
+ case 306:
return 2;
case 245:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0
@@ -46773,9 +47182,6 @@ var ts;
}
function checkAwaitedType(type, errorNode, diagnosticMessage, arg0) {
var awaitedType = getAwaitedType(type, errorNode, diagnosticMessage, arg0);
- if (awaitedType === type && !(type.flags & 3)) {
- addErrorOrSuggestion(false, ts.createDiagnosticForNode(errorNode, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
- }
return awaitedType || errorType;
}
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -46846,7 +47252,7 @@ var ts;
error(returnTypeNode, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
return;
}
- var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415, true);
+ var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 111551, true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
if (promiseConstructorName.kind === 73 && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(false)) {
@@ -46866,7 +47272,7 @@ var ts;
return;
}
var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
- var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 67220415);
+ var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 111551);
if (collidingSymbol) {
error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, ts.idText(rootName), ts.entityNameToString(promiseConstructorName));
return;
@@ -46916,7 +47322,7 @@ var ts;
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 73 ? 67897832 : 1920) | 2097152;
+ var meaning = (typeName.kind === 73 ? 788968 : 1920) | 2097152;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, undefined, undefined, true);
if (rootSymbol
&& rootSymbol.flags & 2097152
@@ -46948,8 +47354,8 @@ var ts;
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
while (typeNode.kind === 178) {
typeNode = typeNode.type;
}
@@ -47576,7 +47982,7 @@ var ts;
}
}
if (node.kind === 187) {
- if (node.parent.kind === 185 && languageVersion < 8) {
+ if (node.parent.kind === 185 && languageVersion < 99) {
checkExternalEmitHelpers(node, 4);
}
if (node.propertyName && node.propertyName.kind === 150) {
@@ -47771,7 +48177,7 @@ var ts;
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 | 2)) === 2 && languageVersion < 8) {
+ if ((functionFlags & (4 | 2)) === 2 && languageVersion < 99) {
checkExternalEmitHelpers(node, 32768);
}
}
@@ -48752,7 +49158,7 @@ var ts;
}
function checkKindsOfPropertyMemberOverrides(type, baseType) {
var baseProperties = getPropertiesOfType(baseType);
- for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
+ basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304) {
@@ -48761,44 +49167,52 @@ var ts;
var derived = getTargetSymbol(getPropertyOfObjectType(type, base.escapedName));
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration.");
- if (derived) {
- if (derived === base) {
- var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
- if (baseDeclarationFlags & 128 && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128))) {
- if (derivedClassDecl.kind === 210) {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
- }
- else {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
+ if (derived === base) {
+ var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
+ if (baseDeclarationFlags & 128 && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128))) {
+ for (var _a = 0, _b = getBaseTypes(type); _a < _b.length; _a++) {
+ var otherBaseType = _b[_a];
+ if (otherBaseType === baseType)
+ continue;
+ var baseSymbol = getPropertyOfObjectType(otherBaseType, base.escapedName);
+ var derivedElsewhere = baseSymbol && getTargetSymbol(baseSymbol);
+ if (derivedElsewhere && derivedElsewhere !== base) {
+ continue basePropertyCheck;
}
}
- }
- else {
- var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
- if (baseDeclarationFlags & 8 || derivedDeclarationFlags & 8) {
- continue;
- }
- if (isPrototypeProperty(base) || base.flags & 98308 && derived.flags & 98308) {
- continue;
- }
- var errorMessage = void 0;
- if (isPrototypeProperty(base)) {
- if (derived.flags & 98304) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
- }
- else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
- }
- }
- else if (base.flags & 98304) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ if (derivedClassDecl.kind === 210) {
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
}
- error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
}
}
+ else {
+ var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
+ if (baseDeclarationFlags & 8 || derivedDeclarationFlags & 8) {
+ continue;
+ }
+ if (isPrototypeProperty(base) || base.flags & 98308 && derived.flags & 98308) {
+ continue;
+ }
+ var errorMessage = void 0;
+ if (isPrototypeProperty(base)) {
+ if (derived.flags & 98304) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
+ }
+ }
+ else if (base.flags & 98304) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
+ }
}
}
function checkInheritedPropertiesAreIdentical(type, typeNode) {
@@ -49295,9 +49709,10 @@ var ts;
function checkAliasSymbol(node) {
var symbol = getSymbolOfNode(node);
var target = resolveAlias(symbol);
- if (target !== unknownSymbol) {
- var excludedMeanings = (symbol.flags & (67220415 | 1048576) ? 67220415 : 0) |
- (symbol.flags & 67897832 ? 67897832 : 0) |
+ var shouldSkipWithJSExpandoTargets = symbol.flags & 67108864;
+ if (!shouldSkipWithJSExpandoTargets && target !== unknownSymbol) {
+ var excludedMeanings = (symbol.flags & (111551 | 1048576) ? 111551 : 0) |
+ (symbol.flags & 788968 ? 788968 : 0) |
(symbol.flags & 1920 ? 1920 : 0);
if (target.flags & excludedMeanings) {
var message = node.kind === 258 ?
@@ -49307,7 +49722,7 @@ var ts;
}
if (compilerOptions.isolatedModules
&& node.kind === 258
- && !(target.flags & 67220415)
+ && !(target.flags & 111551)
&& !(node.flags & 4194304)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
}
@@ -49358,13 +49773,13 @@ var ts;
if (node.moduleReference.kind !== 260) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
- if (target.flags & 67220415) {
+ if (target.flags & 111551) {
var moduleName = getFirstIdentifier(node.moduleReference);
- if (!(resolveEntityName(moduleName, 67220415 | 1920).flags & 1920)) {
+ if (!(resolveEntityName(moduleName, 111551 | 1920).flags & 1920)) {
error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
}
}
- if (target.flags & 67897832) {
+ if (target.flags & 788968) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
}
}
@@ -49418,12 +49833,16 @@ var ts;
}
if (!node.parent.parent.moduleSpecifier) {
var exportedName = node.propertyName || node.name;
- var symbol = resolveName(exportedName, exportedName.escapedText, 67220415 | 67897832 | 1920 | 2097152, undefined, undefined, true);
+ var symbol = resolveName(exportedName, exportedName.escapedText, 111551 | 788968 | 1920 | 2097152, undefined, undefined, true);
if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
}
else {
markExportAsReferenced(node);
+ var target = symbol && (symbol.flags & 2097152 ? resolveAlias(symbol) : symbol);
+ if (!target || target === unknownSymbol || target.flags & 111551) {
+ checkExpressionCached(node.propertyName || node.name);
+ }
}
}
}
@@ -49445,7 +49864,15 @@ var ts;
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
if (node.expression.kind === 73) {
- markExportAsReferenced(node);
+ var id = node.expression;
+ var sym = resolveEntityName(id, 67108863, true, true, node);
+ if (sym) {
+ markAliasReferenced(sym, id);
+ var target = sym.flags & 2097152 ? resolveAlias(sym) : sym;
+ if (target === unknownSymbol || target.flags & 111551) {
+ checkExpressionCached(node.expression);
+ }
+ }
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, true);
}
@@ -49507,13 +49934,6 @@ var ts;
links.exportsChecked = true;
}
}
- function isNotAccessor(declaration) {
- return !ts.isAccessor(declaration);
- }
- function isNotOverload(declaration) {
- return (declaration.kind !== 240 && declaration.kind !== 157) ||
- !!declaration.body;
- }
function checkSourceElement(node) {
if (node) {
var saveCurrentNode = currentNode;
@@ -49591,16 +50011,17 @@ var ts;
return checkInferType(node);
case 184:
return checkImportType(node);
- case 301:
+ case 302:
return checkJSDocAugmentsTag(node);
- case 311:
- case 304:
- return checkJSDocTypeAliasTag(node);
- case 310:
- return checkJSDocTemplateTag(node);
- case 309:
- return checkJSDocTypeTag(node);
+ case 312:
+ case 305:
case 306:
+ return checkJSDocTypeAliasTag(node);
+ case 311:
+ return checkJSDocTemplateTag(node);
+ case 310:
+ return checkJSDocTypeTag(node);
+ case 307:
return checkJSDocParameterTag(node);
case 295:
checkJSDocFunctionType(node);
@@ -49608,7 +50029,7 @@ var ts;
case 292:
case 290:
case 291:
- case 298:
+ case 299:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
@@ -49906,7 +50327,7 @@ var ts;
case 241:
case 242:
if (!isStatic) {
- copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832);
+ copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968);
}
break;
case 197:
@@ -50045,7 +50466,7 @@ var ts;
}
}
if (entityName.parent.kind === 255 && ts.isEntityNameExpression(entityName)) {
- var success = resolveEntityName(entityName, 67220415 | 67897832 | 1920 | 2097152, true);
+ var success = resolveEntityName(entityName, 111551 | 788968 | 1920 | 2097152, true);
if (success && success !== unknownSymbol) {
return success;
}
@@ -50069,9 +50490,9 @@ var ts;
if (isHeritageClauseElementIdentifier(entityName)) {
var meaning = 0;
if (entityName.parent.kind === 212) {
- meaning = 67897832;
+ meaning = 788968;
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
- meaning |= 67220415;
+ meaning |= 111551;
}
}
else {
@@ -50083,10 +50504,10 @@ var ts;
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 306) {
+ if (entityName.parent.kind === 307) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 151 && entityName.parent.parent.kind === 310) {
+ if (entityName.parent.kind === 151 && entityName.parent.parent.kind === 311) {
ts.Debug.assert(!ts.isInJSFile(entityName));
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -50100,7 +50521,7 @@ var ts;
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
- return resolveEntityName(entityName, 67220415, false, true);
+ return resolveEntityName(entityName, 111551, false, true);
}
else if (entityName.kind === 190 || entityName.kind === 149) {
var links = getNodeLinks(entityName);
@@ -50117,7 +50538,7 @@ var ts;
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 165 ? 67897832 : 1920;
+ var meaning = entityName.parent.kind === 165 ? 788968 : 1920;
return resolveEntityName(entityName, meaning, false, true);
}
if (entityName.parent.kind === 164) {
@@ -50216,14 +50637,14 @@ var ts;
}
function getShorthandAssignmentValueSymbol(location) {
if (location && location.kind === 277) {
- return resolveEntityName(location.name, 67220415 | 2097152);
+ return resolveEntityName(location.name, 111551 | 2097152);
}
return undefined;
}
function getExportSpecifierLocalTargetSymbol(node) {
return node.parent.parent.moduleSpecifier ?
getExternalModuleMember(node.parent.parent, node) :
- resolveEntityName(node.propertyName || node.name, 67220415 | 67897832 | 1920 | 2097152);
+ resolveEntityName(node.propertyName || node.name, 111551 | 788968 | 1920 | 2097152);
}
function getTypeOfNode(node) {
if (node.flags & 8388608) {
@@ -50385,13 +50806,13 @@ var ts;
var symbolLinks = getSymbolLinks(moduleSymbol);
if (symbolLinks.exportsSomeValue === undefined) {
symbolLinks.exportsSomeValue = hasExportAssignment
- ? !!(moduleSymbol.flags & 67220415)
+ ? !!(moduleSymbol.flags & 111551)
: ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue);
}
return symbolLinks.exportsSomeValue;
function isValue(s) {
s = resolveSymbol(s);
- return s && !!(s.flags & 67220415);
+ return s && !!(s.flags & 111551);
}
}
function isNameOfModuleOrEnumDeclaration(node) {
@@ -50426,7 +50847,7 @@ var ts;
var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
if (node) {
var symbol = getReferencedValueSymbol(node);
- if (isNonLocalAlias(symbol, 67220415)) {
+ if (isNonLocalAlias(symbol, 111551)) {
return getDeclarationOfAliasSymbol(symbol);
}
}
@@ -50443,7 +50864,7 @@ var ts;
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
- if (resolveName(container.parent, symbol.escapedName, 67220415, undefined, undefined, false)) {
+ if (resolveName(container.parent, symbol.escapedName, 111551, undefined, undefined, false)) {
links.isDeclarationWithCollidingName = true;
}
else if (nodeLinks_1.flags & 262144) {
@@ -50515,7 +50936,7 @@ var ts;
if (target === unknownSymbol) {
return true;
}
- return !!(target.flags & 67220415) &&
+ return !!(target.flags & 111551) &&
(compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));
}
function isConstEnumOrConstEnumOnlyModule(s) {
@@ -50529,7 +50950,7 @@ var ts;
}
var target = getSymbolLinks(symbol).target;
if (target && ts.getModifierFlags(node) & 1 &&
- target.flags & 67220415 && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
+ target.flags & 111551 && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
return true;
}
}
@@ -50571,7 +50992,7 @@ var ts;
if (!symbol || !(symbol.flags & 16)) {
return false;
}
- return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 67220415 && ts.isPropertyAccessExpression(p.valueDeclaration); });
+ return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 111551 && p.valueDeclaration && ts.isPropertyAccessExpression(p.valueDeclaration); });
}
function getPropertiesOfContainerFunction(node) {
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
@@ -50622,8 +51043,8 @@ var ts;
if (!location)
return ts.TypeReferenceSerializationKind.Unknown;
}
- var valueSymbol = resolveEntityName(typeName, 67220415, true, false, location);
- var typeSymbol = resolveEntityName(typeName, 67897832, true, false, location);
+ var valueSymbol = resolveEntityName(typeName, 111551, true, false, location);
+ var typeSymbol = resolveEntityName(typeName, 788968, true, false, location);
if (valueSymbol && valueSymbol === typeSymbol) {
var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(false);
if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) {
@@ -50724,7 +51145,7 @@ var ts;
location = getDeclarationContainer(parent);
}
}
- return resolveName(location, reference.escapedText, 67220415 | 1048576 | 2097152, undefined, undefined, true);
+ return resolveName(location, reference.escapedText, 111551 | 1048576 | 2097152, undefined, undefined, true);
}
function getReferencedValueDeclaration(referenceIn) {
if (!ts.isGeneratedIdentifier(referenceIn)) {
@@ -50745,7 +51166,7 @@ var ts;
return false;
}
function literalTypeToNode(type, enclosing, tracker) {
- var enumResult = type.flags & 1024 ? nodeBuilder.symbolToExpression(type.symbol, 67220415, enclosing, undefined, tracker)
+ var enumResult = type.flags & 1024 ? nodeBuilder.symbolToExpression(type.symbol, 111551, enclosing, undefined, tracker)
: type === trueType ? ts.createTrue() : type === falseType && ts.createFalse();
return enumResult || ts.createLiteral(type.value);
}
@@ -50846,9 +51267,9 @@ var ts;
if (!fileToDirective) {
return undefined;
}
- var meaning = 67897832 | 1920;
+ var meaning = 788968 | 1920;
if ((node.kind === 73 && isInTypeQuery(node)) || (node.kind === 190 && !isInHeritageClause(node))) {
- meaning = 67220415 | 1048576;
+ meaning = 111551 | 1048576;
}
var symbol = resolveEntityName(node, meaning, true);
return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
@@ -51042,7 +51463,7 @@ var ts;
for (var helper = 1; helper <= 131072; helper <<= 1) {
if (uncheckedHelpers & helper) {
var name = getHelperName(helper);
- var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 67220415);
+ var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 111551);
if (!symbol) {
error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name);
}
@@ -51646,14 +52067,16 @@ var ts;
if (name.kind === 8) {
checkGrammarNumericLiteral(name);
}
+ currentKind = 4;
+ break;
case 157:
- currentKind = 1;
+ currentKind = 8;
break;
case 159:
- currentKind = 2;
+ currentKind = 1;
break;
case 160:
- currentKind = 4;
+ currentKind = 2;
break;
default:
throw ts.Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
@@ -51667,11 +52090,11 @@ var ts;
seen.set(effectiveName, currentKind);
}
else {
- if (currentKind === 1 && existingKind === 1) {
+ if ((currentKind & 12) && (existingKind & 12)) {
grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name));
}
- else if ((currentKind & 6) && (existingKind & 6)) {
- if (existingKind !== 6 && currentKind !== existingKind) {
+ else if ((currentKind & 3) && (existingKind & 3)) {
+ if (existingKind !== 3 && currentKind !== existingKind) {
seen.set(effectiveName, currentKind | existingKind);
}
else {
@@ -51761,42 +52184,38 @@ var ts;
return false;
}
function checkGrammarAccessor(accessor) {
- var kind = accessor.kind;
- if (languageVersion < 1) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ if (!(accessor.flags & 4194304)) {
+ if (languageVersion < 1) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ }
+ if (accessor.body === undefined && !ts.hasModifier(accessor, 128)) {
+ return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
+ }
}
- else if (accessor.flags & 4194304) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);
- }
- else if (accessor.body === undefined && !ts.hasModifier(accessor, 128)) {
- return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
- }
- else if (accessor.body && ts.hasModifier(accessor, 128)) {
+ if (accessor.body && ts.hasModifier(accessor, 128)) {
return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
}
- else if (accessor.typeParameters) {
+ if (accessor.typeParameters) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
- else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 159 ?
+ if (!doesAccessorHaveCorrectParameterCount(accessor)) {
+ return grammarErrorOnNode(accessor.name, accessor.kind === 159 ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 160) {
+ if (accessor.kind === 160) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
- else {
- var parameter = accessor.parameters[0];
- if (parameter.dotDotDotToken) {
- return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
- }
- else if (parameter.questionToken) {
- return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
- }
- else if (parameter.initializer) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
- }
+ var parameter = ts.Debug.assertDefined(ts.getSetAccessorValueParameter(accessor), "Return value does not match parameter count assertion.");
+ if (parameter.dotDotDotToken) {
+ return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
+ }
+ if (parameter.questionToken) {
+ return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
+ }
+ if (parameter.initializer) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
}
}
return false;
@@ -52198,11 +52617,8 @@ var ts;
}
function checkGrammarStatementInAmbientContext(node) {
if (node.flags & 4194304) {
- if (ts.isAccessor(node.parent)) {
- return getNodeLinks(node).hasReportedStatementInAmbientContext = true;
- }
var links = getNodeLinks(node);
- if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) {
+ if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
}
if (node.parent.kind === 219 || node.parent.kind === 246 || node.parent.kind === 285) {
@@ -52240,7 +52656,7 @@ var ts;
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 8) {
+ if (languageVersion < 99) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -52287,6 +52703,13 @@ var ts;
}
}
ts.createTypeChecker = createTypeChecker;
+ function isNotAccessor(declaration) {
+ return !ts.isAccessor(declaration);
+ }
+ function isNotOverload(declaration) {
+ return (declaration.kind !== 240 && declaration.kind !== 157) ||
+ !!declaration.body;
+ }
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
case 254:
@@ -54227,27 +54650,27 @@ var ts;
}
ts.createJSDocTypeExpression = createJSDocTypeExpression;
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(309, "type");
+ var tag = createJSDocTag(310, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
}
ts.createJSDocTypeTag = createJSDocTypeTag;
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(307, "returns");
+ var tag = createJSDocTag(308, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
}
ts.createJSDocReturnTag = createJSDocReturnTag;
function createJSDocThisTag(typeExpression) {
- var tag = createJSDocTag(308, "this");
+ var tag = createJSDocTag(309, "this");
tag.typeExpression = typeExpression;
return tag;
}
ts.createJSDocThisTag = createJSDocThisTag;
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(306, "param");
+ var tag = createJSDocTag(307, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -54256,7 +54679,7 @@ var ts;
}
ts.createJSDocParamTag = createJSDocParamTag;
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(297);
+ var node = createSynthesizedNode(298);
node.comment = comment;
node.tags = tags;
return node;
@@ -54605,28 +55028,28 @@ var ts;
}
ts.getMutableClone = getMutableClone;
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(314);
+ var node = createSynthesizedNode(315);
node.original = original;
setTextRange(node, original);
return node;
}
ts.createNotEmittedStatement = createNotEmittedStatement;
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(318);
+ var node = createSynthesizedNode(319);
node.emitNode = {};
node.original = original;
return node;
}
ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker;
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(317);
+ var node = createSynthesizedNode(318);
node.emitNode = {};
node.original = original;
return node;
}
ts.createMergeDeclarationMarker = createMergeDeclarationMarker;
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(315);
+ var node = createSynthesizedNode(316);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -54642,7 +55065,7 @@ var ts;
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 316) {
+ if (node.kind === 317) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27) {
@@ -54652,7 +55075,7 @@ var ts;
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(316);
+ var node = createSynthesizedNode(317);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -55387,51 +55810,55 @@ var ts;
return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location);
}
ts.createExpressionForJsxFragment = createExpressionForJsxFragment;
- function getHelperName(name) {
+ function getUnscopedHelperName(name) {
return ts.setEmitFlags(ts.createIdentifier(name), 4096 | 2);
}
- ts.getHelperName = getHelperName;
+ ts.getUnscopedHelperName = getUnscopedHelperName;
ts.valuesHelper = {
name: "typescript:values",
+ importName: "__values",
scoped: false,
- text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };"
+ text: "\n var __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n };"
};
function createValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.valuesHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__values"), undefined, [expression]), location);
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__values"), undefined, [expression]), location);
}
ts.createValuesHelper = createValuesHelper;
ts.readHelper = {
name: "typescript:read",
+ importName: "__read",
scoped: false,
text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };"
};
function createReadHelper(context, iteratorRecord, count, location) {
context.requestEmitHelper(ts.readHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__read"), undefined, count !== undefined
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__read"), undefined, count !== undefined
? [iteratorRecord, ts.createLiteral(count)]
: [iteratorRecord]), location);
}
ts.createReadHelper = createReadHelper;
ts.spreadHelper = {
name: "typescript:spread",
+ importName: "__spread",
scoped: false,
text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };"
};
function createSpreadHelper(context, argumentList, location) {
context.requestEmitHelper(ts.readHelper);
context.requestEmitHelper(ts.spreadHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spread"), undefined, argumentList), location);
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spread"), undefined, argumentList), location);
}
ts.createSpreadHelper = createSpreadHelper;
ts.spreadArraysHelper = {
name: "typescript:spreadArrays",
+ importName: "__spreadArrays",
scoped: false,
text: "\n var __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n };"
};
function createSpreadArraysHelper(context, argumentList, location) {
context.requestEmitHelper(ts.spreadArraysHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spreadArrays"), undefined, argumentList), location);
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spreadArrays"), undefined, argumentList), location);
}
ts.createSpreadArraysHelper = createSpreadArraysHelper;
function createForOfBindingStatement(node, boundValue) {
@@ -56034,7 +56461,7 @@ var ts;
case 191:
case 190:
case 214:
- case 315:
+ case 316:
node = node.expression;
continue;
}
@@ -56051,7 +56478,7 @@ var ts;
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
return node.kind === 205 && node.operatorToken.kind === 27 ||
- node.kind === 316;
+ node.kind === 317;
}
ts.isCommaSequence = isCommaSequence;
function isOuterExpression(node, kinds) {
@@ -56063,7 +56490,7 @@ var ts;
case 213:
case 214:
return (kinds & 2) !== 0;
- case 315:
+ case 316:
return (kinds & 4) !== 0;
}
return false;
@@ -56100,7 +56527,7 @@ var ts;
case 195: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
case 213: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
case 214: return ts.updateNonNullExpression(outerExpression, expression);
- case 315: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 316: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
function isIgnorableParen(node) {
@@ -56129,6 +56556,54 @@ var ts;
return emitNode && emitNode.externalHelpersModuleName;
}
ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function hasRecordedExternalHelpers(sourceFile) {
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return !!emitNode && (!!emitNode.externalHelpersModuleName || !!emitNode.externalHelpers);
+ }
+ ts.hasRecordedExternalHelpers = hasRecordedExternalHelpers;
+ function createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) {
+ if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
+ var namedBindings = void 0;
+ var moduleKind = ts.getEmitModuleKind(compilerOptions);
+ if (moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) {
+ var helpers = ts.getEmitHelpers(sourceFile);
+ if (helpers) {
+ var helperNames = [];
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!helper.scoped) {
+ var importName = helper.importName;
+ if (importName) {
+ ts.pushIfUnique(helperNames, importName);
+ }
+ }
+ }
+ if (ts.some(helperNames)) {
+ helperNames.sort(ts.compareStringsCaseSensitive);
+ namedBindings = ts.createNamedImports(ts.map(helperNames, function (name) { return ts.isFileLevelUniqueName(sourceFile, name)
+ ? ts.createImportSpecifier(undefined, ts.createIdentifier(name))
+ : ts.createImportSpecifier(ts.createIdentifier(name), getUnscopedHelperName(name)); }));
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = ts.getOrCreateEmitNode(parseNode);
+ emitNode.externalHelpers = true;
+ }
+ }
+ }
+ else {
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
+ if (externalHelpersModuleName) {
+ namedBindings = ts.createNamespaceImport(externalHelpersModuleName);
+ }
+ }
+ if (namedBindings) {
+ var externalHelpersImportDeclaration = ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, namedBindings), ts.createLiteral(ts.externalHelpersModuleNameText));
+ ts.addEmitFlags(externalHelpersImportDeclaration, 67108864);
+ return externalHelpersImportDeclaration;
+ }
+ }
+ }
+ ts.createExternalHelpersImportDeclarationIfNeeded = createExternalHelpersImportDeclarationIfNeeded;
function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(node, compilerOptions)) {
var externalHelpersModuleName = getExternalHelpersModuleName(node);
@@ -56143,8 +56618,8 @@ var ts;
if (!create) {
var helpers = ts.getEmitHelpers(node);
if (helpers) {
- for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
- var helper = helpers_2[_i];
+ for (var _i = 0, helpers_3 = helpers; _i < helpers_3.length; _i++) {
+ var helper = helpers_3[_i];
if (!helper.scoped) {
create = true;
break;
@@ -56735,9 +57210,9 @@ var ts;
return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
case 285:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
- case 315:
- return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
case 316:
+ return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 317:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
return node;
@@ -56775,7 +57250,7 @@ var ts;
case 221:
case 211:
case 237:
- case 314:
+ case 315:
break;
case 149:
result = reduceNode(node.left, cbNode, result);
@@ -57140,10 +57615,10 @@ var ts;
case 285:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 315:
+ case 316:
result = reduceNode(node.expression, cbNode, result);
break;
- case 316:
+ case 317:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -57859,13 +58334,19 @@ var ts;
var hasExportDefault = false;
var exportEquals;
var hasExportStarsToExportValues = false;
- var hasImportStarOrImportDefault = false;
+ var hasImportStar = false;
+ var hasImportDefault = false;
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
case 250:
externalImports.push(node);
- hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
+ if (!hasImportStar && getImportNeedsImportStarHelper(node)) {
+ hasImportStar = true;
+ }
+ if (!hasImportDefault && getImportNeedsImportDefaultHelper(node)) {
+ hasImportDefault = true;
+ }
break;
case 249:
if (node.moduleReference.kind === 260) {
@@ -57950,10 +58431,8 @@ var ts;
break;
}
}
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault);
- var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault);
if (externalHelpersImportDeclaration) {
- ts.addEmitFlags(externalHelpersImportDeclaration, 67108864);
externalImports.unshift(externalHelpersImportDeclaration);
}
return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
@@ -58374,6 +58853,7 @@ var ts;
}
ts.restHelper = {
name: "typescript:rest",
+ importName: "__rest",
scoped: false,
text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
@@ -58394,7 +58874,7 @@ var ts;
}
}
}
- return ts.createCall(ts.getHelperName("__rest"), undefined, [
+ return ts.createCall(ts.getUnscopedHelperName("__rest"), undefined, [
value,
ts.setTextRange(ts.createArrayLiteral(propertyNames), location)
]);
@@ -59223,8 +59703,8 @@ var ts;
}
function serializeTypeList(types) {
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
while (typeNode.kind === 178) {
typeNode = typeNode.type;
}
@@ -59323,7 +59803,7 @@ var ts;
return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object"));
}
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 8
+ return languageVersion < 99
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -60031,36 +60511,39 @@ var ts;
}
}
context.requestEmitHelper(ts.decorateHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray), location);
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__decorate"), undefined, argumentsArray), location);
}
ts.decorateHelper = {
name: "typescript:decorate",
+ importName: "__decorate",
scoped: false,
priority: 2,
text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
};
function createMetadataHelper(context, metadataKey, metadataValue) {
context.requestEmitHelper(ts.metadataHelper);
- return ts.createCall(ts.getHelperName("__metadata"), undefined, [
+ return ts.createCall(ts.getUnscopedHelperName("__metadata"), undefined, [
ts.createLiteral(metadataKey),
metadataValue
]);
}
ts.metadataHelper = {
name: "typescript:metadata",
+ importName: "__metadata",
scoped: false,
priority: 3,
text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
};
function createParamHelper(context, expression, parameterOffset, location) {
context.requestEmitHelper(ts.paramHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__param"), undefined, [
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__param"), undefined, [
ts.createLiteral(parameterOffset),
expression
]), location);
}
ts.paramHelper = {
name: "typescript:param",
+ importName: "__param",
scoped: false,
priority: 4,
text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
@@ -60370,6 +60853,7 @@ var ts;
var capturedSuperProperties;
var hasSuperElementAccess;
var substitutedSuperAccessors = [];
+ var topLevel;
var previousOnEmitNode = context.onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
@@ -60379,10 +60863,23 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitor(node) {
if ((node.transformFlags & 32) === 0) {
return node;
@@ -60393,11 +60890,11 @@ var ts;
case 202:
return visitAwaitExpression(node);
case 157:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 240:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198:
return visitArrowFunction(node);
case 190:
@@ -60410,6 +60907,12 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 159:
+ case 160:
+ case 158:
+ case 241:
+ case 210:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -60604,7 +61107,7 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.body.statements, false, visitor);
- statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
var emitSuperHelpers = languageVersion >= 2 && resolver.getNodeCheckFlags(node) & (4096 | 2048);
if (emitSuperHelpers) {
@@ -60628,7 +61131,7 @@ var ts;
result = block;
}
else {
- var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
+ var expression = createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
var declarations = endLexicalEnvironment();
if (ts.some(declarations)) {
var block = ts.convertToFunctionBody(expression);
@@ -60782,16 +61285,17 @@ var ts;
ts.createSuperAccessVariableStatement = createSuperAccessVariableStatement;
ts.awaiterHelper = {
name: "typescript:awaiter",
+ importName: "__awaiter",
scoped: false,
priority: 5,
- text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
};
- function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ function createAwaiterHelper(context, hasLexicalThis, hasLexicalArguments, promiseConstructor, body) {
context.requestEmitHelper(ts.awaiterHelper);
var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(40), undefined, undefined, [], undefined, body);
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 | 524288;
- return ts.createCall(ts.getHelperName("__awaiter"), undefined, [
- ts.createThis(),
+ return ts.createCall(ts.getUnscopedHelperName("__awaiter"), undefined, [
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
generatorFunc
@@ -60819,9 +61323,11 @@ var ts;
context.onEmitNode = onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
+ var exportedVariableStatement = false;
var enabledSubstitutions;
var enclosingFunctionFlags;
var enclosingSuperContainerFlags = 0;
+ var topLevel;
var capturedSuperProperties;
var hasSuperElementAccess;
var substitutedSuperAccessors = [];
@@ -60830,6 +61336,8 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ exportedVariableStatement = false;
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
@@ -60846,6 +61354,18 @@ var ts;
}
return node;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitorWorker(node, noDestructuringValue) {
if ((node.transformFlags & 16) === 0) {
return node;
@@ -60865,6 +61385,8 @@ var ts;
return visitBinaryExpression(node, noDestructuringValue);
case 275:
return visitCatchClause(node);
+ case 220:
+ return visitVariableStatement(node);
case 238:
return visitVariableDeclaration(node);
case 228:
@@ -60874,17 +61396,17 @@ var ts;
case 201:
return visitVoidExpression(node);
case 158:
- return visitConstructorDeclaration(node);
+ return doOutsideOfTopLevel(visitConstructorDeclaration, node);
case 157:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 159:
- return visitGetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitGetAccessorDeclaration, node);
case 160:
- return visitSetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitSetAccessorDeclaration, node);
case 240:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198:
return visitArrowFunction(node);
case 152:
@@ -60903,6 +61425,9 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 241:
+ case 210:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -60971,7 +61496,16 @@ var ts;
if (objects.length && objects[0].kind !== 189) {
objects.unshift(ts.createObjectLiteral());
}
- return createAssignHelper(context, objects);
+ var expression = objects[0];
+ if (objects.length > 1) {
+ for (var i = 1; i < objects.length; i++) {
+ expression = createAssignHelper(context, [expression, objects[i]]);
+ }
+ return expression;
+ }
+ else {
+ return createAssignHelper(context, objects);
+ }
}
return ts.visitEachChild(node, visitor, context);
}
@@ -61007,9 +61541,29 @@ var ts;
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitVariableStatement(node) {
+ if (ts.hasModifier(node, 1)) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = true;
+ var visited = ts.visitEachChild(node, visitor, context);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitVariableDeclaration(node) {
+ if (exportedVariableStatement) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = false;
+ var visited = visitVariableDeclarationWorker(node, true);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return visitVariableDeclarationWorker(node, false);
+ }
+ function visitVariableDeclarationWorker(node, exportedVariableStatement) {
if (ts.isBindingPattern(node.name) && node.name.transformFlags & 8192) {
- return ts.flattenDestructuringBinding(node, visitor, context, 1);
+ return ts.flattenDestructuringBinding(node, visitor, context, 1, undefined, exportedVariableStatement);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -61188,7 +61742,7 @@ var ts;
var savedHasSuperElementAccess = hasSuperElementAccess;
capturedSuperProperties = ts.createUnderscoreEscapedMap();
hasSuperElementAccess = false;
- var returnStatement = ts.createReturn(createAsyncGeneratorHelper(context, ts.createFunctionExpression(undefined, ts.createToken(40), node.name && ts.getGeneratedNameForNode(node.name), undefined, [], undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))));
+ var returnStatement = ts.createReturn(createAsyncGeneratorHelper(context, ts.createFunctionExpression(undefined, ts.createToken(40), node.name && ts.getGeneratedNameForNode(node.name), undefined, [], undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !topLevel));
var emitSuperHelpers = languageVersion >= 2 && resolver.getNodeCheckFlags(node) & (4096 | 2048);
if (emitSuperHelpers) {
enableSubstitutionForAsyncMethodsWithSuper();
@@ -61340,6 +61894,7 @@ var ts;
ts.transformES2018 = transformES2018;
ts.assignHelper = {
name: "typescript:assign",
+ importName: "__assign",
scoped: false,
priority: 1,
text: "\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"
@@ -61349,51 +61904,55 @@ var ts;
return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), undefined, attributesSegments);
}
context.requestEmitHelper(ts.assignHelper);
- return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments);
+ return ts.createCall(ts.getUnscopedHelperName("__assign"), undefined, attributesSegments);
}
ts.createAssignHelper = createAssignHelper;
ts.awaitHelper = {
name: "typescript:await",
+ importName: "__await",
scoped: false,
text: "\n var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }"
};
function createAwaitHelper(context, expression) {
context.requestEmitHelper(ts.awaitHelper);
- return ts.createCall(ts.getHelperName("__await"), undefined, [expression]);
+ return ts.createCall(ts.getUnscopedHelperName("__await"), undefined, [expression]);
}
ts.asyncGeneratorHelper = {
name: "typescript:asyncGenerator",
+ importName: "__asyncGenerator",
scoped: false,
text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n };"
};
- function createAsyncGeneratorHelper(context, generatorFunc) {
+ function createAsyncGeneratorHelper(context, generatorFunc, hasLexicalThis) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncGeneratorHelper);
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144;
- return ts.createCall(ts.getHelperName("__asyncGenerator"), undefined, [
- ts.createThis(),
+ return ts.createCall(ts.getUnscopedHelperName("__asyncGenerator"), undefined, [
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
ts.createIdentifier("arguments"),
generatorFunc
]);
}
ts.asyncDelegator = {
name: "typescript:asyncDelegator",
+ importName: "__asyncDelegator",
scoped: false,
text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n };"
};
function createAsyncDelegatorHelper(context, expression, location) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncDelegator);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"), undefined, [expression]), location);
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncDelegator"), undefined, [expression]), location);
}
ts.asyncValues = {
name: "typescript:asyncValues",
+ importName: "__asyncValues",
scoped: false,
text: "\n var __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n };"
};
function createAsyncValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.asyncValues);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"), undefined, [expression]), location);
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncValues"), undefined, [expression]), location);
}
})(ts || (ts = {}));
var ts;
@@ -63959,26 +64518,28 @@ var ts;
ts.transformES2015 = transformES2015;
function createExtendsHelper(context, name) {
context.requestEmitHelper(ts.extendsHelper);
- return ts.createCall(ts.getHelperName("__extends"), undefined, [
+ return ts.createCall(ts.getUnscopedHelperName("__extends"), undefined, [
name,
ts.createFileLevelUniqueName("_super")
]);
}
function createTemplateObjectHelper(context, cooked, raw) {
context.requestEmitHelper(ts.templateObjectHelper);
- return ts.createCall(ts.getHelperName("__makeTemplateObject"), undefined, [
+ return ts.createCall(ts.getUnscopedHelperName("__makeTemplateObject"), undefined, [
cooked,
raw
]);
}
ts.extendsHelper = {
name: "typescript:extends",
+ importName: "__extends",
scoped: false,
priority: 0,
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
};
ts.templateObjectHelper = {
name: "typescript:makeTemplateObject",
+ importName: "__makeTemplateObject",
scoped: false,
priority: 0,
text: "\n var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n };"
@@ -65677,10 +66238,11 @@ var ts;
ts.transformGenerators = transformGenerators;
function createGeneratorHelper(context, body) {
context.requestEmitHelper(ts.generatorHelper);
- return ts.createCall(ts.getHelperName("__generator"), undefined, [ts.createThis(), body]);
+ return ts.createCall(ts.getUnscopedHelperName("__generator"), undefined, [ts.createThis(), body]);
}
ts.generatorHelper = {
name: "typescript:generator",
+ importName: "__generator",
scoped: false,
priority: 6,
text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
@@ -65916,9 +66478,9 @@ var ts;
return visitFunctionDeclaration(node);
case 241:
return visitClassDeclaration(node);
- case 317:
- return visitMergeDeclarationMarker(node);
case 318:
+ return visitMergeDeclarationMarker(node);
+ case 319:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -66037,7 +66599,7 @@ var ts;
var promise = ts.createNew(ts.createIdentifier("Promise"), undefined, [func]);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), undefined, [ts.getHelperName("__importStar")]);
+ return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), undefined, [ts.getUnscopedHelperName("__importStar")]);
}
return promise;
}
@@ -66046,7 +66608,7 @@ var ts;
var requireCall = ts.createCall(ts.createIdentifier("require"), undefined, arg ? [arg] : []);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- requireCall = ts.createCall(ts.getHelperName("__importStar"), undefined, [requireCall]);
+ requireCall = ts.createCall(ts.getUnscopedHelperName("__importStar"), undefined, [requireCall]);
}
var func;
if (languageVersion >= 2) {
@@ -66066,11 +66628,11 @@ var ts;
}
if (ts.getImportNeedsImportStarHelper(node)) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.getHelperName("__importStar"), undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importStar"), undefined, [innerExpr]);
}
if (ts.getImportNeedsImportDefaultHelper(node)) {
context.requestEmitHelper(ts.importDefaultHelper);
- return ts.createCall(ts.getHelperName("__importDefault"), undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importDefault"), undefined, [innerExpr]);
}
return innerExpr;
}
@@ -66554,7 +67116,7 @@ var ts;
function createExportStarHelper(context, module) {
var compilerOptions = context.getCompilerOptions();
return compilerOptions.importHelpers
- ? ts.createCall(ts.getHelperName("__exportStar"), undefined, [module, ts.createIdentifier("exports")])
+ ? ts.createCall(ts.getUnscopedHelperName("__exportStar"), undefined, [module, ts.createIdentifier("exports")])
: ts.createCall(ts.createIdentifier("__export"), undefined, [module]);
}
var dynamicImportUMDHelper = {
@@ -66564,11 +67126,13 @@ var ts;
};
ts.importStarHelper = {
name: "typescript:commonjsimportstar",
+ importName: "__importStar",
scoped: false,
text: "\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};"
};
ts.importDefaultHelper = {
name: "typescript:commonjsimportdefault",
+ importName: "__importDefault",
scoped: false,
text: "\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};"
};
@@ -66589,11 +67153,13 @@ var ts;
context.enableSubstitution(205);
context.enableSubstitution(203);
context.enableSubstitution(204);
+ context.enableSubstitution(215);
context.enableEmitNotification(285);
var moduleInfoMap = [];
var deferredExports = [];
var exportFunctionsMap = [];
var noSubstitutionMap = [];
+ var contextObjectMap = [];
var currentSourceFile;
var moduleInfo;
var exportFunction;
@@ -66612,7 +67178,7 @@ var ts;
moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
exportFunction = ts.createUniqueName("exports");
exportFunctionsMap[id] = exportFunction;
- contextObject = ts.createUniqueName("context");
+ contextObject = contextObjectMap[id] = ts.createUniqueName("context");
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [
@@ -67122,9 +67688,9 @@ var ts;
return visitCatchClause(node);
case 219:
return visitBlock(node);
- case 317:
- return visitMergeDeclarationMarker(node);
case 318:
+ return visitMergeDeclarationMarker(node);
+ case 319:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -67281,6 +67847,7 @@ var ts;
moduleInfo = moduleInfoMap[id];
exportFunction = exportFunctionsMap[id];
noSubstitution = noSubstitutionMap[id];
+ contextObject = contextObjectMap[id];
if (noSubstitution) {
delete noSubstitutionMap[id];
}
@@ -67288,6 +67855,7 @@ var ts;
currentSourceFile = undefined;
moduleInfo = undefined;
exportFunction = undefined;
+ contextObject = undefined;
noSubstitution = undefined;
}
else {
@@ -67338,6 +67906,8 @@ var ts;
case 203:
case 204:
return substituteUnaryExpression(node);
+ case 215:
+ return substituteMetaProperty(node);
}
return node;
}
@@ -67405,6 +67975,12 @@ var ts;
}
return node;
}
+ function substituteMetaProperty(node) {
+ if (ts.isImportMeta(node)) {
+ return ts.createPropertyAccess(contextObject, ts.createIdentifier("meta"));
+ }
+ return node;
+ }
function getExports(name) {
var exportedNames;
if (!ts.isGeneratedIdentifier(name)) {
@@ -67442,20 +68018,18 @@ var ts;
context.onSubstituteNode = onSubstituteNode;
context.enableEmitNotification(285);
context.enableSubstitution(73);
- var currentSourceFile;
+ var helperNameSubstitutions;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
if (node.isDeclarationFile) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
- if (externalHelpersModuleName) {
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(node, compilerOptions);
+ if (externalHelpersImportDeclaration) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.statements);
- var tslibImport = ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- ts.addEmitFlags(tslibImport, 67108864);
- ts.append(statements, tslibImport);
+ ts.append(statements, externalHelpersImportDeclaration);
ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements));
}
@@ -67479,9 +68053,9 @@ var ts;
}
function onEmitNode(hint, node, emitCallback) {
if (ts.isSourceFile(node)) {
- currentSourceFile = node;
+ helperNameSubstitutions = ts.createMap();
previousOnEmitNode(hint, node, emitCallback);
- currentSourceFile = undefined;
+ helperNameSubstitutions = undefined;
}
else {
previousOnEmitNode(hint, node, emitCallback);
@@ -67489,19 +68063,18 @@ var ts;
}
function onSubstituteNode(hint, node) {
node = previousOnSubstituteNode(hint, node);
- if (ts.isIdentifier(node) && hint === 1) {
- return substituteExpressionIdentifier(node);
+ if (helperNameSubstitutions && ts.isIdentifier(node) && ts.getEmitFlags(node) & 4096) {
+ return substituteHelperName(node);
}
return node;
}
- function substituteExpressionIdentifier(node) {
- if (ts.getEmitFlags(node) & 4096) {
- var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
- if (externalHelpersModuleName) {
- return ts.createPropertyAccess(externalHelpersModuleName, node);
- }
+ function substituteHelperName(node) {
+ var name = ts.idText(node);
+ var substitution = helperNameSubstitutions.get(name);
+ if (!substitution) {
+ helperNameSubstitutions.set(name, substitution = ts.createFileLevelUniqueName(name));
}
- return node;
+ return substitution;
}
}
ts.transformES2015Module = transformES2015Module;
@@ -67970,6 +68543,7 @@ var ts;
var currentSourceFile;
var refs;
var libs;
+ var emittedImports;
var resolver = context.getEmitResolver();
var options = context.getCompilerOptions();
var newLine = ts.getNewLineCharacter(options);
@@ -68126,7 +68700,7 @@ var ts;
var statements = ts.visitNodes(node.statements, visitDeclarationStatements);
var combinedStatements = ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
refs.forEach(referenceVisitor);
- var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
+ emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
if (ts.isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) {
combinedStatements = ts.setTextRange(ts.createNodeArray(__spreadArrays(combinedStatements, [createEmptyExports()])), combinedStatements);
}
@@ -68220,13 +68794,13 @@ var ts;
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
}
}
- function ensureParameter(p, modifierMask) {
+ function ensureParameter(p, modifierMask, type) {
var oldDiag;
if (!suppressNewDiagnosticContexts) {
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
}
- var newParam = ts.updateParameter(p, undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56)) : undefined, ensureType(p, p.type, true), ensureNoInitializer(p));
+ var newParam = ts.updateParameter(p, undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56)) : undefined, ensureType(p, type || p.type, true), ensureNoInitializer(p));
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
@@ -68326,6 +68900,30 @@ var ts;
}
return ts.createNodeArray(newParams, params.hasTrailingComma);
}
+ function updateAccessorParamsList(input, isPrivate) {
+ var newParams;
+ if (!isPrivate) {
+ var thisParameter = ts.getThisParameter(input);
+ if (thisParameter) {
+ newParams = [ensureParameter(thisParameter)];
+ }
+ }
+ if (ts.isSetAccessorDeclaration(input)) {
+ var newValueParameter = void 0;
+ if (!isPrivate) {
+ var valueParameter = ts.getSetAccessorValueParameter(input);
+ if (valueParameter) {
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ newValueParameter = ensureParameter(valueParameter, undefined, accessorType);
+ }
+ }
+ if (!newValueParameter) {
+ newValueParameter = ts.createParameter(undefined, undefined, undefined, "value");
+ }
+ newParams = ts.append(newParams, newValueParameter);
+ }
+ return ts.createNodeArray(newParams || ts.emptyArray);
+ }
function ensureTypeParams(node, params) {
return ts.hasModifier(node, 8) ? undefined : ts.visitNodes(params, visitDeclarationSubtree);
}
@@ -68461,6 +69059,9 @@ var ts;
enclosingDeclaration = input;
}
var oldDiag = getSymbolAccessibilityDiagnostic;
+ var canProduceDiagnostic = ts.canProduceDiagnostics(input);
+ var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 || input.kind === 182) && input.parent.kind !== 243);
if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) {
if (ts.hasModifier(input, 8)) {
if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input)
@@ -68468,15 +69069,12 @@ var ts;
return cleanup(ts.createProperty(undefined, ensureModifiers(input), input.name, undefined, undefined, undefined));
}
}
- var canProdiceDiagnostic = ts.canProduceDiagnostics(input);
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input);
}
if (ts.isTypeQueryNode(input)) {
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
- var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 || input.kind === 182) && input.parent.kind !== 243);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
suppressNewDiagnosticContexts = true;
}
@@ -68510,10 +69108,18 @@ var ts;
return cleanup(sig);
}
case 159: {
+ if (input.flags & 4194304) {
+ var isPrivate = ts.hasModifier(input, 8);
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ return cleanup(ts.updateGetAccessor(input, undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, isPrivate), !isPrivate ? ensureType(input, accessorType) : undefined, undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
case 160: {
+ if (input.flags & 4194304) {
+ return cleanup(ts.updateSetAccessor(input, undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasModifier(input, 8)), undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
@@ -68570,13 +69176,13 @@ var ts;
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
function cleanup(returnValue) {
- if (returnValue && canProdiceDiagnostic && ts.hasDynamicName(input)) {
+ if (returnValue && canProduceDiagnostic && ts.hasDynamicName(input)) {
checkName(input);
}
if (isEnclosingDeclaration(input)) {
enclosingDeclaration = previousEnclosingDeclaration;
}
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
if (shouldEnterSuppressNewDiagnosticsContextContext) {
@@ -68907,16 +69513,24 @@ var ts;
}
return maskModifierFlags(node, mask, additions);
}
+ function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) {
+ var accessorType = getTypeAnnotationFromAccessor(node);
+ if (!accessorType && node !== accessors.firstAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.firstAccessor);
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.firstAccessor);
+ }
+ if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
+ }
+ return accessorType;
+ }
function ensureAccessor(node) {
var accessors = resolver.getAllAccessorDeclarations(node);
if (node.kind !== accessors.firstAccessor.kind) {
return;
}
- var accessorType = getTypeAnnotationFromAccessor(node);
- if (!accessorType && accessors.secondAccessor) {
- accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
- getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
- }
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessors);
var prop = ts.createProperty(undefined, maskModifiers(node, undefined, (!accessors.setAccessor) ? 64 : 0), node.name, node.questionToken, ensureType(node, accessorType), undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
@@ -69063,7 +69677,7 @@ var ts;
if (jsx === 2) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 8) {
+ if (languageVersion < 99) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6) {
@@ -69121,7 +69735,7 @@ var ts;
}
ts.noEmitNotification = noEmitNotification;
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(319);
+ var enabledSyntaxKindFeatures = new Array(320);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -70487,30 +71101,30 @@ var ts;
return emitSpreadAssignment(node);
case 279:
return emitEnumMember(node);
- case 306:
- case 312:
- return emitJSDocPropertyLikeTag(node);
case 307:
- case 309:
+ case 313:
+ return emitJSDocPropertyLikeTag(node);
case 308:
- case 305:
- return emitJSDocSimpleTypedTag(node);
- case 301:
- return emitJSDocAugmentsTag(node);
case 310:
- return emitJSDocTemplateTag(node);
+ case 309:
+ case 306:
+ return emitJSDocSimpleTypedTag(node);
+ case 302:
+ return emitJSDocAugmentsTag(node);
case 311:
+ return emitJSDocTemplateTag(node);
+ case 312:
return emitJSDocTypedefTag(node);
- case 304:
+ case 305:
return emitJSDocCallbackTag(node);
- case 299:
- return emitJSDocSignature(node);
- case 298:
- return emitJSDocTypeLiteral(node);
- case 303:
case 300:
+ return emitJSDocSignature(node);
+ case 299:
+ return emitJSDocTypeLiteral(node);
+ case 304:
+ case 301:
return emitJSDocSimpleTag(node);
- case 297:
+ case 298:
return emitJSDoc(node);
}
if (ts.isExpression(node)) {
@@ -70602,9 +71216,9 @@ var ts;
return emitJsxSelfClosingElement(node);
case 265:
return emitJsxFragment(node);
- case 315:
- return emitPartiallyEmittedExpression(node);
case 316:
+ return emitPartiallyEmittedExpression(node);
+ case 317:
return emitCommaList(node);
}
}
@@ -70632,8 +71246,8 @@ var ts;
var helpers = getSortedEmitHelpers(sourceFile);
if (!helpers)
continue;
- for (var _c = 0, helpers_3 = helpers; _c < helpers_3.length; _c++) {
- var helper = helpers_3[_c];
+ for (var _c = 0, helpers_4 = helpers; _c < helpers_4.length; _c++) {
+ var helper = helpers_4[_c];
if (!helper.scoped && !shouldSkip && !bundledHelpers.get(helper.name)) {
bundledHelpers.set(helper.name, true);
(result || (result = [])).push(helper.name);
@@ -70653,12 +71267,12 @@ var ts;
for (var i = 0; i < numNodes; i++) {
var currentNode = bundle ? i < numPrepends ? bundle.prepends[i] : bundle.sourceFiles[i - numPrepends] : node;
var sourceFile = ts.isSourceFile(currentNode) ? currentNode : ts.isUnparsedSource(currentNode) ? undefined : currentSourceFile;
- var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.hasRecordedExternalHelpers(sourceFile));
var shouldBundle = (ts.isSourceFile(currentNode) || ts.isUnparsedSource(currentNode)) && !isOwnFileEmit;
var helpers = ts.isUnparsedSource(currentNode) ? currentNode.helpers : getSortedEmitHelpers(currentNode);
if (helpers) {
- for (var _a = 0, helpers_4 = helpers; _a < helpers_4.length; _a++) {
- var helper = helpers_4[_a];
+ for (var _a = 0, helpers_5 = helpers; _a < helpers_5.length; _a++) {
+ var helper = helpers_5[_a];
if (!helper.scoped) {
if (shouldSkip)
continue;
@@ -71981,7 +72595,7 @@ var ts;
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 309 && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 310 && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -72034,7 +72648,7 @@ var ts;
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 298) {
+ if (tag.typeExpression && tag.typeExpression.kind === 299) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -72163,8 +72777,8 @@ var ts;
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference", data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// ");
if (bundleFileInfo)
@@ -72951,7 +73565,7 @@ var ts;
for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) {
if (node.locals) {
var local = node.locals.get(ts.escapeLeadingUnderscores(name));
- if (local && local.flags & (67220415 | 1048576 | 2097152)) {
+ if (local && local.flags & (111551 | 1048576 | 2097152)) {
return false;
}
}
@@ -73098,7 +73712,7 @@ var ts;
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 314;
+ var isEmittedNode = node.kind !== 315;
var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0 || node.kind === 11;
var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 11;
var savedContainerPos = containerPos;
@@ -73347,7 +73961,7 @@ var ts;
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 314
+ if (node.kind !== 315
&& (emitFlags & 16) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -73360,7 +73974,7 @@ var ts;
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 314
+ if (node.kind !== 315
&& (emitFlags & 32) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -73667,6 +74281,9 @@ var ts;
var createFileWatcher = getCreateFileWatcher(watchLogLevel, watchFile);
var createFilePathWatcher = watchLogLevel === WatchLogLevel.None ? watchFilePath : createFileWatcher;
var createDirectoryWatcher = getCreateFileWatcher(watchLogLevel, watchDirectory);
+ if (watchLogLevel === WatchLogLevel.Verbose && ts.sysLog === ts.noop) {
+ ts.sysLog = function (s) { return log(s); };
+ }
return {
watchFile: function (host, file, callback, pollingInterval, detailInfo1, detailInfo2) {
return createFileWatcher(host, file, callback, pollingInterval, undefined, detailInfo1, detailInfo2, watchFile, log, "FileWatcher", getDetailWatchInfo);
@@ -74186,8 +74803,8 @@ var ts;
}
var resolutions = [];
var cache = ts.createMap();
- for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name = names_1[_i];
+ for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
+ var name = names_2[_i];
var result = void 0;
if (cache.has(name)) {
result = cache.get(name);
@@ -74314,7 +74931,7 @@ var ts;
var resolveModuleNamesWorker;
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
if (host.resolveModuleNames) {
- resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference).map(function (resolved) {
+ resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference, options).map(function (resolved) {
if (!resolved || resolved.extension !== undefined) {
return resolved;
}
@@ -74330,7 +74947,7 @@ var ts;
}
var resolveTypeReferenceDirectiveNamesWorker;
if (host.resolveTypeReferenceDirectives) {
- resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference); };
+ resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference, options); };
}
else {
var loader_2 = function (typesRef, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference).resolvedTypeReferenceDirective; };
@@ -74346,7 +74963,8 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
- var structuralIsReused = tryReuseStructureFromOldProgram();
+ var structuralIsReused;
+ structuralIsReused = tryReuseStructureFromOldProgram();
if (structuralIsReused !== 2) {
processingDefaultLibFiles = [];
processingOtherFiles = [];
@@ -77450,8 +78068,8 @@ var ts;
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
!!redirectedReference;
var seenNamesInFile = ts.createMap();
- for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
- var name = names_2[_i];
+ for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
+ var name = names_3[_i];
var resolution = resolutionsInFile.get(name);
if (!seenNamesInFile.has(name) &&
allFilesHaveInvalidatedResolution || unmatchedRedirects || !resolution || resolution.isInvalidated ||
@@ -77882,7 +78500,7 @@ var ts;
return [ambient];
var info = getInfo(importingSourceFile.path, host);
var moduleSourceFile = ts.getSourceFileOfNode(moduleSymbol.valueDeclaration || ts.getNonAugmentationDeclaration(moduleSymbol));
- var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.fileName, info.getCanonicalFileName, host, redirectTargetsMap);
+ var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.originalFileName, info.getCanonicalFileName, host, redirectTargetsMap);
var preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
var global = ts.mapDefined(modulePaths, function (moduleFileName) { return tryGetModuleNameAsNodeModule(moduleFileName, info, host, compilerOptions); });
return global.length ? global : modulePaths.map(function (moduleFileName) { return getLocalModuleSpecifier(moduleFileName, info, compilerOptions, preferences); });
@@ -77897,7 +78515,7 @@ var ts;
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
var ending = _b.ending, relativePreference = _b.relativePreference;
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
- var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) ||
+ var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
if (!baseUrl || relativePreference === 0) {
return relativePath;
@@ -78016,14 +78634,16 @@ var ts;
}
}
}
- function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) {
+ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
if (normalizedTargetPath === undefined) {
return undefined;
}
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
- return ts.removeFileExtension(relativePath);
+ return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
+ ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
+ : ts.removeFileExtension(relativePath);
}
function tryGetModuleNameAsNodeModule(moduleFileName, _a, host, options) {
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
@@ -78601,10 +79221,22 @@ var ts;
ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFileName, currentDirectory)) :
currentDirectory, false);
compilerHost.resolveModuleNames = host.resolveModuleNames ?
- (function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveModuleNames.apply(host, args);
+ }) :
(function (moduleNames, containingFile, reusedNames, redirectedReference) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); });
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
- (function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveTypeReferenceDirectives.apply(host, args);
+ }) :
(function (typeDirectiveNames, containingFile, redirectedReference) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); });
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
@@ -78806,13 +79438,19 @@ var ts;
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
switch (reloadLevel) {
case ts.ConfigFileProgramReloadLevel.Partial:
- return reloadFileNamesFromConfigFile();
+ ts.perfLogger.logStartUpdateProgram("PartialConfigReload");
+ reloadFileNamesFromConfigFile();
+ break;
case ts.ConfigFileProgramReloadLevel.Full:
- return reloadConfigFile();
+ ts.perfLogger.logStartUpdateProgram("FullConfigReload");
+ reloadConfigFile();
+ break;
default:
+ ts.perfLogger.logStartUpdateProgram("SynchronizeProgram");
synchronizeProgram();
- return;
+ break;
}
+ ts.perfLogger.logStopUpdateProgram("Done");
}
function reloadFileNamesFromConfigFile() {
writeLog("Reloading new file names and options");
@@ -79149,8 +79787,28 @@ var ts;
}
}
function getBuildOrder(state) {
- return state.buildOrder ||
- (state.buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); })));
+ return state.buildOrder || createStateBuildOrder(state);
+ }
+ function createStateBuildOrder(state) {
+ var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
+ if (ts.arrayIsEqualTo(state.buildOrder, buildOrder))
+ return state.buildOrder;
+ state.resolvedConfigFilePaths.clear();
+ var currentProjects = ts.arrayToSet(buildOrder, function (resolved) { return toResolvedConfigFilePath(state, resolved); });
+ var noopOnDelete = { onDeleteValue: ts.noop };
+ ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
+ if (state.watch) {
+ ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
+ ts.mutateMapSkippingNewValues(state.allWatchedWildcardDirectories, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcherOf); } });
+ ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
+ }
+ return state.buildOrder = buildOrder;
}
function getBuildOrderFor(state, project, onlyReferences) {
var resolvedProject = project && resolveProjectName(state, project);
diff --git a/lib/tsserver.js b/lib/tsserver.js
index a68d92a1459..9dc248f6b21 100644
--- a/lib/tsserver.js
+++ b/lib/tsserver.js
@@ -94,7 +94,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.6";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".0-beta";
+ ts.version = ts.versionMajorMinor + ".1-rc";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -1249,6 +1249,18 @@ var ts;
return keys;
}
ts.getOwnKeys = getOwnKeys;
+ function getAllKeys(obj) {
+ var result = [];
+ do {
+ var names = Object.getOwnPropertyNames(obj);
+ for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
+ var name = names_1[_i];
+ pushIfUnique(result, name);
+ }
+ } while (obj = Object.getPrototypeOf(obj));
+ return result;
+ }
+ ts.getAllKeys = getAllKeys;
function getOwnValues(sparseArray) {
var values = [];
for (var key in sparseArray) {
@@ -2388,6 +2400,46 @@ var ts;
})(ts || (ts = {}));
/* @internal */
var ts;
+(function (ts) {
+ var nullLogger = {
+ logEvent: ts.noop,
+ logErrEvent: ts.noop,
+ logPerfEvent: ts.noop,
+ logInfoEvent: ts.noop,
+ logStartCommand: ts.noop,
+ logStopCommand: ts.noop,
+ logStartUpdateProgram: ts.noop,
+ logStopUpdateProgram: ts.noop,
+ logStartUpdateGraph: ts.noop,
+ logStopUpdateGraph: ts.noop,
+ logStartResolveModule: ts.noop,
+ logStopResolveModule: ts.noop,
+ logStartParseSourceFile: ts.noop,
+ logStopParseSourceFile: ts.noop,
+ logStartReadFile: ts.noop,
+ logStopReadFile: ts.noop,
+ logStartBindFile: ts.noop,
+ logStopBindFile: ts.noop,
+ logStartScheduledOperation: ts.noop,
+ logStopScheduledOperation: ts.noop,
+ };
+ // Load optional module to enable Event Tracing for Windows
+ // See https://github.com/microsoft/typescript-etw for more information
+ var etwModule;
+ try {
+ // require() will throw an exception if the module is not installed
+ // It may also return undefined if not installed properly
+ etwModule = require("@microsoft/typescript-etw"); // tslint:disable-line:no-implicit-dependencies
+ }
+ catch (e) {
+ etwModule = undefined;
+ }
+ /** Performance logger that will generate ETW events if possible */
+ ts.perfLogger = etwModule ? etwModule : nullLogger;
+ ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
(function (ts) {
// https://semver.org/#spec-item-2
// > A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative
@@ -3080,32 +3132,34 @@ var ts;
SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType";
SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType";
SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature";
- SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag";
- SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 302] = "JSDocAuthorTag";
- SyntaxKind[SyntaxKind["JSDocClassTag"] = 303] = "JSDocClassTag";
- SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 304] = "JSDocCallbackTag";
- SyntaxKind[SyntaxKind["JSDocEnumTag"] = 305] = "JSDocEnumTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 306] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 307] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocThisTag"] = 308] = "JSDocThisTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 309] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 310] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 311] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 312] = "JSDocPropertyTag";
+ // https://jsdoc.app/about-namepaths.html
+ SyntaxKind[SyntaxKind["JSDocNamepathType"] = 297] = "JSDocNamepathType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 298] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 299] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocSignature"] = 300] = "JSDocSignature";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 301] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 302] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 303] = "JSDocAuthorTag";
+ SyntaxKind[SyntaxKind["JSDocClassTag"] = 304] = "JSDocClassTag";
+ SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 305] = "JSDocCallbackTag";
+ SyntaxKind[SyntaxKind["JSDocEnumTag"] = 306] = "JSDocEnumTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 307] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 308] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 309] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 310] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 311] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 312] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 313] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 313] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 314] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 314] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 315] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 316] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 317] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 318] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 315] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 316] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 317] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 318] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 319] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 319] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 320] = "Count";
// Markers
SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment";
@@ -3133,9 +3187,9 @@ var ts;
SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator";
SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode";
SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 312] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 312] = "LastJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 313] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 301] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 313] = "LastJSDocTagNode";
/* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword";
/* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
@@ -3261,6 +3315,8 @@ var ts;
/* @internal */
TokenFlags[TokenFlags["ContainsSeparator"] = 512] = "ContainsSeparator";
/* @internal */
+ TokenFlags[TokenFlags["UnicodeEscape"] = 1024] = "UnicodeEscape";
+ /* @internal */
TokenFlags[TokenFlags["BinaryOrOctalSpecifier"] = 384] = "BinaryOrOctalSpecifier";
/* @internal */
TokenFlags[TokenFlags["NumericLiteralFlags"] = 1008] = "NumericLiteralFlags";
@@ -3484,32 +3540,32 @@ var ts;
SymbolFlags[SymbolFlags["All"] = 67108863] = "All";
SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum";
SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable";
- SymbolFlags[SymbolFlags["Value"] = 67220415] = "Value";
- SymbolFlags[SymbolFlags["Type"] = 67897832] = "Type";
+ SymbolFlags[SymbolFlags["Value"] = 111551] = "Value";
+ SymbolFlags[SymbolFlags["Type"] = 788968] = "Type";
SymbolFlags[SymbolFlags["Namespace"] = 1920] = "Namespace";
SymbolFlags[SymbolFlags["Module"] = 1536] = "Module";
SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor";
// Variables can be redeclared, but can not redeclare a block-scoped declaration with the
// same name, or any other value that is not a variable, e.g. ValueModule or Class
- SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 67220414] = "FunctionScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 111550] = "FunctionScopedVariableExcludes";
// Block-scoped declarations are not allowed to be re-declared
// they can not merge with anything in the value space
- SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 67220415] = "BlockScopedVariableExcludes";
- SymbolFlags[SymbolFlags["ParameterExcludes"] = 67220415] = "ParameterExcludes";
+ SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 111551] = "BlockScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["ParameterExcludes"] = 111551] = "ParameterExcludes";
SymbolFlags[SymbolFlags["PropertyExcludes"] = 0] = "PropertyExcludes";
- SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 68008959] = "EnumMemberExcludes";
- SymbolFlags[SymbolFlags["FunctionExcludes"] = 67219887] = "FunctionExcludes";
- SymbolFlags[SymbolFlags["ClassExcludes"] = 68008383] = "ClassExcludes";
- SymbolFlags[SymbolFlags["InterfaceExcludes"] = 67897736] = "InterfaceExcludes";
- SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 68008191] = "RegularEnumExcludes";
- SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 68008831] = "ConstEnumExcludes";
+ SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes";
+ SymbolFlags[SymbolFlags["FunctionExcludes"] = 110991] = "FunctionExcludes";
+ SymbolFlags[SymbolFlags["ClassExcludes"] = 899503] = "ClassExcludes";
+ SymbolFlags[SymbolFlags["InterfaceExcludes"] = 788872] = "InterfaceExcludes";
+ SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes";
+ SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes";
SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 110735] = "ValueModuleExcludes";
SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes";
- SymbolFlags[SymbolFlags["MethodExcludes"] = 67212223] = "MethodExcludes";
- SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 67154879] = "GetAccessorExcludes";
- SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 67187647] = "SetAccessorExcludes";
- SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 67635688] = "TypeParameterExcludes";
- SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 67897832] = "TypeAliasExcludes";
+ SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes";
+ SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes";
+ SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes";
+ SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes";
+ SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes";
SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes";
SymbolFlags[SymbolFlags["ModuleMember"] = 2623475] = "ModuleMember";
SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal";
@@ -3837,8 +3893,11 @@ var ts;
ModuleKind[ModuleKind["AMD"] = 2] = "AMD";
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
ModuleKind[ModuleKind["System"] = 4] = "System";
+ // NOTE: ES module kinds should be contiguous to more easily check whether a module kind is *any* ES module kind.
+ // Non-ES module kinds should not come between ES2015 (the earliest ES module kind) and ESNext (the last ES
+ // module kind).
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
- ModuleKind[ModuleKind["ESNext"] = 6] = "ESNext";
+ ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
var JsxEmit;
(function (JsxEmit) {
@@ -3877,9 +3936,9 @@ var ts;
ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018";
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
- ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext";
+ ScriptTarget[ScriptTarget["ESNext"] = 99] = "ESNext";
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
- ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest";
+ ScriptTarget[ScriptTarget["Latest"] = 99] = "Latest";
})(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
var LanguageVariant;
(function (LanguageVariant) {
@@ -4575,6 +4634,38 @@ var ts;
}
}
ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
+ /* @internal */
+ function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
+ var cache = ts.createMap();
+ var callbacksCache = ts.createMultiMap();
+ var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
+ return function (fileName, callback, pollingInterval) {
+ var path = toCanonicalFileName(fileName);
+ var existing = cache.get(path);
+ if (existing) {
+ existing.refCount++;
+ }
+ else {
+ cache.set(path, {
+ watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval),
+ refCount: 1
+ });
+ }
+ callbacksCache.add(path, callback);
+ return {
+ close: function () {
+ var watcher = ts.Debug.assertDefined(cache.get(path));
+ callbacksCache.remove(path, callback);
+ watcher.refCount--;
+ if (watcher.refCount)
+ return;
+ cache.delete(path);
+ ts.closeFileWatcherOf(watcher);
+ }
+ };
+ };
+ }
+ ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
/**
* Returns true if file status changed
*/
@@ -4601,6 +4692,8 @@ var ts;
ts.getFileWatcherEventKind = getFileWatcherEventKind;
/*@internal*/
ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
+ /*@internal*/
+ ts.sysLog = ts.noop;
/**
* Watch the directory recursively using host provided method to watch child directories
* that means if this is recursive watcher, watch the children directories as well
@@ -4741,6 +4834,7 @@ var ts;
var Buffer = require("buffer").Buffer;
var nodeVersion = getNodeMajorVersion();
var isNode4OrLater = nodeVersion >= 4;
+ var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
var platform = _os.platform();
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
var FileSystemEntryKind;
@@ -4751,6 +4845,7 @@ var ts;
var useNonPollingWatchers = process.env.TSC_NONPOLLING_WATCHER;
var tscWatchFile = process.env.TSC_WATCHFILE;
var tscWatchDirectory = process.env.TSC_WATCHDIRECTORY;
+ var fsWatchFile = createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames);
var dynamicPollingWatchFile;
var nodeSystem = {
args: process.argv.slice(2),
@@ -4887,7 +4982,7 @@ var ts;
return useNonPollingWatchers ?
createNonPollingWatchFile() :
// Default to do not use polling interval as it is before this experiment branch
- function (fileName, callback) { return fsWatchFile(fileName, callback); };
+ function (fileName, callback) { return fsWatchFile(fileName, callback, /*pollingInterval*/ undefined); };
}
function getWatchDirectory() {
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
@@ -4961,7 +5056,7 @@ var ts;
return watcher;
}
}
- function fsWatchFile(fileName, callback, pollingInterval) {
+ function fsWatchFileWorker(fileName, callback, pollingInterval) {
_fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
var eventKind;
return {
@@ -5019,6 +5114,12 @@ var ts;
}
function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingWatchFile, pollingInterval) {
var options;
+ var lastDirectoryPartWithDirectorySeparator;
+ var lastDirectoryPart;
+ if (isLinuxOrMacOs) {
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
+ }
/** Watcher for the file system entry depending on whether it is missing or present */
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
watchMissingFileSystemEntry() :
@@ -5035,6 +5136,7 @@ var ts;
* @param createWatcher
*/
function invokeCallbackAndUpdateWatcher(createWatcher) {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
// Call the callback for current directory
callback("rename", "");
// If watcher is not closed, update it
@@ -5059,7 +5161,9 @@ var ts;
}
}
try {
- var presentWatcher = _fs.watch(fileOrDirectory, options, callback);
+ var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
+ callbackChangingToMissingFileSystemEntry :
+ callback);
// Watch the missing file or directory or error
presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
return presentWatcher;
@@ -5071,11 +5175,23 @@ var ts;
return watchPresentFileSystemEntryWithFsWatchFile();
}
}
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
+ return event === "rename" &&
+ (!relativeName ||
+ relativeName === lastDirectoryPart ||
+ relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length) &&
+ !fileSystemEntryExists(fileOrDirectory, entryKind) ?
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
+ callback(event, relativeName);
+ }
/**
* Watch the file or directory using fs.watchFile since fs.watch threw exception
* Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
*/
function watchPresentFileSystemEntryWithFsWatchFile() {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
return fallbackPollingWatchFile(fileOrDirectory, createFileWatcherCallback(callback), pollingInterval);
}
/**
@@ -5108,7 +5224,7 @@ var ts;
function createWatchDirectoryUsing(fsWatchFile) {
return function (directoryName, callback) { return fsWatchFile(directoryName, function () { return callback(directoryName); }, PollingInterval.Medium); };
}
- function readFile(fileName, _encoding) {
+ function readFileWorker(fileName, _encoding) {
if (!fileExists(fileName)) {
return undefined;
}
@@ -5136,7 +5252,14 @@ var ts;
// Default is UTF-8 with no byte order mark
return buffer.toString("utf8");
}
+ function readFile(fileName, _encoding) {
+ ts.perfLogger.logStartReadFile(fileName);
+ var file = readFileWorker(fileName, _encoding);
+ ts.perfLogger.logStopReadFile();
+ return file;
+ }
function writeFile(fileName, data, writeByteOrderMark) {
+ ts.perfLogger.logEvent("WriteFile: " + fileName);
// If a BOM is required, emit one
if (writeByteOrderMark) {
data = byteOrderMarkIndicator + data;
@@ -5153,6 +5276,7 @@ var ts;
}
}
function getAccessibleFileSystemEntries(path) {
+ ts.perfLogger.logEvent("ReadDir: " + (path || "."));
try {
var entries = _fs.readdirSync(path || ".").sort();
var files = [];
@@ -5208,6 +5332,7 @@ var ts;
return fileSystemEntryExists(path, 1 /* Directory */);
}
function getDirectories(path) {
+ ts.perfLogger.logEvent("ReadDir: " + path);
return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); });
}
function realpath(path) {
@@ -5398,7 +5523,6 @@ var ts;
A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."),
Invalid_reference_directive_syntax: diag(1084, ts.DiagnosticCategory.Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, ts.DiagnosticCategory.Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."),
- An_accessor_cannot_be_declared_in_an_ambient_context: diag(1086, ts.DiagnosticCategory.Error, "An_accessor_cannot_be_declared_in_an_ambient_context_1086", "An accessor cannot be declared in an ambient context."),
_0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."),
_0_modifier_cannot_appear_on_a_parameter: diag(1090, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."),
Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."),
@@ -5551,6 +5675,7 @@ var ts;
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
+ Keywords_cannot_contain_escape_characters: diag(1260, ts.DiagnosticCategory.Error, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -5583,7 +5708,7 @@ var ts;
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
- The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_option_1343", "The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options."),
+ The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system_1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'esnext' or 'system'."),
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness"),
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
@@ -6706,7 +6831,7 @@ var ts;
_a.of = 148 /* OfKeyword */,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */, "`": 59 /* BacktickToken */ }));
/*
As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
IdentifierStart ::
@@ -6753,6 +6878,14 @@ var ts;
*/
var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
+ /**
+ * Generated by scripts/regenerate-unicode-identifier-parts.js on node v12.4.0 with unicode 12.1
+ * based on http://www.unicode.org/reports/tr31/ and https://www.ecma-international.org/ecma-262/6.0/#sec-names-and-keywords
+ * unicodeESNextIdentifierStart corresponds to the ID_Start and Other_ID_Start property, and
+ * unicodeESNextIdentifierPart corresponds to ID_Continue, Other_ID_Continue, plus ID_Start and Other_ID_Start
+ */
+ var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3133, 3160, 3162, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101];
+ var unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3328, 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7673, 7675, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65071, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69376, 69404, 69415, 69415, 69424, 69456, 69600, 69622, 69632, 69702, 69734, 69743, 69759, 69818, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69958, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70096, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70206, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70751, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71680, 71738, 71840, 71913, 71935, 71935, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123584, 123641, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101, 917760, 917999];
function lookupInUnicodeMap(code, map) {
// Bail out quickly if it couldn't possibly be in the map.
if (code < map[0]) {
@@ -6779,15 +6912,17 @@ var ts;
return false;
}
/* @internal */ function isUnicodeIdentifierStart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
- lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierStart);
+ return languageVersion >= 2 /* ES2015 */ ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierStart) :
+ languageVersion === 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierStart);
}
ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;
function isUnicodeIdentifierPart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
- lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierPart);
+ return languageVersion >= 2 /* ES2015 */ ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierPart) :
+ languageVersion === 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierPart);
}
function makeReverseMap(source) {
var result = [];
@@ -7283,11 +7418,12 @@ var ts;
ts.isIdentifierPart = isIdentifierPart;
/* @internal */
function isIdentifierText(name, languageVersion) {
- if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {
+ var ch = codePointAt(name, 0);
+ if (!isIdentifierStart(ch, languageVersion)) {
return false;
}
- for (var i = 1; i < name.length; i++) {
- if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {
+ for (var i = charSize(ch); i < name.length; i += charSize(ch)) {
+ if (!isIdentifierPart(ch = codePointAt(name, i), languageVersion)) {
return false;
}
}
@@ -7318,6 +7454,7 @@ var ts;
getTokenPos: function () { return tokenPos; },
getTokenText: function () { return text.substring(tokenPos, pos); },
getTokenValue: function () { return tokenValue; },
+ hasUnicodeEscape: function () { return (tokenFlags & 1024 /* UnicodeEscape */) !== 0; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; },
@@ -7444,7 +7581,7 @@ var ts;
}
}
function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
- if (!isIdentifierStart(text.charCodeAt(pos), languageVersion)) {
+ if (!isIdentifierStart(codePointAt(text, pos), languageVersion)) {
return;
}
var identifierStart = pos;
@@ -7652,6 +7789,7 @@ var ts;
pos++;
return scanExtendedUnicodeEscape();
}
+ tokenFlags |= 1024 /* UnicodeEscape */;
// '\uDDDD'
return scanHexadecimalEscape(/*numDigits*/ 4);
case 120 /* x */:
@@ -7734,21 +7872,41 @@ var ts;
}
return -1;
}
+ function peekExtendedUnicodeEscape() {
+ if (languageVersion >= 2 /* ES2015 */ && codePointAt(text, pos + 1) === 117 /* u */ && codePointAt(text, pos + 2) === 123 /* openBrace */) {
+ var start_2 = pos;
+ pos += 3;
+ var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
+ var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
+ pos = start_2;
+ return escapedValue;
+ }
+ return -1;
+ }
function scanIdentifierParts() {
var result = "";
var start = pos;
while (pos < end) {
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
if (isIdentifierPart(ch, languageVersion)) {
- pos++;
+ pos += charSize(ch);
}
else if (ch === 92 /* backslash */) {
+ ch = peekExtendedUnicodeEscape();
+ if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ result += scanExtendedUnicodeEscape();
+ start = pos;
+ continue;
+ }
ch = peekUnicodeEscape();
if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
break;
}
+ tokenFlags |= 1024 /* UnicodeEscape */;
result += text.substring(start, pos);
- result += String.fromCharCode(ch);
+ result += utf16EncodeAsString(ch);
// Valid Unicode escape is always six characters
pos += 6;
start = pos;
@@ -7843,7 +8001,7 @@ var ts;
if (pos >= end) {
return token = 1 /* EndOfFileToken */;
}
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
// Special handling for shebang
if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) {
pos = scanShebangTrivia(text, pos);
@@ -8208,9 +8366,17 @@ var ts;
pos++;
return token = 58 /* AtToken */;
case 92 /* backslash */:
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
var cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
pos += 6;
+ tokenFlags |= 1024 /* UnicodeEscape */;
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
return token = getIdentifierToken();
}
@@ -8219,9 +8385,9 @@ var ts;
return token = 0 /* Unknown */;
default:
if (isIdentifierStart(ch, languageVersion)) {
- pos++;
- while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))
- pos++;
+ pos += charSize(ch);
+ while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion))
+ pos += charSize(ch);
tokenValue = text.substring(tokenPos, pos);
if (ch === 92 /* backslash */) {
tokenValue += scanIdentifierParts();
@@ -8229,16 +8395,16 @@ var ts;
return token = getIdentifierToken();
}
else if (isWhiteSpaceSingleLine(ch)) {
- pos++;
+ pos += charSize(ch);
continue;
}
else if (isLineBreak(ch)) {
tokenFlags |= 1 /* PrecedingLineBreak */;
- pos++;
+ pos += charSize(ch);
continue;
}
error(ts.Diagnostics.Invalid_character);
- pos++;
+ pos += charSize(ch);
return token = 0 /* Unknown */;
}
}
@@ -8355,7 +8521,7 @@ var ts;
// First non-whitespace character on this line.
var firstNonWhitespace = 0;
// These initial values are special because the first line is:
- // firstNonWhitespace = 0 to indicate that we want leading whitspace,
+ // firstNonWhitespace = 0 to indicate that we want leading whitespace,
while (pos < end) {
char = text.charCodeAt(pos);
if (char === 123 /* openBrace */) {
@@ -8389,17 +8555,22 @@ var ts;
// they allow dashes
function scanJsxIdentifier() {
if (tokenIsIdentifierOrKeyword(token)) {
- var firstCharPosition = pos;
+ // An identifier or keyword has already been parsed - check for a `-` and then append it and everything after it to the token
+ // Do note that this means that `scanJsxIdentifier` effectively _mutates_ the visible token without advancing to a new token
+ // Any caller should be expecting this behavior and should only read the pos or token value after calling it.
while (pos < end) {
var ch = text.charCodeAt(pos);
- if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
+ if (ch === 45 /* minus */) {
+ tokenValue += "-";
pos++;
+ continue;
}
- else {
+ var oldPos = pos;
+ tokenValue += scanIdentifierParts(); // reuse `scanIdentifierParts` so unicode escapes are handled
+ if (pos === oldPos) {
break;
}
}
- tokenValue += text.substring(firstCharPosition, pos);
}
return token;
}
@@ -8421,8 +8592,8 @@ var ts;
if (pos >= end) {
return token = 1 /* EndOfFileToken */;
}
- var ch = text.charCodeAt(pos);
- pos++;
+ var ch = codePointAt(text, pos);
+ pos += charSize(ch);
switch (ch) {
case 9 /* tab */:
case 11 /* verticalTab */:
@@ -8460,12 +8631,33 @@ var ts;
return token = 24 /* DotToken */;
case 96 /* backtick */:
return token = 59 /* BacktickToken */;
- }
- if (isIdentifierStart(ch, 8 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) {
+ case 92 /* backslash */:
+ pos--;
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
+ var cookedChar = peekUnicodeEscape();
+ if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
+ pos += 6;
+ tokenFlags |= 1024 /* UnicodeEscape */;
+ tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
pos++;
- }
+ return token = 0 /* Unknown */;
+ }
+ if (isIdentifierStart(ch, languageVersion)) {
+ var char = ch;
+ while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion))
+ pos += charSize(char);
tokenValue = text.substring(tokenPos, pos);
+ if (char === 92 /* backslash */) {
+ tokenValue += scanIdentifierParts();
+ }
return token = getIdentifierToken();
}
else {
@@ -8548,6 +8740,33 @@ var ts;
}
}
ts.createScanner = createScanner;
+ /* @internal */
+ var codePointAt = String.prototype.codePointAt ? function (s, i) { return s.codePointAt(i); } : function codePointAt(str, i) {
+ // from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt
+ var size = str.length;
+ // Account for out-of-bounds indices:
+ if (i < 0 || i >= size) {
+ return undefined; // String.codePointAt returns `undefined` for OOB indexes
+ }
+ // Get the first code unit
+ var first = str.charCodeAt(i);
+ // check if it’s the start of a surrogate pair
+ if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { // high surrogate and there is a next code unit
+ var second = str.charCodeAt(i + 1);
+ if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
+ // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
+ }
+ }
+ return first;
+ };
+ /* @internal */
+ function charSize(ch) {
+ if (ch >= 0x10000) {
+ return 2;
+ }
+ return 1;
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -9003,7 +9222,7 @@ var ts;
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 313 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 314 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -9061,6 +9280,8 @@ var ts;
return emitNode && emitNode.flags || 0;
}
ts.getEmitFlags = getEmitFlags;
+ var escapeNoSubstitutionTemplateLiteralText = ts.compose(escapeString, escapeTemplateSubstitution);
+ var escapeNonAsciiNoSubstitutionTemplateLiteralText = ts.compose(escapeNonAsciiString, escapeTemplateSubstitution);
function getLiteralText(node, sourceFile, neverAsciiEscape) {
// If we don't need to downlevel and we can reach the original source text using
// the node's parent reference, then simply get the text as it was originally written.
@@ -9068,7 +9289,11 @@ var ts;
ts.isBigIntLiteral(node))) {
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
}
- var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216 /* NoAsciiEscaping */) ? escapeString : escapeNonAsciiString;
+ // If a NoSubstitutionTemplateLiteral appears to have a substitution in it, the original text
+ // had to include a backslash: `not \${a} substitution`.
+ var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216 /* NoAsciiEscaping */) ?
+ node.kind === 14 /* NoSubstitutionTemplateLiteral */ ? escapeNoSubstitutionTemplateLiteralText : escapeString :
+ node.kind === 14 /* NoSubstitutionTemplateLiteral */ ? escapeNonAsciiNoSubstitutionTemplateLiteralText : escapeNonAsciiString;
// If we can't reach the original source text, use the canonical form if it's a number,
// or a (possibly escaped) quoted form of the original text if it's string-like.
switch (node.kind) {
@@ -9183,6 +9408,43 @@ var ts;
return ts.isExternalModule(node) || compilerOptions.isolatedModules || ((ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS) && !!node.commonJsModuleIndicator);
}
ts.isEffectiveExternalModule = isEffectiveExternalModule;
+ /**
+ * Returns whether the source file will be treated as if it were in strict mode at runtime.
+ */
+ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
+ // We can only verify strict mode for JS/TS files
+ switch (node.scriptKind) {
+ case 1 /* JS */:
+ case 3 /* TS */:
+ case 2 /* JSX */:
+ case 4 /* TSX */:
+ break;
+ default:
+ return false;
+ }
+ // Strict mode does not matter for declaration files.
+ if (node.isDeclarationFile) {
+ return false;
+ }
+ // If `alwaysStrict` is set, then treat the file as strict.
+ if (ts.getStrictOptionValue(compilerOptions, "alwaysStrict")) {
+ return true;
+ }
+ // Starting with a "use strict" directive indicates the file is strict.
+ if (ts.startsWithUseStrict(node.statements)) {
+ return true;
+ }
+ if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
+ // ECMAScript Modules are always strict.
+ if (ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
+ return true;
+ }
+ // Other modules are strict unless otherwise specified.
+ return !compilerOptions.noImplicitUseStrict;
+ }
+ return false;
+ }
+ ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile;
function isBlockScope(node, parentNode) {
switch (node.kind) {
case 285 /* SourceFile */:
@@ -9210,9 +9472,9 @@ var ts;
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
- case 299 /* JSDocSignature */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 300 /* JSDocSignature */:
return true;
default:
ts.assertType(node);
@@ -9233,7 +9495,7 @@ var ts;
case 210 /* ClassExpression */:
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
case 240 /* FunctionDeclaration */:
case 157 /* MethodDeclaration */:
case 158 /* Constructor */:
@@ -9461,6 +9723,12 @@ var ts;
return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */;
}
ts.isImportCall = isImportCall;
+ function isImportMeta(n) {
+ return ts.isMetaProperty(n)
+ && n.keywordToken === 93 /* ImportKeyword */
+ && n.name.escapedText === "meta";
+ }
+ ts.isImportMeta = isImportMeta;
function isLiteralImportTypeNode(n) {
return ts.isImportTypeNode(n) && ts.isLiteralTypeNode(n.argument) && ts.isStringLiteral(n.argument.literal);
}
@@ -9553,7 +9821,7 @@ var ts;
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
case 151 /* TypeParameter */:
return node === parent.constraint;
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return node === parent.constraint;
case 155 /* PropertyDeclaration */:
case 154 /* PropertySignature */:
@@ -10584,7 +10852,7 @@ var ts;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 311 /* JSDocTypedefTag */ || node.kind === 304 /* JSDocCallbackTag */;
+ return node.kind === 312 /* JSDocTypedefTag */ || node.kind === 305 /* JSDocCallbackTag */ || node.kind === 306 /* JSDocEnumTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -11034,6 +11302,10 @@ var ts;
return isKeyword(token) && !isContextualKeyword(token);
}
ts.isNonContextualKeyword = isNonContextualKeyword;
+ function isFutureReservedKeyword(token) {
+ return 110 /* FirstFutureReservedWord */ <= token && token <= 118 /* LastFutureReservedWord */;
+ }
+ ts.isFutureReservedKeyword = isFutureReservedKeyword;
function isStringANonContextualKeyword(name) {
var token = ts.stringToToken(name);
return token !== undefined && isNonContextualKeyword(token);
@@ -11293,7 +11565,7 @@ var ts;
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return 0;
case 209 /* SpreadElement */:
return 1;
@@ -11479,6 +11751,10 @@ var ts;
}
}
ts.createDiagnosticCollection = createDiagnosticCollection;
+ var templateSubstitutionRegExp = /\$\{/g;
+ function escapeTemplateSubstitution(str) {
+ return str.replace(templateSubstitutionRegExp, "\\${");
+ }
// This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator,
// paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in
// the language service. These characters should be escaped when printing, and if any characters are added,
@@ -11847,6 +12123,7 @@ var ts;
return accessor.parameters[hasThis ? 1 : 0];
}
}
+ ts.getSetAccessorValueParameter = getSetAccessorValueParameter;
/** Get the type annotation for the value parameter. */
function getSetAccessorTypeAnnotationNode(accessor) {
var parameter = getSetAccessorValueParameter(accessor);
@@ -11955,7 +12232,7 @@ var ts;
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
/** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 298 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
}
/**
* Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -12746,8 +13023,8 @@ var ts;
/**
* Mutates the map with newMap such that keys in map will be same as newMap.
*/
- function mutateMap(map, newMap, options) {
- var createNewValue = options.createNewValue, onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
+ function mutateMapSkippingNewValues(map, newMap, options) {
+ var onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
// Needs update
map.forEach(function (existingValue, key) {
var valueInNewMap = newMap.get(key);
@@ -12761,6 +13038,15 @@ var ts;
onExistingValue(existingValue, valueInNewMap, key);
}
});
+ }
+ ts.mutateMapSkippingNewValues = mutateMapSkippingNewValues;
+ /**
+ * Mutates the map with newMap such that keys in map will be same as newMap.
+ */
+ function mutateMap(map, newMap, options) {
+ // Needs update
+ mutateMapSkippingNewValues(map, newMap, options);
+ var createNewValue = options.createNewValue;
// Add new values that are not already present
newMap.forEach(function (valueInNewMap, key) {
if (!map.has(key)) {
@@ -12897,7 +13183,7 @@ var ts;
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 8 /* ESNext */:
+ case 99 /* ESNext */:
return "lib.esnext.full.d.ts";
case 7 /* ES2020 */:
return "lib.es2020.full.d.ts";
@@ -13317,6 +13603,9 @@ var ts;
break;
case 222 /* ExpressionStatement */:
var expr = hostNode.expression;
+ if (expr.kind === 205 /* BinaryExpression */ && expr.operatorToken.kind === 60 /* EqualsToken */) {
+ expr = expr.left;
+ }
switch (expr.kind) {
case 190 /* PropertyAccessExpression */:
return expr.name;
@@ -13356,8 +13645,8 @@ var ts;
switch (declaration.kind) {
case 73 /* Identifier */:
return declaration;
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */: {
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */: {
var name = declaration.name;
if (name.kind === 149 /* QualifiedName */) {
return name.right;
@@ -13381,8 +13670,10 @@ var ts;
return undefined;
}
}
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
+ case 306 /* JSDocEnumTag */:
+ return nameForNamelessJSDocTypedef(declaration);
case 255 /* ExportAssignment */: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
@@ -13588,7 +13879,7 @@ var ts;
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 298 /* JSDocComment */);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -13860,7 +14151,7 @@ var ts;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 315 /* PartiallyEmittedExpression */) {
+ while (node.kind === 316 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
@@ -14272,67 +14563,67 @@ var ts;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 297 /* JSDocComment */;
+ return node.kind === 298 /* JSDocComment */;
}
ts.isJSDoc = isJSDoc;
function isJSDocAuthorTag(node) {
- return node.kind === 302 /* JSDocAuthorTag */;
+ return node.kind === 303 /* JSDocAuthorTag */;
}
ts.isJSDocAuthorTag = isJSDocAuthorTag;
function isJSDocAugmentsTag(node) {
- return node.kind === 301 /* JSDocAugmentsTag */;
+ return node.kind === 302 /* JSDocAugmentsTag */;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 303 /* JSDocClassTag */;
+ return node.kind === 304 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 305 /* JSDocEnumTag */;
+ return node.kind === 306 /* JSDocEnumTag */;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 308 /* JSDocThisTag */;
+ return node.kind === 309 /* JSDocThisTag */;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 306 /* JSDocParameterTag */;
+ return node.kind === 307 /* JSDocParameterTag */;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 307 /* JSDocReturnTag */;
+ return node.kind === 308 /* JSDocReturnTag */;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 309 /* JSDocTypeTag */;
+ return node.kind === 310 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 310 /* JSDocTemplateTag */;
+ return node.kind === 311 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 311 /* JSDocTypedefTag */;
+ return node.kind === 312 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 312 /* JSDocPropertyTag */;
+ return node.kind === 313 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 312 /* JSDocPropertyTag */ || node.kind === 306 /* JSDocParameterTag */;
+ return node.kind === 313 /* JSDocPropertyTag */ || node.kind === 307 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 298 /* JSDocTypeLiteral */;
+ return node.kind === 299 /* JSDocTypeLiteral */;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 304 /* JSDocCallbackTag */;
+ return node.kind === 305 /* JSDocCallbackTag */;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 299 /* JSDocSignature */;
+ return node.kind === 300 /* JSDocSignature */;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
@@ -14343,7 +14634,7 @@ var ts;
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 313 /* SyntaxList */;
+ return n.kind === 314 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -14495,7 +14786,7 @@ var ts;
switch (kind) {
case 156 /* MethodSignature */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 162 /* ConstructSignature */:
case 163 /* IndexSignature */:
case 166 /* FunctionType */:
@@ -14790,8 +15081,8 @@ var ts;
case 209 /* SpreadElement */:
case 213 /* AsExpression */:
case 211 /* OmittedExpression */:
- case 316 /* CommaListExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 317 /* CommaListExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -14805,12 +15096,12 @@ var ts;
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 315 /* PartiallyEmittedExpression */;
+ return node.kind === 316 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 314 /* NotEmittedStatement */;
+ return node.kind === 315 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -14921,9 +15212,9 @@ var ts;
|| kind === 243 /* TypeAliasDeclaration */
|| kind === 151 /* TypeParameter */
|| kind === 238 /* VariableDeclaration */
- || kind === 311 /* JSDocTypedefTag */
- || kind === 304 /* JSDocCallbackTag */
- || kind === 312 /* JSDocPropertyTag */;
+ || kind === 312 /* JSDocTypedefTag */
+ || kind === 305 /* JSDocCallbackTag */
+ || kind === 313 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
return kind === 240 /* FunctionDeclaration */
@@ -14958,14 +15249,14 @@ var ts;
|| kind === 220 /* VariableStatement */
|| kind === 225 /* WhileStatement */
|| kind === 232 /* WithStatement */
- || kind === 314 /* NotEmittedStatement */
- || kind === 318 /* EndOfDeclarationMarker */
- || kind === 317 /* MergeDeclarationMarker */;
+ || kind === 315 /* NotEmittedStatement */
+ || kind === 319 /* EndOfDeclarationMarker */
+ || kind === 318 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
if (node.kind === 151 /* TypeParameter */) {
- return (node.parent && node.parent.kind !== 310 /* JSDocTemplateTag */) || ts.isInJSFile(node);
+ return (node.parent && node.parent.kind !== 311 /* JSDocTemplateTag */) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -15060,18 +15351,18 @@ var ts;
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 312 /* LastJSDocNode */;
+ return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 313 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 298 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 312 /* LastJSDocTagNode */;
+ return node.kind >= 301 /* FirstJSDocTagNode */ && node.kind <= 313 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
@@ -17102,7 +17393,7 @@ var ts;
return visitNode(cbNode, node.expression);
case 259 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
case 261 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
@@ -17140,26 +17431,26 @@ var ts;
case 295 /* JSDocFunctionType */:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 297 /* JSDocComment */:
+ case 298 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 302 /* JSDocAuthorTag */:
+ case 303 /* JSDocAuthorTag */:
return visitNode(cbNode, node.tagName);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
node.typeExpression.kind === 289 /* JSDocTypeExpression */
@@ -17167,26 +17458,26 @@ var ts;
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 304 /* JSDocCallbackTag */:
+ case 305 /* JSDocCallbackTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 308 /* JSDocThisTag */:
- case 305 /* JSDocEnumTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 309 /* JSDocThisTag */:
+ case 306 /* JSDocEnumTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 300 /* JSDocTag */:
- case 303 /* JSDocClassTag */:
+ case 301 /* JSDocTag */:
+ case 304 /* JSDocClassTag */:
return visitNode(cbNode, node.tagName);
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -17195,12 +17486,14 @@ var ts;
if (setParentNodes === void 0) { setParentNodes = false; }
ts.performance.mark("beforeParse");
var result;
+ ts.perfLogger.logStartParseSourceFile(fileName);
if (languageVersion === 100 /* JSON */) {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, 6 /* JSON */);
}
else {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
}
+ ts.perfLogger.logStopParseSourceFile();
ts.performance.mark("afterParse");
ts.performance.measure("Parse", "beforeParse", "afterParse");
return result;
@@ -17266,7 +17559,7 @@ var ts;
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
+ var scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ true);
var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
@@ -17284,6 +17577,7 @@ var ts;
var identifiers;
var identifierCount;
var parsingContext;
+ var notParenthesizedArrow;
// Flags that dictate what parsing context we're in. For example:
// Whether or not we are in strict parsing mode. All that changes in strict parsing mode is
// that some tokens that would be considered identifiers may be considered keywords.
@@ -17491,6 +17785,7 @@ var ts;
identifiers = undefined;
syntaxCursor = undefined;
sourceText = undefined;
+ notParenthesizedArrow = undefined;
}
function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {
var isDeclarationFile = isDeclarationFileName(fileName);
@@ -17700,9 +17995,17 @@ var ts;
function token() {
return currentToken;
}
- function nextToken() {
+ function nextTokenWithoutCheck() {
return currentToken = scanner.scan();
}
+ function nextToken() {
+ // if the keyword had an escape
+ if (ts.isKeyword(currentToken) && (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape())) {
+ // issue a parse error for the escape
+ parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), ts.Diagnostics.Keywords_cannot_contain_escape_characters);
+ }
+ return nextTokenWithoutCheck();
+ }
function nextTokenJSDoc() {
return currentToken = scanner.scanJsDocToken();
}
@@ -17941,7 +18244,7 @@ var ts;
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
- nextToken();
+ nextTokenWithoutCheck();
return finishNode(node);
}
// Only for end of file because the error gets reported incorrectly on embedded script tags.
@@ -18851,6 +19154,23 @@ var ts;
}
function parseJSDocType() {
scanner.setInJSDocType(true);
+ var moduleSpecifier = parseOptionalToken(131 /* ModuleKeyword */);
+ if (moduleSpecifier) {
+ var moduleTag = createNode(297 /* JSDocNamepathType */, moduleSpecifier.pos);
+ terminate: while (true) {
+ switch (token()) {
+ case 19 /* CloseBraceToken */:
+ case 1 /* EndOfFileToken */:
+ case 27 /* CommaToken */:
+ case 5 /* WhitespaceTrivia */:
+ break terminate;
+ default:
+ nextTokenJSDoc();
+ }
+ }
+ scanner.setInJSDocType(false);
+ return finishNode(moduleTag);
+ }
var dotdotdot = parseOptionalToken(25 /* DotDotDotToken */);
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
@@ -19974,7 +20294,15 @@ var ts;
}
}
function parsePossibleParenthesizedArrowFunctionExpressionHead() {
- return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ var tokenPos = scanner.getTokenPos();
+ if (notParenthesizedArrow && notParenthesizedArrow.has(tokenPos.toString())) {
+ return undefined;
+ }
+ var result = parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ if (!result) {
+ (notParenthesizedArrow || (notParenthesizedArrow = ts.createMap())).set(tokenPos.toString(), true);
+ }
+ return result;
}
function tryParseAsyncSimpleArrowFunctionExpression() {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
@@ -22385,8 +22713,8 @@ var ts;
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
+ initializeState(content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 99 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -22408,9 +22736,9 @@ var ts;
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion
- var jsDoc = parseJSDocCommentWorker(start, length);
+ var jsDoc = doInsideOfContext(2097152 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
var diagnostics = parseDiagnostics;
clearState();
return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined;
@@ -22421,7 +22749,7 @@ var ts;
var saveToken = currentToken;
var saveParseDiagnosticsLength = parseDiagnostics.length;
var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
- var comment = parseJSDocCommentWorker(start, length);
+ var comment = doInsideOfContext(2097152 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
if (comment) {
comment.parent = parent;
}
@@ -22560,7 +22888,7 @@ var ts;
}
}
function createJSDocComment() {
- var result = createNode(297 /* JSDocComment */, start);
+ var result = createNode(298 /* JSDocComment */, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -22760,7 +23088,7 @@ var ts;
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(300 /* JSDocTag */, start);
+ var result = createNode(301 /* JSDocTag */, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -22823,8 +23151,8 @@ var ts;
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(312 /* JSDocPropertyTag */, start) :
- createNode(306 /* JSDocParameterTag */, start);
+ createNode(313 /* JSDocPropertyTag */, start) :
+ createNode(307 /* JSDocParameterTag */, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -22844,15 +23172,15 @@ var ts;
var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
- var start_2 = scanner.getStartPos();
+ var start_3 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 306 /* JSDocParameterTag */ || child.kind === 312 /* JSDocPropertyTag */) {
+ if (child.kind === 307 /* JSDocParameterTag */ || child.kind === 313 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2);
+ jsdocTypeLiteral = createNode(299 /* JSDocTypeLiteral */, start_3);
jsdocTypeLiteral.jsDocPropertyTags = children;
if (typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
@@ -22866,7 +23194,7 @@ var ts;
if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307 /* JSDocReturnTag */, start);
+ var result = createNode(308 /* JSDocReturnTag */, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
@@ -22875,13 +23203,13 @@ var ts;
if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(309 /* JSDocTypeTag */, start);
+ var result = createNode(310 /* JSDocTypeTag */, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
return finishNode(result);
}
function parseAuthorTag(start, tagName, indent) {
- var result = createNode(302 /* JSDocAuthorTag */, start);
+ var result = createNode(303 /* JSDocAuthorTag */, start);
result.tagName = tagName;
var authorInfoWithEmail = tryParse(function () { return tryParseAuthorNameAndEmail(); });
if (!authorInfoWithEmail) {
@@ -22935,7 +23263,7 @@ var ts;
}
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(301 /* JSDocAugmentsTag */, start);
+ var result = createNode(302 /* JSDocAugmentsTag */, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
@@ -22962,19 +23290,19 @@ var ts;
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(303 /* JSDocClassTag */, start);
+ var tag = createNode(304 /* JSDocClassTag */, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(308 /* JSDocThisTag */, start);
+ var tag = createNode(309 /* JSDocThisTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(305 /* JSDocEnumTag */, start);
+ var tag = createNode(306 /* JSDocEnumTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
@@ -22983,7 +23311,7 @@ var ts;
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(311 /* JSDocTypedefTag */, start);
+ var typedefTag = createNode(312 /* JSDocTypedefTag */, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -22997,9 +23325,9 @@ var ts;
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start);
+ jsdocTypeLiteral = createNode(299 /* JSDocTypeLiteral */, start);
}
- if (child.kind === 309 /* JSDocTypeTag */) {
+ if (child.kind === 310 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -23045,14 +23373,14 @@ var ts;
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(304 /* JSDocCallbackTag */, start);
+ var callbackTag = createNode(305 /* JSDocCallbackTag */, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(299 /* JSDocSignature */, start);
+ var jsdocSignature = createNode(300 /* JSDocSignature */, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -23060,7 +23388,7 @@ var ts;
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58 /* AtToken */)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 307 /* JSDocReturnTag */) {
+ if (tag && tag.kind === 308 /* JSDocReturnTag */) {
return tag;
}
}
@@ -23105,7 +23433,7 @@ var ts;
case 58 /* AtToken */:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 306 /* JSDocParameterTag */ || child.kind === 312 /* JSDocPropertyTag */) &&
+ if (child && (child.kind === 307 /* JSDocParameterTag */ || child.kind === 313 /* JSDocPropertyTag */) &&
target !== 4 /* CallbackParameter */ &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -23175,7 +23503,7 @@ var ts;
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27 /* CommaToken */));
- var result = createNode(310 /* JSDocTemplateTag */, start);
+ var result = createNode(311 /* JSDocTemplateTag */, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
@@ -23210,16 +23538,19 @@ var ts;
if (!ts.tokenIsIdentifierOrKeyword(token())) {
return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
}
+ identifierCount++;
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
var result = createNode(73 /* Identifier */, pos);
- result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
+ if (token() !== 73 /* Identifier */) {
+ result.originalKeywordKind = token();
+ }
+ result.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
finishNode(result, end);
nextTokenJSDoc();
return result;
}
}
- JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker;
})(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {}));
})(Parser || (Parser = {}));
var IncrementalParser;
@@ -24136,7 +24467,7 @@ var ts;
es2018: 5 /* ES2018 */,
es2019: 6 /* ES2019 */,
es2020: 7 /* ES2020 */,
- esnext: 8 /* ESNext */,
+ esnext: 99 /* ESNext */,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
@@ -25504,10 +25835,10 @@ var ts;
var config = __assign({ compilerOptions: __assign({}, ts.arrayFrom(optionMap.entries()).reduce(function (prev, cur) {
var _a;
return (__assign({}, prev, (_a = {}, _a[cur[0]] = cur[1], _a)));
- }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath, originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
+ }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath ? r.originalPath : "", originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
include: filterSameAsDefaultInclude(configParseResult.configFileSpecs.validatedIncludeSpecs),
exclude: configParseResult.configFileSpecs.validatedExcludeSpecs
- } : {}), { compilerOnSave: !!configParseResult.compileOnSave ? true : undefined });
+ } : {}), { compileOnSave: !!configParseResult.compileOnSave ? true : undefined });
return config;
}
ts.convertToTSConfig = convertToTSConfig;
@@ -27032,6 +27363,7 @@ var ts;
trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
}
}
+ ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
switch (moduleResolution) {
case ts.ModuleResolutionKind.NodeJs:
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
@@ -27042,6 +27374,9 @@ var ts;
default:
return ts.Debug.fail("Unexpected moduleResolution: " + moduleResolution);
}
+ if (result && result.resolvedModule)
+ ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
+ ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
if (perFolderCache) {
perFolderCache.set(moduleName, result);
if (!ts.isExternalModuleNameRelative(moduleName)) {
@@ -27874,7 +28209,9 @@ var ts;
var binder = createBinder();
function bindSourceFile(file, options) {
ts.performance.mark("beforeBind");
+ ts.perfLogger.logStartBindFile("" + file.fileName);
binder(file, options);
+ ts.perfLogger.logStopBindFile();
ts.performance.mark("afterBind");
ts.performance.measure("Bind", "beforeBind", "afterBind");
}
@@ -27987,7 +28324,7 @@ var ts;
if (symbol.constEnumOnlyModule && (symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */))) {
symbol.constEnumOnlyModule = false;
}
- if (symbolFlags & 67220415 /* Value */) {
+ if (symbolFlags & 111551 /* Value */) {
setValueDeclaration(symbol, node);
}
}
@@ -28031,7 +28368,7 @@ var ts;
return "__constructor" /* Constructor */;
case 166 /* FunctionType */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return "__call" /* Call */;
case 167 /* ConstructorType */:
case 162 /* ConstructSignature */:
@@ -28216,10 +28553,10 @@ var ts;
if (ts.isJSDocTypeAlias(node))
ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file.
if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32 /* ExportContext */)) || ts.isJSDocTypeAlias(node)) {
- if (ts.hasModifier(node, 512 /* Default */) && !getDeclarationName(node)) {
+ if (!container.locals || (ts.hasModifier(node, 512 /* Default */) && !getDeclarationName(node))) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default!
}
- var exportKind = symbolFlags & 67220415 /* Value */ ? 1048576 /* ExportValue */ : 0;
+ var exportKind = symbolFlags & 111551 /* Value */ ? 1048576 /* ExportValue */ : 0;
var local = declareSymbol(container.locals, /*parent*/ undefined, node, exportKind, symbolExcludes);
local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
node.localSymbol = local;
@@ -28449,8 +28786,9 @@ var ts;
case 192 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
bindJSDocTypeAlias(node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
@@ -29107,7 +29445,7 @@ var ts;
}
function bindJSDocTypeAlias(node) {
node.tagName.parent = node;
- if (node.fullName) {
+ if (node.kind !== 306 /* JSDocEnumTag */ && node.fullName) {
setParentPointers(node, node.fullName);
}
}
@@ -29141,7 +29479,7 @@ var ts;
case 244 /* EnumDeclaration */:
case 189 /* ObjectLiteralExpression */:
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 269 /* JsxAttributes */:
return 1 /* IsContainer */;
case 242 /* InterfaceDeclaration */:
@@ -29163,7 +29501,7 @@ var ts;
case 159 /* GetAccessor */:
case 160 /* SetAccessor */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 295 /* JSDocFunctionType */:
case 166 /* FunctionType */:
case 162 /* ConstructSignature */:
@@ -29226,7 +29564,7 @@ var ts;
case 244 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 189 /* ObjectLiteralExpression */:
case 242 /* InterfaceDeclaration */:
case 269 /* JsxAttributes */:
@@ -29240,7 +29578,7 @@ var ts;
case 167 /* ConstructorType */:
case 161 /* CallSignature */:
case 162 /* ConstructSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 163 /* IndexSignature */:
case 157 /* MethodDeclaration */:
case 156 /* MethodSignature */:
@@ -29251,8 +29589,8 @@ var ts;
case 197 /* FunctionExpression */:
case 198 /* ArrowFunction */:
case 295 /* JSDocFunctionType */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
case 243 /* TypeAliasDeclaration */:
case 182 /* MappedType */:
// All the children of these container types are never visible through another
@@ -29433,9 +29771,21 @@ var ts;
currentFlow = { flags: 2 /* Start */ };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
+ var declName = ts.getNameOfDeclaration(typeAlias);
+ if ((ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName) && declName && ts.isPropertyAccessEntityNameExpression(declName.parent)) {
+ // typedef anchored to an A.B.C assignment - we need to bind into B's namespace under name C
+ var isTopLevel = isTopLevelNamespaceAssignment(declName.parent);
+ if (isTopLevel) {
+ bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
+ var oldContainer = container;
+ container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
+ declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
+ container = oldContainer;
+ }
+ }
+ else if (ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
parent = typeAlias.parent;
- bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
}
else {
bind(typeAlias.fullName);
@@ -29454,7 +29804,8 @@ var ts;
node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ &&
node.originalKeywordKind <= 118 /* LastFutureReservedWord */ &&
!ts.isIdentifierName(node) &&
- !(node.flags & 4194304 /* Ambient */)) {
+ !(node.flags & 4194304 /* Ambient */) &&
+ !(node.flags & 2097152 /* JSDoc */)) {
// Report error only if there are no parse errors in file
if (!file.parseDiagnostics.length) {
file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));
@@ -29707,7 +30058,7 @@ var ts;
while (parentNode && !ts.isJSDocTypeAlias(parentNode)) {
parentNode = parentNode.parent;
}
- bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
break;
}
// falls through
@@ -29728,7 +30079,7 @@ var ts;
file.commonJsModuleIndicator &&
ts.isModuleExportsPropertyAccessExpression(node) &&
!lookupSymbolForNameWorker(blockScopeContainer, "module")) {
- declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */);
+ declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 111550 /* FunctionScopedVariableExcludes */);
}
break;
case 205 /* BinaryExpression */:
@@ -29794,7 +30145,7 @@ var ts;
case 277 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
case 279 /* EnumMember */:
- return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */);
case 161 /* CallSignature */:
case 162 /* ConstructSignature */:
case 163 /* IndexSignature */:
@@ -29805,22 +30156,22 @@ var ts;
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
- return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */);
case 240 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
case 158 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
case 159 /* GetAccessor */:
- return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */);
case 160 /* SetAccessor */:
- return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 78783 /* SetAccessorExcludes */);
case 166 /* FunctionType */:
case 295 /* JSDocFunctionType */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 167 /* ConstructorType */:
return bindFunctionOrConstructorType(node);
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 182 /* MappedType */:
return bindAnonymousTypeWorker(node);
case 189 /* ObjectLiteralExpression */:
@@ -29853,9 +30204,9 @@ var ts;
inStrictMode = true;
return bindClassLikeDeclaration(node);
case 242 /* InterfaceDeclaration */:
- return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */);
+ return bindBlockScopedDeclaration(node, 64 /* Interface */, 788872 /* InterfaceExcludes */);
case 243 /* TypeAliasDeclaration */:
- return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
case 244 /* EnumDeclaration */:
return bindEnumDeclaration(node);
case 245 /* ModuleDeclaration */:
@@ -29889,22 +30240,23 @@ var ts;
// falls through
case 246 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
- case 306 /* JSDocParameterTag */:
- if (node.parent.kind === 299 /* JSDocSignature */) {
+ case 307 /* JSDocParameterTag */:
+ if (node.parent.kind === 300 /* JSDocSignature */) {
return bindParameter(node);
}
- if (node.parent.kind !== 298 /* JSDocTypeLiteral */) {
+ if (node.parent.kind !== 299 /* JSDocTypeLiteral */) {
break;
}
// falls through
- case 312 /* JSDocPropertyTag */:
+ case 313 /* JSDocPropertyTag */:
var propTag = node;
var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -30082,7 +30434,7 @@ var ts;
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220414 /* FunctionScopedVariableExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
}
break;
default:
@@ -30163,7 +30515,7 @@ var ts;
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false);
}
function bindPotentiallyMissingNamespaces(namespaceSymbol, entityName, isToplevel, isPrototypeProperty) {
- if (isToplevel && !isPrototypeProperty && (!namespaceSymbol || !(namespaceSymbol.flags & 1920 /* Namespace */))) {
+ if (isToplevel && !isPrototypeProperty) {
// make symbols or add declarations for intermediate containers
var flags_1 = 1536 /* Module */ | 67108864 /* Assignment */;
var excludeFlags_1 = 110735 /* ValueModuleExcludes */ & ~67108864 /* Assignment */;
@@ -30191,14 +30543,17 @@ var ts;
(namespaceSymbol.exports || (namespaceSymbol.exports = ts.createSymbolTable()));
var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedExpandoInitializer(declaration));
var includes = isMethod ? 8192 /* Method */ : 4 /* Property */;
- var excludes = isMethod ? 67212223 /* MethodExcludes */ : 0 /* PropertyExcludes */;
+ var excludes = isMethod ? 103359 /* MethodExcludes */ : 0 /* PropertyExcludes */;
declareSymbol(symbolTable, namespaceSymbol, declaration, includes | 67108864 /* Assignment */, excludes & ~67108864 /* Assignment */);
}
+ function isTopLevelNamespaceAssignment(propertyAccess) {
+ return ts.isBinaryExpression(propertyAccess.parent)
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
+ : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
+ }
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
- var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
- : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
+ var isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -30269,7 +30624,7 @@ var ts;
}
function bindClassLikeDeclaration(node) {
if (node.kind === 241 /* ClassDeclaration */) {
- bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */);
+ bindBlockScopedDeclaration(node, 32 /* Class */, 899503 /* ClassExcludes */);
}
else {
var bindingName = node.name ? node.name.escapedText : "__class" /* Class */;
@@ -30302,19 +30657,16 @@ var ts;
}
function bindEnumDeclaration(node) {
return ts.isEnumConst(node)
- ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 68008831 /* ConstEnumExcludes */)
- : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 68008191 /* RegularEnumExcludes */);
+ ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */)
+ : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */);
}
function bindVariableDeclarationOrBindingElement(node) {
if (inStrictMode) {
checkStrictModeEvalOrArguments(node, node.name);
}
if (!ts.isBindingPattern(node.name)) {
- var isEnum = ts.isInJSFile(node) && !!ts.getJSDocEnumTag(node);
- var enumFlags = (isEnum ? 256 /* RegularEnum */ : 0 /* None */);
- var enumExcludes = (isEnum ? 68008191 /* RegularEnumExcludes */ : 0 /* None */);
if (ts.isBlockOrCatchScoped(node)) {
- bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */ | enumFlags, 67220415 /* BlockScopedVariableExcludes */ | enumExcludes);
+ bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
}
else if (ts.isParameterDeclaration(node)) {
// It is safe to walk up parent chain to find whether the node is a destructuring parameter declaration
@@ -30326,15 +30678,15 @@ var ts;
// function foo([a,a]) {} // Duplicate Identifier error
// function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter
// // which correctly set excluded symbols
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220415 /* ParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */ | enumFlags, 67220414 /* FunctionScopedVariableExcludes */ | enumExcludes);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
}
}
}
function bindParameter(node) {
- if (node.kind === 306 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) {
+ if (node.kind === 307 /* JSDocParameterTag */ && container.kind !== 300 /* JSDocSignature */) {
return;
}
if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) {
@@ -30346,7 +30698,7 @@ var ts;
bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, "__" + node.parent.parameters.indexOf(node));
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220415 /* ParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
}
// If this is a property-parameter, then also declare the property symbol into the
// containing class.
@@ -30364,10 +30716,10 @@ var ts;
checkStrictModeFunctionName(node);
if (inStrictMode) {
checkStrictModeFunctionDeclaration(node);
- bindBlockScopedDeclaration(node, 16 /* Function */, 67219887 /* FunctionExcludes */);
+ bindBlockScopedDeclaration(node, 16 /* Function */, 110991 /* FunctionExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 67219887 /* FunctionExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 110991 /* FunctionExcludes */);
}
}
function bindFunctionExpression(node) {
@@ -30405,10 +30757,10 @@ var ts;
if (!container_1.locals) {
container_1.locals = ts.createSymbolTable();
}
- declareSymbol(container_1.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbol(container_1.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
}
else if (node.parent.kind === 177 /* InferType */) {
@@ -30417,14 +30769,14 @@ var ts;
if (!container_2.locals) {
container_2.locals = ts.createSymbolTable();
}
- declareSymbol(container_2.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbol(container_2.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
else {
bindAnonymousDeclaration(node, 262144 /* TypeParameter */, getDeclarationName(node)); // TODO: GH#18217
}
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
}
// reachability checks
@@ -31035,7 +31387,7 @@ var ts;
break;
case 195 /* TypeAssertionExpression */:
case 213 /* AsExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
excludeFlags = 536870912 /* OuterExpressionExcludes */;
@@ -31294,7 +31646,7 @@ var ts;
return 536875008 /* BindingPatternExcludes */;
case 195 /* TypeAssertionExpression */:
case 213 /* AsExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
case 196 /* ParenthesizedExpression */:
case 99 /* SuperKeyword */:
return 536870912 /* OuterExpressionExcludes */;
@@ -31525,6 +31877,179 @@ var ts;
WideningKind[WideningKind["Normal"] = 0] = "Normal";
WideningKind[WideningKind["GeneratorYield"] = 1] = "GeneratorYield";
})(WideningKind || (WideningKind = {}));
+ var TypeFacts;
+ (function (TypeFacts) {
+ TypeFacts[TypeFacts["None"] = 0] = "None";
+ TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
+ TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
+ TypeFacts[TypeFacts["TypeofEQBigInt"] = 4] = "TypeofEQBigInt";
+ TypeFacts[TypeFacts["TypeofEQBoolean"] = 8] = "TypeofEQBoolean";
+ TypeFacts[TypeFacts["TypeofEQSymbol"] = 16] = "TypeofEQSymbol";
+ TypeFacts[TypeFacts["TypeofEQObject"] = 32] = "TypeofEQObject";
+ TypeFacts[TypeFacts["TypeofEQFunction"] = 64] = "TypeofEQFunction";
+ TypeFacts[TypeFacts["TypeofEQHostObject"] = 128] = "TypeofEQHostObject";
+ TypeFacts[TypeFacts["TypeofNEString"] = 256] = "TypeofNEString";
+ TypeFacts[TypeFacts["TypeofNENumber"] = 512] = "TypeofNENumber";
+ TypeFacts[TypeFacts["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt";
+ TypeFacts[TypeFacts["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean";
+ TypeFacts[TypeFacts["TypeofNESymbol"] = 4096] = "TypeofNESymbol";
+ TypeFacts[TypeFacts["TypeofNEObject"] = 8192] = "TypeofNEObject";
+ TypeFacts[TypeFacts["TypeofNEFunction"] = 16384] = "TypeofNEFunction";
+ TypeFacts[TypeFacts["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject";
+ TypeFacts[TypeFacts["EQUndefined"] = 65536] = "EQUndefined";
+ TypeFacts[TypeFacts["EQNull"] = 131072] = "EQNull";
+ TypeFacts[TypeFacts["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull";
+ TypeFacts[TypeFacts["NEUndefined"] = 524288] = "NEUndefined";
+ TypeFacts[TypeFacts["NENull"] = 1048576] = "NENull";
+ TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
+ TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
+ TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
+ TypeFacts[TypeFacts["All"] = 16777215] = "All";
+ // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
+ // The presence of a particular fact means that the given test is true for some (and possibly all) values
+ // of that kind of type.
+ TypeFacts[TypeFacts["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts";
+ TypeFacts[TypeFacts["BaseStringFacts"] = 12582401] = "BaseStringFacts";
+ TypeFacts[TypeFacts["StringStrictFacts"] = 16317953] = "StringStrictFacts";
+ TypeFacts[TypeFacts["StringFacts"] = 16776705] = "StringFacts";
+ TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts";
+ TypeFacts[TypeFacts["EmptyStringFacts"] = 12582401] = "EmptyStringFacts";
+ TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts";
+ TypeFacts[TypeFacts["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts";
+ TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts";
+ TypeFacts[TypeFacts["BaseNumberFacts"] = 12582146] = "BaseNumberFacts";
+ TypeFacts[TypeFacts["NumberStrictFacts"] = 16317698] = "NumberStrictFacts";
+ TypeFacts[TypeFacts["NumberFacts"] = 16776450] = "NumberFacts";
+ TypeFacts[TypeFacts["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts";
+ TypeFacts[TypeFacts["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts";
+ TypeFacts[TypeFacts["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts";
+ TypeFacts[TypeFacts["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts";
+ TypeFacts[TypeFacts["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts";
+ TypeFacts[TypeFacts["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts";
+ TypeFacts[TypeFacts["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts";
+ TypeFacts[TypeFacts["BigIntFacts"] = 16775940] = "BigIntFacts";
+ TypeFacts[TypeFacts["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts";
+ TypeFacts[TypeFacts["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts";
+ TypeFacts[TypeFacts["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts";
+ TypeFacts[TypeFacts["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts";
+ TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts";
+ TypeFacts[TypeFacts["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts";
+ TypeFacts[TypeFacts["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts";
+ TypeFacts[TypeFacts["BooleanFacts"] = 16774920] = "BooleanFacts";
+ TypeFacts[TypeFacts["FalseStrictFacts"] = 12121864] = "FalseStrictFacts";
+ TypeFacts[TypeFacts["FalseFacts"] = 12580616] = "FalseFacts";
+ TypeFacts[TypeFacts["TrueStrictFacts"] = 7927560] = "TrueStrictFacts";
+ TypeFacts[TypeFacts["TrueFacts"] = 16774920] = "TrueFacts";
+ TypeFacts[TypeFacts["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts";
+ TypeFacts[TypeFacts["SymbolFacts"] = 16772880] = "SymbolFacts";
+ TypeFacts[TypeFacts["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts";
+ TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
+ TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
+ TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
+ TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
+ TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
+ TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
+ TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
+ })(TypeFacts || (TypeFacts = {}));
+ var typeofEQFacts = ts.createMapFromTemplate({
+ string: 1 /* TypeofEQString */,
+ number: 2 /* TypeofEQNumber */,
+ bigint: 4 /* TypeofEQBigInt */,
+ boolean: 8 /* TypeofEQBoolean */,
+ symbol: 16 /* TypeofEQSymbol */,
+ undefined: 65536 /* EQUndefined */,
+ object: 32 /* TypeofEQObject */,
+ function: 64 /* TypeofEQFunction */
+ });
+ var typeofNEFacts = ts.createMapFromTemplate({
+ string: 256 /* TypeofNEString */,
+ number: 512 /* TypeofNENumber */,
+ bigint: 1024 /* TypeofNEBigInt */,
+ boolean: 2048 /* TypeofNEBoolean */,
+ symbol: 4096 /* TypeofNESymbol */,
+ undefined: 524288 /* NEUndefined */,
+ object: 8192 /* TypeofNEObject */,
+ function: 16384 /* TypeofNEFunction */
+ });
+ var TypeSystemPropertyName;
+ (function (TypeSystemPropertyName) {
+ TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
+ TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
+ TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
+ TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
+ })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
+ var CheckMode;
+ (function (CheckMode) {
+ CheckMode[CheckMode["Normal"] = 0] = "Normal";
+ CheckMode[CheckMode["Contextual"] = 1] = "Contextual";
+ CheckMode[CheckMode["Inferential"] = 2] = "Inferential";
+ CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
+ CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
+ CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
+ })(CheckMode || (CheckMode = {}));
+ var ContextFlags;
+ (function (ContextFlags) {
+ ContextFlags[ContextFlags["None"] = 0] = "None";
+ ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
+ })(ContextFlags || (ContextFlags = {}));
+ var AccessFlags;
+ (function (AccessFlags) {
+ AccessFlags[AccessFlags["None"] = 0] = "None";
+ AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
+ AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
+ AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
+ AccessFlags[AccessFlags["NoTupleBoundsCheck"] = 8] = "NoTupleBoundsCheck";
+ })(AccessFlags || (AccessFlags = {}));
+ var CallbackCheck;
+ (function (CallbackCheck) {
+ CallbackCheck[CallbackCheck["None"] = 0] = "None";
+ CallbackCheck[CallbackCheck["Bivariant"] = 1] = "Bivariant";
+ CallbackCheck[CallbackCheck["Strict"] = 2] = "Strict";
+ })(CallbackCheck || (CallbackCheck = {}));
+ var MappedTypeModifiers;
+ (function (MappedTypeModifiers) {
+ MappedTypeModifiers[MappedTypeModifiers["IncludeReadonly"] = 1] = "IncludeReadonly";
+ MappedTypeModifiers[MappedTypeModifiers["ExcludeReadonly"] = 2] = "ExcludeReadonly";
+ MappedTypeModifiers[MappedTypeModifiers["IncludeOptional"] = 4] = "IncludeOptional";
+ MappedTypeModifiers[MappedTypeModifiers["ExcludeOptional"] = 8] = "ExcludeOptional";
+ })(MappedTypeModifiers || (MappedTypeModifiers = {}));
+ var ExpandingFlags;
+ (function (ExpandingFlags) {
+ ExpandingFlags[ExpandingFlags["None"] = 0] = "None";
+ ExpandingFlags[ExpandingFlags["Source"] = 1] = "Source";
+ ExpandingFlags[ExpandingFlags["Target"] = 2] = "Target";
+ ExpandingFlags[ExpandingFlags["Both"] = 3] = "Both";
+ })(ExpandingFlags || (ExpandingFlags = {}));
+ var MembersOrExportsResolutionKind;
+ (function (MembersOrExportsResolutionKind) {
+ MembersOrExportsResolutionKind["resolvedExports"] = "resolvedExports";
+ MembersOrExportsResolutionKind["resolvedMembers"] = "resolvedMembers";
+ })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {}));
+ var UnusedKind;
+ (function (UnusedKind) {
+ UnusedKind[UnusedKind["Local"] = 0] = "Local";
+ UnusedKind[UnusedKind["Parameter"] = 1] = "Parameter";
+ })(UnusedKind || (UnusedKind = {}));
+ var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
+ var DeclarationMeaning;
+ (function (DeclarationMeaning) {
+ DeclarationMeaning[DeclarationMeaning["GetAccessor"] = 1] = "GetAccessor";
+ DeclarationMeaning[DeclarationMeaning["SetAccessor"] = 2] = "SetAccessor";
+ DeclarationMeaning[DeclarationMeaning["PropertyAssignment"] = 4] = "PropertyAssignment";
+ DeclarationMeaning[DeclarationMeaning["Method"] = 8] = "Method";
+ DeclarationMeaning[DeclarationMeaning["GetOrSetAccessor"] = 3] = "GetOrSetAccessor";
+ DeclarationMeaning[DeclarationMeaning["PropertyAssignmentOrMethod"] = 12] = "PropertyAssignmentOrMethod";
+ })(DeclarationMeaning || (DeclarationMeaning = {}));
+ var DeclarationSpaces;
+ (function (DeclarationSpaces) {
+ DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None";
+ DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue";
+ DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType";
+ DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace";
+ })(DeclarationSpaces || (DeclarationSpaces = {}));
function getNodeId(node) {
if (!node.id) {
node.id = nextNodeId;
@@ -31850,7 +32375,7 @@ var ts;
// Ensure file is type checked
checkSourceFile(file);
ts.Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
- diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.get(file.fileName));
+ diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
if (!file.isDeclarationFile && (!unusedIsError(0 /* Local */) || !unusedIsError(1 /* Parameter */))) {
addUnusedDiagnostics();
}
@@ -32074,102 +32599,7 @@ var ts;
var potentialNewTargetCollisions = [];
var awaitedTypeStack = [];
var diagnostics = ts.createDiagnosticCollection();
- // Suggestion diagnostics must have a file. Keyed by source file name.
- var suggestionDiagnostics = ts.createMultiMap();
- var TypeFacts;
- (function (TypeFacts) {
- TypeFacts[TypeFacts["None"] = 0] = "None";
- TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
- TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
- TypeFacts[TypeFacts["TypeofEQBigInt"] = 4] = "TypeofEQBigInt";
- TypeFacts[TypeFacts["TypeofEQBoolean"] = 8] = "TypeofEQBoolean";
- TypeFacts[TypeFacts["TypeofEQSymbol"] = 16] = "TypeofEQSymbol";
- TypeFacts[TypeFacts["TypeofEQObject"] = 32] = "TypeofEQObject";
- TypeFacts[TypeFacts["TypeofEQFunction"] = 64] = "TypeofEQFunction";
- TypeFacts[TypeFacts["TypeofEQHostObject"] = 128] = "TypeofEQHostObject";
- TypeFacts[TypeFacts["TypeofNEString"] = 256] = "TypeofNEString";
- TypeFacts[TypeFacts["TypeofNENumber"] = 512] = "TypeofNENumber";
- TypeFacts[TypeFacts["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt";
- TypeFacts[TypeFacts["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean";
- TypeFacts[TypeFacts["TypeofNESymbol"] = 4096] = "TypeofNESymbol";
- TypeFacts[TypeFacts["TypeofNEObject"] = 8192] = "TypeofNEObject";
- TypeFacts[TypeFacts["TypeofNEFunction"] = 16384] = "TypeofNEFunction";
- TypeFacts[TypeFacts["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject";
- TypeFacts[TypeFacts["EQUndefined"] = 65536] = "EQUndefined";
- TypeFacts[TypeFacts["EQNull"] = 131072] = "EQNull";
- TypeFacts[TypeFacts["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull";
- TypeFacts[TypeFacts["NEUndefined"] = 524288] = "NEUndefined";
- TypeFacts[TypeFacts["NENull"] = 1048576] = "NENull";
- TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
- TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
- TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
- TypeFacts[TypeFacts["All"] = 16777215] = "All";
- // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
- // The presence of a particular fact means that the given test is true for some (and possibly all) values
- // of that kind of type.
- TypeFacts[TypeFacts["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts";
- TypeFacts[TypeFacts["BaseStringFacts"] = 12582401] = "BaseStringFacts";
- TypeFacts[TypeFacts["StringStrictFacts"] = 16317953] = "StringStrictFacts";
- TypeFacts[TypeFacts["StringFacts"] = 16776705] = "StringFacts";
- TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts";
- TypeFacts[TypeFacts["EmptyStringFacts"] = 12582401] = "EmptyStringFacts";
- TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts";
- TypeFacts[TypeFacts["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts";
- TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts";
- TypeFacts[TypeFacts["BaseNumberFacts"] = 12582146] = "BaseNumberFacts";
- TypeFacts[TypeFacts["NumberStrictFacts"] = 16317698] = "NumberStrictFacts";
- TypeFacts[TypeFacts["NumberFacts"] = 16776450] = "NumberFacts";
- TypeFacts[TypeFacts["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts";
- TypeFacts[TypeFacts["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts";
- TypeFacts[TypeFacts["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts";
- TypeFacts[TypeFacts["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts";
- TypeFacts[TypeFacts["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts";
- TypeFacts[TypeFacts["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts";
- TypeFacts[TypeFacts["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts";
- TypeFacts[TypeFacts["BigIntFacts"] = 16775940] = "BigIntFacts";
- TypeFacts[TypeFacts["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts";
- TypeFacts[TypeFacts["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts";
- TypeFacts[TypeFacts["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts";
- TypeFacts[TypeFacts["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts";
- TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts";
- TypeFacts[TypeFacts["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts";
- TypeFacts[TypeFacts["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts";
- TypeFacts[TypeFacts["BooleanFacts"] = 16774920] = "BooleanFacts";
- TypeFacts[TypeFacts["FalseStrictFacts"] = 12121864] = "FalseStrictFacts";
- TypeFacts[TypeFacts["FalseFacts"] = 12580616] = "FalseFacts";
- TypeFacts[TypeFacts["TrueStrictFacts"] = 7927560] = "TrueStrictFacts";
- TypeFacts[TypeFacts["TrueFacts"] = 16774920] = "TrueFacts";
- TypeFacts[TypeFacts["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts";
- TypeFacts[TypeFacts["SymbolFacts"] = 16772880] = "SymbolFacts";
- TypeFacts[TypeFacts["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts";
- TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
- TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
- TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
- TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
- TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
- TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
- TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
- })(TypeFacts || (TypeFacts = {}));
- var typeofEQFacts = ts.createMapFromTemplate({
- string: 1 /* TypeofEQString */,
- number: 2 /* TypeofEQNumber */,
- bigint: 4 /* TypeofEQBigInt */,
- boolean: 8 /* TypeofEQBoolean */,
- symbol: 16 /* TypeofEQSymbol */,
- undefined: 65536 /* EQUndefined */,
- object: 32 /* TypeofEQObject */,
- function: 64 /* TypeofEQFunction */
- });
- var typeofNEFacts = ts.createMapFromTemplate({
- string: 256 /* TypeofNEString */,
- number: 512 /* TypeofNENumber */,
- bigint: 1024 /* TypeofNEBigInt */,
- boolean: 2048 /* TypeofNEBoolean */,
- symbol: 4096 /* TypeofNESymbol */,
- undefined: 524288 /* NEUndefined */,
- object: 8192 /* TypeofNEObject */,
- function: 16384 /* TypeofNEFunction */
- });
+ var suggestionDiagnostics = ts.createDiagnosticCollection();
var typeofTypesByName = ts.createMapFromTemplate({
string: stringType,
number: numberType,
@@ -32187,71 +32617,8 @@ var ts;
var comparableRelation = ts.createMap();
var identityRelation = ts.createMap();
var enumRelation = ts.createMap();
- var TypeSystemPropertyName;
- (function (TypeSystemPropertyName) {
- TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
- TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
- TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
- TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
- TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
- TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
- TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
- })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
- var CheckMode;
- (function (CheckMode) {
- CheckMode[CheckMode["Normal"] = 0] = "Normal";
- CheckMode[CheckMode["Contextual"] = 1] = "Contextual";
- CheckMode[CheckMode["Inferential"] = 2] = "Inferential";
- CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
- CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
- CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
- })(CheckMode || (CheckMode = {}));
- var ContextFlags;
- (function (ContextFlags) {
- ContextFlags[ContextFlags["None"] = 0] = "None";
- ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
- })(ContextFlags || (ContextFlags = {}));
- var AccessFlags;
- (function (AccessFlags) {
- AccessFlags[AccessFlags["None"] = 0] = "None";
- AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
- AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
- AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
- AccessFlags[AccessFlags["NoTupleBoundsCheck"] = 8] = "NoTupleBoundsCheck";
- })(AccessFlags || (AccessFlags = {}));
- var CallbackCheck;
- (function (CallbackCheck) {
- CallbackCheck[CallbackCheck["None"] = 0] = "None";
- CallbackCheck[CallbackCheck["Bivariant"] = 1] = "Bivariant";
- CallbackCheck[CallbackCheck["Strict"] = 2] = "Strict";
- })(CallbackCheck || (CallbackCheck = {}));
- var MappedTypeModifiers;
- (function (MappedTypeModifiers) {
- MappedTypeModifiers[MappedTypeModifiers["IncludeReadonly"] = 1] = "IncludeReadonly";
- MappedTypeModifiers[MappedTypeModifiers["ExcludeReadonly"] = 2] = "ExcludeReadonly";
- MappedTypeModifiers[MappedTypeModifiers["IncludeOptional"] = 4] = "IncludeOptional";
- MappedTypeModifiers[MappedTypeModifiers["ExcludeOptional"] = 8] = "ExcludeOptional";
- })(MappedTypeModifiers || (MappedTypeModifiers = {}));
- var ExpandingFlags;
- (function (ExpandingFlags) {
- ExpandingFlags[ExpandingFlags["None"] = 0] = "None";
- ExpandingFlags[ExpandingFlags["Source"] = 1] = "Source";
- ExpandingFlags[ExpandingFlags["Target"] = 2] = "Target";
- ExpandingFlags[ExpandingFlags["Both"] = 3] = "Both";
- })(ExpandingFlags || (ExpandingFlags = {}));
- var MembersOrExportsResolutionKind;
- (function (MembersOrExportsResolutionKind) {
- MembersOrExportsResolutionKind["resolvedExports"] = "resolvedExports";
- MembersOrExportsResolutionKind["resolvedMembers"] = "resolvedMembers";
- })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {}));
- var UnusedKind;
- (function (UnusedKind) {
- UnusedKind[UnusedKind["Local"] = 0] = "Local";
- UnusedKind[UnusedKind["Parameter"] = 1] = "Parameter";
- })(UnusedKind || (UnusedKind = {}));
var builtinGlobals = ts.createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
- var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
initializeTypeChecker();
return checker;
function getJsxNamespace(location) {
@@ -32316,7 +32683,7 @@ var ts;
diagnostics.add(diagnostic);
}
else {
- suggestionDiagnostics.add(diagnostic.file.fileName, __assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
+ suggestionDiagnostics.add(__assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
}
}
function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
@@ -32342,35 +32709,35 @@ var ts;
function getExcludedSymbolFlags(flags) {
var result = 0;
if (flags & 2 /* BlockScopedVariable */)
- result |= 67220415 /* BlockScopedVariableExcludes */;
+ result |= 111551 /* BlockScopedVariableExcludes */;
if (flags & 1 /* FunctionScopedVariable */)
- result |= 67220414 /* FunctionScopedVariableExcludes */;
+ result |= 111550 /* FunctionScopedVariableExcludes */;
if (flags & 4 /* Property */)
result |= 0 /* PropertyExcludes */;
if (flags & 8 /* EnumMember */)
- result |= 68008959 /* EnumMemberExcludes */;
+ result |= 900095 /* EnumMemberExcludes */;
if (flags & 16 /* Function */)
- result |= 67219887 /* FunctionExcludes */;
+ result |= 110991 /* FunctionExcludes */;
if (flags & 32 /* Class */)
- result |= 68008383 /* ClassExcludes */;
+ result |= 899503 /* ClassExcludes */;
if (flags & 64 /* Interface */)
- result |= 67897736 /* InterfaceExcludes */;
+ result |= 788872 /* InterfaceExcludes */;
if (flags & 256 /* RegularEnum */)
- result |= 68008191 /* RegularEnumExcludes */;
+ result |= 899327 /* RegularEnumExcludes */;
if (flags & 128 /* ConstEnum */)
- result |= 68008831 /* ConstEnumExcludes */;
+ result |= 899967 /* ConstEnumExcludes */;
if (flags & 512 /* ValueModule */)
result |= 110735 /* ValueModuleExcludes */;
if (flags & 8192 /* Method */)
- result |= 67212223 /* MethodExcludes */;
+ result |= 103359 /* MethodExcludes */;
if (flags & 32768 /* GetAccessor */)
- result |= 67154879 /* GetAccessorExcludes */;
+ result |= 46015 /* GetAccessorExcludes */;
if (flags & 65536 /* SetAccessor */)
- result |= 67187647 /* SetAccessorExcludes */;
+ result |= 78783 /* SetAccessorExcludes */;
if (flags & 262144 /* TypeParameter */)
- result |= 67635688 /* TypeParameterExcludes */;
+ result |= 526824 /* TypeParameterExcludes */;
if (flags & 524288 /* TypeAlias */)
- result |= 67897832 /* TypeAliasExcludes */;
+ result |= 788968 /* TypeAliasExcludes */;
if (flags & 2097152 /* Alias */)
result |= 2097152 /* AliasExcludes */;
return result;
@@ -32623,8 +32990,8 @@ var ts;
function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) {
var constructorDeclaration = parameter.parent;
var classDeclaration = parameter.parent.parent;
- var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 67220415 /* Value */);
- var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 67220415 /* Value */);
+ var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 111551 /* Value */);
+ var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 111551 /* Value */);
if (parameterSymbol && propertySymbol) {
return [parameterSymbol, propertySymbol];
}
@@ -32803,7 +33170,7 @@ var ts;
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) {
+ if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 298 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
// type parameters are visible in parameter list, return type and type parameter list
? lastLocation === location.type ||
@@ -32906,7 +33273,7 @@ var ts;
if (!ts.hasModifier(location, 32 /* Static */)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
- if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) {
+ if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
// Remember the property node, it will be used later to report appropriate error
propertyWithInvalidInitializer = location;
}
@@ -32919,7 +33286,7 @@ var ts;
// The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals
// These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would
// trigger resolving late-bound names, which we may already be in the process of doing while we're here!
- if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 67897832 /* Type */)) {
+ if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
// ignore type parameters not declared in this container
result = undefined;
@@ -32946,7 +33313,7 @@ var ts;
// The type parameters of a class are not in scope in the base class expression.
if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) {
var container = location.parent.parent;
- if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) {
+ if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 788968 /* Type */))) {
if (nameNotFoundMessage) {
error(errorLocation, ts.Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
}
@@ -32966,7 +33333,7 @@ var ts;
grandparent = location.parent.parent;
if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
- if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) {
+ if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
return undefined;
}
@@ -33030,8 +33397,9 @@ var ts;
location = location.parent;
}
break;
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
break;
@@ -33129,21 +33497,21 @@ var ts;
// we want to check for block-scoped
if (errorLocation &&
(meaning & 2 /* BlockScopedVariable */ ||
- ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 67220415 /* Value */) === 67220415 /* Value */))) {
+ ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */))) {
var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
}
}
// If we're in an external module, we can't reference value symbols created from UMD export declarations
- if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
+ if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
}
}
// If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
- if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) {
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
var candidate = getMergedSymbol(getLateBoundSymbol(result));
var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
// A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
@@ -33260,9 +33628,9 @@ var ts;
}
}
function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
- var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(errorLocation) ? 67220415 /* Value */ : 0);
+ var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(errorLocation) ? 111551 /* Value */ : 0);
if (meaning === namespaceMeaning) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 /* Type */ & ~namespaceMeaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~namespaceMeaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
var parent = errorLocation.parent;
if (symbol) {
if (ts.isQualifiedName(parent)) {
@@ -33281,8 +33649,8 @@ var ts;
return false;
}
function checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning) {
- if (meaning & (67897832 /* Type */ & ~1920 /* Namespace */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, ~67897832 /* Type */ & 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ if (meaning & (788968 /* Type */ & ~1920 /* Namespace */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, ~788968 /* Type */ & 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol && !(symbol.flags & 1920 /* Namespace */)) {
error(errorLocation, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here, ts.unescapeLeadingUnderscores(name));
return true;
@@ -33291,12 +33659,12 @@ var ts;
return false;
}
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 /* Value */ & ~1024 /* NamespaceModule */)) {
+ if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
if (name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never") {
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
return true;
}
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 /* Type */ & ~67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol && !(symbol.flags & 1024 /* NamespaceModule */)) {
var message = isES2015OrLaterConstructorName(name)
? ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later
@@ -33320,15 +33688,15 @@ var ts;
return false;
}
function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 /* Value */ & ~1024 /* NamespaceModule */ & ~67897832 /* Type */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */ & ~788968 /* Type */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
return true;
}
}
- else if (meaning & (67897832 /* Type */ & ~1024 /* NamespaceModule */ & ~67220415 /* Value */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* ValueModule */ | 1024 /* NamespaceModule */) & ~67897832 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ else if (meaning & (788968 /* Type */ & ~1024 /* NamespaceModule */ & ~111551 /* Value */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* ValueModule */ | 1024 /* NamespaceModule */) & ~788968 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
return true;
@@ -33339,7 +33707,7 @@ var ts;
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
// Block-scoped variables cannot be used before their definition
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -33491,7 +33859,7 @@ var ts;
if (valueSymbol === unknownSymbol && typeSymbol === unknownSymbol) {
return unknownSymbol;
}
- if (valueSymbol.flags & (67897832 /* Type */ | 1920 /* Namespace */)) {
+ if (valueSymbol.flags & (788968 /* Type */ | 1920 /* Namespace */)) {
return valueSymbol;
}
var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName);
@@ -33581,7 +33949,7 @@ var ts;
if (ts.isClassExpression(expression)) {
return checkExpression(expression).symbol;
}
- var aliasLike = resolveEntityName(expression, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias);
+ var aliasLike = resolveEntityName(expression, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias);
if (aliasLike) {
return aliasLike;
}
@@ -33600,7 +33968,7 @@ var ts;
case 254 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
case 258 /* ExportSpecifier */:
- return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
+ return getTargetOfExportSpecifier(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
case 255 /* ExportAssignment */:
case 205 /* BinaryExpression */:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
@@ -33615,7 +33983,7 @@ var ts;
* OR Is a JSContainer which may merge an alias with a local declaration
*/
function isNonLocalAlias(symbol, excludes) {
- if (excludes === void 0) { excludes = 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */; }
+ if (excludes === void 0) { excludes = 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */; }
if (!symbol)
return false;
return (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */ || !!(symbol.flags & 2097152 /* Alias */ && symbol.flags & 67108864 /* Assignment */);
@@ -33649,7 +34017,7 @@ var ts;
var target = resolveAlias(symbol);
if (target) {
var markAlias = target === unknownSymbol ||
- ((target.flags & 67220415 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));
+ ((target.flags & 111551 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));
if (markAlias) {
markAliasSymbolAsReferenced(symbol);
}
@@ -33665,17 +34033,15 @@ var ts;
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 255 /* ExportAssignment */) {
- // export default
- checkExpressionCached(node.expression);
- }
- else if (node.kind === 258 /* ExportSpecifier */) {
- // export { } or export { as foo }
- checkExpressionCached(node.propertyName || node.name);
- }
- else if (ts.isInternalModuleImportEqualsDeclaration(node)) {
- // import foo =
- checkExpressionCached(node.moduleReference);
+ // We defer checking of the reference of an `import =` until the import itself is referenced,
+ // This way a chain of imports can be elided if ultimately the final input is only used in a type
+ // position.
+ if (ts.isInternalModuleImportEqualsDeclaration(node)) {
+ var target = resolveSymbol(symbol);
+ if (target === unknownSymbol || target.flags & 111551 /* Value */) {
+ // import foo =
+ checkExpressionCached(node.moduleReference);
+ }
}
}
}
@@ -33698,7 +34064,7 @@ var ts;
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */);
- return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
+ return resolveEntityName(entityName, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
function getFullyQualifiedName(symbol, containingLocation) {
@@ -33711,7 +34077,7 @@ var ts;
if (ts.nodeIsMissing(name)) {
return undefined;
}
- var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0);
+ var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 111551 /* Value */ : 0);
var symbol;
if (name.kind === 73 /* Identifier */) {
var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
@@ -34212,7 +34578,7 @@ var ts;
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 ? symbol.exportSymbol : symbol);
}
function symbolIsValue(symbol) {
- return !!(symbol.flags & 67220415 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 67220415 /* Value */);
+ return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */);
}
function findConstructorDeclaration(node) {
var members = node.members;
@@ -34320,7 +34686,7 @@ var ts;
}
function getQualifiedLeftMeaning(rightMeaning) {
// If we are looking in value space, the parent meaning is value, other wise it is namespace
- return rightMeaning === 67220415 /* Value */ ? 67220415 /* Value */ : 1920 /* Namespace */;
+ return rightMeaning === 111551 /* Value */ ? 111551 /* Value */ : 1920 /* Namespace */;
}
function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) {
if (visitedSymbolTablesMap === void 0) { visitedSymbolTablesMap = ts.createMap(); }
@@ -34438,11 +34804,11 @@ var ts;
return false;
}
function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67897832 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 788968 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false);
return access.accessibility === 0 /* Accessible */;
}
function isValueSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67220415 /* Value */, /*shouldComputeAliasesToMakeVisible*/ false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 111551 /* Value */, /*shouldComputeAliasesToMakeVisible*/ false);
return access.accessibility === 0 /* Accessible */;
}
function isAnySymbolAccessible(symbols, enclosingDeclaration, initialSymbol, meaning, shouldComputeAliasesToMakeVisible) {
@@ -34485,7 +34851,7 @@ var ts;
// from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however,
// we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal.
var firstDecl = ts.first(symbol.declarations);
- if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
+ if (!ts.length(containers) && meaning & 111551 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
containers = [getSymbolOfNode(firstDecl.parent)];
}
@@ -34598,7 +34964,7 @@ var ts;
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
entityName.parent.kind === 150 /* ComputedPropertyName */) {
// Typeof value
- meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
}
else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ ||
entityName.parent.kind === 249 /* ImportEqualsDeclaration */) {
@@ -34608,7 +34974,7 @@ var ts;
}
else {
// Type Reference or TypeAlias entity = Identifier
- meaning = 67897832 /* Type */;
+ meaning = 788968 /* Type */;
}
var firstIdentifier = getFirstIdentifier(entityName);
var symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
@@ -34780,14 +35146,14 @@ var ts;
}
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
var parentSymbol = getParentOfSymbol(type.symbol);
- var parentName = symbolToTypeNode(parentSymbol, context, 67897832 /* Type */);
+ var parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
var enumLiteralName = getDeclaredTypeOfSymbol(parentSymbol) === type
? parentName
: appendReferenceToType(parentName, ts.createTypeReferenceNode(ts.symbolName(type.symbol), /*typeArguments*/ undefined));
return enumLiteralName;
}
if (type.flags & 1056 /* EnumLike */) {
- return symbolToTypeNode(type.symbol, context, 67897832 /* Type */);
+ return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
}
if (type.flags & 128 /* StringLiteral */) {
context.approximateLength += (type.value.length + 2);
@@ -34810,7 +35176,7 @@ var ts;
if (!(context.flags & 1048576 /* AllowUniqueESSymbolType */)) {
if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
context.approximateLength += 6;
- return symbolToTypeNode(type.symbol, context, 67220415 /* Value */);
+ return symbolToTypeNode(type.symbol, context, 111551 /* Value */);
}
if (context.tracker.reportInaccessibleUniqueSymbolError) {
context.tracker.reportInaccessibleUniqueSymbolError();
@@ -34873,14 +35239,14 @@ var ts;
}
// Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter.
return type.symbol
- ? symbolToTypeNode(type.symbol, context, 67897832 /* Type */)
+ ? symbolToTypeNode(type.symbol, context, 788968 /* Type */)
: ts.createTypeReferenceNode(ts.createIdentifier("?"), /*typeArguments*/ undefined);
}
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */))
return ts.createTypeReferenceNode(ts.createIdentifier(""), typeArgumentNodes);
- return symbolToTypeNode(type.aliasSymbol, context, 67897832 /* Type */, typeArgumentNodes);
+ return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
}
if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) {
var types = type.flags & 1048576 /* Union */ ? formatUnionTypes(type.types) : type.types;
@@ -34959,21 +35325,21 @@ var ts;
id = (isConstructorObject ? "+" : "") + getSymbolId(symbol);
if (isJSConstructor(symbol.valueDeclaration)) {
// Instance and static types share the same symbol; only add 'typeof' for the static side.
- var isInstanceType = type === getInferredClassType(symbol) ? 67897832 /* Type */ : 67220415 /* Value */;
+ var isInstanceType = type === getInferredClassType(symbol) ? 788968 /* Type */ : 111551 /* Value */;
return symbolToTypeNode(symbol, context, isInstanceType);
}
// Always use 'typeof T' for type of class, enum, and module objects
else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) ||
shouldWriteTypeOfFunctionSymbol()) {
- return symbolToTypeNode(symbol, context, 67220415 /* Value */);
+ return symbolToTypeNode(symbol, context, 111551 /* Value */);
}
else if (context.visitedTypes && context.visitedTypes.has(typeId)) {
// If type is an anonymous type literal in a type alias declaration, use type alias name
var typeAlias = getTypeAliasForTypeLiteral(type);
if (typeAlias) {
// The specified symbol flags need to be reinterpreted as type flags
- return symbolToTypeNode(typeAlias, context, 67897832 /* Type */);
+ return symbolToTypeNode(typeAlias, context, 788968 /* Type */);
}
else {
return createElidedInformationPlaceholder(context);
@@ -35106,7 +35472,7 @@ var ts;
var typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
var flags_2 = context.flags;
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
- var ref = symbolToTypeNode(parent, context, 67897832 /* Type */, typeArgumentSlice);
+ var ref = symbolToTypeNode(parent, context, 788968 /* Type */, typeArgumentSlice);
context.flags = flags_2;
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
}
@@ -35119,7 +35485,7 @@ var ts;
}
var flags = context.flags;
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
- var finalRef = symbolToTypeNode(type.symbol, context, 67897832 /* Type */, typeArgumentNodes);
+ var finalRef = symbolToTypeNode(type.symbol, context, 788968 /* Type */, typeArgumentNodes);
context.flags = flags;
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
}
@@ -35236,7 +35602,7 @@ var ts;
trackComputedName(decl.name, saveEnclosingDeclaration, context);
}
}
- var propertyName = symbolToName(propertySymbol, context, 67220415 /* Value */, /*expectsIdentifier*/ true);
+ var propertyName = symbolToName(propertySymbol, context, 111551 /* Value */, /*expectsIdentifier*/ true);
context.approximateLength += (ts.symbolName(propertySymbol).length + 1);
context.enclosingDeclaration = saveEnclosingDeclaration;
var optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? ts.createToken(56 /* QuestionToken */) : undefined;
@@ -35386,7 +35752,7 @@ var ts;
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 306 /* JSDocParameterTag */);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 307 /* JSDocParameterTag */);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -35430,9 +35796,9 @@ var ts;
return;
// get symbol of the first identifier of the entityName
var firstIdentifier = getFirstIdentifier(node.expression);
- var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
+ var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (name) {
- context.tracker.trackSymbol(name, enclosingDeclaration, 67220415 /* Value */);
+ context.tracker.trackSymbol(name, enclosingDeclaration, 111551 /* Value */);
}
}
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
@@ -35594,7 +35960,7 @@ var ts;
}
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
- var isTypeOf = meaning === 67220415 /* Value */;
+ var isTypeOf = meaning === 111551 /* Value */;
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
// module is root, must use `ImportTypeNode`
var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
@@ -35673,7 +36039,7 @@ var ts;
}
}
function typeParameterShadowsNameInScope(escapedName, context) {
- return !!resolveName(context.enclosingDeclaration, escapedName, 67897832 /* Type */, /*nameNotFoundArg*/ undefined, escapedName, /*isUse*/ false);
+ return !!resolveName(context.enclosingDeclaration, escapedName, 788968 /* Type */, /*nameNotFoundArg*/ undefined, escapedName, /*isUse*/ false);
}
function typeParameterToName(type, context) {
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
@@ -35682,7 +36048,7 @@ var ts;
return cached;
}
}
- var result = symbolToName(type.symbol, context, 67897832 /* Type */, /*expectsIdentifier*/ true);
+ var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
var rawtext = result.escapedText;
var i = 0;
@@ -35909,8 +36275,9 @@ var ts;
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 306 /* JSDocEnumTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
@@ -35993,10 +36360,10 @@ var ts;
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
if (node.parent && node.parent.kind === 255 /* ExportAssignment */) {
- exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
+ exportSymbol = resolveName(node, node.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
}
else if (node.parent.kind === 258 /* ExportSpecifier */) {
- exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
var result;
if (exportSymbol) {
@@ -36017,7 +36384,7 @@ var ts;
// Add the referenced top container visible
var internalModuleReference = declaration.moduleReference;
var firstIdentifier = getFirstIdentifier(internalModuleReference);
- var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, undefined, undefined, /*isUse*/ false);
+ var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, undefined, undefined, /*isUse*/ false);
if (importSymbol) {
buildVisibleNodeList(importSymbol.declarations);
}
@@ -36081,8 +36448,10 @@ var ts;
}
return ts.Debug.assertNever(propertyName);
}
- // Pop an entry from the type resolution stack and return its associated result value. The result value will
- // be true if no circularities were detected, or false if a circularity was found.
+ /**
+ * Pop an entry from the type resolution stack and return its associated result value. The result value will
+ * be true if no circularities were detected, or false if a circularity was found.
+ */
function popTypeResolution() {
resolutionTargets.pop();
resolutionPropertyNames.pop();
@@ -36411,7 +36780,7 @@ var ts;
// No type specified and nothing can be inferred
return undefined;
}
- function getWidenedTypeFromAssignmentDeclaration(symbol, resolvedSymbol) {
+ function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
// function/class/{} initializers are themselves containers, so they won't merge in the same way as other initializers
var container = ts.getAssignedExpandoInitializer(symbol.valueDeclaration);
if (container) {
@@ -36444,7 +36813,7 @@ var ts;
}
}
if (!ts.isCallExpression(expression)) {
- jsdocType = getJSDocTypeFromAssignmentDeclaration(jsdocType, expression, symbol, declaration);
+ jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
}
if (!jsdocType) {
(types || (types = [])).push((ts.isBinaryExpression(expression) || ts.isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
@@ -36491,8 +36860,8 @@ var ts;
type.objectFlags |= 16384 /* JSLiteral */;
return type;
}
- function getJSDocTypeFromAssignmentDeclaration(declaredType, expression, _symbol, declaration) {
- var typeNode = ts.getJSDocType(expression.parent);
+ function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) {
+ var typeNode = ts.getEffectiveTypeAnnotationNode(expression.parent);
if (typeNode) {
var type = getWidenedType(getTypeFromTypeNode(typeNode));
if (!declaredType) {
@@ -36502,6 +36871,12 @@ var ts;
errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
}
}
+ if (symbol.parent) {
+ var typeNode_2 = ts.getEffectiveTypeAnnotationNode(symbol.parent.valueDeclaration);
+ if (typeNode_2) {
+ return getTypeOfPropertyOfType(getTypeFromTypeNode(typeNode_2), symbol.escapedName);
+ }
+ }
return declaredType;
}
/** If we don't have an explicit JSDoc type, get the type from the initializer. */
@@ -36772,7 +37147,7 @@ var ts;
}
else if (ts.isInJSFile(declaration) &&
(ts.isCallExpression(declaration) || ts.isBinaryExpression(declaration) || ts.isPropertyAccessExpression(declaration) && ts.isBinaryExpression(declaration.parent))) {
- type = getWidenedTypeFromAssignmentDeclaration(symbol);
+ type = getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (ts.isJSDocPropertyLikeTag(declaration)
|| ts.isPropertyAccessExpression(declaration)
@@ -36787,7 +37162,7 @@ var ts;
return getTypeOfFuncClassEnumModule(symbol);
}
type = ts.isBinaryExpression(declaration.parent) ?
- getWidenedTypeFromAssignmentDeclaration(symbol) :
+ getWidenedTypeForAssignmentDeclaration(symbol) :
tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
}
else if (ts.isPropertyAssignment(declaration)) {
@@ -36889,7 +37264,9 @@ var ts;
// Otherwise, fall back to 'any'.
else {
if (setter) {
- errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ if (!isPrivateWithinAmbient(setter)) {
+ errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ }
}
else {
ts.Debug.assert(!!getter, "there must existed getter as we are current checking either setter or getter in this function");
@@ -36944,7 +37321,7 @@ var ts;
}
else if (declaration.kind === 205 /* BinaryExpression */ ||
declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) {
- return getWidenedTypeFromAssignmentDeclaration(symbol);
+ return getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
var resolvedModule = resolveExternalModuleSymbol(symbol);
@@ -36953,7 +37330,7 @@ var ts;
return errorType;
}
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
- var type_2 = getWidenedTypeFromAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
+ var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
if (!popTypeResolution()) {
return reportCircularityError(symbol);
}
@@ -36982,7 +37359,7 @@ var ts;
// type symbol, call getDeclaredTypeOfSymbol.
// This check is important because without it, a call to getTypeOfSymbol could end
// up recursively calling getTypeOfAlias, causing a stack overflow.
- links.type = targetSymbol.flags & 67220415 /* Value */
+ links.type = targetSymbol.flags & 111551 /* Value */
? getTypeOfSymbol(targetSymbol)
: errorType;
}
@@ -37109,9 +37486,10 @@ var ts;
case 197 /* FunctionExpression */:
case 198 /* ArrowFunction */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 311 /* JSDocTemplateTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 306 /* JSDocEnumTag */:
+ case 305 /* JSDocCallbackTag */:
case 182 /* MappedType */:
case 176 /* ConditionalType */:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
@@ -37381,7 +37759,7 @@ var ts;
for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {
var node = baseTypeNodes_1[_b];
if (ts.isEntityNameExpression(node.expression)) {
- var baseSymbol = resolveEntityName(node.expression, 67897832 /* Type */, /*ignoreErrors*/ true);
+ var baseSymbol = resolveEntityName(node.expression, 788968 /* Type */, /*ignoreErrors*/ true);
if (!baseSymbol || !(baseSymbol.flags & 64 /* Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {
return false;
}
@@ -37428,9 +37806,10 @@ var ts;
if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {
return errorType;
}
- var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */;
- });
+ var declaration = ts.find(symbol.declarations, ts.isTypeAlias);
+ if (!declaration) {
+ return ts.Debug.fail("Type alias symbol with no valid declaration found");
+ }
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
// If typeNode is missing, we will error in checkJSDocTypedefTag.
var type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
@@ -37446,7 +37825,7 @@ var ts;
}
else {
type = errorType;
- error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
+ error(ts.isJSDocEnumTag(declaration) ? declaration : declaration.name || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
links.declaredType = type;
}
@@ -37763,7 +38142,7 @@ var ts;
else {
symbol.declarations.push(member);
}
- if (symbolFlags & 67220415 /* Value */) {
+ if (symbolFlags & 111551 /* Value */) {
if (!symbol.valueDeclaration || symbol.valueDeclaration.kind !== member.kind) {
symbol.valueDeclaration = member;
}
@@ -38069,8 +38448,9 @@ var ts;
}
var result;
for (var i = 0; i < signatureLists.length; i++) {
- // Allow matching non-generic signatures to have excess parameters and different return types
- var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true);
+ // Allow matching non-generic signatures to have excess parameters and different return types.
+ // Prefer matching this types if possible.
+ var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true);
if (!match) {
return undefined;
}
@@ -38094,7 +38474,7 @@ var ts;
for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {
var signature = _a[_i];
// Only process signatures with parameter lists that aren't already in the result list
- if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) {
+ if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true)) {
var unionSignatures = findMatchingSignatures(signatureLists, signature, i);
if (unionSignatures) {
var s = signature;
@@ -38103,7 +38483,7 @@ var ts;
var thisParameter = signature.thisParameter;
var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
if (firstThisParameterOfUnionSignatures) {
- var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */);
+ var thisType = getIntersectionType(ts.mapDefined(unionSignatures, function (sig) { return sig.thisParameter && getTypeOfSymbol(sig.thisParameter); }));
thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
@@ -38147,8 +38527,8 @@ var ts;
}
// A signature `this` type might be a read or a write position... It's very possible that it should be invariant
// and we should refuse to merge signatures if there are `this` types and they do not match. However, so as to be
- // permissive when calling, for now, we'll union the `this` types just like the overlapping-union-signature check does
- var thisType = getUnionType([getTypeOfSymbol(left), getTypeOfSymbol(right)], 2 /* Subtype */);
+ // permissive when calling, for now, we'll intersect the `this` types just like we do for param types in union signatures.
+ var thisType = getIntersectionType([getTypeOfSymbol(left), getTypeOfSymbol(right)]);
return createSymbolWithType(left, thisType);
}
function combineUnionParameters(left, right) {
@@ -38522,7 +38902,7 @@ var ts;
else {
// Otherwise, get the declared constraint type, and if the constraint type is a type parameter,
// get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T',
- // the modifiers type is T. Otherwise, the modifiers type is {}.
+ // the modifiers type is T. Otherwise, the modifiers type is unknown.
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint;
@@ -38967,7 +39347,7 @@ var ts;
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 /* StringLike */ ? globalStringType :
t.flags & 296 /* NumberLike */ ? globalNumberType :
- t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) :
+ t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 99 /* ESNext */) :
t.flags & 528 /* BooleanLike */ ? globalBooleanType :
t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) :
t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType :
@@ -39321,7 +39701,7 @@ var ts;
var type = ts.isJSDocParameterTag(param) ? (param.typeExpression && param.typeExpression.type) : param.type;
// Include parameter symbol instead of property symbol in the signature
if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !ts.isBindingPattern(param.name)) {
- var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 67220415 /* Value */, undefined, undefined, /*isUse*/ false);
+ var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 111551 /* Value */, undefined, undefined, /*isUse*/ false);
paramSymbol = resolvedSymbol;
}
if (i === 0 && paramSymbol.escapedName === "this" /* This */) {
@@ -39904,20 +40284,6 @@ var ts;
if (type) {
return type;
}
- // JS enums are 'string' or 'number', not an enum type.
- var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
- if (enumTag) {
- var links = getNodeLinks(enumTag);
- if (!pushTypeResolution(enumTag, 5 /* EnumTagType */)) {
- return errorType;
- }
- var type_4 = enumTag.typeExpression ? getTypeFromTypeNode(enumTag.typeExpression) : errorType;
- if (!popTypeResolution()) {
- type_4 = errorType;
- error(node, ts.Diagnostics.Enum_type_0_circularly_references_itself, symbolToString(symbol));
- }
- return (links.resolvedEnumType = type_4);
- }
// Get type from reference to named type that cannot be generic (enum or type parameter)
var res = tryGetDeclaredTypeOfSymbol(symbol);
if (res) {
@@ -39925,7 +40291,7 @@ var ts;
res.flags & 262144 /* TypeParameter */ ? getConstrainedTypeVariable(res, node) : getRegularTypeOfLiteralType(res) :
errorType;
}
- if (!(symbol.flags & 67220415 /* Value */ && isJSDocTypeReference(node))) {
+ if (!(symbol.flags & 111551 /* Value */ && isJSDocTypeReference(node))) {
return errorType;
}
var jsdocType = getJSDocTypeReference(node, symbol, typeArguments);
@@ -39933,7 +40299,7 @@ var ts;
return jsdocType;
}
// Resolve the type reference as a Type for the purpose of reporting errors.
- resolveTypeReferenceName(getTypeReferenceName(node), 67897832 /* Type */);
+ resolveTypeReferenceName(getTypeReferenceName(node), 788968 /* Type */);
return getTypeOfSymbol(symbol);
}
/**
@@ -40001,7 +40367,7 @@ var ts;
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) {
+ while (node && !ts.isStatement(node) && node.kind !== 298 /* JSDocComment */) {
var parent = node.parent;
if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
@@ -40079,10 +40445,10 @@ var ts;
if (!links.resolvedType) {
var symbol = void 0;
var type = void 0;
- var meaning = 67897832 /* Type */;
+ var meaning = 788968 /* Type */;
if (isJSDocTypeReference(node)) {
type = getIntendedTypeFromJSDocTypeReference(node);
- meaning |= 67220415 /* Value */;
+ meaning |= 111551 /* Value */;
}
if (!type) {
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
@@ -40137,10 +40503,10 @@ var ts;
return type;
}
function getGlobalValueSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67220415 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
+ return getGlobalSymbol(name, 111551 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
}
function getGlobalTypeSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67897832 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
+ return getGlobalSymbol(name, 788968 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
}
function getGlobalSymbol(name, meaning, diagnostic) {
// Don't track references for global symbols anyway, so value if `isReference` is arbitrary
@@ -40209,7 +40575,7 @@ var ts;
}
function getGlobalTypeOrUndefined(name, arity) {
if (arity === void 0) { arity = 0; }
- var symbol = getGlobalSymbol(name, 67897832 /* Type */, /*diagnostic*/ undefined);
+ var symbol = getGlobalSymbol(name, 788968 /* Type */, /*diagnostic*/ undefined);
return symbol && getTypeOfGlobalSymbol(symbol, arity);
}
function getGlobalExtractSymbol() {
@@ -40573,7 +40939,7 @@ var ts;
if (isEmptyAnonymousObjectType(type)) {
if (!(includes & 8388608 /* IncludesEmptyObject */)) {
includes |= 8388608 /* IncludesEmptyObject */;
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
}
else {
@@ -40581,13 +40947,13 @@ var ts;
if (type === wildcardType)
includes |= 4194304 /* IncludesWildcard */;
}
- else if ((strictNullChecks || !(flags & 98304 /* Nullable */)) && !ts.contains(typeSet, type)) {
+ else if ((strictNullChecks || !(flags & 98304 /* Nullable */)) && !typeSet.has(type.id.toString())) {
if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
// We have seen two distinct unit types which means we should reduce to an
// empty intersection. Adding TypeFlags.NonPrimitive causes that to happen.
includes |= 67108864 /* NonPrimitive */;
}
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
includes |= flags & 68943871 /* IncludesMask */;
}
@@ -40700,8 +41066,9 @@ var ts;
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
// for intersections of types with signatures can be deterministic.
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
- var typeSet = [];
- var includes = addTypesToIntersection(typeSet, 0, types);
+ var typeMembershipMap = ts.createMap();
+ var includes = addTypesToIntersection(typeMembershipMap, 0, types);
+ var typeSet = ts.arrayFrom(typeMembershipMap.values());
// An intersection type is considered empty if it contains
// the type never, or
// more than one unit type or,
@@ -41396,7 +41763,7 @@ var ts;
links.resolvedSymbol = unknownSymbol;
return links.resolvedType = errorType;
}
- var targetMeaning = node.isTypeOf ? 67220415 /* Value */ : node.flags & 2097152 /* JSDoc */ ? 67220415 /* Value */ | 67897832 /* Type */ : 67897832 /* Type */;
+ var targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 2097152 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */;
// TODO: Future work: support unions/generics/whatever via a deferred import-type
var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
if (!innerModuleSymbol) {
@@ -41426,7 +41793,7 @@ var ts;
resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
}
else {
- var errorMessage = targetMeaning === 67220415 /* Value */
+ var errorMessage = targetMeaning === 111551 /* Value */
? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here
: ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
error(node, errorMessage, node.argument.literal.text);
@@ -41440,7 +41807,7 @@ var ts;
function resolveImportSymbolType(node, links, symbol, meaning) {
var resolvedSymbol = resolveSymbol(symbol);
links.resolvedSymbol = resolvedSymbol;
- if (meaning === 67220415 /* Value */) {
+ if (meaning === 111551 /* Value */) {
return links.resolvedType = getTypeOfSymbol(symbol); // intentionally doesn't use resolved symbol so type is cached as expected on the alias
}
else {
@@ -41738,9 +42105,9 @@ var ts;
case 166 /* FunctionType */:
case 167 /* ConstructorType */:
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 295 /* JSDocFunctionType */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 180 /* TypeOperator */:
return getTypeFromTypeOperatorNode(node);
@@ -41967,7 +42334,8 @@ var ts;
}
function maybeTypeParameterReference(node) {
return !(node.kind === 149 /* QualifiedName */ ||
- node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
+ node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName ||
+ node.parent.kind === 184 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier);
}
function isTypeParameterPossiblyReferenced(tp, node) {
// If the type parameter doesn't have exactly one declaration, if there are invening statement blocks
@@ -43235,7 +43603,7 @@ var ts;
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */);
- var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
+ var isPerformingExcessPropertyChecks = !isApparentIntersectionConstituent && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
@@ -43245,11 +43613,11 @@ var ts;
return 0 /* False */;
}
}
- if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
+ var isPerformingCommonPropertyChecks = relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
target.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target) &&
- (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)) &&
- !hasCommonProperties(source, target, isComparingJsxAttributes)) {
+ (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
+ if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
if (reportErrors) {
var calls = getSignaturesOfType(source, 0 /* Call */);
var constructs = getSignaturesOfType(source, 1 /* Construct */);
@@ -43277,10 +43645,10 @@ var ts;
else {
if (target.flags & 1048576 /* Union */) {
result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
// Validate against excess props using the original `source`
var discriminantType = findMatchingDiscriminantType(source, target) || filterPrimitivesIfContainsNonPrimitive(target);
- if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined)) {
+ if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined, isIntersectionConstituent)) {
return 0 /* False */;
}
}
@@ -43288,9 +43656,9 @@ var ts;
else if (target.flags & 2097152 /* Intersection */) {
isIntersectionConstituent = true; // set here to affect the following trio of checks
result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
// Validate against excess props using the original `source`
- if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) {
+ if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, /*isIntersectionConstituent*/ false)) {
return 0 /* False */;
}
}
@@ -43605,7 +43973,7 @@ var ts;
}
return result;
}
- function typeArgumentsRelatedTo(sources, targets, variances, reportErrors) {
+ function typeArgumentsRelatedTo(sources, targets, variances, reportErrors, isIntersectionConstituent) {
if (sources === void 0) { sources = ts.emptyArray; }
if (targets === void 0) { targets = ts.emptyArray; }
if (variances === void 0) { variances = ts.emptyArray; }
@@ -43632,10 +44000,10 @@ var ts;
related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t);
}
else if (variance === 1 /* Covariant */) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
else if (variance === 2 /* Contravariant */) {
- related = isRelatedTo(t, s, reportErrors);
+ related = isRelatedTo(t, s, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
else if (variance === 3 /* Bivariant */) {
// In the bivariant case we first compare contravariantly without reporting
@@ -43644,16 +44012,16 @@ var ts;
// which is generally easier to reason about.
related = isRelatedTo(t, s, /*reportErrors*/ false);
if (!related) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
else {
// In the invariant case we first compare covariantly, and only when that
// succeeds do we proceed to compare contravariantly. Thus, error elaboration
// will typically be based on the covariant check.
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
if (related) {
- related &= isRelatedTo(t, s, reportErrors);
+ related &= isRelatedTo(t, s, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
if (!related) {
@@ -43796,7 +44164,7 @@ var ts;
source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
!(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
var variances = getAliasVariances(source.aliasSymbol);
- var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances);
+ var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -43971,13 +44339,16 @@ var ts;
if (relation !== identityRelation) {
source = getApparentType(source);
}
+ else if (isGenericMappedType(source)) {
+ return 0 /* False */;
+ }
if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target &&
!(ts.getObjectFlags(source) & 8192 /* MarkerType */ || ts.getObjectFlags(target) & 8192 /* MarkerType */)) {
// We have type references to the same generic type, and the type references are not marker
// type references (which are intended by be compared structurally). Obtain the variance
// information for the type parameters and relate the type arguments accordingly.
var variances = getVariances(source.target);
- var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances);
+ var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -44005,7 +44376,7 @@ var ts;
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) {
// Report structural errors only if we haven't reported any errors yet
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined, isIntersectionConstituent);
if (result) {
result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors);
if (result) {
@@ -44040,8 +44411,8 @@ var ts;
}
}
return 0 /* False */;
- function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
- if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
+ function relateVariances(sourceTypeArguments, targetTypeArguments, variances, isIntersectionConstituent) {
+ if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors, isIntersectionConstituent)) {
return result;
}
if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) {
@@ -44166,7 +44537,7 @@ var ts;
if (sourceProperty === targetProperty)
return "continue";
// We compare the source property to the target in the context of a single discriminant type.
- var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false);
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false, /*isIntersectionConstituent*/ false);
// If the target property could not be found, or if the properties were not related,
// then this constituent is not a match.
if (!related) {
@@ -44196,7 +44567,7 @@ var ts;
var result = -1 /* True */;
for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
var type = matchingTypes_1[_b];
- result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties);
+ result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties, /*isIntersectionConstituent*/ false);
if (result) {
result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false);
if (result) {
@@ -44231,7 +44602,7 @@ var ts;
}
return result || properties;
}
- function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */);
var source = getTypeOfSourceProperty(sourceProp);
if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) {
@@ -44271,10 +44642,10 @@ var ts;
return result_7;
}
else {
- return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
- function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {
@@ -44312,7 +44683,7 @@ var ts;
return 0 /* False */;
}
// If the target comes from a partial union prop, allow `undefined` in the target type
- var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
@@ -44335,7 +44706,7 @@ var ts;
}
return related;
}
- function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties, isIntersectionConstituent) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target, excludedProperties);
}
@@ -44424,7 +44795,7 @@ var ts;
if (!(targetProp.flags & 4194304 /* Prototype */)) {
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp && sourceProp !== targetProp) {
- var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, isIntersectionConstituent);
if (!related) {
return 0 /* False */;
}
@@ -44659,23 +45030,27 @@ var ts;
}
}
function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue) {
- var match;
+ // undefined=unknown, true=discriminated, false=not discriminated
+ // The state of each type progresses from left to right. Discriminated types stop at 'true'.
+ var discriminable = target.types.map(function (_) { return undefined; });
for (var _i = 0, discriminators_1 = discriminators; _i < discriminators_1.length; _i++) {
var _a = discriminators_1[_i], getDiscriminatingType = _a[0], propertyName = _a[1];
+ var i = 0;
for (var _b = 0, _c = target.types; _b < _c.length; _b++) {
var type = _c[_b];
var targetType = getTypeOfPropertyOfType(type, propertyName);
if (targetType && related(getDiscriminatingType(), targetType)) {
- if (match) {
- if (type === match)
- continue; // Finding multiple fields which discriminate to the same type is fine
- return defaultValue;
- }
- match = type;
+ discriminable[i] = discriminable[i] === undefined ? true : discriminable[i];
}
+ else {
+ discriminable[i] = false;
+ }
+ i++;
}
}
- return match || defaultValue;
+ var match = discriminable.indexOf(/*searchElement*/ true);
+ // make sure exactly 1 matches before returning it
+ return match === -1 || discriminable.indexOf(/*searchElement*/ true, match + 1) !== -1 ? defaultValue : target.types[match];
}
/**
* A type is 'weak' if it is an object type with at least one optional property
@@ -45487,7 +45862,7 @@ var ts;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
param.parent.parameters.indexOf(param) > -1 &&
- (resolveName(param, param.name.escapedText, 67897832 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
+ (resolveName(param, param.name.escapedText, 788968 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
param.name.originalKeywordKind && ts.isTypeNodeKind(param.name.originalKeywordKind))) {
var newName = "arg" + param.parent.parameters.indexOf(param);
errorOrSuggestion(noImplicitAny, declaration, ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, ts.declarationNameToString(param.name));
@@ -45651,7 +46026,7 @@ var ts;
objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
objectFlags & 32 /* Mapped */ ||
- type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));
+ type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && couldUnionOrIntersectionContainTypeVariables(type));
}
function couldUnionOrIntersectionContainTypeVariables(type) {
if (type.couldContainTypeVariables === undefined) {
@@ -45806,6 +46181,8 @@ var ts;
var visited;
var bivariant = false;
var propagationType;
+ var inferenceMatch = false;
+ var inferenceIncomplete = false;
var allowComplexConstraintInference = true;
inferFromTypes(originalSource, originalTarget);
function inferFromTypes(source, target) {
@@ -45828,43 +46205,54 @@ var ts;
inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
return;
}
- if (source.flags & 1048576 /* Union */ && target.flags & 1048576 /* Union */ && !(source.flags & 1024 /* EnumLiteral */ && target.flags & 1024 /* EnumLiteral */) ||
- source.flags & 2097152 /* Intersection */ && target.flags & 2097152 /* Intersection */) {
- // Source and target are both unions or both intersections. If source and target
- // are the same type, just relate each constituent type to itself.
- if (source === target) {
- for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
- var t = _a[_i];
- inferFromTypes(t, t);
- }
- return;
+ if (source === target && source.flags & 3145728 /* UnionOrIntersection */) {
+ // When source and target are the same union or intersection type, just relate each constituent
+ // type to itself.
+ for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ inferFromTypes(t, t);
}
- // Find each source constituent type that has an identically matching target constituent
- // type, and for each such type infer from the type to itself. When inferring from a
- // type to itself we effectively find all type parameter occurrences within that type
- // and infer themselves as their type arguments. We have special handling for numeric
- // and string literals because the number and string types are not represented as unions
- // of all their possible values.
- var matchingTypes = void 0;
- for (var _b = 0, _c = source.types; _b < _c.length; _b++) {
- var t = _c[_b];
- if (typeIdenticalToSomeType(t, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t);
- inferFromTypes(t, t);
- }
- else if (t.flags & (256 /* NumberLiteral */ | 128 /* StringLiteral */)) {
- var b = getBaseTypeOfLiteralType(t);
- if (typeIdenticalToSomeType(b, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t, b);
- }
+ return;
+ }
+ if (target.flags & 1048576 /* Union */) {
+ if (source.flags & 1048576 /* Union */) {
+ // First, infer between identically matching source and target constituents and remove the
+ // matching types.
+ var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
+ // Next, infer between closely matching source and target constituents and remove
+ // the matching types. Types closely match when they are instantiations of the same
+ // object type or instantiations of the same type alias.
+ var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
}
+ source = getUnionType(sources);
+ target = getUnionType(targets);
}
- // Next, to improve the quality of inferences, reduce the source and target types by
- // removing the identically matched constituents. For example, when inferring from
- // 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'.
- if (matchingTypes) {
- source = removeTypesFromUnionOrIntersection(source, matchingTypes);
- target = removeTypesFromUnionOrIntersection(target, matchingTypes);
+ else {
+ if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
+ return;
+ if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
+ return;
+ }
+ }
+ else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
+ // We reduce intersection types only when they contain naked type parameters. For example, when
+ // inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
+ // infer { extra: any } for T. But when inferring to 'string[] & Iterable' we want to keep the
+ // string[] on the source side and infer string for T.
+ if (source.flags & 2097152 /* Intersection */) {
+ // Infer between identically matching source and target constituents and remove the matching types.
+ var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
+ }
+ source = getIntersectionType(sources);
+ target = getIntersectionType(targets);
+ }
+ else if (!(source.flags & 1048576 /* Union */)) {
+ if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
+ return;
}
}
else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
@@ -45910,13 +46298,14 @@ var ts;
clearCachedInferences(inferences);
}
}
+ inferenceMatch = true;
return;
}
else {
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
var simplified = getSimplifiedType(target, /*writing*/ false);
if (simplified !== target) {
- inferFromTypesOnce(source, simplified);
+ invokeOnce(source, simplified, inferFromTypes);
}
else if (target.flags & 8388608 /* IndexedAccess */) {
var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
@@ -45925,13 +46314,13 @@ var ts;
if (indexType.flags & 63176704 /* Instantiable */) {
var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
if (simplified_1 && simplified_1 !== target) {
- inferFromTypesOnce(source, simplified_1);
+ invokeOnce(source, simplified_1, inferFromTypes);
}
}
}
}
}
- if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {
+ if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
// If source and target are references to the same generic type, infer from type arguments
inferFromTypeArguments(source.typeArguments || ts.emptyArray, target.typeArguments || ts.emptyArray, getVariances(source.target));
}
@@ -45961,16 +46350,16 @@ var ts;
}
else if (target.flags & 16777216 /* Conditional */ && !contravariant) {
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
- inferToMultipleTypes(source, targetTypes, /*isIntersection*/ false);
+ inferToMultipleTypes(source, targetTypes, target.flags);
}
else if (target.flags & 3145728 /* UnionOrIntersection */) {
- inferToMultipleTypes(source, target.types, !!(target.flags & 2097152 /* Intersection */));
+ inferToMultipleTypes(source, target.types, target.flags);
}
else if (source.flags & 1048576 /* Union */) {
// Source is a union or intersection type, infer from each constituent type
var sourceTypes = source.types;
- for (var _d = 0, sourceTypes_3 = sourceTypes; _d < sourceTypes_3.length; _d++) {
- var sourceType = sourceTypes_3[_d];
+ for (var _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) {
+ var sourceType = sourceTypes_3[_e];
inferFromTypes(sourceType, target);
}
}
@@ -45994,38 +46383,59 @@ var ts;
source = apparentSource;
}
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
- var key = source.id + "," + target.id;
- if (visited && visited.get(key)) {
- return;
- }
- (visited || (visited = ts.createMap())).set(key, true);
- // If we are already processing another target type with the same associated symbol (such as
- // an instantiation of the same generic type), we do not explore this target as it would yield
- // no further inferences. We exclude the static side of classes from this check since it shares
- // its symbol with the instance side which would lead to false positives.
- var isNonConstructorObject = target.flags & 524288 /* Object */ &&
- !(ts.getObjectFlags(target) & 16 /* Anonymous */ && target.symbol && target.symbol.flags & 32 /* Class */);
- var symbol = isNonConstructorObject ? target.symbol : undefined;
- if (symbol) {
- if (ts.contains(symbolStack, symbol)) {
- return;
- }
- (symbolStack || (symbolStack = [])).push(symbol);
- inferFromObjectTypes(source, target);
- symbolStack.pop();
- }
- else {
- inferFromObjectTypes(source, target);
+ invokeOnce(source, target, inferFromObjectTypes);
+ }
+ }
+ }
+ function invokeOnce(source, target, action) {
+ var key = source.id + "," + target.id;
+ var status = visited && visited.get(key);
+ if (status !== undefined) {
+ if (status & 1)
+ inferenceMatch = true;
+ if (status & 2)
+ inferenceIncomplete = true;
+ return;
+ }
+ (visited || (visited = ts.createMap())).set(key, 0);
+ var saveInferenceMatch = inferenceMatch;
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceMatch = false;
+ inferenceIncomplete = false;
+ action(source, target);
+ visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0));
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ }
+ function inferFromMatchingType(source, targets, matches) {
+ var matched = false;
+ for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
+ var t = targets_1[_i];
+ if (matches(source, t)) {
+ inferFromTypes(source, t);
+ matched = true;
+ }
+ }
+ return matched;
+ }
+ function inferFromMatchingTypes(sources, targets, matches) {
+ var matchedSources;
+ var matchedTargets;
+ for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
+ var t = targets_2[_i];
+ for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
+ var s = sources_1[_a];
+ if (matches(s, t)) {
+ inferFromTypes(s, t);
+ matchedSources = ts.appendIfUnique(matchedSources, s);
+ matchedTargets = ts.appendIfUnique(matchedTargets, t);
}
}
}
- function inferFromTypesOnce(source, target) {
- var key = source.id + "," + target.id;
- if (!visited || !visited.get(key)) {
- (visited || (visited = ts.createMap())).set(key, true);
- inferFromTypes(source, target);
- }
- }
+ return [
+ matchedSources ? ts.filter(sources, function (t) { return !ts.contains(matchedSources, t); }) : sources,
+ matchedTargets ? ts.filter(targets, function (t) { return !ts.contains(matchedTargets, t); }) : targets,
+ ];
}
function inferFromTypeArguments(sourceTypes, targetTypes, variances) {
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
@@ -46059,29 +46469,69 @@ var ts;
}
return undefined;
}
- function inferToMultipleTypes(source, targets, isIntersection) {
- // We infer from types that are not naked type variables first so that inferences we
- // make from nested naked type variables and given slightly higher priority by virtue
- // of being first in the candidates array.
+ function inferToMultipleTypes(source, targets, targetFlags) {
var typeVariableCount = 0;
- for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
- var t = targets_1[_i];
- if (getInferenceInfoForType(t)) {
- typeVariableCount++;
+ if (targetFlags & 1048576 /* Union */) {
+ var nakedTypeVariable = void 0;
+ var sources = source.flags & 1048576 /* Union */ ? source.types : [source];
+ var matched_1 = new Array(sources.length);
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceIncomplete = false;
+ // First infer to types that are not naked type variables. For each source type we
+ // track whether inferences were made from that particular type to some target.
+ for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
+ var t = targets_3[_i];
+ if (getInferenceInfoForType(t)) {
+ nakedTypeVariable = t;
+ typeVariableCount++;
+ }
+ else {
+ for (var i = 0; i < sources.length; i++) {
+ var saveInferenceMatch = inferenceMatch;
+ inferenceMatch = false;
+ inferFromTypes(sources[i], t);
+ if (inferenceMatch)
+ matched_1[i] = true;
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ }
+ }
}
- else {
- inferFromTypes(source, t);
+ var inferenceComplete = !inferenceIncomplete;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ // If the target has a single naked type variable and inference completed (meaning we
+ // explored the types fully), create a union of the source types from which no inferences
+ // have been made so far and infer from that union to the naked type variable.
+ if (typeVariableCount === 1 && inferenceComplete) {
+ var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; });
+ if (unmatched.length) {
+ inferFromTypes(getUnionType(unmatched), nakedTypeVariable);
+ return;
+ }
+ }
+ }
+ else {
+ // We infer from types that are not naked type variables first so that inferences we
+ // make from nested naked type variables and given slightly higher priority by virtue
+ // of being first in the candidates array.
+ for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
+ var t = targets_4[_a];
+ if (getInferenceInfoForType(t)) {
+ typeVariableCount++;
+ }
+ else {
+ inferFromTypes(source, t);
+ }
}
}
// Inferences directly to naked type variables are given lower priority as they are
// less specific. For example, when inferring from Promise to T | Promise,
// we want to infer string for T, not Promise | string. For intersection types
// we only infer to single naked type variables.
- if (isIntersection ? typeVariableCount === 1 : typeVariableCount !== 0) {
+ if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) {
var savePriority = priority;
priority |= 1 /* NakedTypeVariable */;
- for (var _a = 0, targets_2 = targets; _a < targets_2.length; _a++) {
- var t = targets_2[_a];
+ for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
+ var t = targets_5[_b];
if (getInferenceInfoForType(t)) {
inferFromTypes(source, t);
}
@@ -46146,6 +46596,27 @@ var ts;
return false;
}
function inferFromObjectTypes(source, target) {
+ // If we are already processing another target type with the same associated symbol (such as
+ // an instantiation of the same generic type), we do not explore this target as it would yield
+ // no further inferences. We exclude the static side of classes from this check since it shares
+ // its symbol with the instance side which would lead to false positives.
+ var isNonConstructorObject = target.flags & 524288 /* Object */ &&
+ !(ts.getObjectFlags(target) & 16 /* Anonymous */ && target.symbol && target.symbol.flags & 32 /* Class */);
+ var symbol = isNonConstructorObject ? target.symbol : undefined;
+ if (symbol) {
+ if (ts.contains(symbolStack, symbol)) {
+ inferenceIncomplete = true;
+ return;
+ }
+ (symbolStack || (symbolStack = [])).push(symbol);
+ inferFromObjectTypesWorker(source, target);
+ symbolStack.pop();
+ }
+ else {
+ inferFromObjectTypesWorker(source, target);
+ }
+ }
+ function inferFromObjectTypesWorker(source, target) {
if (isGenericMappedType(source) && isGenericMappedType(target)) {
// The source and target types are generic types { [P in S]: X } and { [P in T]: Y }, so we infer
// from S to T and from X to Y.
@@ -46244,28 +46715,12 @@ var ts;
}
}
}
- function typeIdenticalToSomeType(type, types) {
- for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
- var t = types_11[_i];
- if (isTypeIdenticalTo(t, type)) {
- return true;
- }
- }
- return false;
+ function isTypeOrBaseIdenticalTo(s, t) {
+ return isTypeIdenticalTo(s, t) || !!(s.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t);
}
- /**
- * Return a new union or intersection type computed by removing a given set of types
- * from a given union or intersection type.
- */
- function removeTypesFromUnionOrIntersection(type, typesToRemove) {
- var reducedTypes = [];
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (!typeIdenticalToSomeType(t, typesToRemove)) {
- reducedTypes.push(t);
- }
- }
- return type.flags & 1048576 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);
+ function isTypeCloselyMatchedBy(s, t) {
+ return !!(s.flags & 524288 /* Object */ && t.flags & 524288 /* Object */ && s.symbol && s.symbol === t.symbol ||
+ s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol);
}
function hasPrimitiveConstraint(type) {
var constraint = getConstraintOfTypeParameter(type);
@@ -46416,7 +46871,7 @@ var ts;
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
+ resolveName(node, node.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
/*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
@@ -46613,8 +47068,8 @@ var ts;
}
function getTypeFactsOfTypes(types) {
var result = 0 /* None */;
- for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
- var t = types_12[_i];
+ for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
+ var t = types_11[_i];
result |= getTypeFacts(t);
}
return result;
@@ -46989,8 +47444,8 @@ var ts;
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var t = types_13[_i];
+ for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
+ var t = types_12[_i];
if (!(t.flags & 131072 /* Never */)) {
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
return false;
@@ -47942,8 +48397,11 @@ var ts;
}
return type;
}
+ function isExportOrExportExpression(location) {
+ return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); });
+ }
function markAliasReferenced(symbol, location) {
- if (isNonLocalAlias(symbol, /*excludes*/ 67220415 /* Value */) && !isInTypeQuery(location) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && ((compilerOptions.preserveConstEnums && isExportOrExportExpression(location)) || !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol)))) {
markAliasSymbolAsReferenced(symbol);
}
}
@@ -48836,6 +49294,15 @@ var ts;
}
return false;
}
+ function getContextualIterationType(kind, functionDecl) {
+ var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2 /* Async */);
+ var contextualReturnType = getContextualReturnType(functionDecl);
+ if (contextualReturnType) {
+ return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
+ || undefined;
+ }
+ return undefined;
+ }
function getContextualReturnType(functionDecl) {
// If the containing function has a return type annotation, is a constructor, or is a get accessor whose
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
@@ -48929,7 +49396,7 @@ var ts;
}
else if (ts.isIdentifier(lhs.expression)) {
var id = lhs.expression;
- var parentSymbol = resolveName(id, id.escapedText, 67220415 /* Value */, undefined, id.escapedText, /*isUse*/ true);
+ var parentSymbol = resolveName(id, id.escapedText, 111551 /* Value */, undefined, id.escapedText, /*isUse*/ true);
if (parentSymbol) {
var annotated = ts.getEffectiveTypeAnnotationNode(parentSymbol.valueDeclaration);
if (annotated) {
@@ -49117,9 +49584,12 @@ var ts;
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
// be "pushed" onto a node using the contextualType property.
function getApparentTypeOfContextualType(node, contextFlags) {
- var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
- if (contextualType) {
- var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true);
+ var contextualType = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, contextFlags) :
+ getContextualType(node, contextFlags);
+ var instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
+ if (instantiatedType) {
+ var apparentType = mapType(instantiatedType, getApparentType, /*noReductions*/ true);
if (apparentType.flags & 1048576 /* Union */) {
if (ts.isObjectLiteralExpression(node)) {
return discriminateContextualTypeByObjectMembers(node, apparentType);
@@ -49169,7 +49639,7 @@ var ts;
return type;
}
/**
- * Woah! Do you really want to use this function?
+ * Whoa! Do you really want to use this function?
*
* Unless you're trying to get the *non-apparent* type for a
* value-literal type or you're authoring relevant portions of this algorithm,
@@ -49420,9 +49890,7 @@ var ts;
if (typeTagSignature) {
return typeTagSignature;
}
- var type = ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) :
- getApparentTypeOfContextualType(node, 1 /* Signature */);
+ var type = getApparentTypeOfContextualType(node, 1 /* Signature */);
if (!type) {
return undefined;
}
@@ -49431,8 +49899,8 @@ var ts;
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var current = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var current = types_13[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -49983,7 +50451,7 @@ var ts;
function getJsxType(name, location) {
var namespace = getJsxNamespaceAt(location);
var exports = namespace && getExportsOfSymbol(namespace);
- var typeSymbol = exports && getSymbol(exports, name, 67897832 /* Type */);
+ var typeSymbol = exports && getSymbol(exports, name, 788968 /* Type */);
return typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType;
}
/**
@@ -50057,7 +50525,7 @@ var ts;
*/
function getNameFromJsxElementAttributesContainer(nameOfAttribPropContainer, jsxNamespace) {
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [symbol]
- var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 67897832 /* Type */);
+ var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 788968 /* Type */);
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [type]
var jsxElementAttribPropInterfaceType = jsxElementAttribPropInterfaceSym && getDeclaredTypeOfSymbol(jsxElementAttribPropInterfaceSym);
// The properties of JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute
@@ -50081,7 +50549,7 @@ var ts;
}
function getJsxLibraryManagedAttributes(jsxNamespace) {
// JSX.LibraryManagedAttributes [symbol]
- return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 67897832 /* Type */);
+ return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 788968 /* Type */);
}
/// e.g. "props" for React.d.ts,
/// or 'undefined' if ElementAttributesProperty doesn't exist (which means all
@@ -50233,13 +50701,13 @@ var ts;
var reactRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
var reactNamespace = getJsxNamespace(node);
var reactLocation = isNodeOpeningLikeElement ? node.tagName : node;
- var reactSym = resolveName(reactLocation, reactNamespace, 67220415 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true);
+ var reactSym = resolveName(reactLocation, reactNamespace, 111551 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true);
if (reactSym) {
// Mark local symbol as referenced here because it might not have been marked
// if jsx emit was not react as there wont be error being emitted
reactSym.isReferenced = 67108863 /* All */;
- // If react symbol is alias, mark it as referenced
- if (reactSym.flags & 2097152 /* Alias */ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) {
+ // If react symbol is alias, mark it as refereced
+ if (reactSym.flags & 2097152 /* Alias */) {
markAliasSymbolAsReferenced(reactSym);
}
}
@@ -50564,7 +51032,7 @@ var ts;
}
function checkPropertyNotUsedBeforeDeclaration(prop, node, right) {
var valueDeclaration = prop.valueDeclaration;
- if (!valueDeclaration) {
+ if (!valueDeclaration || ts.getSourceFileOfNode(node).isDeclarationFile) {
return;
}
var diagnosticMessage;
@@ -50680,7 +51148,7 @@ var ts;
return prop !== undefined && prop.valueDeclaration && ts.hasModifier(prop.valueDeclaration, 32 /* Static */);
}
function getSuggestedSymbolForNonexistentProperty(name, containingType) {
- return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 67220415 /* Value */);
+ return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 111551 /* Value */);
}
function getSuggestionForNonexistentProperty(name, containingType) {
var suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
@@ -52164,8 +52632,8 @@ var ts;
if (apparentType.flags & 1048576 /* Union */) {
var types = apparentType.types;
var hasSignatures = false;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var constituent = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var constituent = types_14[_i];
var signatures = getSignaturesOfType(constituent, kind);
if (signatures.length !== 0) {
hasSignatures = true;
@@ -52316,8 +52784,8 @@ var ts;
var exports = namespace && getExportsOfSymbol(namespace);
// We fake up a SFC signature for each intrinsic, however a more specific per-element signature drawn from the JSX declaration
// file would probably be preferable.
- var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */);
- var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node);
+ var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* Type */);
+ var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* Type */, node);
var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */));
var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
parameterSymbol.type = result;
@@ -52546,7 +53014,7 @@ var ts;
if (!globalESSymbol) {
return false;
}
- return globalESSymbol === resolveName(left, "Symbol", 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
+ return globalESSymbol === resolveName(left, "Symbol", 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
}
function checkImportCallExpression(node) {
// Check grammar of dynamic import
@@ -52606,7 +53074,7 @@ var ts;
// Make sure require is not a local function
if (!ts.isIdentifier(node.expression))
return ts.Debug.fail();
- var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); // TODO: GH#18217
+ var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); // TODO: GH#18217
if (resolvedRequire === requireSymbol) {
return true;
}
@@ -52715,8 +53183,8 @@ var ts;
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
- error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
+ error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system);
}
var file = ts.getSourceFileOfNode(node);
ts.Debug.assert(!!(file.flags & 1048576 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
@@ -52906,7 +53374,7 @@ var ts;
links.type = contextualType;
var decl = parameter.valueDeclaration;
if (decl.name.kind !== 73 /* Identifier */) {
- // if inference didn't come up with anything but {}, fall back to the binding pattern if present.
+ // if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
@@ -53014,7 +53482,7 @@ var ts;
nextType && isUnitType(nextType)) {
var contextualType = !contextualSignature ? undefined :
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
- getReturnTypeOfSignature(contextualSignature);
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
if (isGenerator) {
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0 /* Yield */, isAsync);
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1 /* Return */, isAsync);
@@ -53032,7 +53500,7 @@ var ts;
nextType = getWidenedType(nextType);
}
if (isGenerator) {
- return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || unknownType, isAsync);
+ return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || getContextualIterationType(2 /* Next */, func) || unknownType, isAsync);
}
else {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -53152,8 +53620,8 @@ var ts;
var witnesses = getSwitchClauseTypeOfWitnesses(node);
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
- var type_5 = getBaseConstraintOfType(operandType) || operandType;
- return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
+ var type_4 = getBaseConstraintOfType(operandType) || operandType;
+ return !!(filterType(type_4, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
}
var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
@@ -53526,7 +53994,11 @@ var ts;
}
}
var operandType = checkExpression(node.expression);
- return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ var awaitedType = checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ if (awaitedType === operandType && awaitedType !== errorType && !(operandType.flags & 3 /* AnyOrUnknown */)) {
+ addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(node, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
+ }
+ return awaitedType;
}
function checkPrefixUnaryExpression(node) {
var operandType = checkExpression(node.operand);
@@ -53611,8 +54083,8 @@ var ts;
}
if (type.flags & 3145728 /* UnionOrIntersection */) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -53721,7 +54193,7 @@ var ts;
error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
else {
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(property, 4 /* Rest */);
}
var nonRestNames = [];
@@ -54095,7 +54567,7 @@ var ts;
var propType = getTypeOfSymbol(prop);
if (propType.symbol && propType.symbol.flags & 32 /* Class */) {
var name = prop.escapedName;
- var symbol = resolveName(prop.valueDeclaration, name, 67897832 /* Type */, undefined, name, /*isUse*/ false);
+ var symbol = resolveName(prop.valueDeclaration, name, 788968 /* Type */, undefined, name, /*isUse*/ false);
if (symbol && symbol.declarations.some(ts.isJSDocTypedefTag)) {
grammarErrorOnNode(symbol.declarations[0], ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
return grammarErrorOnNode(prop.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
@@ -54244,7 +54716,7 @@ var ts;
if (node.asteriskToken) {
// Async generator functions prior to ESNext require the __await, __asyncDelegator,
// and __asyncValues helpers
- if (isAsync && languageVersion < 8 /* ESNext */) {
+ if (isAsync && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 53248 /* AsyncDelegatorIncludes */);
}
// Generator functions prior to ES2015 require the __values helper
@@ -54274,7 +54746,7 @@ var ts;
return getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, isAsync)
|| anyType;
}
- return anyType;
+ return getContextualIterationType(2 /* Next */, func) || anyType;
}
function checkConditionalExpression(node, checkMode) {
checkTruthinessExpression(node.condition);
@@ -54624,7 +55096,8 @@ var ts;
var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) ||
(node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) ||
((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node));
+ (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node)) ||
+ (node.parent.kind === 258 /* ExportSpecifier */ && (compilerOptions.preserveConstEnums || node.flags & 4194304 /* Ambient */)); // We allow reexporting const enums
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -54889,7 +55362,7 @@ var ts;
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4 /* Invalid */)) {
// Async generators prior to ESNext require the __await and __asyncGenerator helpers
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) {
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 12288 /* AsyncGeneratorIncludes */);
}
// Async functions prior to ES2017 require the __awaiter helper
@@ -54952,13 +55425,6 @@ var ts;
}
}
function checkClassForDuplicateDeclarations(node) {
- var Declaration;
- (function (Declaration) {
- Declaration[Declaration["Getter"] = 1] = "Getter";
- Declaration[Declaration["Setter"] = 2] = "Setter";
- Declaration[Declaration["Method"] = 4] = "Method";
- Declaration[Declaration["Property"] = 3] = "Property";
- })(Declaration || (Declaration = {}));
var instanceNames = ts.createUnderscoreEscapedMap();
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
@@ -54967,7 +55433,7 @@ var ts;
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
- addName(instanceNames, param.name, param.name.escapedText, 3 /* Property */);
+ addName(instanceNames, param.name, param.name.escapedText, 3 /* GetOrSetAccessor */);
}
}
}
@@ -54979,16 +55445,16 @@ var ts;
if (name && memberName) {
switch (member.kind) {
case 159 /* GetAccessor */:
- addName(names, name, memberName, 1 /* Getter */);
+ addName(names, name, memberName, 1 /* GetAccessor */);
break;
case 160 /* SetAccessor */:
- addName(names, name, memberName, 2 /* Setter */);
+ addName(names, name, memberName, 2 /* SetAccessor */);
break;
case 155 /* PropertyDeclaration */:
- addName(names, name, memberName, 3 /* Property */);
+ addName(names, name, memberName, 3 /* GetOrSetAccessor */);
break;
case 157 /* MethodDeclaration */:
- addName(names, name, memberName, 4 /* Method */);
+ addName(names, name, memberName, 8 /* Method */);
break;
}
}
@@ -54997,8 +55463,8 @@ var ts;
function addName(names, location, name, meaning) {
var prev = names.get(name);
if (prev) {
- if (prev & 4 /* Method */) {
- if (meaning !== 4 /* Method */) {
+ if (prev & 8 /* Method */) {
+ if (meaning !== 8 /* Method */) {
error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));
}
}
@@ -55566,6 +56032,7 @@ var ts;
}
var duplicateFunctionDeclaration = false;
var multipleConstructorImplementation = false;
+ var hasNonAmbientClass = false;
for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
var current = declarations_4[_i];
var node = current;
@@ -55581,6 +56048,9 @@ var ts;
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
+ if ((node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */) && !inAmbientContext) {
+ hasNonAmbientClass = true;
+ }
if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
@@ -55622,6 +56092,15 @@ var ts;
error(ts.getNameOfDeclaration(declaration), ts.Diagnostics.Duplicate_function_implementation);
});
}
+ if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */) {
+ // A non-ambient class cannot be an implementation for a non-constructor function/class merge
+ // TODO: The below just replicates our older error from when classes and functions were
+ // entirely unable to merge - a more helpful message like "Class declaration cannot implement overload list"
+ // might be warranted. :shrug:
+ ts.forEach(declarations, function (declaration) {
+ addDuplicateDeclarationError(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Duplicate_identifier_0, ts.symbolName(symbol), ts.filter(declarations, function (d) { return d !== declaration; }));
+ });
+ }
// Abstract methods can't have an implementation -- in particular, they don't need one.
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&
!ts.hasModifier(lastSeenNonAmbientDeclaration, 128 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) {
@@ -55643,13 +56122,6 @@ var ts;
}
}
}
- var DeclarationSpaces;
- (function (DeclarationSpaces) {
- DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None";
- DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue";
- DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType";
- DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace";
- })(DeclarationSpaces || (DeclarationSpaces = {}));
function checkExportsOnMergedDeclarations(node) {
if (!produceDiagnostics) {
return;
@@ -55713,8 +56185,9 @@ var ts;
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return 2 /* ExportType */;
case 245 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
@@ -55812,9 +56285,6 @@ var ts;
*/
function checkAwaitedType(type, errorNode, diagnosticMessage, arg0) {
var awaitedType = getAwaitedType(type, errorNode, diagnosticMessage, arg0);
- if (awaitedType === type && !(type.flags & 3 /* AnyOrUnknown */)) {
- addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(errorNode, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
- }
return awaitedType || errorType;
}
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -55973,7 +56443,7 @@ var ts;
error(returnTypeNode, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
return;
}
- var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true);
+ var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 111551 /* Value */, /*ignoreErrors*/ true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
@@ -55996,7 +56466,7 @@ var ts;
}
// Verify there is no local declaration that could collide with the promise constructor.
var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
- var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 67220415 /* Value */);
+ var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 111551 /* Value */);
if (collidingSymbol) {
error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, ts.idText(rootName), ts.entityNameToString(promiseConstructorName));
return;
@@ -56053,7 +56523,7 @@ var ts;
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
+ var meaning = (typeName.kind === 73 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true);
if (rootSymbol
&& rootSymbol.flags & 2097152 /* Alias */
@@ -56092,8 +56562,8 @@ var ts;
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
@@ -56821,7 +57291,7 @@ var ts;
}
}
if (node.kind === 187 /* BindingElement */) {
- if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) {
+ if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 4 /* Rest */);
}
// check computed properties inside property names of binding elements
@@ -57035,7 +57505,7 @@ var ts;
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) {
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 99 /* ESNext */) {
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
checkExternalEmitHelpers(node, 32768 /* ForAwaitOfIncludes */);
}
@@ -58312,7 +58782,7 @@ var ts;
// derived class instance member variables and accessors, but not by other kinds of members.
// NOTE: assignability is checked in checkClassDeclaration
var baseProperties = getPropertiesOfType(baseType);
- for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
+ basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304 /* Prototype */) {
@@ -58321,54 +58791,65 @@ var ts;
var derived = getTargetSymbol(getPropertyOfObjectType(type, base.escapedName)); // TODO: GH#18217
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration.");
- if (derived) {
- // In order to resolve whether the inherited method was overridden in the base class or not,
- // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
- // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
- if (derived === base) {
- // derived class inherits base without override/redeclaration
- var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
- // It is an error to inherit an abstract member without implementing it or being declared abstract.
- // If there is no declaration for the derived class (as in the case of class expressions),
- // then the class cannot be declared abstract.
- if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 210 /* ClassExpression */) {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
- }
- else {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
+ // In order to resolve whether the inherited method was overridden in the base class or not,
+ // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
+ // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
+ if (derived === base) {
+ // derived class inherits base without override/redeclaration
+ var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
+ // It is an error to inherit an abstract member without implementing it or being declared abstract.
+ // If there is no declaration for the derived class (as in the case of class expressions),
+ // then the class cannot be declared abstract.
+ if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
+ // Searches other base types for a declaration that would satisfy the inherited abstract member.
+ // (The class may have more than one base type via declaration merging with an interface with the
+ // same name.)
+ for (var _a = 0, _b = getBaseTypes(type); _a < _b.length; _a++) {
+ var otherBaseType = _b[_a];
+ if (otherBaseType === baseType)
+ continue;
+ var baseSymbol = getPropertyOfObjectType(otherBaseType, base.escapedName);
+ var derivedElsewhere = baseSymbol && getTargetSymbol(baseSymbol);
+ if (derivedElsewhere && derivedElsewhere !== base) {
+ continue basePropertyCheck;
}
}
- }
- else {
- // derived overrides base.
- var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
- if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
- // either base or derived property is private - not override, skip it
- continue;
- }
- if (isPrototypeProperty(base) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) {
- // method is overridden with method or property/accessor is overridden with property/accessor - correct case
- continue;
- }
- var errorMessage = void 0;
- if (isPrototypeProperty(base)) {
- if (derived.flags & 98304 /* Accessor */) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
- }
- else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
- }
- }
- else if (base.flags & 98304 /* Accessor */) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ if (derivedClassDecl.kind === 210 /* ClassExpression */) {
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
}
- error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
}
}
+ else {
+ // derived overrides base.
+ var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
+ if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
+ // either base or derived property is private - not override, skip it
+ continue;
+ }
+ if (isPrototypeProperty(base) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) {
+ // method is overridden with method or property/accessor is overridden with property/accessor - correct case
+ continue;
+ }
+ var errorMessage = void 0;
+ if (isPrototypeProperty(base)) {
+ if (derived.flags & 98304 /* Accessor */) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
+ }
+ }
+ else if (base.flags & 98304 /* Accessor */) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
+ }
}
}
function checkInheritedPropertiesAreIdentical(type, typeNode) {
@@ -58912,15 +59393,16 @@ var ts;
function checkAliasSymbol(node) {
var symbol = getSymbolOfNode(node);
var target = resolveAlias(symbol);
- if (target !== unknownSymbol) {
- // For external modules symbol represent local symbol for an alias.
+ var shouldSkipWithJSExpandoTargets = symbol.flags & 67108864 /* Assignment */;
+ if (!shouldSkipWithJSExpandoTargets && target !== unknownSymbol) {
+ // For external modules symbol represents local symbol for an alias.
// This local symbol will merge any other local declarations (excluding other aliases)
// and symbol.flags will contains combined representation for all merged declaration.
// Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,
// otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export*
// in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).
- var excludedMeanings = (symbol.flags & (67220415 /* Value */ | 1048576 /* ExportValue */) ? 67220415 /* Value */ : 0) |
- (symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) |
+ var excludedMeanings = (symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */) ? 111551 /* Value */ : 0) |
+ (symbol.flags & 788968 /* Type */ ? 788968 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
var message = node.kind === 258 /* ExportSpecifier */ ?
@@ -58931,7 +59413,7 @@ var ts;
// Don't allow to re-export something with no value side when `--isolatedModules` is set.
if (compilerOptions.isolatedModules
&& node.kind === 258 /* ExportSpecifier */
- && !(target.flags & 67220415 /* Value */)
+ && !(target.flags & 111551 /* Value */)
&& !(node.flags & 4194304 /* Ambient */)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
}
@@ -58984,14 +59466,14 @@ var ts;
if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
- if (target.flags & 67220415 /* Value */) {
+ if (target.flags & 111551 /* Value */) {
// Target is a value symbol, check that it is not hidden by a local declaration with the same name
var moduleName = getFirstIdentifier(node.moduleReference);
- if (!(resolveEntityName(moduleName, 67220415 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
+ if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
}
}
- if (target.flags & 67897832 /* Type */) {
+ if (target.flags & 788968 /* Type */) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
}
}
@@ -59051,13 +59533,17 @@ var ts;
if (!node.parent.parent.moduleSpecifier) {
var exportedName = node.propertyName || node.name;
// find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases)
- var symbol = resolveName(exportedName, exportedName.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
+ var symbol = resolveName(exportedName, exportedName.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
/*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
}
else {
markExportAsReferenced(node);
+ var target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
+ if (!target || target === unknownSymbol || target.flags & 111551 /* Value */) {
+ checkExpressionCached(node.propertyName || node.name);
+ }
}
}
}
@@ -59081,7 +59567,17 @@ var ts;
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
if (node.expression.kind === 73 /* Identifier */) {
- markExportAsReferenced(node);
+ var id = node.expression;
+ var sym = resolveEntityName(id, 67108863 /* All */, /*ignoreErrors*/ true, /*dontResolveAlias*/ true, node);
+ if (sym) {
+ markAliasReferenced(sym, id);
+ // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
+ var target = sym.flags & 2097152 /* Alias */ ? resolveAlias(sym) : sym;
+ if (target === unknownSymbol || target.flags & 111551 /* Value */) {
+ // However if it is a value, we need to check it's being used correctly
+ checkExpressionCached(node.expression);
+ }
+ }
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, /*setVisibility*/ true);
}
@@ -59150,14 +59646,6 @@ var ts;
links.exportsChecked = true;
}
}
- function isNotAccessor(declaration) {
- // Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
- return !ts.isAccessor(declaration);
- }
- function isNotOverload(declaration) {
- return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
- !!declaration.body;
- }
function checkSourceElement(node) {
if (node) {
var saveCurrentNode = currentNode;
@@ -59237,16 +59725,17 @@ var ts;
return checkInferType(node);
case 184 /* ImportType */:
return checkImportType(node);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return checkJSDocTypeAliasTag(node);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return checkJSDocTemplateTag(node);
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
return checkJSDocTypeTag(node);
- case 306 /* JSDocParameterTag */:
+ case 307 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
case 295 /* JSDocFunctionType */:
checkJSDocFunctionType(node);
@@ -59255,7 +59744,7 @@ var ts;
case 292 /* JSDocNullableType */:
case 290 /* JSDocAllType */:
case 291 /* JSDocUnknownType */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
@@ -59596,7 +60085,7 @@ var ts;
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
// Note: that the memberFlags come from previous iteration.
if (!isStatic) {
- copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */);
+ copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* Type */);
}
break;
case 197 /* FunctionExpression */:
@@ -59749,7 +60238,7 @@ var ts;
if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
// Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression
var success = resolveEntityName(entityName,
- /*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
+ /*all meanings*/ 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
if (success && success !== unknownSymbol) {
return success;
}
@@ -59775,10 +60264,10 @@ var ts;
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) {
- meaning = 67897832 /* Type */;
+ meaning = 788968 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
- meaning |= 67220415 /* Value */;
+ meaning |= 111551 /* Value */;
}
}
else {
@@ -59790,10 +60279,10 @@ var ts;
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 306 /* JSDocParameterTag */) {
+ if (entityName.parent.kind === 307 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 310 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 311 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -59808,7 +60297,7 @@ var ts;
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
- return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
+ return resolveEntityName(entityName, 111551 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) {
var links = getNodeLinks(entityName);
@@ -59825,7 +60314,7 @@ var ts;
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
+ var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
if (entityName.parent.kind === 164 /* TypePredicate */) {
@@ -59935,7 +60424,7 @@ var ts;
}
function getShorthandAssignmentValueSymbol(location) {
if (location && location.kind === 277 /* ShorthandPropertyAssignment */) {
- return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */);
+ return resolveEntityName(location.name, 111551 /* Value */ | 2097152 /* Alias */);
}
return undefined;
}
@@ -59943,7 +60432,7 @@ var ts;
function getExportSpecifierLocalTargetSymbol(node) {
return node.parent.parent.moduleSpecifier ?
getExternalModuleMember(node.parent.parent, node) :
- resolveEntityName(node.propertyName || node.name, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ resolveEntityName(node.propertyName || node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
function getTypeOfNode(node) {
if (node.flags & 8388608 /* InWithStatement */) {
@@ -60144,13 +60633,13 @@ var ts;
// for export assignments - check if resolved symbol for RHS is itself a value
// otherwise - check if at least one export is value
symbolLinks.exportsSomeValue = hasExportAssignment
- ? !!(moduleSymbol.flags & 67220415 /* Value */)
+ ? !!(moduleSymbol.flags & 111551 /* Value */)
: ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue);
}
return symbolLinks.exportsSomeValue;
function isValue(s) {
s = resolveSymbol(s);
- return s && !!(s.flags & 67220415 /* Value */);
+ return s && !!(s.flags & 111551 /* Value */);
}
}
function isNameOfModuleOrEnumDeclaration(node) {
@@ -60199,7 +60688,7 @@ var ts;
var symbol = getReferencedValueSymbol(node);
// We should only get the declaration of an alias if there isn't a local value
// declaration for the symbol
- if (isNonLocalAlias(symbol, /*excludes*/ 67220415 /* Value */)) {
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */)) {
return getDeclarationOfAliasSymbol(symbol);
}
}
@@ -60216,7 +60705,7 @@ var ts;
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
- if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
+ if (resolveName(container.parent, symbol.escapedName, 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
// redeclaration - always should be renamed
links.isDeclarationWithCollidingName = true;
}
@@ -60312,7 +60801,7 @@ var ts;
}
// const enums and modules that contain only const enums are not considered values from the emit perspective
// unless 'preserveConstEnums' option is set to true
- return !!(target.flags & 67220415 /* Value */) &&
+ return !!(target.flags & 111551 /* Value */) &&
(compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));
}
function isConstEnumOrConstEnumOnlyModule(s) {
@@ -60326,7 +60815,7 @@ var ts;
}
var target = getSymbolLinks(symbol).target; // TODO: GH#18217
if (target && ts.getModifierFlags(node) & 1 /* Export */ &&
- target.flags & 67220415 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
+ target.flags & 111551 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
// An `export import ... =` of a value symbol is always considered referenced
return true;
}
@@ -60380,7 +60869,7 @@ var ts;
if (!symbol || !(symbol.flags & 16 /* Function */)) {
return false;
}
- return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 67220415 /* Value */ && ts.isPropertyAccessExpression(p.valueDeclaration); });
+ return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 111551 /* Value */ && p.valueDeclaration && ts.isPropertyAccessExpression(p.valueDeclaration); });
}
function getPropertiesOfContainerFunction(node) {
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
@@ -60434,9 +60923,9 @@ var ts;
return ts.TypeReferenceSerializationKind.Unknown;
}
// Resolve the symbol as a value to ensure the type can be reached at runtime during emit.
- var valueSymbol = resolveEntityName(typeName, 67220415 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
+ var valueSymbol = resolveEntityName(typeName, 111551 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
// Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.
- var typeSymbol = resolveEntityName(typeName, 67897832 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
+ var typeSymbol = resolveEntityName(typeName, 788968 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
if (valueSymbol && valueSymbol === typeSymbol) {
var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(/*reportErrors*/ false);
if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) {
@@ -60541,7 +61030,7 @@ var ts;
location = getDeclarationContainer(parent);
}
}
- return resolveName(location, reference.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
+ return resolveName(location, reference.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
}
function getReferencedValueDeclaration(referenceIn) {
if (!ts.isGeneratedIdentifier(referenceIn)) {
@@ -60562,7 +61051,7 @@ var ts;
return false;
}
function literalTypeToNode(type, enclosing, tracker) {
- var enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(type.symbol, 67220415 /* Value */, enclosing, /*flags*/ undefined, tracker)
+ var enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(type.symbol, 111551 /* Value */, enclosing, /*flags*/ undefined, tracker)
: type === trueType ? ts.createTrue() : type === falseType && ts.createFalse();
return enumResult || ts.createLiteral(type.value);
}
@@ -60675,9 +61164,9 @@ var ts;
// property access can only be used as values, or types when within an expression with type arguments inside a heritage clause
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
- var meaning = 67897832 /* Type */ | 1920 /* Namespace */;
+ var meaning = 788968 /* Type */ | 1920 /* Namespace */;
if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
- meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
}
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
@@ -60900,7 +61389,7 @@ var ts;
for (var helper = 1 /* FirstEmitHelper */; helper <= 131072 /* LastEmitHelper */; helper <<= 1) {
if (uncheckedHelpers & helper) {
var name = getHelperName(helper);
- var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 67220415 /* Value */);
+ var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 111551 /* Value */);
if (!symbol) {
error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name);
}
@@ -61479,13 +61968,6 @@ var ts;
return !!exclamationToken && grammarErrorOnNode(exclamationToken, message);
}
function checkGrammarObjectLiteralExpression(node, inDestructuring) {
- var Flags;
- (function (Flags) {
- Flags[Flags["Property"] = 1] = "Property";
- Flags[Flags["GetAccessor"] = 2] = "GetAccessor";
- Flags[Flags["SetAccessor"] = 4] = "SetAccessor";
- Flags[Flags["GetOrSetAccessor"] = 6] = "GetOrSetAccessor";
- })(Flags || (Flags = {}));
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
@@ -61537,15 +62019,16 @@ var ts;
if (name.kind === 8 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
- // falls through
+ currentKind = 4 /* PropertyAssignment */;
+ break;
case 157 /* MethodDeclaration */:
- currentKind = 1 /* Property */;
+ currentKind = 8 /* Method */;
break;
case 159 /* GetAccessor */:
- currentKind = 2 /* GetAccessor */;
+ currentKind = 1 /* GetAccessor */;
break;
case 160 /* SetAccessor */:
- currentKind = 4 /* SetAccessor */;
+ currentKind = 2 /* SetAccessor */;
break;
default:
throw ts.Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
@@ -61559,11 +62042,11 @@ var ts;
seen.set(effectiveName, currentKind);
}
else {
- if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) {
+ if ((currentKind & 12 /* PropertyAssignmentOrMethod */) && (existingKind & 12 /* PropertyAssignmentOrMethod */)) {
grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name));
}
- else if ((currentKind & 6 /* GetOrSetAccessor */) && (existingKind & 6 /* GetOrSetAccessor */)) {
- if (existingKind !== 6 /* GetOrSetAccessor */ && currentKind !== existingKind) {
+ else if ((currentKind & 3 /* GetOrSetAccessor */) && (existingKind & 3 /* GetOrSetAccessor */)) {
+ if (existingKind !== 3 /* GetOrSetAccessor */ && currentKind !== existingKind) {
seen.set(effectiveName, currentKind | existingKind);
}
else {
@@ -61661,42 +62144,38 @@ var ts;
return false;
}
function checkGrammarAccessor(accessor) {
- var kind = accessor.kind;
- if (languageVersion < 1 /* ES5 */) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ if (!(accessor.flags & 4194304 /* Ambient */)) {
+ if (languageVersion < 1 /* ES5 */) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ }
+ if (accessor.body === undefined && !ts.hasModifier(accessor, 128 /* Abstract */)) {
+ return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
+ }
}
- else if (accessor.flags & 4194304 /* Ambient */) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);
- }
- else if (accessor.body === undefined && !ts.hasModifier(accessor, 128 /* Abstract */)) {
- return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
- }
- else if (accessor.body && ts.hasModifier(accessor, 128 /* Abstract */)) {
+ if (accessor.body && ts.hasModifier(accessor, 128 /* Abstract */)) {
return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
}
- else if (accessor.typeParameters) {
+ if (accessor.typeParameters) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
- else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ?
+ if (!doesAccessorHaveCorrectParameterCount(accessor)) {
+ return grammarErrorOnNode(accessor.name, accessor.kind === 159 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 160 /* SetAccessor */) {
+ if (accessor.kind === 160 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
- else {
- var parameter = accessor.parameters[0];
- if (parameter.dotDotDotToken) {
- return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
- }
- else if (parameter.questionToken) {
- return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
- }
- else if (parameter.initializer) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
- }
+ var parameter = ts.Debug.assertDefined(ts.getSetAccessorValueParameter(accessor), "Return value does not match parameter count assertion.");
+ if (parameter.dotDotDotToken) {
+ return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
+ }
+ if (parameter.questionToken) {
+ return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
+ }
+ if (parameter.initializer) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
}
}
return false;
@@ -62131,13 +62610,9 @@ var ts;
}
function checkGrammarStatementInAmbientContext(node) {
if (node.flags & 4194304 /* Ambient */) {
- // An accessors is already reported about the ambient context
- if (ts.isAccessor(node.parent)) {
- return getNodeLinks(node).hasReportedStatementInAmbientContext = true;
- }
// Find containing block which is either Block, ModuleBlock, SourceFile
var links = getNodeLinks(node);
- if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) {
+ if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
}
// We are either parented by another statement, or some sort of block.
@@ -62185,7 +62660,7 @@ var ts;
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -62235,6 +62710,14 @@ var ts;
}
}
ts.createTypeChecker = createTypeChecker;
+ function isNotAccessor(declaration) {
+ // Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
+ return !ts.isAccessor(declaration);
+ }
+ function isNotOverload(declaration) {
+ return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
+ !!declaration.body;
+ }
/** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
@@ -64213,7 +64696,7 @@ var ts;
ts.createJSDocTypeExpression = createJSDocTypeExpression;
/* @internal */
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(309 /* JSDocTypeTag */, "type");
+ var tag = createJSDocTag(310 /* JSDocTypeTag */, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -64221,7 +64704,7 @@ var ts;
ts.createJSDocTypeTag = createJSDocTypeTag;
/* @internal */
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(307 /* JSDocReturnTag */, "returns");
+ var tag = createJSDocTag(308 /* JSDocReturnTag */, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -64229,14 +64712,14 @@ var ts;
ts.createJSDocReturnTag = createJSDocReturnTag;
/** @internal */
function createJSDocThisTag(typeExpression) {
- var tag = createJSDocTag(308 /* JSDocThisTag */, "this");
+ var tag = createJSDocTag(309 /* JSDocThisTag */, "this");
tag.typeExpression = typeExpression;
return tag;
}
ts.createJSDocThisTag = createJSDocThisTag;
/* @internal */
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(306 /* JSDocParameterTag */, "param");
+ var tag = createJSDocTag(307 /* JSDocParameterTag */, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -64246,7 +64729,7 @@ var ts;
ts.createJSDocParamTag = createJSDocParamTag;
/* @internal */
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(297 /* JSDocComment */);
+ var node = createSynthesizedNode(298 /* JSDocComment */);
node.comment = comment;
node.tags = tags;
return node;
@@ -64611,7 +65094,7 @@ var ts;
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(314 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(315 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -64623,7 +65106,7 @@ var ts;
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(318 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(319 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -64635,7 +65118,7 @@ var ts;
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(317 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(318 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -64650,7 +65133,7 @@ var ts;
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(315 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(316 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -64666,7 +65149,7 @@ var ts;
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 316 /* CommaListExpression */) {
+ if (node.kind === 317 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) {
@@ -64676,7 +65159,7 @@ var ts;
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(316 /* CommaListExpression */);
+ var node = createSynthesizedNode(317 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -65524,29 +66007,34 @@ var ts;
}
ts.createExpressionForJsxFragment = createExpressionForJsxFragment;
// Helpers
- function getHelperName(name) {
+ /**
+ * Gets an identifier for the name of an *unscoped* emit helper.
+ */
+ function getUnscopedHelperName(name) {
return ts.setEmitFlags(ts.createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */);
}
- ts.getHelperName = getHelperName;
+ ts.getUnscopedHelperName = getUnscopedHelperName;
ts.valuesHelper = {
name: "typescript:values",
+ importName: "__values",
scoped: false,
- text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };"
+ text: "\n var __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n };"
};
function createValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.valuesHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__values"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__values"),
/*typeArguments*/ undefined, [expression]), location);
}
ts.createValuesHelper = createValuesHelper;
ts.readHelper = {
name: "typescript:read",
+ importName: "__read",
scoped: false,
text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };"
};
function createReadHelper(context, iteratorRecord, count, location) {
context.requestEmitHelper(ts.readHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__read"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__read"),
/*typeArguments*/ undefined, count !== undefined
? [iteratorRecord, ts.createLiteral(count)]
: [iteratorRecord]), location);
@@ -65554,24 +66042,26 @@ var ts;
ts.createReadHelper = createReadHelper;
ts.spreadHelper = {
name: "typescript:spread",
+ importName: "__spread",
scoped: false,
text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };"
};
function createSpreadHelper(context, argumentList, location) {
context.requestEmitHelper(ts.readHelper);
context.requestEmitHelper(ts.spreadHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spread"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spread"),
/*typeArguments*/ undefined, argumentList), location);
}
ts.createSpreadHelper = createSpreadHelper;
ts.spreadArraysHelper = {
name: "typescript:spreadArrays",
+ importName: "__spreadArrays",
scoped: false,
text: "\n var __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n };"
};
function createSpreadArraysHelper(context, argumentList, location) {
context.requestEmitHelper(ts.spreadArraysHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spreadArrays"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spreadArrays"),
/*typeArguments*/ undefined, argumentList), location);
}
ts.createSpreadArraysHelper = createSpreadArraysHelper;
@@ -66416,7 +66906,7 @@ var ts;
case 191 /* ElementAccessExpression */:
case 190 /* PropertyAccessExpression */:
case 214 /* NonNullExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -66433,7 +66923,7 @@ var ts;
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
- node.kind === 316 /* CommaListExpression */;
+ node.kind === 317 /* CommaListExpression */;
}
ts.isCommaSequence = isCommaSequence;
var OuterExpressionKinds;
@@ -66452,7 +66942,7 @@ var ts;
case 213 /* AsExpression */:
case 214 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -66489,7 +66979,7 @@ var ts;
case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 315 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 316 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -66532,6 +67022,60 @@ var ts;
return emitNode && emitNode.externalHelpersModuleName;
}
ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function hasRecordedExternalHelpers(sourceFile) {
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return !!emitNode && (!!emitNode.externalHelpersModuleName || !!emitNode.externalHelpers);
+ }
+ ts.hasRecordedExternalHelpers = hasRecordedExternalHelpers;
+ function createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) {
+ if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
+ var namedBindings = void 0;
+ var moduleKind = ts.getEmitModuleKind(compilerOptions);
+ if (moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) {
+ // use named imports
+ var helpers = ts.getEmitHelpers(sourceFile);
+ if (helpers) {
+ var helperNames = [];
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!helper.scoped) {
+ var importName = helper.importName;
+ if (importName) {
+ ts.pushIfUnique(helperNames, importName);
+ }
+ }
+ }
+ if (ts.some(helperNames)) {
+ helperNames.sort(ts.compareStringsCaseSensitive);
+ // Alias the imports if the names are used somewhere in the file.
+ // NOTE: We don't need to care about global import collisions as this is a module.
+ namedBindings = ts.createNamedImports(ts.map(helperNames, function (name) { return ts.isFileLevelUniqueName(sourceFile, name)
+ ? ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(name))
+ : ts.createImportSpecifier(ts.createIdentifier(name), getUnscopedHelperName(name)); }));
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = ts.getOrCreateEmitNode(parseNode);
+ emitNode.externalHelpers = true;
+ }
+ }
+ }
+ else {
+ // use a namespace import
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
+ if (externalHelpersModuleName) {
+ namedBindings = ts.createNamespaceImport(externalHelpersModuleName);
+ }
+ }
+ if (namedBindings) {
+ var externalHelpersImportDeclaration = ts.createImportDeclaration(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, namedBindings), ts.createLiteral(ts.externalHelpersModuleNameText));
+ ts.addEmitFlags(externalHelpersImportDeclaration, 67108864 /* NeverApplyImportHelper */);
+ return externalHelpersImportDeclaration;
+ }
+ }
+ }
+ ts.createExternalHelpersImportDeclarationIfNeeded = createExternalHelpersImportDeclarationIfNeeded;
function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(node, compilerOptions)) {
var externalHelpersModuleName = getExternalHelpersModuleName(node);
@@ -66546,8 +67090,8 @@ var ts;
if (!create) {
var helpers = ts.getEmitHelpers(node);
if (helpers) {
- for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
- var helper = helpers_2[_i];
+ for (var _i = 0, helpers_3 = helpers; _i < helpers_3.length; _i++) {
+ var helper = helpers_3[_i];
if (!helper.scoped) {
create = true;
break;
@@ -67286,9 +67830,9 @@ var ts;
case 285 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -67344,7 +67888,7 @@ var ts;
case 221 /* EmptyStatement */:
case 211 /* OmittedExpression */:
case 237 /* DebuggerStatement */:
- case 314 /* NotEmittedStatement */:
+ case 315 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
@@ -67725,10 +68269,10 @@ var ts;
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -68516,7 +69060,8 @@ var ts;
var hasExportDefault = false;
var exportEquals;
var hasExportStarsToExportValues = false;
- var hasImportStarOrImportDefault = false;
+ var hasImportStar = false;
+ var hasImportDefault = false;
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
@@ -68526,7 +69071,12 @@ var ts;
// import * as x from "mod"
// import { x, y } from "mod"
externalImports.push(node);
- hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
+ if (!hasImportStar && getImportNeedsImportStarHelper(node)) {
+ hasImportStar = true;
+ }
+ if (!hasImportDefault && getImportNeedsImportDefaultHelper(node)) {
+ hasImportDefault = true;
+ }
break;
case 249 /* ImportEqualsDeclaration */:
if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
@@ -68620,12 +69170,8 @@ var ts;
break;
}
}
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault);
- var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault);
if (externalHelpersImportDeclaration) {
- ts.addEmitFlags(externalHelpersImportDeclaration, 67108864 /* NeverApplyImportHelper */);
externalImports.unshift(externalHelpersImportDeclaration);
}
return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
@@ -69213,6 +69759,7 @@ var ts;
}
ts.restHelper = {
name: "typescript:rest",
+ importName: "__rest",
scoped: false,
text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
@@ -69237,7 +69784,7 @@ var ts;
}
}
}
- return ts.createCall(ts.getHelperName("__rest"),
+ return ts.createCall(ts.getUnscopedHelperName("__rest"),
/*typeArguments*/ undefined, [
value,
ts.setTextRange(ts.createArrayLiteral(propertyNames), location)
@@ -70602,8 +71149,8 @@ var ts;
// Note when updating logic here also update getEntityNameForDecoratorMetadata
// so that aliases can be marked as referenced
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
@@ -70745,7 +71292,7 @@ var ts;
* available.
*/
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 8 /* ESNext */
+ return languageVersion < 99 /* ESNext */
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -71883,18 +72430,19 @@ var ts;
}
}
context.requestEmitHelper(ts.decorateHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__decorate"),
/*typeArguments*/ undefined, argumentsArray), location);
}
ts.decorateHelper = {
name: "typescript:decorate",
+ importName: "__decorate",
scoped: false,
priority: 2,
text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
};
function createMetadataHelper(context, metadataKey, metadataValue) {
context.requestEmitHelper(ts.metadataHelper);
- return ts.createCall(ts.getHelperName("__metadata"),
+ return ts.createCall(ts.getUnscopedHelperName("__metadata"),
/*typeArguments*/ undefined, [
ts.createLiteral(metadataKey),
metadataValue
@@ -71902,13 +72450,14 @@ var ts;
}
ts.metadataHelper = {
name: "typescript:metadata",
+ importName: "__metadata",
scoped: false,
priority: 3,
text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
};
function createParamHelper(context, expression, parameterOffset, location) {
context.requestEmitHelper(ts.paramHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__param"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__param"),
/*typeArguments*/ undefined, [
ts.createLiteral(parameterOffset),
expression
@@ -71916,6 +72465,7 @@ var ts;
}
ts.paramHelper = {
name: "typescript:param",
+ importName: "__param",
scoped: false,
priority: 4,
text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
@@ -72360,6 +72910,7 @@ var ts;
var hasSuperElementAccess;
/** A set of node IDs for generated super accessors (variable statements). */
var substitutedSuperAccessors = [];
+ var topLevel;
// Save the previous transformation hooks.
var previousOnEmitNode = context.onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
@@ -72371,10 +72922,23 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitor(node) {
if ((node.transformFlags & 32 /* ContainsES2017 */) === 0) {
return node;
@@ -72386,11 +72950,11 @@ var ts;
case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
case 157 /* MethodDeclaration */:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 240 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197 /* FunctionExpression */:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198 /* ArrowFunction */:
return visitArrowFunction(node);
case 190 /* PropertyAccessExpression */:
@@ -72403,6 +72967,12 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -72654,7 +73224,7 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.body.statements, /*ensureUseStrict*/ false, visitor);
- statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
@@ -72681,7 +73251,7 @@ var ts;
result = block;
}
else {
- var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
+ var expression = createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
var declarations = endLexicalEnvironment();
if (ts.some(declarations)) {
var block = ts.convertToFunctionBody(expression);
@@ -72880,11 +73450,12 @@ var ts;
ts.createSuperAccessVariableStatement = createSuperAccessVariableStatement;
ts.awaiterHelper = {
name: "typescript:awaiter",
+ importName: "__awaiter",
scoped: false,
priority: 5,
- text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
};
- function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ function createAwaiterHelper(context, hasLexicalThis, hasLexicalArguments, promiseConstructor, body) {
context.requestEmitHelper(ts.awaiterHelper);
var generatorFunc = ts.createFunctionExpression(
/*modifiers*/ undefined, ts.createToken(40 /* AsteriskToken */),
@@ -72894,9 +73465,9 @@ var ts;
/*type*/ undefined, body);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */ | 524288 /* ReuseTempVariableScope */;
- return ts.createCall(ts.getHelperName("__awaiter"),
+ return ts.createCall(ts.getUnscopedHelperName("__awaiter"),
/*typeArguments*/ undefined, [
- ts.createThis(),
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
generatorFunc
@@ -72930,9 +73501,11 @@ var ts;
context.onEmitNode = onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
+ var exportedVariableStatement = false;
var enabledSubstitutions;
var enclosingFunctionFlags;
var enclosingSuperContainerFlags = 0;
+ var topLevel;
/** Keeps track of property names accessed on super (`super.x`) within async functions. */
var capturedSuperProperties;
/** Whether the async function contains an element access on super (`super[x]`). */
@@ -72944,6 +73517,8 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ exportedVariableStatement = false;
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
@@ -72960,6 +73535,18 @@ var ts;
}
return node;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitorWorker(node, noDestructuringValue) {
if ((node.transformFlags & 16 /* ContainsES2018 */) === 0) {
return node;
@@ -72979,6 +73566,8 @@ var ts;
return visitBinaryExpression(node, noDestructuringValue);
case 275 /* CatchClause */:
return visitCatchClause(node);
+ case 220 /* VariableStatement */:
+ return visitVariableStatement(node);
case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
case 228 /* ForOfStatement */:
@@ -72988,17 +73577,17 @@ var ts;
case 201 /* VoidExpression */:
return visitVoidExpression(node);
case 158 /* Constructor */:
- return visitConstructorDeclaration(node);
+ return doOutsideOfTopLevel(visitConstructorDeclaration, node);
case 157 /* MethodDeclaration */:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 159 /* GetAccessor */:
- return visitGetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitGetAccessorDeclaration, node);
case 160 /* SetAccessor */:
- return visitSetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitSetAccessorDeclaration, node);
case 240 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197 /* FunctionExpression */:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198 /* ArrowFunction */:
return visitArrowFunction(node);
case 152 /* Parameter */:
@@ -73017,6 +73606,9 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -73084,14 +73676,39 @@ var ts;
if (node.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
// spread elements emit like so:
// non-spread elements are chunked together into object literals, and then all are passed to __assign:
- // { a, ...o, b } => __assign({a}, o, {b});
+ // { a, ...o, b } => __assign(__assign({a}, o), {b});
// If the first element is a spread element, then the first argument to __assign is {}:
- // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
+ // { ...o, a, b, ...o2 } => __assign(__assign(__assign({}, o), {a, b}), o2)
+ //
+ // We cannot call __assign with more than two elements, since any element could cause side effects. For
+ // example:
+ // var k = { a: 1, b: 2 };
+ // var o = { a: 3, ...k, b: k.a++ };
+ // // expected: { a: 1, b: 1 }
+ // If we translate the above to `__assign({ a: 3 }, k, { b: k.a++ })`, the `k.a++` will evaluate before
+ // `k` is spread and we end up with `{ a: 2, b: 1 }`.
+ //
+ // This also occurs for spread elements, not just property assignments:
+ // var k = { a: 1, get b() { l = { z: 9 }; return 2; } };
+ // var l = { c: 3 };
+ // var o = { ...k, ...l };
+ // // expected: { a: 1, b: 2, z: 9 }
+ // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we
+ // end up with `{ a: 1, b: 2, c: 3 }`
var objects = chunkObjectLiteralElements(node.properties);
if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) {
objects.unshift(ts.createObjectLiteral());
}
- return createAssignHelper(context, objects);
+ var expression = objects[0];
+ if (objects.length > 1) {
+ for (var i = 1; i < objects.length; i++) {
+ expression = createAssignHelper(context, [expression, objects[i]]);
+ }
+ return expression;
+ }
+ else {
+ return createAssignHelper(context, objects);
+ }
}
return ts.visitEachChild(node, visitor, context);
}
@@ -73132,15 +73749,36 @@ var ts;
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitVariableStatement(node) {
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = true;
+ var visited = ts.visitEachChild(node, visitor, context);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
/**
* Visits a VariableDeclaration node with a binding pattern.
*
* @param node A VariableDeclaration node.
*/
function visitVariableDeclaration(node) {
+ if (exportedVariableStatement) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = false;
+ var visited = visitVariableDeclarationWorker(node, /*exportedVariableStatement*/ true);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return visitVariableDeclarationWorker(node, /*exportedVariableStatement*/ false);
+ }
+ function visitVariableDeclarationWorker(node, exportedVariableStatement) {
// If we are here it is because the name contains a binding pattern with a rest somewhere in it.
if (ts.isBindingPattern(node.name) && node.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
- return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */);
+ return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */,
+ /*rval*/ undefined, exportedVariableStatement);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -73358,7 +73996,7 @@ var ts;
/*modifiers*/ undefined, ts.createToken(40 /* AsteriskToken */), node.name && ts.getGeneratedNameForNode(node.name),
/*typeParameters*/ undefined,
/*parameters*/ [],
- /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))));
+ /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !topLevel));
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
var emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* AsyncMethodWithSuperBinding */ | 2048 /* AsyncMethodWithSuper */);
@@ -73538,6 +74176,7 @@ var ts;
ts.transformES2018 = transformES2018;
ts.assignHelper = {
name: "typescript:assign",
+ importName: "__assign",
scoped: false,
priority: 1,
text: "\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"
@@ -73548,55 +74187,59 @@ var ts;
/*typeArguments*/ undefined, attributesSegments);
}
context.requestEmitHelper(ts.assignHelper);
- return ts.createCall(ts.getHelperName("__assign"),
+ return ts.createCall(ts.getUnscopedHelperName("__assign"),
/*typeArguments*/ undefined, attributesSegments);
}
ts.createAssignHelper = createAssignHelper;
ts.awaitHelper = {
name: "typescript:await",
+ importName: "__await",
scoped: false,
text: "\n var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }"
};
function createAwaitHelper(context, expression) {
context.requestEmitHelper(ts.awaitHelper);
- return ts.createCall(ts.getHelperName("__await"), /*typeArguments*/ undefined, [expression]);
+ return ts.createCall(ts.getUnscopedHelperName("__await"), /*typeArguments*/ undefined, [expression]);
}
ts.asyncGeneratorHelper = {
name: "typescript:asyncGenerator",
+ importName: "__asyncGenerator",
scoped: false,
text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n };"
};
- function createAsyncGeneratorHelper(context, generatorFunc) {
+ function createAsyncGeneratorHelper(context, generatorFunc, hasLexicalThis) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncGeneratorHelper);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */;
- return ts.createCall(ts.getHelperName("__asyncGenerator"),
+ return ts.createCall(ts.getUnscopedHelperName("__asyncGenerator"),
/*typeArguments*/ undefined, [
- ts.createThis(),
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
ts.createIdentifier("arguments"),
generatorFunc
]);
}
ts.asyncDelegator = {
name: "typescript:asyncDelegator",
+ importName: "__asyncDelegator",
scoped: false,
text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n };"
};
function createAsyncDelegatorHelper(context, expression, location) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncDelegator);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncDelegator"),
/*typeArguments*/ undefined, [expression]), location);
}
ts.asyncValues = {
name: "typescript:asyncValues",
+ importName: "__asyncValues",
scoped: false,
text: "\n var __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n };"
};
function createAsyncValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.asyncValues);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncValues"),
/*typeArguments*/ undefined, [expression]), location);
}
})(ts || (ts = {}));
@@ -77408,7 +78051,7 @@ var ts;
ts.transformES2015 = transformES2015;
function createExtendsHelper(context, name) {
context.requestEmitHelper(ts.extendsHelper);
- return ts.createCall(ts.getHelperName("__extends"),
+ return ts.createCall(ts.getUnscopedHelperName("__extends"),
/*typeArguments*/ undefined, [
name,
ts.createFileLevelUniqueName("_super")
@@ -77416,7 +78059,7 @@ var ts;
}
function createTemplateObjectHelper(context, cooked, raw) {
context.requestEmitHelper(ts.templateObjectHelper);
- return ts.createCall(ts.getHelperName("__makeTemplateObject"),
+ return ts.createCall(ts.getUnscopedHelperName("__makeTemplateObject"),
/*typeArguments*/ undefined, [
cooked,
raw
@@ -77424,12 +78067,14 @@ var ts;
}
ts.extendsHelper = {
name: "typescript:extends",
+ importName: "__extends",
scoped: false,
priority: 0,
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
};
ts.templateObjectHelper = {
name: "typescript:makeTemplateObject",
+ importName: "__makeTemplateObject",
scoped: false,
priority: 0,
text: "\n var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n };"
@@ -80123,7 +80768,7 @@ var ts;
ts.transformGenerators = transformGenerators;
function createGeneratorHelper(context, body) {
context.requestEmitHelper(ts.generatorHelper);
- return ts.createCall(ts.getHelperName("__generator"),
+ return ts.createCall(ts.getUnscopedHelperName("__generator"),
/*typeArguments*/ undefined, [ts.createThis(), body]);
}
// The __generator helper is used by down-level transformations to emulate the runtime
@@ -80187,6 +80832,7 @@ var ts;
// For examples of how these are used, see the comments in ./transformers/generators.ts
ts.generatorHelper = {
name: "typescript:generator",
+ importName: "__generator",
scoped: false,
priority: 6,
text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
@@ -80560,9 +81206,9 @@ var ts;
return visitFunctionDeclaration(node);
case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 317 /* MergeDeclarationMarker */:
+ case 318 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 318 /* EndOfDeclarationMarker */:
+ case 319 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -80721,7 +81367,7 @@ var ts;
var promise = ts.createNew(ts.createIdentifier("Promise"), /*typeArguments*/ undefined, [func]);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), /*typeArguments*/ undefined, [ts.getHelperName("__importStar")]);
+ return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), /*typeArguments*/ undefined, [ts.getUnscopedHelperName("__importStar")]);
}
return promise;
}
@@ -80735,7 +81381,7 @@ var ts;
var requireCall = ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- requireCall = ts.createCall(ts.getHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
+ requireCall = ts.createCall(ts.getUnscopedHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
}
var func;
if (languageVersion >= 2 /* ES2015 */) {
@@ -80769,11 +81415,11 @@ var ts;
}
if (ts.getImportNeedsImportStarHelper(node)) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.getHelperName("__importStar"), /*typeArguments*/ undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importStar"), /*typeArguments*/ undefined, [innerExpr]);
}
if (ts.getImportNeedsImportDefaultHelper(node)) {
context.requestEmitHelper(ts.importDefaultHelper);
- return ts.createCall(ts.getHelperName("__importDefault"), /*typeArguments*/ undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importDefault"), /*typeArguments*/ undefined, [innerExpr]);
}
return innerExpr;
}
@@ -81545,7 +82191,7 @@ var ts;
function createExportStarHelper(context, module) {
var compilerOptions = context.getCompilerOptions();
return compilerOptions.importHelpers
- ? ts.createCall(ts.getHelperName("__exportStar"), /*typeArguments*/ undefined, [module, ts.createIdentifier("exports")])
+ ? ts.createCall(ts.getUnscopedHelperName("__exportStar"), /*typeArguments*/ undefined, [module, ts.createIdentifier("exports")])
: ts.createCall(ts.createIdentifier("__export"), /*typeArguments*/ undefined, [module]);
}
// emit helper for dynamic import
@@ -81557,12 +82203,14 @@ var ts;
// emit helper for `import * as Name from "foo"`
ts.importStarHelper = {
name: "typescript:commonjsimportstar",
+ importName: "__importStar",
scoped: false,
text: "\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};"
};
// emit helper for `import Name from "foo"`
ts.importDefaultHelper = {
name: "typescript:commonjsimportdefault",
+ importName: "__importDefault",
scoped: false,
text: "\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};"
};
@@ -81584,11 +82232,13 @@ var ts;
context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(215 /* MetaProperty */); // Substitutes 'import.meta'
context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var exportFunctionsMap = []; // The export function associated with a source file.
var noSubstitutionMap = []; // Set of nodes for which substitution rules should be ignored for each file.
+ var contextObjectMap = []; // The context object associated with a source file.
var currentSourceFile; // The current file.
var moduleInfo; // ExternalModuleInfo for the current file.
var exportFunction; // The export function for the current file.
@@ -81627,7 +82277,7 @@ var ts;
// existing identifiers.
exportFunction = ts.createUniqueName("exports");
exportFunctionsMap[id] = exportFunction;
- contextObject = ts.createUniqueName("context");
+ contextObject = contextObjectMap[id] = ts.createUniqueName("context");
// Add the body of the module.
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
@@ -82497,9 +83147,9 @@ var ts;
return visitCatchClause(node);
case 219 /* Block */:
return visitBlock(node);
- case 317 /* MergeDeclarationMarker */:
+ case 318 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 318 /* EndOfDeclarationMarker */:
+ case 319 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -82785,6 +83435,7 @@ var ts;
moduleInfo = moduleInfoMap[id];
exportFunction = exportFunctionsMap[id];
noSubstitution = noSubstitutionMap[id];
+ contextObject = contextObjectMap[id];
if (noSubstitution) {
delete noSubstitutionMap[id];
}
@@ -82792,6 +83443,7 @@ var ts;
currentSourceFile = undefined;
moduleInfo = undefined;
exportFunction = undefined;
+ contextObject = undefined;
noSubstitution = undefined;
}
else {
@@ -82868,6 +83520,8 @@ var ts;
case 203 /* PrefixUnaryExpression */:
case 204 /* PostfixUnaryExpression */:
return substituteUnaryExpression(node);
+ case 215 /* MetaProperty */:
+ return substituteMetaProperty(node);
}
return node;
}
@@ -82976,6 +83630,12 @@ var ts;
}
return node;
}
+ function substituteMetaProperty(node) {
+ if (ts.isImportMeta(node)) {
+ return ts.createPropertyAccess(contextObject, ts.createIdentifier("meta"));
+ }
+ return node;
+ }
/**
* Gets the exports of a name.
*
@@ -83029,22 +83689,18 @@ var ts;
context.onSubstituteNode = onSubstituteNode;
context.enableEmitNotification(285 /* SourceFile */);
context.enableSubstitution(73 /* Identifier */);
- var currentSourceFile;
+ var helperNameSubstitutions;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
if (node.isDeclarationFile) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
- if (externalHelpersModuleName) {
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(node, compilerOptions);
+ if (externalHelpersImportDeclaration) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.statements);
- var tslibImport = ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- ts.addEmitFlags(tslibImport, 67108864 /* NeverApplyImportHelper */);
- ts.append(statements, tslibImport);
+ ts.append(statements, externalHelpersImportDeclaration);
ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements));
}
@@ -83080,9 +83736,9 @@ var ts;
*/
function onEmitNode(hint, node, emitCallback) {
if (ts.isSourceFile(node)) {
- currentSourceFile = node;
+ helperNameSubstitutions = ts.createMap();
previousOnEmitNode(hint, node, emitCallback);
- currentSourceFile = undefined;
+ helperNameSubstitutions = undefined;
}
else {
previousOnEmitNode(hint, node, emitCallback);
@@ -83099,19 +83755,18 @@ var ts;
*/
function onSubstituteNode(hint, node) {
node = previousOnSubstituteNode(hint, node);
- if (ts.isIdentifier(node) && hint === 1 /* Expression */) {
- return substituteExpressionIdentifier(node);
+ if (helperNameSubstitutions && ts.isIdentifier(node) && ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ return substituteHelperName(node);
}
return node;
}
- function substituteExpressionIdentifier(node) {
- if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
- var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
- if (externalHelpersModuleName) {
- return ts.createPropertyAccess(externalHelpersModuleName, node);
- }
+ function substituteHelperName(node) {
+ var name = ts.idText(node);
+ var substitution = helperNameSubstitutions.get(name);
+ if (!substitution) {
+ helperNameSubstitutions.set(name, substitution = ts.createFileLevelUniqueName(name));
}
- return node;
+ return substitution;
}
}
ts.transformES2015Module = transformES2015Module;
@@ -83610,6 +84265,7 @@ var ts;
var currentSourceFile;
var refs;
var libs;
+ var emittedImports; // must be declared in container so it can be `undefined` while transformer's first pass
var resolver = context.getEmitResolver();
var options = context.getCompilerOptions();
var newLine = ts.getNewLineCharacter(options);
@@ -83772,7 +84428,7 @@ var ts;
var statements = ts.visitNodes(node.statements, visitDeclarationStatements);
var combinedStatements = ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
refs.forEach(referenceVisitor);
- var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
+ emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
if (ts.isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) {
combinedStatements = ts.setTextRange(ts.createNodeArray(__spreadArrays(combinedStatements, [createEmptyExports()])), combinedStatements);
}
@@ -83870,14 +84526,14 @@ var ts;
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
}
}
- function ensureParameter(p, modifierMask) {
+ function ensureParameter(p, modifierMask, type) {
var oldDiag;
if (!suppressNewDiagnosticContexts) {
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
}
var newParam = ts.updateParameter(p,
- /*decorators*/ undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56 /* QuestionToken */)) : undefined, ensureType(p, p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
+ /*decorators*/ undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56 /* QuestionToken */)) : undefined, ensureType(p, type || p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
ensureNoInitializer(p));
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
@@ -83984,6 +84640,33 @@ var ts;
}
return ts.createNodeArray(newParams, params.hasTrailingComma);
}
+ function updateAccessorParamsList(input, isPrivate) {
+ var newParams;
+ if (!isPrivate) {
+ var thisParameter = ts.getThisParameter(input);
+ if (thisParameter) {
+ newParams = [ensureParameter(thisParameter)];
+ }
+ }
+ if (ts.isSetAccessorDeclaration(input)) {
+ var newValueParameter = void 0;
+ if (!isPrivate) {
+ var valueParameter = ts.getSetAccessorValueParameter(input);
+ if (valueParameter) {
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ newValueParameter = ensureParameter(valueParameter, /*modifierMask*/ undefined, accessorType);
+ }
+ }
+ if (!newValueParameter) {
+ newValueParameter = ts.createParameter(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*dotDotDotToken*/ undefined, "value");
+ }
+ newParams = ts.append(newParams, newValueParameter);
+ }
+ return ts.createNodeArray(newParams || ts.emptyArray);
+ }
function ensureTypeParams(node, params) {
return ts.hasModifier(node, 8 /* Private */) ? undefined : ts.visitNodes(params, visitDeclarationSubtree);
}
@@ -84150,6 +84833,11 @@ var ts;
enclosingDeclaration = input;
}
var oldDiag = getSymbolAccessibilityDiagnostic;
+ // Setup diagnostic-related flags before first potential `cleanup` call, otherwise
+ // We'd see a TDZ violation at runtime
+ var canProduceDiagnostic = ts.canProduceDiagnostics(input);
+ var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
// Emit methods which are private as properties with no type information
if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) {
if (ts.hasModifier(input, 8 /* Private */)) {
@@ -84158,15 +84846,12 @@ var ts;
return cleanup(ts.createProperty(/*decorators*/ undefined, ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined));
}
}
- var canProdiceDiagnostic = ts.canProduceDiagnostics(input);
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input);
}
if (ts.isTypeQueryNode(input)) {
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
- var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
// We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
suppressNewDiagnosticContexts = true;
@@ -84205,10 +84890,24 @@ var ts;
return cleanup(sig);
}
case 159 /* GetAccessor */: {
+ // For now, only emit class accessors as accessors if they were already declared in an ambient context.
+ if (input.flags & 4194304 /* Ambient */) {
+ var isPrivate = ts.hasModifier(input, 8 /* Private */);
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ return cleanup(ts.updateGetAccessor(input,
+ /*decorators*/ undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, isPrivate), !isPrivate ? ensureType(input, accessorType) : undefined,
+ /*body*/ undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
case 160 /* SetAccessor */: {
+ // For now, only emit class accessors as accessors if they were already declared in an ambient context.
+ if (input.flags & 4194304 /* Ambient */) {
+ return cleanup(ts.updateSetAccessor(input,
+ /*decorators*/ undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasModifier(input, 8 /* Private */)),
+ /*body*/ undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
@@ -84269,13 +84968,13 @@ var ts;
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
function cleanup(returnValue) {
- if (returnValue && canProdiceDiagnostic && ts.hasDynamicName(input)) {
+ if (returnValue && canProduceDiagnostic && ts.hasDynamicName(input)) {
checkName(input);
}
if (isEnclosingDeclaration(input)) {
enclosingDeclaration = previousEnclosingDeclaration;
}
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
if (shouldEnterSuppressNewDiagnosticsContextContext) {
@@ -84644,17 +85343,26 @@ var ts;
}
return maskModifierFlags(node, mask, additions);
}
+ function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) {
+ var accessorType = getTypeAnnotationFromAccessor(node);
+ if (!accessorType && node !== accessors.firstAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.firstAccessor);
+ // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.firstAccessor);
+ }
+ if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
+ // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
+ }
+ return accessorType;
+ }
function ensureAccessor(node) {
var accessors = resolver.getAllAccessorDeclarations(node);
if (node.kind !== accessors.firstAccessor.kind) {
return;
}
- var accessorType = getTypeAnnotationFromAccessor(node);
- if (!accessorType && accessors.secondAccessor) {
- accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
- // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
- getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
- }
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessors);
var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
@@ -84817,7 +85525,7 @@ var ts;
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6 /* ES2019 */) {
@@ -84893,7 +85601,7 @@ var ts;
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(319 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(320 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -86418,30 +87126,30 @@ var ts;
case 279 /* EnumMember */:
return emitEnumMember(node);
// JSDoc nodes (only used in codefixes currently)
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return emitJSDocPropertyLikeTag(node);
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 308 /* JSDocThisTag */:
- case 305 /* JSDocEnumTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 309 /* JSDocThisTag */:
+ case 306 /* JSDocEnumTag */:
return emitJSDocSimpleTypedTag(node);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return emitJSDocAugmentsTag(node);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return emitJSDocTemplateTag(node);
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return emitJSDocTypedefTag(node);
- case 304 /* JSDocCallbackTag */:
+ case 305 /* JSDocCallbackTag */:
return emitJSDocCallbackTag(node);
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return emitJSDocSignature(node);
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
return emitJSDocTypeLiteral(node);
- case 303 /* JSDocClassTag */:
- case 300 /* JSDocTag */:
+ case 304 /* JSDocClassTag */:
+ case 301 /* JSDocTag */:
return emitJSDocSimpleTag(node);
- case 297 /* JSDocComment */:
+ case 298 /* JSDocComment */:
return emitJSDoc(node);
// Transformation nodes (ignored)
}
@@ -86540,9 +87248,9 @@ var ts;
case 265 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -86570,8 +87278,8 @@ var ts;
var helpers = getSortedEmitHelpers(sourceFile);
if (!helpers)
continue;
- for (var _c = 0, helpers_3 = helpers; _c < helpers_3.length; _c++) {
- var helper = helpers_3[_c];
+ for (var _c = 0, helpers_4 = helpers; _c < helpers_4.length; _c++) {
+ var helper = helpers_4[_c];
if (!helper.scoped && !shouldSkip && !bundledHelpers.get(helper.name)) {
bundledHelpers.set(helper.name, true);
(result || (result = [])).push(helper.name);
@@ -86591,12 +87299,12 @@ var ts;
for (var i = 0; i < numNodes; i++) {
var currentNode = bundle ? i < numPrepends ? bundle.prepends[i] : bundle.sourceFiles[i - numPrepends] : node;
var sourceFile = ts.isSourceFile(currentNode) ? currentNode : ts.isUnparsedSource(currentNode) ? undefined : currentSourceFile;
- var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.hasRecordedExternalHelpers(sourceFile));
var shouldBundle = (ts.isSourceFile(currentNode) || ts.isUnparsedSource(currentNode)) && !isOwnFileEmit;
var helpers = ts.isUnparsedSource(currentNode) ? currentNode.helpers : getSortedEmitHelpers(currentNode);
if (helpers) {
- for (var _a = 0, helpers_4 = helpers; _a < helpers_4.length; _a++) {
- var helper = helpers_4[_a];
+ for (var _a = 0, helpers_5 = helpers; _a < helpers_5.length; _a++) {
+ var helper = helpers_5[_a];
if (!helper.scoped) {
// Skip the helper if it can be skipped and the noEmitHelpers compiler
// option is set, or if it can be imported and the importHelpers compiler
@@ -88036,7 +88744,7 @@ var ts;
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 309 /* JSDocTypeTag */ && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 310 /* JSDocTypeTag */ && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -88089,7 +88797,7 @@ var ts;
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) {
+ if (tag.typeExpression && tag.typeExpression.kind === 299 /* JSDocTypeLiteral */) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -88223,8 +88931,8 @@ var ts;
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// ");
if (bundleFileInfo)
@@ -89078,7 +89786,7 @@ var ts;
if (node.locals) {
var local = node.locals.get(ts.escapeLeadingUnderscores(name));
// We conservatively include alias symbols to cover cases where they're emitted as locals
- if (local && local.flags & (67220415 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
+ if (local && local.flags & (111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
return false;
}
}
@@ -89265,7 +89973,7 @@ var ts;
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 314 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 315 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
@@ -89546,7 +90254,7 @@ var ts;
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 314 /* NotEmittedStatement */
+ if (node.kind !== 315 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -89559,7 +90267,7 @@ var ts;
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 314 /* NotEmittedStatement */
+ if (node.kind !== 315 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -89927,6 +90635,9 @@ var ts;
var createFileWatcher = getCreateFileWatcher(watchLogLevel, watchFile);
var createFilePathWatcher = watchLogLevel === WatchLogLevel.None ? watchFilePath : createFileWatcher;
var createDirectoryWatcher = getCreateFileWatcher(watchLogLevel, watchDirectory);
+ if (watchLogLevel === WatchLogLevel.Verbose && ts.sysLog === ts.noop) {
+ ts.sysLog = function (s) { return log(s); };
+ }
return {
watchFile: function (host, file, callback, pollingInterval, detailInfo1, detailInfo2) {
return createFileWatcher(host, file, callback, pollingInterval, /*passThrough*/ undefined, detailInfo1, detailInfo2, watchFile, log, "FileWatcher", getDetailWatchInfo);
@@ -90471,8 +91182,8 @@ var ts;
}
var resolutions = [];
var cache = ts.createMap();
- for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name = names_1[_i];
+ for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
+ var name = names_2[_i];
var result = void 0;
if (cache.has(name)) {
result = cache.get(name);
@@ -90633,7 +91344,7 @@ var ts;
var resolveModuleNamesWorker;
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
if (host.resolveModuleNames) {
- resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference).map(function (resolved) {
+ resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference, options).map(function (resolved) {
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
if (!resolved || resolved.extension !== undefined) {
return resolved;
@@ -90650,7 +91361,7 @@ var ts;
}
var resolveTypeReferenceDirectiveNamesWorker;
if (host.resolveTypeReferenceDirectives) {
- resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference); };
+ resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference, options); };
}
else {
var loader_2 = function (typesRef, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference).resolvedTypeReferenceDirective; }; // TODO: GH#18217
@@ -90680,7 +91391,10 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
- var structuralIsReused = tryReuseStructureFromOldProgram();
+ // We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks
+ // `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`.
+ var structuralIsReused;
+ structuralIsReused = tryReuseStructureFromOldProgram();
if (structuralIsReused !== 2 /* Completely */) {
processingDefaultLibFiles = [];
processingOtherFiles = [];
@@ -94349,8 +95063,8 @@ var ts;
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
!!redirectedReference;
var seenNamesInFile = ts.createMap();
- for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
- var name = names_2[_i];
+ for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
+ var name = names_3[_i];
var resolution = resolutionsInFile.get(name);
// Resolution is valid if it is present and not invalidated
if (!seenNamesInFile.has(name) &&
@@ -94856,7 +95570,7 @@ var ts;
return [ambient];
var info = getInfo(importingSourceFile.path, host);
var moduleSourceFile = ts.getSourceFileOfNode(moduleSymbol.valueDeclaration || ts.getNonAugmentationDeclaration(moduleSymbol));
- var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.fileName, info.getCanonicalFileName, host, redirectTargetsMap);
+ var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.originalFileName, info.getCanonicalFileName, host, redirectTargetsMap);
var preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
var global = ts.mapDefined(modulePaths, function (moduleFileName) { return tryGetModuleNameAsNodeModule(moduleFileName, info, host, compilerOptions); });
return global.length ? global : modulePaths.map(function (moduleFileName) { return getLocalModuleSpecifier(moduleFileName, info, compilerOptions, preferences); });
@@ -94872,7 +95586,7 @@ var ts;
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
var ending = _b.ending, relativePreference = _b.relativePreference;
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
- var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) ||
+ var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
if (!baseUrl || relativePreference === 0 /* Relative */) {
return relativePath;
@@ -94998,14 +95712,16 @@ var ts;
}
}
}
- function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) {
+ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
if (normalizedTargetPath === undefined) {
return undefined;
}
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
- return ts.removeFileExtension(relativePath);
+ return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
+ ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
+ : ts.removeFileExtension(relativePath);
}
function tryGetModuleNameAsNodeModule(moduleFileName, _a, host, options) {
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
@@ -95655,10 +96371,22 @@ var ts;
/*logChangesWhenResolvingModule*/ false);
// Resolve module using host module resolution strategy if provided otherwise use resolution cache to resolve module names
compilerHost.resolveModuleNames = host.resolveModuleNames ?
- (function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveModuleNames.apply(host, args);
+ }) :
(function (moduleNames, containingFile, reusedNames, redirectedReference) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); });
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
- (function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveTypeReferenceDirectives.apply(host, args);
+ }) :
(function (typeDirectiveNames, containingFile, redirectedReference) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); });
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
@@ -95884,13 +96612,19 @@ var ts;
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
switch (reloadLevel) {
case ts.ConfigFileProgramReloadLevel.Partial:
- return reloadFileNamesFromConfigFile();
+ ts.perfLogger.logStartUpdateProgram("PartialConfigReload");
+ reloadFileNamesFromConfigFile();
+ break;
case ts.ConfigFileProgramReloadLevel.Full:
- return reloadConfigFile();
+ ts.perfLogger.logStartUpdateProgram("FullConfigReload");
+ reloadConfigFile();
+ break;
default:
+ ts.perfLogger.logStartUpdateProgram("SynchronizeProgram");
synchronizeProgram();
- return;
+ break;
}
+ ts.perfLogger.logStopUpdateProgram("Done");
}
function reloadFileNamesFromConfigFile() {
writeLog("Reloading new file names and options");
@@ -96269,8 +97003,31 @@ var ts;
}
}
function getBuildOrder(state) {
- return state.buildOrder ||
- (state.buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); })));
+ return state.buildOrder || createStateBuildOrder(state);
+ }
+ function createStateBuildOrder(state) {
+ var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
+ if (ts.arrayIsEqualTo(state.buildOrder, buildOrder))
+ return state.buildOrder;
+ // Clear all to ResolvedConfigFilePaths cache to start fresh
+ state.resolvedConfigFilePaths.clear();
+ var currentProjects = ts.arrayToSet(buildOrder, function (resolved) { return toResolvedConfigFilePath(state, resolved); });
+ var noopOnDelete = { onDeleteValue: ts.noop };
+ // Config file cache
+ ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
+ // Remove watches for the program no longer in the solution
+ if (state.watch) {
+ ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
+ ts.mutateMapSkippingNewValues(state.allWatchedWildcardDirectories, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcherOf); } });
+ ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
+ }
+ return state.buildOrder = buildOrder;
}
function getBuildOrderFor(state, project, onlyReferences) {
var resolvedProject = project && resolveProjectName(state, project);
@@ -97723,7 +98480,7 @@ var ts;
/* @internal */
var ts;
(function (ts) {
- ts.scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
+ ts.scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ true);
var SemanticMeaning;
(function (SemanticMeaning) {
SemanticMeaning[SemanticMeaning["None"] = 0] = "None";
@@ -97758,7 +98515,7 @@ var ts;
case 243 /* TypeAliasDeclaration */:
case 169 /* TypeLiteral */:
return 2 /* Type */;
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
// If it has no name node, it shares the name with the value declaration below it.
return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */;
case 279 /* EnumMember */:
@@ -98023,8 +98780,8 @@ var ts;
return "class" /* classElement */;
case 242 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
case 243 /* TypeAliasDeclaration */:
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
return "type" /* typeElement */;
case 244 /* EnumDeclaration */: return "enum" /* enumElement */;
case 238 /* VariableDeclaration */:
@@ -99643,8 +100400,9 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ /** The classifier is used for syntactic highlighting in editors via the TSServer */
function createClassifier() {
- var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false);
+ var scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false);
function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {
return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
}
@@ -100198,8 +100956,8 @@ var ts;
var spanStart = span.start;
var spanLength = span.length;
// Make a scanner we can get trivia from.
- var triviaScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var triviaScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
var result = [];
processElement(sourceFile);
return { spans: result, endOfLineState: 0 /* None */ };
@@ -100271,6 +101029,11 @@ var ts;
return;
}
}
+ else if (kind === 2 /* SingleLineCommentTrivia */) {
+ if (tryClassifyTripleSlashComment(start, width)) {
+ return;
+ }
+ }
// Simple comment. Just add as is.
pushCommentRange(start, width);
}
@@ -100291,18 +101054,18 @@ var ts;
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param"
pos = tag.tagName.end;
switch (tag.kind) {
- case 306 /* JSDocParameterTag */:
+ case 307 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
pos = tag.end;
break;
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
- case 307 /* JSDocReturnTag */:
+ case 308 /* JSDocReturnTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
@@ -100331,6 +101094,65 @@ var ts;
}
}
}
+ function tryClassifyTripleSlashComment(start, width) {
+ var tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/im;
+ var attributeRegex = /(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/img;
+ var text = sourceFile.text.substr(start, width);
+ var match = tripleSlashXMLCommentRegEx.exec(text);
+ if (!match) {
+ return false;
+ }
+ var pos = start;
+ pushCommentRange(pos, match[1].length); // ///
+ pos += match[1].length;
+ pushClassification(pos, match[2].length, 10 /* punctuation */); // <
+ pos += match[2].length;
+ if (!match[3]) {
+ return true;
+ }
+ pushClassification(pos, match[3].length, 21 /* jsxSelfClosingTagName */); // element name
+ pos += match[3].length;
+ var attrText = match[4];
+ var attrPos = pos;
+ while (true) {
+ var attrMatch = attributeRegex.exec(attrText);
+ if (!attrMatch) {
+ break;
+ }
+ var newAttrPos = pos + attrMatch.index;
+ if (newAttrPos > attrPos) {
+ pushCommentRange(attrPos, newAttrPos - attrPos);
+ attrPos = newAttrPos;
+ }
+ pushClassification(attrPos, attrMatch[1].length, 22 /* jsxAttribute */); // attribute name
+ attrPos += attrMatch[1].length;
+ if (attrMatch[2].length) {
+ pushCommentRange(attrPos, attrMatch[2].length); // whitespace
+ attrPos += attrMatch[2].length;
+ }
+ pushClassification(attrPos, attrMatch[3].length, 5 /* operator */); // =
+ attrPos += attrMatch[3].length;
+ if (attrMatch[4].length) {
+ pushCommentRange(attrPos, attrMatch[4].length); // whitespace
+ attrPos += attrMatch[4].length;
+ }
+ pushClassification(attrPos, attrMatch[5].length, 24 /* jsxAttributeStringLiteralValue */); // attribute value
+ attrPos += attrMatch[5].length;
+ }
+ pos += match[4].length;
+ if (pos > attrPos) {
+ pushCommentRange(attrPos, pos - attrPos);
+ }
+ if (match[5]) {
+ pushClassification(pos, match[5].length, 10 /* punctuation */); // />
+ pos += match[5].length;
+ }
+ var end = start + width;
+ if (pos < end) {
+ pushCommentRange(pos, end - pos);
+ }
+ return true;
+ }
function processJSDocTemplateTag(tag) {
for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) {
var child = _a[_i];
@@ -100555,7 +101377,7 @@ var ts;
return convertPathCompletions(completion.paths);
case 1 /* Properties */: {
var entries = [];
- Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 8 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
+ Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 99 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, entries: entries };
}
case 2 /* Types */: {
@@ -101134,7 +101956,7 @@ var ts;
var offset = index !== -1 ? index + 1 : 0;
// If the range is an identifier, span is unnecessary.
var length = text.length - offset;
- return length === 0 || ts.isIdentifierText(text.substr(offset, length), 8 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
+ return length === 0 || ts.isIdentifierText(text.substr(offset, length), 99 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
}
// Returns true if the path is explicitly relative to the script (i.e. relative to . or ..)
function isPathRelativeToScript(path) {
@@ -101696,7 +102518,7 @@ var ts;
currentToken = ts.getTokenAtPosition(sourceFile, position);
if (!currentToken ||
(!ts.isDeclarationName(currentToken) &&
- (currentToken.parent.kind !== 312 /* JSDocPropertyTag */ ||
+ (currentToken.parent.kind !== 313 /* JSDocPropertyTag */ ||
currentToken.parent.name !== currentToken))) {
// Use as type location if inside tag's type expression
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
@@ -101892,11 +102714,11 @@ var ts;
};
function isTagWithTypeExpression(tag) {
switch (tag.kind) {
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 311 /* JSDocTypedefTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 312 /* JSDocTypedefTag */:
return true;
default:
return false;
@@ -101905,11 +102727,13 @@ var ts;
function getTypeScriptMemberSymbols() {
// Right of dot member completion list
completionKind = 2 /* PropertyAccess */;
- // Since this is qualified name check its a type node location
+ // Since this is qualified name check it's a type node location
var isImportType = ts.isLiteralImportTypeNode(node);
- var isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !node.isTypeOf) || ts.isPartOfTypeNode(node.parent);
+ var isTypeLocation = insideJsDocTagTypeExpression
+ || (isImportType && !node.isTypeOf)
+ || ts.isPartOfTypeNode(node.parent)
+ || ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
var isRhsOfImportDeclaration = ts.isInRightSideOfInternalImportEqualsDeclaration(node);
- var allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker));
if (ts.isEntityName(node) || isImportType) {
var isNamespaceName = ts.isModuleDeclaration(node.parent);
if (isNamespaceName)
@@ -101925,7 +102749,7 @@ var ts;
var isValidAccess = isNamespaceName
// At `namespace N.M/**/`, if this is the only declaration of `M`, don't include `M` as a completion.
? function (symbol) { return !!(symbol.flags & 1920 /* Namespace */) && !symbol.declarations.every(function (d) { return d.parent === node.parent; }); }
- : allowTypeOrValue ?
+ : isRhsOfImportDeclaration ?
// Any kind is allowed when dotting off namespace in internal import equals declaration
function (symbol) { return isValidTypeAccess_1(symbol) || isValidValueAccess_1(symbol); } :
isTypeLocation ? isValidTypeAccess_1 : isValidValueAccess_1;
@@ -102071,7 +102895,7 @@ var ts;
var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
isInSnippetScope = isSnippetScope(scopeNode);
var isTypeOnly = isTypeOnlyCompletion();
- var symbolMeanings = (isTypeOnly ? 0 /* None */ : 67220415 /* Value */) | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
+ var symbolMeanings = (isTypeOnly ? 0 /* None */ : 111551 /* Value */) | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined");
for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
var symbol = symbols_2[_i];
@@ -102126,7 +102950,6 @@ var ts;
}
function filterGlobalCompletion(symbols) {
var isTypeOnly = isTypeOnlyCompletion();
- var allowTypes = isTypeOnly || !isContextTokenValueLocation(contextToken) && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
if (isTypeOnly) {
keywordFilters = isTypeAssertion()
? 6 /* TypeAssertionKeywords */
@@ -102143,23 +102966,24 @@ var ts;
if (ts.isInRightSideOfInternalImportEqualsDeclaration(location)) {
return !!(symbol.flags & 1920 /* Namespace */);
}
- if (allowTypes) {
- // Its a type, but you can reach it by namespace.type as well
- var symbolAllowedAsType = symbolCanBeReferencedAtTypeLocation(symbol);
- if (symbolAllowedAsType || isTypeOnly) {
- return symbolAllowedAsType;
- }
+ if (isTypeOnly) {
+ // It's a type, but you can reach it by namespace.type as well
+ return symbolCanBeReferencedAtTypeLocation(symbol);
}
}
// expressions are value space (which includes the value namespaces)
- return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 67220415 /* Value */);
+ return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 111551 /* Value */);
});
}
function isTypeAssertion() {
return ts.isAssertionExpression(contextToken.parent);
}
function isTypeOnlyCompletion() {
- return insideJsDocTagTypeExpression || !isContextTokenValueLocation(contextToken) && (ts.isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
+ return insideJsDocTagTypeExpression
+ || !isContextTokenValueLocation(contextToken) &&
+ (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
+ || ts.isPartOfTypeNode(location)
+ || isContextTokenTypeLocation(contextToken));
}
function isContextTokenValueLocation(contextToken) {
return contextToken &&
@@ -102193,7 +103017,7 @@ var ts;
function symbolCanBeReferencedAtTypeLocation(symbol, seenModules) {
if (seenModules === void 0) { seenModules = ts.createMap(); }
var sym = ts.skipAlias(symbol.exportSymbol || symbol, typeChecker);
- return !!(sym.flags & 67897832 /* Type */) ||
+ return !!(sym.flags & 788968 /* Type */) ||
!!(sym.flags & 1536 /* Module */) &&
ts.addToSeen(seenModules, ts.getSymbolId(sym)) &&
typeChecker.getExportsOfModule(sym).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, seenModules); });
@@ -102898,16 +103722,18 @@ var ts;
case 0 /* None */:
return false;
case 1 /* All */:
- return kind === 122 /* AsyncKeyword */ || 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 126 /* DeclareKeyword */ || kind === 131 /* ModuleKeyword */
+ return isFunctionLikeBodyKeyword(kind)
+ || kind === 126 /* DeclareKeyword */
+ || kind === 131 /* ModuleKeyword */
|| ts.isTypeKeyword(kind) && kind !== 142 /* UndefinedKeyword */;
+ case 5 /* FunctionLikeBodyKeywords */:
+ return isFunctionLikeBodyKeyword(kind);
case 2 /* ClassElementKeywords */:
return isClassMemberCompletionKeyword(kind);
case 3 /* InterfaceElementKeywords */:
return isInterfaceOrTypeLiteralCompletionKeyword(kind);
case 4 /* ConstructorParameterKeywords */:
return ts.isParameterPropertyModifier(kind);
- case 5 /* FunctionLikeBodyKeywords */:
- return isFunctionLikeBodyKeyword(kind);
case 6 /* TypeAssertionKeywords */:
return ts.isTypeKeyword(kind) || kind === 78 /* ConstKeyword */;
case 7 /* TypeKeywords */:
@@ -102966,7 +103792,9 @@ var ts;
}
}
function isFunctionLikeBodyKeyword(kind) {
- return kind === 122 /* AsyncKeyword */ || kind === 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
+ return kind === 122 /* AsyncKeyword */
+ || kind === 123 /* AwaitKeyword */
+ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}
function keywordForNode(node) {
return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind;
@@ -103003,7 +103831,7 @@ var ts;
function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) {
// class c { method() { } | method2() { } }
switch (location.kind) {
- case 313 /* SyntaxList */:
+ case 314 /* SyntaxList */:
return ts.tryCast(location.parent, ts.isObjectTypeDeclaration);
case 1 /* EndOfFileToken */:
var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration);
@@ -103273,10 +104101,12 @@ var ts;
return __spreadArrays(container.parameters, (ts.isClassLike(container.parent) ? container.parent.members : []));
case 241 /* ClassDeclaration */:
case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 169 /* TypeLiteral */:
var nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
- if (modifierFlag & 28 /* AccessibilityModifier */) {
+ if (modifierFlag & (28 /* AccessibilityModifier */ | 64 /* Readonly */)) {
var constructor = ts.find(container.members, ts.isConstructorDeclaration);
if (constructor) {
return __spreadArrays(nodes, constructor.parameters);
@@ -104008,7 +104838,7 @@ var ts;
/**
* Given a local reference, we might notice that it's an import/export and recursively search for references of that.
* If at an import, look locally for the symbol it imports.
- * If an an export, look for all imports of it.
+ * If at an export, look for all imports of it.
* This doesn't handle export specifiers; that is done in `getReferencesAtExportSpecifier`.
* @param comingFromExport If we are doing a search for all exports, don't bother looking backwards for the imported symbol, since that's the reason we're here.
*/
@@ -104140,10 +104970,10 @@ var ts;
// If a reference is a class expression, the exported node would be its parent.
// If a reference is a variable declaration, the exported node would be the variable statement.
function getExportNode(parent, node) {
- if (parent.kind === 238 /* VariableDeclaration */) {
- var p = parent;
- return p.name !== node ? undefined :
- p.parent.kind === 275 /* CatchClause */ ? undefined : p.parent.parent.kind === 220 /* VariableStatement */ ? p.parent.parent : undefined;
+ var declaration = ts.isVariableDeclaration(parent) ? parent : ts.isBindingElement(parent) ? ts.walkUpBindingElementsAndPatterns(parent) : undefined;
+ if (declaration) {
+ return parent.name !== node ? undefined :
+ ts.isCatchClause(declaration.parent) ? undefined : ts.isVariableStatement(declaration.parent.parent) ? declaration.parent.parent : undefined;
}
else {
return parent;
@@ -104607,8 +105437,8 @@ var ts;
case 249 /* ImportEqualsDeclaration */:
case 254 /* ImportSpecifier */:
case 242 /* InterfaceDeclaration */:
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
case 268 /* JsxAttribute */:
case 245 /* ModuleDeclaration */:
case 248 /* NamespaceExportDeclaration */:
@@ -104633,8 +105463,8 @@ var ts;
return !!decl.initializer || ts.isCatchClause(decl.parent);
case 156 /* MethodSignature */:
case 154 /* PropertySignature */:
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
return false;
default:
return ts.Debug.failBadSyntaxKind(decl);
@@ -104825,10 +105655,23 @@ var ts;
}
return references.length ? [{ definition: { type: 0 /* Symbol */, symbol: symbol }, references: references }] : ts.emptyArray;
}
+ /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */
+ function isReadonlyTypeOperator(node) {
+ return node.kind === 134 /* ReadonlyKeyword */
+ && ts.isTypeOperatorNode(node.parent)
+ && node.parent.operator === 134 /* ReadonlyKeyword */;
+ }
/** getReferencedSymbols for special node kinds. */
function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) {
if (ts.isTypeKeyword(node.kind)) {
- return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken);
+ // A modifier readonly (like on a property declaration) is not special;
+ // a readonly type keyword (like `readonly string[]`) is.
+ if (node.kind === 134 /* ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) {
+ return undefined;
+ }
+ // Likewise, when we *are* looking for a special keyword, make sure we
+ // *don’t* include readonly member modifiers.
+ return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 134 /* ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined);
}
// Labels
if (ts.isJumpStatementTarget(node)) {
@@ -105253,8 +106096,8 @@ var ts;
// We found a match. Make sure it's not part of a larger word (i.e. the char
// before and after it have to be a non-identifier char).
var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 8 /* Latest */)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 8 /* Latest */))) {
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 99 /* Latest */)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 99 /* Latest */))) {
// Found a real match. Keep searching.
positions.push(position);
}
@@ -105289,11 +106132,13 @@ var ts;
return false;
}
}
- function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) {
+ function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken, filter) {
var references = ts.flatMap(sourceFiles, function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
return ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, ts.tokenToString(keywordKind), sourceFile), function (referenceLocation) {
- return referenceLocation.kind === keywordKind ? FindAllReferences.nodeEntry(referenceLocation) : undefined;
+ if (referenceLocation.kind === keywordKind && (!filter || filter(referenceLocation))) {
+ return FindAllReferences.nodeEntry(referenceLocation);
+ }
});
});
return references.length ? [{ definition: { type: 2 /* Keyword */, node: references[0].node }, references: references }] : undefined;
@@ -106435,18 +107280,21 @@ var ts;
}
}
function getDefinitionFromSymbol(typeChecker, symbol, node) {
- return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(symbol.declarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
+ // There are cases when you extend a function by adding properties to it afterwards,
+ // we want to strip those extra properties
+ var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return !ts.isAssignmentDeclaration(d) || d === symbol.valueDeclaration; }) || undefined;
+ return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(filteredDeclarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
function getConstructSignatureDefinition() {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 125 /* ConstructorKeyword */)) {
- var cls = ts.find(symbol.declarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
+ var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
return getSignatureDefinition(cls.members, /*selectConstructors*/ true);
}
}
function getCallSignatureDefinition() {
return ts.isCallOrNewExpressionTarget(node) || ts.isNameOfFunctionDeclaration(node)
- ? getSignatureDefinition(symbol.declarations, /*selectConstructors*/ false)
+ ? getSignatureDefinition(filteredDeclarations, /*selectConstructors*/ false)
: undefined;
}
function getSignatureDefinition(signatureDeclarations, selectConstructors) {
@@ -106628,11 +107476,11 @@ var ts;
JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
function getCommentHavingNodes(declaration) {
switch (declaration.kind) {
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return [declaration];
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
return [declaration, declaration.parent];
default:
return ts.getJSDocCommentsAndTags(declaration);
@@ -106653,16 +107501,16 @@ var ts;
function getCommentText(tag) {
var comment = tag.comment;
switch (tag.kind) {
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return withNode(tag.class);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return withList(tag.typeParameters);
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
return withNode(tag.typeExpression);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
var name = tag.name;
return name ? withNode(name) : comment;
default:
@@ -107487,8 +108335,8 @@ var ts;
case 245 /* ModuleDeclaration */:
case 285 /* SourceFile */:
case 243 /* TypeAliasDeclaration */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
return true;
case 158 /* Constructor */:
case 157 /* MethodDeclaration */:
@@ -108041,9 +108889,9 @@ var ts;
function addRegionOutliningSpans(sourceFile, out) {
var regions = [];
var lineStarts = sourceFile.getLineStarts();
- for (var i = 0; i < lineStarts.length; i++) {
- var currentLineStart = lineStarts[i];
- var lineEnd = i + 1 === lineStarts.length ? sourceFile.getEnd() : lineStarts[i + 1] - 1;
+ for (var _i = 0, lineStarts_1 = lineStarts; _i < lineStarts_1.length; _i++) {
+ var currentLineStart = lineStarts_1[_i];
+ var lineEnd = sourceFile.getLineEndOfPosition(currentLineStart);
var lineText = sourceFile.text.substring(currentLineStart, lineEnd);
var result = isRegionDelimiter(lineText);
if (!result || ts.isInComment(sourceFile, currentLineStart)) {
@@ -108478,7 +109326,7 @@ var ts;
if (ch >= 65 /* A */ && ch <= 90 /* Z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 99 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -108491,7 +109339,7 @@ var ts;
if (ch >= 97 /* a */ && ch <= 122 /* z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 99 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -109141,7 +109989,7 @@ var ts;
if (node.getStart(sourceFile) > pos) {
break outer;
}
- if (positionShouldSnapToNode(pos, node, nextNode)) {
+ if (positionShouldSnapToNode(sourceFile, pos, node)) {
// 1. Blocks are effectively redundant with SyntaxLists.
// 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
// of things that should be considered independently.
@@ -109184,6 +110032,12 @@ var ts;
parentNode = node;
break;
}
+ // If we made it to the end of the for loop, we’re done.
+ // In practice, I’ve only seen this happen at the very end
+ // of a SourceFile.
+ if (i === children.length - 1) {
+ break outer;
+ }
}
}
return selectionRange;
@@ -109207,12 +110061,11 @@ var ts;
* count too, unless that position belongs to the next node. In effect, makes
* selections able to snap to preceding tokens when the cursor is on the tail
* end of them with only whitespace ahead.
+ * @param sourceFile The source file containing the nodes.
* @param pos The position to check.
* @param node The candidate node to snap to.
- * @param nextNode The next sibling node in the tree.
- * @param sourceFile The source file containing the nodes.
*/
- function positionShouldSnapToNode(pos, node, nextNode) {
+ function positionShouldSnapToNode(sourceFile, pos, node) {
// Can’t use 'ts.positionBelongsToNode()' here because it cleverly accounts
// for missing nodes, which can’t really be considered when deciding what
// to select.
@@ -109221,9 +110074,8 @@ var ts;
return true;
}
var nodeEnd = node.getEnd();
- var nextNodeStart = nextNode && nextNode.getStart();
if (nodeEnd === pos) {
- return pos !== nextNodeStart;
+ return ts.getTouchingPropertyName(sourceFile, pos).pos < node.end;
}
return false;
}
@@ -109372,7 +110224,7 @@ var ts;
}
function createSyntaxList(children) {
ts.Debug.assertGreaterThanOrEqual(children.length, 1);
- var syntaxList = ts.createNode(313 /* SyntaxList */, children[0].pos, ts.last(children).end);
+ var syntaxList = ts.createNode(314 /* SyntaxList */, children[0].pos, ts.last(children).end);
syntaxList._children = children;
return syntaxList;
}
@@ -110881,7 +111733,14 @@ var ts;
*/
function transpileModule(input, transpileOptions) {
var diagnostics = [];
- var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : ts.getDefaultCompilerOptions();
+ var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
+ // mix in default options
+ var defaultOptions = ts.getDefaultCompilerOptions();
+ for (var key in defaultOptions) {
+ if (ts.hasProperty(defaultOptions, key) && options[key] === undefined) {
+ options[key] = defaultOptions[key];
+ }
+ }
options.isolatedModules = true;
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
options.suppressOutputPathCheck = true;
@@ -111087,8 +111946,8 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
- var standardScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
- var jsxScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
+ var standardScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
+ var jsxScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
var ScanAction;
(function (ScanAction) {
ScanAction[ScanAction["Scan"] = 0] = "Scan";
@@ -113423,7 +114282,7 @@ var ts;
case 210 /* ClassExpression */:
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return getList(node.typeParameters);
case 193 /* NewExpression */:
case 192 /* CallExpression */:
@@ -114316,7 +115175,7 @@ var ts;
function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) {
// TODO: this emits the file, parses it back, then formats it that -- may be a less roundabout way to do this
var nonFormattedText = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
- var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 8 /* ESNext */, /*setParentNodes*/ true, scriptKind);
+ var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 99 /* ESNext */, /*setParentNodes*/ true, scriptKind);
var changes = ts.formatting.formatDocument(sourceFile, formatContext);
return applyChanges(nonFormattedText, changes) + newLineCharacter;
}
@@ -115686,14 +116545,14 @@ var ts;
return undefined;
}
switch (oldTag.kind) {
- case 306 /* JSDocParameterTag */: {
+ case 307 /* JSDocParameterTag */: {
var oldParam = oldTag;
var newParam = newTag;
return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
? ts.createJSDocParamTag(newParam.name, newParam.isBracketed, newParam.typeExpression, oldParam.comment)
: undefined;
}
- case 307 /* JSDocReturnTag */:
+ case 308 /* JSDocReturnTag */:
return ts.createJSDocReturnTag(newTag.typeExpression, oldTag.comment);
}
}
@@ -116998,7 +117857,7 @@ var ts;
forEachExportReference(sourceFile, function (node) {
var _a = node.name, text = _a.text, originalKeywordKind = _a.originalKeywordKind;
if (!res.has(text) && (originalKeywordKind !== undefined && ts.isNonContextualKeyword(originalKeywordKind)
- || checker.resolveName(node.name.text, node, 67220415 /* Value */, /*excludeGlobals*/ true))) {
+ || checker.resolveName(node.name.text, node, 111551 /* Value */, /*excludeGlobals*/ true))) {
// Unconditionally add an underscore in case `text` is a keyword.
res.set(text, makeUniqueName("_" + text, identifiers));
}
@@ -117599,9 +118458,10 @@ var ts;
ImportKind[ImportKind["Default"] = 1] = "Default";
ImportKind[ImportKind["Namespace"] = 2] = "Namespace";
ImportKind[ImportKind["Equals"] = 3] = "Equals";
+ ImportKind[ImportKind["ConstEquals"] = 4] = "ConstEquals";
})(ImportKind || (ImportKind = {}));
function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
- var exportInfos = getAllReExportingModules(exportedSymbol, moduleSymbol, symbolName, sourceFile, program.getCompilerOptions(), program.getTypeChecker(), program.getSourceFiles());
+ var exportInfos = getAllReExportingModules(sourceFile, exportedSymbol, moduleSymbol, symbolName, sourceFile, program.getCompilerOptions(), program.getTypeChecker(), program.getSourceFiles());
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol; }));
// We sort the best codefixes first, so taking `first` is best for completions.
var moduleSpecifier = ts.first(getNewImportInfos(program, sourceFile, position, exportInfos, host, preferences)).moduleSpecifier;
@@ -117613,14 +118473,14 @@ var ts;
var description = _a.description, changes = _a.changes, commands = _a.commands;
return { description: description, changes: changes, commands: commands };
}
- function getAllReExportingModules(exportedSymbol, exportingModuleSymbol, symbolName, sourceFile, compilerOptions, checker, allSourceFiles) {
+ function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, sourceFile, compilerOptions, checker, allSourceFiles) {
var result = [];
forEachExternalModule(checker, allSourceFiles, function (moduleSymbol, moduleFile) {
// Don't import from a re-export when looking "up" like to `./index` or `../index`.
if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(sourceFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) {
return;
}
- var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
+ var defaultInfo = getDefaultLikeExportInfo(importingFile, moduleSymbol, checker, compilerOptions);
if (defaultInfo && defaultInfo.name === symbolName && ts.skipAlias(defaultInfo.symbol, checker) === exportedSymbol) {
result.push({ moduleSymbol: moduleSymbol, importKind: defaultInfo.kind, exportedSymbolIsTypeOnly: isTypeOnlySymbol(defaultInfo.symbol, checker) });
}
@@ -117634,7 +118494,7 @@ var ts;
return result;
}
function isTypeOnlySymbol(s, checker) {
- return !(ts.skipAlias(s, checker).flags & 67220415 /* Value */);
+ return !(ts.skipAlias(s, checker).flags & 111551 /* Value */);
}
function getFixForImport(exportInfos, symbolName, position, program, sourceFile, host, preferences) {
var checker = program.getTypeChecker();
@@ -117742,7 +118602,7 @@ var ts;
return undefined;
var symbol = checker.getAliasedSymbol(umdSymbol);
var symbolName = umdSymbol.name;
- var exportInfos = [{ moduleSymbol: symbol, importKind: getUmdImportKind(program.getCompilerOptions()), exportedSymbolIsTypeOnly: false }];
+ var exportInfos = [{ moduleSymbol: symbol, importKind: getUmdImportKind(sourceFile, program.getCompilerOptions()), exportedSymbolIsTypeOnly: false }];
var fixes = getFixForImport(exportInfos, symbolName, ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined, program, sourceFile, host, preferences);
return { fixes: fixes, symbolName: symbolName };
}
@@ -117754,10 +118614,10 @@ var ts;
// The error wasn't for the symbolAtLocation, it was for the JSX tag itself, which needs access to e.g. `React`.
var parent = token.parent;
return (ts.isJsxOpeningLikeElement(parent) && parent.tagName === token) || ts.isJsxOpeningFragment(parent)
- ? ts.tryCast(checker.resolveName(checker.getJsxNamespace(parent), ts.isJsxOpeningLikeElement(parent) ? token : parent, 67220415 /* Value */, /*excludeGlobals*/ false), ts.isUMDExportSymbol)
+ ? ts.tryCast(checker.resolveName(checker.getJsxNamespace(parent), ts.isJsxOpeningLikeElement(parent) ? token : parent, 111551 /* Value */, /*excludeGlobals*/ false), ts.isUMDExportSymbol)
: undefined;
}
- function getUmdImportKind(compilerOptions) {
+ function getUmdImportKind(importingFile, compilerOptions) {
// Import a synthetic `default` if enabled.
if (ts.getAllowSyntheticDefaultImports(compilerOptions)) {
return 1 /* Default */;
@@ -117768,6 +118628,9 @@ var ts;
case ts.ModuleKind.AMD:
case ts.ModuleKind.CommonJS:
case ts.ModuleKind.UMD:
+ if (ts.isInJSFile(importingFile)) {
+ return ts.isExternalModule(importingFile) ? 2 /* Namespace */ : 4 /* ConstEquals */;
+ }
return 3 /* Equals */;
case ts.ModuleKind.System:
case ts.ModuleKind.ES2015:
@@ -117806,7 +118669,7 @@ var ts;
}
forEachExternalModuleToImportFrom(checker, sourceFile, program.getSourceFiles(), function (moduleSymbol) {
cancellationToken.throwIfCancellationRequested();
- var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, program.getCompilerOptions());
+ var defaultInfo = getDefaultLikeExportInfo(sourceFile, moduleSymbol, checker, program.getCompilerOptions());
if (defaultInfo && defaultInfo.name === symbolName && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
addSymbol(moduleSymbol, defaultInfo.symbol, defaultInfo.kind);
}
@@ -117818,20 +118681,41 @@ var ts;
});
return originalSymbolToExportInfos;
}
- function getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions) {
- var exported = getDefaultLikeExportWorker(moduleSymbol, checker);
+ function getDefaultLikeExportInfo(importingFile, moduleSymbol, checker, compilerOptions) {
+ var exported = getDefaultLikeExportWorker(importingFile, moduleSymbol, checker, compilerOptions);
if (!exported)
return undefined;
var symbol = exported.symbol, kind = exported.kind;
var info = getDefaultExportInfoWorker(symbol, moduleSymbol, checker, compilerOptions);
return info && __assign({ symbol: symbol, kind: kind }, info);
}
- function getDefaultLikeExportWorker(moduleSymbol, checker) {
+ function getDefaultLikeExportWorker(importingFile, moduleSymbol, checker, compilerOptions) {
var defaultExport = checker.tryGetMemberInModuleExports("default" /* Default */, moduleSymbol);
if (defaultExport)
return { symbol: defaultExport, kind: 1 /* Default */ };
var exportEquals = checker.resolveExternalModuleSymbol(moduleSymbol);
- return exportEquals === moduleSymbol ? undefined : { symbol: exportEquals, kind: 3 /* Equals */ };
+ return exportEquals === moduleSymbol ? undefined : { symbol: exportEquals, kind: getExportEqualsImportKind(importingFile, compilerOptions, checker) };
+ }
+ function getExportEqualsImportKind(importingFile, compilerOptions, checker) {
+ if (ts.getAllowSyntheticDefaultImports(compilerOptions) && ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
+ return 1 /* Default */;
+ }
+ if (ts.isInJSFile(importingFile)) {
+ return ts.isExternalModule(importingFile) ? 1 /* Default */ : 4 /* ConstEquals */;
+ }
+ for (var _i = 0, _a = importingFile.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ if (ts.isImportEqualsDeclaration(statement)) {
+ return 3 /* Equals */;
+ }
+ if (ts.isImportDeclaration(statement) && statement.importClause && statement.importClause.name) {
+ var moduleSymbol = checker.getImmediateAliasedSymbol(statement.importClause.symbol);
+ if (moduleSymbol && moduleSymbol.name !== "default" /* Default */) {
+ return 1 /* Default */;
+ }
+ }
+ }
+ return 3 /* Equals */;
}
function getDefaultExportInfoWorker(defaultExport, moduleSymbol, checker, compilerOptions) {
var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport);
@@ -117844,9 +118728,11 @@ var ts;
var aliased = checker.getImmediateAliasedSymbol(defaultExport);
return aliased && getDefaultExportInfoWorker(aliased, ts.Debug.assertDefined(aliased.parent), checker, compilerOptions);
}
- else {
- return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) };
+ if (defaultExport.escapedName !== "default" /* Default */ &&
+ defaultExport.escapedName !== "export=" /* ExportEquals */) {
+ return { symbolForMeaning: defaultExport, name: defaultExport.getName() };
}
+ return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) };
}
function getNameForExportDefault(symbol) {
return symbol.declarations && ts.firstDefined(symbol.declarations, function (declaration) {
@@ -117938,11 +118824,17 @@ var ts;
ts.insertImport(changes, sourceFile, ts.makeImport(defaultImport === undefined ? undefined : ts.createIdentifier(defaultImport), namedImports.map(function (n) { return ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(n)); }), moduleSpecifier, quotePreference));
}
if (namespaceLikeImport) {
- ts.insertImport(changes, sourceFile, namespaceLikeImport.importKind === 3 /* Equals */
- ? ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createIdentifier(namespaceLikeImport.name), ts.createExternalModuleReference(quotedModuleSpecifier))
- : ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(ts.createIdentifier(namespaceLikeImport.name))), quotedModuleSpecifier));
+ ts.insertImport(changes, sourceFile, namespaceLikeImport.importKind === 3 /* Equals */ ? ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createIdentifier(namespaceLikeImport.name), ts.createExternalModuleReference(quotedModuleSpecifier)) :
+ namespaceLikeImport.importKind === 4 /* ConstEquals */ ? createConstEqualsRequireDeclaration(namespaceLikeImport.name, quotedModuleSpecifier) :
+ ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(ts.createIdentifier(namespaceLikeImport.name))), quotedModuleSpecifier));
}
}
+ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
+ return ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(ts.createIdentifier(name),
+ /*type*/ undefined, ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, [quotedModuleSpecifier]))
+ ], 2 /* Const */));
+ }
function symbolHasMeaning(_a, meaning) {
var declarations = _a.declarations;
return ts.some(declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); });
@@ -118084,10 +118976,10 @@ var ts;
flags |= 1920 /* Namespace */;
}
if (meaning & 2 /* Type */) {
- flags |= 67897832 /* Type */;
+ flags |= 788968 /* Type */;
}
if (meaning & 1 /* Value */) {
- flags |= 67220415 /* Value */;
+ flags |= 111551 /* Value */;
}
return flags;
}
@@ -119312,9 +120204,8 @@ var ts;
var modifiers = visibilityModifier ? ts.createNodeArray([visibilityModifier]) : undefined;
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
var optional = !!(symbol.flags & 16777216 /* Optional */);
+ var ambient = !!(enclosingDeclaration.flags & 4194304 /* Ambient */);
switch (declaration.kind) {
- case 159 /* GetAccessor */:
- case 160 /* SetAccessor */:
case 154 /* PropertySignature */:
case 155 /* PropertyDeclaration */:
var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
@@ -119322,6 +120213,29 @@ var ts;
/*decorators*/ undefined, modifiers, name, optional ? ts.createToken(56 /* QuestionToken */) : undefined, typeNode,
/*initializer*/ undefined));
break;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */: {
+ var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration);
+ var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
+ var orderedAccessors = allAccessors.secondAccessor
+ ? [allAccessors.firstAccessor, allAccessors.secondAccessor]
+ : [allAccessors.firstAccessor];
+ for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) {
+ var accessor = orderedAccessors_1[_i];
+ if (ts.isGetAccessorDeclaration(accessor)) {
+ out(ts.createGetAccessor(
+ /*decorators*/ undefined, modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : createStubbedMethodBody(preferences)));
+ }
+ else {
+ ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration);
+ var parameter = ts.getSetAccessorValueParameter(accessor);
+ var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined;
+ out(ts.createSetAccessor(
+ /*decorators*/ undefined, modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : createStubbedMethodBody(preferences)));
+ }
+ }
+ break;
+ }
case 156 /* MethodSignature */:
case 157 /* MethodDeclaration */:
// The signature for the implementation appears as an entry in `signatures` iff
@@ -119338,21 +120252,23 @@ var ts;
if (declarations.length === 1) {
ts.Debug.assert(signatures.length === 1);
var signature = signatures[0];
- outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
+ outputMethod(signature, modifiers, name, ambient ? undefined : createStubbedMethodBody(preferences));
break;
}
- for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
- var signature = signatures_1[_i];
+ for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) {
+ var signature = signatures_1[_a];
// Need to ensure nodes are fresh each time so they can have different positions.
outputMethod(signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
}
- if (declarations.length > signatures.length) {
- var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
- outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
- }
- else {
- ts.Debug.assert(declarations.length === signatures.length);
- out(createMethodImplementingSignatures(signatures, name, optional, modifiers, preferences));
+ if (!ambient) {
+ if (declarations.length > signatures.length) {
+ var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
+ outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
+ }
+ else {
+ ts.Debug.assert(declarations.length === signatures.length);
+ out(createMethodImplementingSignatures(signatures, name, optional, modifiers, preferences));
+ }
}
break;
}
@@ -120189,7 +121105,7 @@ var ts;
function doChangeNamedToNamespace(sourceFile, checker, changes, toConvert) {
var importDecl = toConvert.parent.parent;
var moduleSpecifier = importDecl.moduleSpecifier;
- var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 8 /* ESNext */) : "module";
+ var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 99 /* ESNext */) : "module";
var namespaceNameConflicts = toConvert.elements.some(function (element) {
return ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
return !!checker.resolveName(preferredName, id, 67108863 /* All */, /*excludeGlobals*/ true);
@@ -121818,7 +122734,7 @@ var ts;
}
else if (ts.isTypeQueryNode(node)) {
if (ts.isIdentifier(node.exprName)) {
- var symbol = checker.resolveName(node.exprName.text, node.exprName, 67220415 /* Value */, /* excludeGlobals */ false);
+ var symbol = checker.resolveName(node.exprName.text, node.exprName, 111551 /* Value */, /* excludeGlobals */ false);
if (symbol && rangeContainsSkipTrivia(statement, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) {
return true;
}
@@ -121840,7 +122756,7 @@ var ts;
changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
}
function doTypedefChange(changes, file, name, firstStatement, selection, typeParameters) {
- var node = ts.createNode(311 /* JSDocTypedefTag */);
+ var node = ts.createNode(312 /* JSDocTypedefTag */);
node.tagName = ts.createIdentifier("typedef"); // TODO: jsdoc factory https://github.com/Microsoft/TypeScript/pull/29539
node.fullName = ts.createIdentifier(name);
node.name = node.fullName;
@@ -121848,7 +122764,7 @@ var ts;
var templates = [];
ts.forEach(typeParameters, function (typeParameter) {
var constraint = ts.getEffectiveConstraintOfTypeParameter(typeParameter);
- var template = ts.createNode(310 /* JSDocTemplateTag */);
+ var template = ts.createNode(311 /* JSDocTemplateTag */);
template.tagName = ts.createIdentifier("template");
template.constraint = constraint && ts.cast(constraint, ts.isJSDocTypeExpression);
var parameter = ts.createNode(151 /* TypeParameter */);
@@ -122214,7 +123130,7 @@ var ts;
}
}
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) {
- var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 8 /* ESNext */);
+ var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 99 /* ESNext */);
var needUniqueName = false;
var toChange = [];
ts.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function (ref) {
@@ -122352,7 +123268,7 @@ var ts;
}
if (namedBindings) {
if (namedBindingsUnused) {
- changes.delete(sourceFile, namedBindings);
+ changes.replaceNode(sourceFile, importDecl.importClause, ts.updateImportClause(importDecl.importClause, name, /*namedBindings*/ undefined));
}
else if (namedBindings.kind === 253 /* NamedImports */) {
for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
@@ -123400,7 +124316,7 @@ var ts;
if (!children.length) {
return undefined;
}
- var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 312 /* LastJSDocNode */; });
+ var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 313 /* LastJSDocNode */; });
return child.kind < 149 /* FirstNode */ ?
child :
child.getFirstToken(sourceFile);
@@ -123470,7 +124386,7 @@ var ts;
}
}
function createSyntaxList(nodes, parent) {
- var list = createNode(313 /* SyntaxList */, nodes.pos, nodes.end, parent);
+ var list = createNode(314 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
@@ -124065,7 +124981,7 @@ var ts;
var sourceFile;
if (this.currentFileName !== fileName) {
// This is a new file, just parse it
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 8 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 99 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
}
else if (this.currentFileVersion !== version) {
// This is the same file, just a newer version. Incrementally parse the file.
@@ -124222,7 +125138,11 @@ var ts;
function getValidSourceFile(fileName) {
var sourceFile = program.getSourceFile(fileName);
if (!sourceFile) {
- throw new Error("Could not find sourceFile: '" + fileName + "' in " + (program && JSON.stringify(program.getSourceFiles().map(function (f) { return f.fileName; }))) + ".");
+ var error = new Error("Could not find source file: '" + fileName + "'.");
+ // We've been having trouble debugging this, so attach sidecar data for the tsserver log.
+ // See https://github.com/microsoft/TypeScript/issues/30180.
+ error.ProgramFiles = program.getSourceFiles().map(function (f) { return f.fileName; });
+ throw error;
}
return sourceFile;
}
@@ -124291,11 +125211,21 @@ var ts;
compilerHost.trace = function (message) { return host.trace(message); };
}
if (host.resolveModuleNames) {
- compilerHost.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); };
+ compilerHost.resolveModuleNames = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveModuleNames.apply(host, args);
+ };
}
if (host.resolveTypeReferenceDirectives) {
- compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference) {
- return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile, redirectedReference);
+ compilerHost.resolveTypeReferenceDirectives = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveTypeReferenceDirectives.apply(host, args);
};
}
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
@@ -124542,7 +125472,7 @@ var ts;
var normalizedFileName = ts.normalizePath(fileName);
ts.Debug.assert(filesToSearch.some(function (f) { return ts.normalizePath(f) === normalizedFileName; }));
synchronizeHostData();
- var sourceFilesToSearch = filesToSearch.map(getValidSourceFile);
+ var sourceFilesToSearch = ts.mapDefined(filesToSearch, function (fileName) { return program.getSourceFile(fileName); });
var sourceFile = getValidSourceFile(fileName);
return ts.DocumentHighlights.getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch);
}
@@ -126869,66 +127799,82 @@ var ts;
}
}
JsTyping.discoverTypings = discoverTypings;
- var PackageNameValidationResult;
- (function (PackageNameValidationResult) {
- PackageNameValidationResult[PackageNameValidationResult["Ok"] = 0] = "Ok";
- PackageNameValidationResult[PackageNameValidationResult["ScopedPackagesNotSupported"] = 1] = "ScopedPackagesNotSupported";
- PackageNameValidationResult[PackageNameValidationResult["EmptyName"] = 2] = "EmptyName";
- PackageNameValidationResult[PackageNameValidationResult["NameTooLong"] = 3] = "NameTooLong";
- PackageNameValidationResult[PackageNameValidationResult["NameStartsWithDot"] = 4] = "NameStartsWithDot";
- PackageNameValidationResult[PackageNameValidationResult["NameStartsWithUnderscore"] = 5] = "NameStartsWithUnderscore";
- PackageNameValidationResult[PackageNameValidationResult["NameContainsNonURISafeCharacters"] = 6] = "NameContainsNonURISafeCharacters";
- })(PackageNameValidationResult = JsTyping.PackageNameValidationResult || (JsTyping.PackageNameValidationResult = {}));
+ var NameValidationResult;
+ (function (NameValidationResult) {
+ NameValidationResult[NameValidationResult["Ok"] = 0] = "Ok";
+ NameValidationResult[NameValidationResult["EmptyName"] = 1] = "EmptyName";
+ NameValidationResult[NameValidationResult["NameTooLong"] = 2] = "NameTooLong";
+ NameValidationResult[NameValidationResult["NameStartsWithDot"] = 3] = "NameStartsWithDot";
+ NameValidationResult[NameValidationResult["NameStartsWithUnderscore"] = 4] = "NameStartsWithUnderscore";
+ NameValidationResult[NameValidationResult["NameContainsNonURISafeCharacters"] = 5] = "NameContainsNonURISafeCharacters";
+ })(NameValidationResult = JsTyping.NameValidationResult || (JsTyping.NameValidationResult = {}));
var maxPackageNameLength = 214;
/**
* Validates package name using rules defined at https://docs.npmjs.com/files/package.json
*/
function validatePackageName(packageName) {
+ return validatePackageNameWorker(packageName, /*supportScopedPackage*/ true);
+ }
+ JsTyping.validatePackageName = validatePackageName;
+ function validatePackageNameWorker(packageName, supportScopedPackage) {
if (!packageName) {
- return 2 /* EmptyName */;
+ return 1 /* EmptyName */;
}
if (packageName.length > maxPackageNameLength) {
- return 3 /* NameTooLong */;
+ return 2 /* NameTooLong */;
}
if (packageName.charCodeAt(0) === 46 /* dot */) {
- return 4 /* NameStartsWithDot */;
+ return 3 /* NameStartsWithDot */;
}
if (packageName.charCodeAt(0) === 95 /* _ */) {
- return 5 /* NameStartsWithUnderscore */;
+ return 4 /* NameStartsWithUnderscore */;
}
// check if name is scope package like: starts with @ and has one '/' in the middle
// scoped packages are not currently supported
- // TODO: when support will be added we'll need to split and check both scope and package name
- if (/^@[^/]+\/[^/]+$/.test(packageName)) {
- return 1 /* ScopedPackagesNotSupported */;
+ if (supportScopedPackage) {
+ var matches = /^@([^/]+)\/([^/]+)$/.exec(packageName);
+ if (matches) {
+ var scopeResult = validatePackageNameWorker(matches[1], /*supportScopedPackage*/ false);
+ if (scopeResult !== 0 /* Ok */) {
+ return { name: matches[1], isScopeName: true, result: scopeResult };
+ }
+ var packageResult = validatePackageNameWorker(matches[2], /*supportScopedPackage*/ false);
+ if (packageResult !== 0 /* Ok */) {
+ return { name: matches[2], isScopeName: false, result: packageResult };
+ }
+ return 0 /* Ok */;
+ }
}
if (encodeURIComponent(packageName) !== packageName) {
- return 6 /* NameContainsNonURISafeCharacters */;
+ return 5 /* NameContainsNonURISafeCharacters */;
}
return 0 /* Ok */;
}
- JsTyping.validatePackageName = validatePackageName;
function renderPackageNameValidationFailure(result, typing) {
+ return typeof result === "object" ?
+ renderPackageNameValidationFailureWorker(typing, result.result, result.name, result.isScopeName) :
+ renderPackageNameValidationFailureWorker(typing, result, typing, /*isScopeName*/ false);
+ }
+ JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
+ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeName) {
+ var kind = isScopeName ? "Scope" : "Package";
switch (result) {
- case 2 /* EmptyName */:
- return "Package name '" + typing + "' cannot be empty";
- case 3 /* NameTooLong */:
- return "Package name '" + typing + "' should be less than " + maxPackageNameLength + " characters";
- case 4 /* NameStartsWithDot */:
- return "Package name '" + typing + "' cannot start with '.'";
- case 5 /* NameStartsWithUnderscore */:
- return "Package name '" + typing + "' cannot start with '_'";
- case 1 /* ScopedPackagesNotSupported */:
- return "Package '" + typing + "' is scoped and currently is not supported";
- case 6 /* NameContainsNonURISafeCharacters */:
- return "Package name '" + typing + "' contains non URI safe characters";
+ case 1 /* EmptyName */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot be empty";
+ case 2 /* NameTooLong */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' should be less than " + maxPackageNameLength + " characters";
+ case 3 /* NameStartsWithDot */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot start with '.'";
+ case 4 /* NameStartsWithUnderscore */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot start with '_'";
+ case 5 /* NameContainsNonURISafeCharacters */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' contains non URI safe characters";
case 0 /* Ok */:
return ts.Debug.fail(); // Shouldn't have called this.
default:
throw ts.Debug.assertNever(result);
}
}
- JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
})(JsTyping = ts.JsTyping || (ts.JsTyping = {}));
})(ts || (ts = {}));
var ts;
@@ -127053,11 +127999,13 @@ var ts;
}
};
ThrottledOperations.run = function (self, operationId, cb) {
+ ts.perfLogger.logStartScheduledOperation(operationId);
self.pendingTimeouts.delete(operationId);
if (self.logger) {
self.logger.info("Running: " + operationId);
}
cb();
+ ts.perfLogger.logStopScheduledOperation();
};
return ThrottledOperations;
}());
@@ -127077,6 +128025,7 @@ var ts;
};
GcTimer.run = function (self) {
self.timerId = undefined;
+ ts.perfLogger.logStartScheduledOperation("GC collect");
var log = self.logger.hasLevel(server.LogLevel.requestTime);
var before = log && self.host.getMemoryUsage(); // TODO: GH#18217
self.host.gc(); // TODO: GH#18217
@@ -127084,6 +128033,7 @@ var ts;
var after = self.host.getMemoryUsage(); // TODO: GH#18217
self.logger.perftrc("GC::before " + before + ", after " + after);
}
+ ts.perfLogger.logStopScheduledOperation();
};
return GcTimer;
}());
@@ -128604,6 +129554,7 @@ var ts;
* @returns: true if set of files in the project stays the same and false - otherwise.
*/
Project.prototype.updateGraph = function () {
+ ts.perfLogger.logStartUpdateGraph();
this.resolutionCache.startRecordingFilesWithChangedResolutions();
var hasNewProgram = this.updateGraphWorker();
var hasAddedorRemovedFiles = this.hasAddedorRemovedFiles;
@@ -128634,6 +129585,7 @@ var ts;
if (hasNewProgram) {
this.projectProgramVersion++;
}
+ ts.perfLogger.logStopUpdateGraph();
return !hasNewProgram;
};
/*@internal*/
@@ -128734,9 +129686,12 @@ var ts;
}, function (removed) { return _this.detachScriptInfoFromProject(removed); });
var elapsed = ts.timestamp() - start;
this.writeLog("Finishing updateGraphWorker: Project: " + this.getProjectName() + " Version: " + this.getProjectVersion() + " structureChanged: " + hasNewProgram + " Elapsed: " + elapsed + "ms");
- if (this.program !== oldProgram) {
+ if (this.hasAddedorRemovedFiles) {
this.print();
}
+ else if (this.program !== oldProgram) {
+ this.writeLog("Different program with same set of files:: oldProgram.structureIsReused:: " + (oldProgram && oldProgram.structureIsReused));
+ }
return hasNewProgram;
};
Project.prototype.detachScriptInfoFromProject = function (uncheckedFileName, noRemoveResolution) {
@@ -128971,7 +129926,7 @@ var ts;
Project.prototype.enableProxy = function (pluginModuleFactory, configEntry) {
try {
if (typeof pluginModuleFactory !== "function") {
- this.projectService.logger.info("Skipped loading plugin " + configEntry.name + " because it did expose a proper factory function");
+ this.projectService.logger.info("Skipped loading plugin " + configEntry.name + " because it did not expose a proper factory function");
return;
}
var info = {
@@ -130085,7 +131040,13 @@ var ts;
project.print();
project.close();
if (ts.Debug.shouldAssert(1 /* Normal */)) {
- this.filenameToScriptInfo.forEach(function (info) { return ts.Debug.assert(!info.isAttached(project), "Found script Info still attached to project", function () { return project.projectName + ": ScriptInfos still attached: " + JSON.stringify(ts.mapDefined(ts.arrayFrom(_this.filenameToScriptInfo.values()), function (info) { return info.isAttached(project) ? info : undefined; })); }); });
+ this.filenameToScriptInfo.forEach(function (info) { return ts.Debug.assert(!info.isAttached(project), "Found script Info still attached to project", function () { return project.projectName + ": ScriptInfos still attached: " + JSON.stringify(ts.arrayFrom(ts.mapDefinedIterator(_this.filenameToScriptInfo.values(), function (info) { return info.isAttached(project) ?
+ {
+ fileName: info.fileName,
+ projects: info.containingProjects.map(function (p) { return p.projectName; }),
+ hasMixedContent: info.hasMixedContent
+ } : undefined; })),
+ /*replacer*/ undefined, " "); }); });
}
// Remove the project from pending project updates
this.pendingProjectUpdates.delete(project.getProjectName());
@@ -131442,6 +132403,7 @@ var ts;
var configFileName;
var configFileErrors;
var project = this.findExternalProjectContainingOpenScriptInfo(info);
+ var defaultConfigProject;
if (!project && !this.syntaxOnly) { // Checking syntaxOnly is an optimization
configFileName = this.getConfigFileNameForFile(info);
if (configFileName) {
@@ -131462,6 +132424,7 @@ var ts;
// Ensure project is ready to check if it contains opened script info
updateProjectIfDirty(project);
}
+ defaultConfigProject = project;
}
}
// Project we have at this point is going to be updated since its either found through
@@ -131478,12 +132441,12 @@ var ts;
this.assignOrphanScriptInfoToInferredProject(info, this.openFiles.get(info.path));
}
ts.Debug.assert(!info.isOrphan());
- return { configFileName: configFileName, configFileErrors: configFileErrors };
+ return { configFileName: configFileName, configFileErrors: configFileErrors, defaultConfigProject: defaultConfigProject };
};
- ProjectService.prototype.cleanupAfterOpeningFile = function () {
+ ProjectService.prototype.cleanupAfterOpeningFile = function (toRetainConfigProjects) {
// This was postponed from closeOpenFile to after opening next file,
// so that we can reuse the project if we need to right away
- this.removeOrphanConfiguredProjects();
+ this.removeOrphanConfiguredProjects(toRetainConfigProjects);
// Remove orphan inferred projects now that we have reused projects
// We need to create a duplicate because we cant guarantee order after removal
for (var _i = 0, _a = this.inferredProjects.slice(); _i < _a.length; _i++) {
@@ -131501,21 +132464,29 @@ var ts;
};
ProjectService.prototype.openClientFileWithNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent, projectRootPath) {
var info = this.getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath);
- var result = this.assignProjectToOpenedScriptInfo(info);
- this.cleanupAfterOpeningFile();
+ var _a = this.assignProjectToOpenedScriptInfo(info), defaultConfigProject = _a.defaultConfigProject, result = __rest(_a, ["defaultConfigProject"]);
+ this.cleanupAfterOpeningFile(defaultConfigProject);
this.telemetryOnOpenFile(info);
return result;
};
- ProjectService.prototype.removeOrphanConfiguredProjects = function () {
+ ProjectService.prototype.removeOrphanConfiguredProjects = function (toRetainConfiguredProjects) {
var _this = this;
var toRemoveConfiguredProjects = ts.cloneMap(this.configuredProjects);
+ if (toRetainConfiguredProjects) {
+ if (ts.isArray(toRetainConfiguredProjects)) {
+ toRetainConfiguredProjects.forEach(retainConfiguredProject);
+ }
+ else {
+ retainConfiguredProject(toRetainConfiguredProjects);
+ }
+ }
// Do not remove configured projects that are used as original projects of other
this.inferredProjects.forEach(markOriginalProjectsAsUsed);
this.externalProjects.forEach(markOriginalProjectsAsUsed);
this.configuredProjects.forEach(function (project) {
// If project has open ref (there are more than zero references from external project/open file), keep it alive as well as any project it references
if (project.hasOpenRef()) {
- toRemoveConfiguredProjects.delete(project.canonicalConfigFilePath);
+ retainConfiguredProject(project);
markOriginalProjectsAsUsed(project);
}
else {
@@ -131524,7 +132495,7 @@ var ts;
if (ref) {
var refProject = _this.configuredProjects.get(ref.sourceFile.path);
if (refProject && refProject.hasOpenRef()) {
- toRemoveConfiguredProjects.delete(project.canonicalConfigFilePath);
+ retainConfiguredProject(project);
}
}
});
@@ -131537,6 +132508,9 @@ var ts;
project.originalConfiguredProjects.forEach(function (_value, configuredProjectPath) { return toRemoveConfiguredProjects.delete(configuredProjectPath); });
}
}
+ function retainConfiguredProject(project) {
+ toRemoveConfiguredProjects.delete(project.canonicalConfigFilePath);
+ }
};
ProjectService.prototype.removeOrphanScriptInfos = function () {
var _this = this;
@@ -131664,15 +132638,16 @@ var ts;
}
}
// All the script infos now exist, so ok to go update projects for open files
+ var defaultConfigProjects;
if (openScriptInfos) {
- openScriptInfos.forEach(function (info) { return _this.assignProjectToOpenedScriptInfo(info); });
+ defaultConfigProjects = ts.mapDefined(openScriptInfos, function (info) { return _this.assignProjectToOpenedScriptInfo(info).defaultConfigProject; });
}
// While closing files there could be open files that needed assigning new inferred projects, do it now
if (assignOrphanScriptInfosToInferredProject) {
this.assignOrphanScriptInfosToInferredProject();
}
// Cleanup projects
- this.cleanupAfterOpeningFile();
+ this.cleanupAfterOpeningFile(defaultConfigProjects);
// Telemetry
ts.forEach(openScriptInfos, function (info) { return _this.telemetryOnOpenFile(info); });
this.printProjects();
@@ -132047,6 +133022,9 @@ var ts;
}
return false;
}
+ function dtsChangeCanAffectEmit(compilationSettings) {
+ return ts.getEmitDeclarations(compilationSettings) || !!compilationSettings.emitDecoratorMetadata;
+ }
function formatDiag(fileName, project, diag) {
var scriptInfo = project.getScriptInfoForNormalizedPath(fileName); // TODO: GH#18217
return {
@@ -132863,7 +133841,8 @@ var ts;
}
catch (_b) { } // tslint:disable-line no-empty
}
- if (err.message && err.message.indexOf("Could not find sourceFile:") !== -1) {
+ if (err.ProgramFiles) {
+ msg += "\n\nProgram files: " + JSON.stringify(err.ProgramFiles) + "\n";
msg += "\n\nProjects::\n";
var counter_1 = 0;
var addProjectInfo = function (project) {
@@ -132886,7 +133865,9 @@ var ts;
}
return;
}
- this.host.write(formatMessage(msg, this.logger, this.byteLength, this.host.newLine));
+ var msgText = formatMessage(msg, this.logger, this.byteLength, this.host.newLine);
+ ts.perfLogger.logEvent("Response message size: " + msgText.length);
+ this.host.write(msgText);
};
Session.prototype.event = function (body, eventName) {
this.send(toEvent(eventName, body));
@@ -133618,15 +134599,19 @@ var ts;
return server.emptyArray;
}
return combineProjectOutput(info, function (path) { return _this.projectService.getScriptInfoForPath(path); }, projects, function (project, info) {
- var result;
- if (project.compileOnSaveEnabled && project.languageServiceEnabled && !project.isOrphan() && !project.getCompilationSettings().noEmit) {
- result = {
- projectFileName: project.getProjectName(),
- fileNames: project.getCompileOnSaveAffectedFileList(info),
- projectUsesOutFile: !!project.getCompilationSettings().outFile || !!project.getCompilationSettings().out
- };
+ if (!project.compileOnSaveEnabled || !project.languageServiceEnabled || project.isOrphan()) {
+ return undefined;
}
- return result;
+ var compilationSettings = project.getCompilationSettings();
+ if (!!compilationSettings.noEmit || ts.fileExtensionIs(info.fileName, ".d.ts" /* Dts */) && !dtsChangeCanAffectEmit(compilationSettings)) {
+ // avoid triggering emit when a change is made in a .d.ts when declaration emit and decorator metadata emit are disabled
+ return undefined;
+ }
+ return {
+ projectFileName: project.getProjectName(),
+ fileNames: project.getCompileOnSaveAffectedFileList(info),
+ projectUsesOutFile: !!compilationSettings.outFile || !!compilationSettings.out
+ };
});
};
Session.prototype.emitFile = function (args) {
@@ -134107,6 +135092,7 @@ var ts;
try {
request = JSON.parse(message);
relevantFile = request.arguments && request.arguments.file ? request.arguments : undefined;
+ ts.perfLogger.logStartCommand("" + request.command, message.substring(0, 100));
var _a = this.executeCommand(request), response = _a.response, responseRequired = _a.responseRequired;
if (this.logger.hasLevel(server.LogLevel.requestTime)) {
var elapsedTime = hrTimeToMilliseconds(this.hrtime(start)).toFixed(4);
@@ -134117,6 +135103,8 @@ var ts;
this.logger.perftrc(request.seq + "::" + request.command + ": async elapsed time (in milliseconds) " + elapsedTime);
}
}
+ // Note: Log before writing the response, else the editor can complete its activity before the server does
+ ts.perfLogger.logStopCommand("" + request.command, "Success");
if (response) {
this.doOutput(response, request.command, request.seq, /*success*/ true);
}
@@ -134127,10 +135115,12 @@ var ts;
catch (err) {
if (err instanceof ts.OperationCanceledException) {
// Handle cancellation exceptions
+ ts.perfLogger.logStopCommand("" + (request && request.command), "Canceled: " + err);
this.doOutput({ canceled: true }, request.command, request.seq, /*success*/ true);
return;
}
this.logErrorWorker(err, message, relevantFile);
+ ts.perfLogger.logStopCommand("" + (request && request.command), "Error: " + err);
this.doOutput(
/*info*/ undefined, request ? request.command : server.CommandNames.Unknown, request ? request.seq : 0,
/*success*/ false, "Error processing request. " + err.message + "\n" + err.stack);
@@ -135066,6 +136056,17 @@ var ts;
};
Logger.prototype.msg = function (s, type) {
if (type === void 0) { type = server.Msg.Err; }
+ switch (type) {
+ case server.Msg.Info:
+ ts.perfLogger.logInfoEvent(s);
+ break;
+ case server.Msg.Perf:
+ ts.perfLogger.logPerfEvent(s);
+ break;
+ default: // Msg.Err
+ ts.perfLogger.logErrEvent(s);
+ break;
+ }
if (!this.canWrite)
return;
s = "[" + server.nowString() + "] " + s + "\n";
@@ -135772,6 +136773,31 @@ var ts;
if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) {
ts.sys.tryEnableSourceMapsForHost();
}
+ // Overwrites the current console messages to instead write to
+ // the log. This is so that language service plugins which use
+ // console.log don't break the message passing between tsserver
+ // and the client
+ console.log = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return logger.msg(args.length === 1 ? args[0] : args.join(", "), server.Msg.Info);
+ };
+ console.warn = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return logger.msg(args.length === 1 ? args[0] : args.join(", "), server.Msg.Err);
+ };
+ console.error = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return logger.msg(args.length === 1 ? args[0] : args.join(", "), server.Msg.Err);
+ };
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
//# sourceMappingURL=tsserver.js.map
\ No newline at end of file
diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts
index 9208f383563..4c88e5fe219 100644
--- a/lib/tsserverlibrary.d.ts
+++ b/lib/tsserverlibrary.d.ts
@@ -374,29 +374,30 @@ declare namespace ts {
JSDocOptionalType = 294,
JSDocFunctionType = 295,
JSDocVariadicType = 296,
- JSDocComment = 297,
- JSDocTypeLiteral = 298,
- JSDocSignature = 299,
- JSDocTag = 300,
- JSDocAugmentsTag = 301,
- JSDocAuthorTag = 302,
- JSDocClassTag = 303,
- JSDocCallbackTag = 304,
- JSDocEnumTag = 305,
- JSDocParameterTag = 306,
- JSDocReturnTag = 307,
- JSDocThisTag = 308,
- JSDocTypeTag = 309,
- JSDocTemplateTag = 310,
- JSDocTypedefTag = 311,
- JSDocPropertyTag = 312,
- SyntaxList = 313,
- NotEmittedStatement = 314,
- PartiallyEmittedExpression = 315,
- CommaListExpression = 316,
- MergeDeclarationMarker = 317,
- EndOfDeclarationMarker = 318,
- Count = 319,
+ JSDocNamepathType = 297,
+ JSDocComment = 298,
+ JSDocTypeLiteral = 299,
+ JSDocSignature = 300,
+ JSDocTag = 301,
+ JSDocAugmentsTag = 302,
+ JSDocAuthorTag = 303,
+ JSDocClassTag = 304,
+ JSDocCallbackTag = 305,
+ JSDocEnumTag = 306,
+ JSDocParameterTag = 307,
+ JSDocReturnTag = 308,
+ JSDocThisTag = 309,
+ JSDocTypeTag = 310,
+ JSDocTemplateTag = 311,
+ JSDocTypedefTag = 312,
+ JSDocPropertyTag = 313,
+ SyntaxList = 314,
+ NotEmittedStatement = 315,
+ PartiallyEmittedExpression = 316,
+ CommaListExpression = 317,
+ MergeDeclarationMarker = 318,
+ EndOfDeclarationMarker = 319,
+ Count = 320,
FirstAssignment = 60,
LastAssignment = 72,
FirstCompoundAssignment = 61,
@@ -423,9 +424,9 @@ declare namespace ts {
LastBinaryOperator = 72,
FirstNode = 149,
FirstJSDocNode = 289,
- LastJSDocNode = 312,
- FirstJSDocTagNode = 300,
- LastJSDocTagNode = 312,
+ LastJSDocNode = 313,
+ FirstJSDocTagNode = 301,
+ LastJSDocTagNode = 313,
}
export enum NodeFlags {
None = 0,
@@ -1558,6 +1559,10 @@ declare namespace ts {
kind: SyntaxKind.JSDocVariadicType;
type: TypeNode;
}
+ export interface JSDocNamepathType extends JSDocType {
+ kind: SyntaxKind.JSDocNamepathType;
+ type: TypeNode;
+ }
export type JSDocTypeReferencingNode = JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
export interface JSDoc extends Node {
kind: SyntaxKind.JSDocComment;
@@ -1589,7 +1594,8 @@ declare namespace ts {
export interface JSDocClassTag extends JSDocTag {
kind: SyntaxKind.JSDocClassTag;
}
- export interface JSDocEnumTag extends JSDocTag {
+ export interface JSDocEnumTag extends JSDocTag, Declaration {
+ parent: JSDoc;
kind: SyntaxKind.JSDocEnumTag;
typeExpression?: JSDocTypeExpression;
}
@@ -2126,28 +2132,28 @@ declare namespace ts {
ModuleExports = 134217728,
Enum = 384,
Variable = 3,
- Value = 67220415,
- Type = 67897832,
+ Value = 111551,
+ Type = 788968,
Namespace = 1920,
Module = 1536,
Accessor = 98304,
- FunctionScopedVariableExcludes = 67220414,
- BlockScopedVariableExcludes = 67220415,
- ParameterExcludes = 67220415,
+ FunctionScopedVariableExcludes = 111550,
+ BlockScopedVariableExcludes = 111551,
+ ParameterExcludes = 111551,
PropertyExcludes = 0,
- EnumMemberExcludes = 68008959,
- FunctionExcludes = 67219887,
- ClassExcludes = 68008383,
- InterfaceExcludes = 67897736,
- RegularEnumExcludes = 68008191,
- ConstEnumExcludes = 68008831,
+ EnumMemberExcludes = 900095,
+ FunctionExcludes = 110991,
+ ClassExcludes = 899503,
+ InterfaceExcludes = 788872,
+ RegularEnumExcludes = 899327,
+ ConstEnumExcludes = 899967,
ValueModuleExcludes = 110735,
NamespaceModuleExcludes = 0,
- MethodExcludes = 67212223,
- GetAccessorExcludes = 67154879,
- SetAccessorExcludes = 67187647,
- TypeParameterExcludes = 67635688,
- TypeAliasExcludes = 67897832,
+ MethodExcludes = 103359,
+ GetAccessorExcludes = 46015,
+ SetAccessorExcludes = 78783,
+ TypeParameterExcludes = 526824,
+ TypeAliasExcludes = 788968,
AliasExcludes = 2097152,
ModuleMember = 2623475,
ExportHasLocal = 944,
@@ -2600,7 +2606,7 @@ declare namespace ts {
UMD = 3,
System = 4,
ES2015 = 5,
- ESNext = 6
+ ESNext = 99
}
export enum JsxEmit {
None = 0,
@@ -2640,9 +2646,9 @@ declare namespace ts {
ES2018 = 5,
ES2019 = 6,
ES2020 = 7,
- ESNext = 8,
+ ESNext = 99,
JSON = 100,
- Latest = 8
+ Latest = 99
}
export enum LanguageVariant {
Standard = 0,
@@ -2768,11 +2774,11 @@ declare namespace ts {
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
readDirectory?(rootDir: string, extensions: ReadonlyArray, excludes: ReadonlyArray | undefined, includes: ReadonlyArray, depth?: number): string[];
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
/**
* This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
*/
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
getEnvironmentVariable?(name: string): string | undefined;
createHash?(data: string): string;
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
@@ -3168,6 +3174,7 @@ declare namespace ts {
getTokenPos(): number;
getTokenText(): string;
getTokenValue(): string;
+ hasUnicodeEscape(): boolean;
hasExtendedUnicodeEscape(): boolean;
hasPrecedingLineBreak(): boolean;
isIdentifier(): boolean;
@@ -4528,9 +4535,9 @@ declare namespace ts {
/** If provided is used to get the environment variable */
getEnvironmentVariable?(name: string): string | undefined;
/** If provided, used to resolve the module names, otherwise typescript's default module resolution */
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
/** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
}
interface WatchCompilerHost extends ProgramHost, WatchHost {
/** If provided, callback to invoke after every new program creation */
@@ -4885,9 +4892,9 @@ declare namespace ts {
realpath?(path: string): string;
fileExists?(path: string): boolean;
getTypeRootsVersion?(): number;
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined;
- resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
+ resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
getDirectories?(directoryName: string): string[];
/**
* Gets a set of custom transformers to use during emit.
@@ -5670,6 +5677,7 @@ declare namespace ts {
}
}
declare namespace ts {
+ /** The classifier is used for syntactic highlighting in editors via the TSServer */
function createClassifier(): Classifier;
}
declare namespace ts {
diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js
index 10c90b5ad19..095427c187d 100644
--- a/lib/tsserverlibrary.js
+++ b/lib/tsserverlibrary.js
@@ -93,7 +93,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.6";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".0-beta";
+ ts.version = ts.versionMajorMinor + ".1-rc";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -1248,6 +1248,18 @@ var ts;
return keys;
}
ts.getOwnKeys = getOwnKeys;
+ function getAllKeys(obj) {
+ var result = [];
+ do {
+ var names = Object.getOwnPropertyNames(obj);
+ for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
+ var name = names_1[_i];
+ pushIfUnique(result, name);
+ }
+ } while (obj = Object.getPrototypeOf(obj));
+ return result;
+ }
+ ts.getAllKeys = getAllKeys;
function getOwnValues(sparseArray) {
var values = [];
for (var key in sparseArray) {
@@ -2387,6 +2399,46 @@ var ts;
})(ts || (ts = {}));
/* @internal */
var ts;
+(function (ts) {
+ var nullLogger = {
+ logEvent: ts.noop,
+ logErrEvent: ts.noop,
+ logPerfEvent: ts.noop,
+ logInfoEvent: ts.noop,
+ logStartCommand: ts.noop,
+ logStopCommand: ts.noop,
+ logStartUpdateProgram: ts.noop,
+ logStopUpdateProgram: ts.noop,
+ logStartUpdateGraph: ts.noop,
+ logStopUpdateGraph: ts.noop,
+ logStartResolveModule: ts.noop,
+ logStopResolveModule: ts.noop,
+ logStartParseSourceFile: ts.noop,
+ logStopParseSourceFile: ts.noop,
+ logStartReadFile: ts.noop,
+ logStopReadFile: ts.noop,
+ logStartBindFile: ts.noop,
+ logStopBindFile: ts.noop,
+ logStartScheduledOperation: ts.noop,
+ logStopScheduledOperation: ts.noop,
+ };
+ // Load optional module to enable Event Tracing for Windows
+ // See https://github.com/microsoft/typescript-etw for more information
+ var etwModule;
+ try {
+ // require() will throw an exception if the module is not installed
+ // It may also return undefined if not installed properly
+ etwModule = require("@microsoft/typescript-etw"); // tslint:disable-line:no-implicit-dependencies
+ }
+ catch (e) {
+ etwModule = undefined;
+ }
+ /** Performance logger that will generate ETW events if possible */
+ ts.perfLogger = etwModule ? etwModule : nullLogger;
+ ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
(function (ts) {
// https://semver.org/#spec-item-2
// > A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative
@@ -3079,32 +3131,34 @@ var ts;
SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType";
SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType";
SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature";
- SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag";
- SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 302] = "JSDocAuthorTag";
- SyntaxKind[SyntaxKind["JSDocClassTag"] = 303] = "JSDocClassTag";
- SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 304] = "JSDocCallbackTag";
- SyntaxKind[SyntaxKind["JSDocEnumTag"] = 305] = "JSDocEnumTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 306] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 307] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocThisTag"] = 308] = "JSDocThisTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 309] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 310] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 311] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 312] = "JSDocPropertyTag";
+ // https://jsdoc.app/about-namepaths.html
+ SyntaxKind[SyntaxKind["JSDocNamepathType"] = 297] = "JSDocNamepathType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 298] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 299] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocSignature"] = 300] = "JSDocSignature";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 301] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 302] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 303] = "JSDocAuthorTag";
+ SyntaxKind[SyntaxKind["JSDocClassTag"] = 304] = "JSDocClassTag";
+ SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 305] = "JSDocCallbackTag";
+ SyntaxKind[SyntaxKind["JSDocEnumTag"] = 306] = "JSDocEnumTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 307] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 308] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 309] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 310] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 311] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 312] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 313] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 313] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 314] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 314] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 315] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 316] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 317] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 318] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 315] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 316] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 317] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 318] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 319] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 319] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 320] = "Count";
// Markers
SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment";
@@ -3132,9 +3186,9 @@ var ts;
SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator";
SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode";
SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 312] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 312] = "LastJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 313] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 301] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 313] = "LastJSDocTagNode";
/* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword";
/* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
@@ -3260,6 +3314,8 @@ var ts;
/* @internal */
TokenFlags[TokenFlags["ContainsSeparator"] = 512] = "ContainsSeparator";
/* @internal */
+ TokenFlags[TokenFlags["UnicodeEscape"] = 1024] = "UnicodeEscape";
+ /* @internal */
TokenFlags[TokenFlags["BinaryOrOctalSpecifier"] = 384] = "BinaryOrOctalSpecifier";
/* @internal */
TokenFlags[TokenFlags["NumericLiteralFlags"] = 1008] = "NumericLiteralFlags";
@@ -3483,32 +3539,32 @@ var ts;
SymbolFlags[SymbolFlags["All"] = 67108863] = "All";
SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum";
SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable";
- SymbolFlags[SymbolFlags["Value"] = 67220415] = "Value";
- SymbolFlags[SymbolFlags["Type"] = 67897832] = "Type";
+ SymbolFlags[SymbolFlags["Value"] = 111551] = "Value";
+ SymbolFlags[SymbolFlags["Type"] = 788968] = "Type";
SymbolFlags[SymbolFlags["Namespace"] = 1920] = "Namespace";
SymbolFlags[SymbolFlags["Module"] = 1536] = "Module";
SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor";
// Variables can be redeclared, but can not redeclare a block-scoped declaration with the
// same name, or any other value that is not a variable, e.g. ValueModule or Class
- SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 67220414] = "FunctionScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 111550] = "FunctionScopedVariableExcludes";
// Block-scoped declarations are not allowed to be re-declared
// they can not merge with anything in the value space
- SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 67220415] = "BlockScopedVariableExcludes";
- SymbolFlags[SymbolFlags["ParameterExcludes"] = 67220415] = "ParameterExcludes";
+ SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 111551] = "BlockScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["ParameterExcludes"] = 111551] = "ParameterExcludes";
SymbolFlags[SymbolFlags["PropertyExcludes"] = 0] = "PropertyExcludes";
- SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 68008959] = "EnumMemberExcludes";
- SymbolFlags[SymbolFlags["FunctionExcludes"] = 67219887] = "FunctionExcludes";
- SymbolFlags[SymbolFlags["ClassExcludes"] = 68008383] = "ClassExcludes";
- SymbolFlags[SymbolFlags["InterfaceExcludes"] = 67897736] = "InterfaceExcludes";
- SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 68008191] = "RegularEnumExcludes";
- SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 68008831] = "ConstEnumExcludes";
+ SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes";
+ SymbolFlags[SymbolFlags["FunctionExcludes"] = 110991] = "FunctionExcludes";
+ SymbolFlags[SymbolFlags["ClassExcludes"] = 899503] = "ClassExcludes";
+ SymbolFlags[SymbolFlags["InterfaceExcludes"] = 788872] = "InterfaceExcludes";
+ SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes";
+ SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes";
SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 110735] = "ValueModuleExcludes";
SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes";
- SymbolFlags[SymbolFlags["MethodExcludes"] = 67212223] = "MethodExcludes";
- SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 67154879] = "GetAccessorExcludes";
- SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 67187647] = "SetAccessorExcludes";
- SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 67635688] = "TypeParameterExcludes";
- SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 67897832] = "TypeAliasExcludes";
+ SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes";
+ SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes";
+ SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes";
+ SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes";
+ SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes";
SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes";
SymbolFlags[SymbolFlags["ModuleMember"] = 2623475] = "ModuleMember";
SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal";
@@ -3836,8 +3892,11 @@ var ts;
ModuleKind[ModuleKind["AMD"] = 2] = "AMD";
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
ModuleKind[ModuleKind["System"] = 4] = "System";
+ // NOTE: ES module kinds should be contiguous to more easily check whether a module kind is *any* ES module kind.
+ // Non-ES module kinds should not come between ES2015 (the earliest ES module kind) and ESNext (the last ES
+ // module kind).
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
- ModuleKind[ModuleKind["ESNext"] = 6] = "ESNext";
+ ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
var JsxEmit;
(function (JsxEmit) {
@@ -3876,9 +3935,9 @@ var ts;
ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018";
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
- ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext";
+ ScriptTarget[ScriptTarget["ESNext"] = 99] = "ESNext";
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
- ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest";
+ ScriptTarget[ScriptTarget["Latest"] = 99] = "Latest";
})(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
var LanguageVariant;
(function (LanguageVariant) {
@@ -4574,6 +4633,38 @@ var ts;
}
}
ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
+ /* @internal */
+ function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
+ var cache = ts.createMap();
+ var callbacksCache = ts.createMultiMap();
+ var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
+ return function (fileName, callback, pollingInterval) {
+ var path = toCanonicalFileName(fileName);
+ var existing = cache.get(path);
+ if (existing) {
+ existing.refCount++;
+ }
+ else {
+ cache.set(path, {
+ watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval),
+ refCount: 1
+ });
+ }
+ callbacksCache.add(path, callback);
+ return {
+ close: function () {
+ var watcher = ts.Debug.assertDefined(cache.get(path));
+ callbacksCache.remove(path, callback);
+ watcher.refCount--;
+ if (watcher.refCount)
+ return;
+ cache.delete(path);
+ ts.closeFileWatcherOf(watcher);
+ }
+ };
+ };
+ }
+ ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
/**
* Returns true if file status changed
*/
@@ -4600,6 +4691,8 @@ var ts;
ts.getFileWatcherEventKind = getFileWatcherEventKind;
/*@internal*/
ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
+ /*@internal*/
+ ts.sysLog = ts.noop;
/**
* Watch the directory recursively using host provided method to watch child directories
* that means if this is recursive watcher, watch the children directories as well
@@ -4740,6 +4833,7 @@ var ts;
var Buffer = require("buffer").Buffer;
var nodeVersion = getNodeMajorVersion();
var isNode4OrLater = nodeVersion >= 4;
+ var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
var platform = _os.platform();
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
var FileSystemEntryKind;
@@ -4750,6 +4844,7 @@ var ts;
var useNonPollingWatchers = process.env.TSC_NONPOLLING_WATCHER;
var tscWatchFile = process.env.TSC_WATCHFILE;
var tscWatchDirectory = process.env.TSC_WATCHDIRECTORY;
+ var fsWatchFile = createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames);
var dynamicPollingWatchFile;
var nodeSystem = {
args: process.argv.slice(2),
@@ -4886,7 +4981,7 @@ var ts;
return useNonPollingWatchers ?
createNonPollingWatchFile() :
// Default to do not use polling interval as it is before this experiment branch
- function (fileName, callback) { return fsWatchFile(fileName, callback); };
+ function (fileName, callback) { return fsWatchFile(fileName, callback, /*pollingInterval*/ undefined); };
}
function getWatchDirectory() {
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
@@ -4960,7 +5055,7 @@ var ts;
return watcher;
}
}
- function fsWatchFile(fileName, callback, pollingInterval) {
+ function fsWatchFileWorker(fileName, callback, pollingInterval) {
_fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
var eventKind;
return {
@@ -5018,6 +5113,12 @@ var ts;
}
function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingWatchFile, pollingInterval) {
var options;
+ var lastDirectoryPartWithDirectorySeparator;
+ var lastDirectoryPart;
+ if (isLinuxOrMacOs) {
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
+ }
/** Watcher for the file system entry depending on whether it is missing or present */
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
watchMissingFileSystemEntry() :
@@ -5034,6 +5135,7 @@ var ts;
* @param createWatcher
*/
function invokeCallbackAndUpdateWatcher(createWatcher) {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
// Call the callback for current directory
callback("rename", "");
// If watcher is not closed, update it
@@ -5058,7 +5160,9 @@ var ts;
}
}
try {
- var presentWatcher = _fs.watch(fileOrDirectory, options, callback);
+ var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
+ callbackChangingToMissingFileSystemEntry :
+ callback);
// Watch the missing file or directory or error
presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
return presentWatcher;
@@ -5070,11 +5174,23 @@ var ts;
return watchPresentFileSystemEntryWithFsWatchFile();
}
}
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
+ return event === "rename" &&
+ (!relativeName ||
+ relativeName === lastDirectoryPart ||
+ relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length) &&
+ !fileSystemEntryExists(fileOrDirectory, entryKind) ?
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
+ callback(event, relativeName);
+ }
/**
* Watch the file or directory using fs.watchFile since fs.watch threw exception
* Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
*/
function watchPresentFileSystemEntryWithFsWatchFile() {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
return fallbackPollingWatchFile(fileOrDirectory, createFileWatcherCallback(callback), pollingInterval);
}
/**
@@ -5107,7 +5223,7 @@ var ts;
function createWatchDirectoryUsing(fsWatchFile) {
return function (directoryName, callback) { return fsWatchFile(directoryName, function () { return callback(directoryName); }, PollingInterval.Medium); };
}
- function readFile(fileName, _encoding) {
+ function readFileWorker(fileName, _encoding) {
if (!fileExists(fileName)) {
return undefined;
}
@@ -5135,7 +5251,14 @@ var ts;
// Default is UTF-8 with no byte order mark
return buffer.toString("utf8");
}
+ function readFile(fileName, _encoding) {
+ ts.perfLogger.logStartReadFile(fileName);
+ var file = readFileWorker(fileName, _encoding);
+ ts.perfLogger.logStopReadFile();
+ return file;
+ }
function writeFile(fileName, data, writeByteOrderMark) {
+ ts.perfLogger.logEvent("WriteFile: " + fileName);
// If a BOM is required, emit one
if (writeByteOrderMark) {
data = byteOrderMarkIndicator + data;
@@ -5152,6 +5275,7 @@ var ts;
}
}
function getAccessibleFileSystemEntries(path) {
+ ts.perfLogger.logEvent("ReadDir: " + (path || "."));
try {
var entries = _fs.readdirSync(path || ".").sort();
var files = [];
@@ -5207,6 +5331,7 @@ var ts;
return fileSystemEntryExists(path, 1 /* Directory */);
}
function getDirectories(path) {
+ ts.perfLogger.logEvent("ReadDir: " + path);
return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); });
}
function realpath(path) {
@@ -5397,7 +5522,6 @@ var ts;
A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."),
Invalid_reference_directive_syntax: diag(1084, ts.DiagnosticCategory.Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, ts.DiagnosticCategory.Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."),
- An_accessor_cannot_be_declared_in_an_ambient_context: diag(1086, ts.DiagnosticCategory.Error, "An_accessor_cannot_be_declared_in_an_ambient_context_1086", "An accessor cannot be declared in an ambient context."),
_0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."),
_0_modifier_cannot_appear_on_a_parameter: diag(1090, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."),
Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."),
@@ -5550,6 +5674,7 @@ var ts;
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
+ Keywords_cannot_contain_escape_characters: diag(1260, ts.DiagnosticCategory.Error, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -5582,7 +5707,7 @@ var ts;
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
- The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_option_1343", "The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options."),
+ The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system_1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'esnext' or 'system'."),
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness"),
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
@@ -6705,7 +6830,7 @@ var ts;
_a.of = 148 /* OfKeyword */,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */, "`": 59 /* BacktickToken */ }));
/*
As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
IdentifierStart ::
@@ -6752,6 +6877,14 @@ var ts;
*/
var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
+ /**
+ * Generated by scripts/regenerate-unicode-identifier-parts.js on node v12.4.0 with unicode 12.1
+ * based on http://www.unicode.org/reports/tr31/ and https://www.ecma-international.org/ecma-262/6.0/#sec-names-and-keywords
+ * unicodeESNextIdentifierStart corresponds to the ID_Start and Other_ID_Start property, and
+ * unicodeESNextIdentifierPart corresponds to ID_Continue, Other_ID_Continue, plus ID_Start and Other_ID_Start
+ */
+ var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3133, 3160, 3162, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101];
+ var unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3328, 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7673, 7675, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65071, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69376, 69404, 69415, 69415, 69424, 69456, 69600, 69622, 69632, 69702, 69734, 69743, 69759, 69818, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69958, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70096, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70206, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70751, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71680, 71738, 71840, 71913, 71935, 71935, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123584, 123641, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101, 917760, 917999];
function lookupInUnicodeMap(code, map) {
// Bail out quickly if it couldn't possibly be in the map.
if (code < map[0]) {
@@ -6778,15 +6911,17 @@ var ts;
return false;
}
/* @internal */ function isUnicodeIdentifierStart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
- lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierStart);
+ return languageVersion >= 2 /* ES2015 */ ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierStart) :
+ languageVersion === 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierStart);
}
ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;
function isUnicodeIdentifierPart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
- lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierPart);
+ return languageVersion >= 2 /* ES2015 */ ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierPart) :
+ languageVersion === 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierPart);
}
function makeReverseMap(source) {
var result = [];
@@ -7282,11 +7417,12 @@ var ts;
ts.isIdentifierPart = isIdentifierPart;
/* @internal */
function isIdentifierText(name, languageVersion) {
- if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {
+ var ch = codePointAt(name, 0);
+ if (!isIdentifierStart(ch, languageVersion)) {
return false;
}
- for (var i = 1; i < name.length; i++) {
- if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {
+ for (var i = charSize(ch); i < name.length; i += charSize(ch)) {
+ if (!isIdentifierPart(ch = codePointAt(name, i), languageVersion)) {
return false;
}
}
@@ -7317,6 +7453,7 @@ var ts;
getTokenPos: function () { return tokenPos; },
getTokenText: function () { return text.substring(tokenPos, pos); },
getTokenValue: function () { return tokenValue; },
+ hasUnicodeEscape: function () { return (tokenFlags & 1024 /* UnicodeEscape */) !== 0; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; },
@@ -7443,7 +7580,7 @@ var ts;
}
}
function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
- if (!isIdentifierStart(text.charCodeAt(pos), languageVersion)) {
+ if (!isIdentifierStart(codePointAt(text, pos), languageVersion)) {
return;
}
var identifierStart = pos;
@@ -7651,6 +7788,7 @@ var ts;
pos++;
return scanExtendedUnicodeEscape();
}
+ tokenFlags |= 1024 /* UnicodeEscape */;
// '\uDDDD'
return scanHexadecimalEscape(/*numDigits*/ 4);
case 120 /* x */:
@@ -7733,21 +7871,41 @@ var ts;
}
return -1;
}
+ function peekExtendedUnicodeEscape() {
+ if (languageVersion >= 2 /* ES2015 */ && codePointAt(text, pos + 1) === 117 /* u */ && codePointAt(text, pos + 2) === 123 /* openBrace */) {
+ var start_2 = pos;
+ pos += 3;
+ var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
+ var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
+ pos = start_2;
+ return escapedValue;
+ }
+ return -1;
+ }
function scanIdentifierParts() {
var result = "";
var start = pos;
while (pos < end) {
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
if (isIdentifierPart(ch, languageVersion)) {
- pos++;
+ pos += charSize(ch);
}
else if (ch === 92 /* backslash */) {
+ ch = peekExtendedUnicodeEscape();
+ if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ result += scanExtendedUnicodeEscape();
+ start = pos;
+ continue;
+ }
ch = peekUnicodeEscape();
if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
break;
}
+ tokenFlags |= 1024 /* UnicodeEscape */;
result += text.substring(start, pos);
- result += String.fromCharCode(ch);
+ result += utf16EncodeAsString(ch);
// Valid Unicode escape is always six characters
pos += 6;
start = pos;
@@ -7842,7 +8000,7 @@ var ts;
if (pos >= end) {
return token = 1 /* EndOfFileToken */;
}
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
// Special handling for shebang
if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) {
pos = scanShebangTrivia(text, pos);
@@ -8207,9 +8365,17 @@ var ts;
pos++;
return token = 58 /* AtToken */;
case 92 /* backslash */:
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
var cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
pos += 6;
+ tokenFlags |= 1024 /* UnicodeEscape */;
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
return token = getIdentifierToken();
}
@@ -8218,9 +8384,9 @@ var ts;
return token = 0 /* Unknown */;
default:
if (isIdentifierStart(ch, languageVersion)) {
- pos++;
- while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))
- pos++;
+ pos += charSize(ch);
+ while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion))
+ pos += charSize(ch);
tokenValue = text.substring(tokenPos, pos);
if (ch === 92 /* backslash */) {
tokenValue += scanIdentifierParts();
@@ -8228,16 +8394,16 @@ var ts;
return token = getIdentifierToken();
}
else if (isWhiteSpaceSingleLine(ch)) {
- pos++;
+ pos += charSize(ch);
continue;
}
else if (isLineBreak(ch)) {
tokenFlags |= 1 /* PrecedingLineBreak */;
- pos++;
+ pos += charSize(ch);
continue;
}
error(ts.Diagnostics.Invalid_character);
- pos++;
+ pos += charSize(ch);
return token = 0 /* Unknown */;
}
}
@@ -8354,7 +8520,7 @@ var ts;
// First non-whitespace character on this line.
var firstNonWhitespace = 0;
// These initial values are special because the first line is:
- // firstNonWhitespace = 0 to indicate that we want leading whitspace,
+ // firstNonWhitespace = 0 to indicate that we want leading whitespace,
while (pos < end) {
char = text.charCodeAt(pos);
if (char === 123 /* openBrace */) {
@@ -8388,17 +8554,22 @@ var ts;
// they allow dashes
function scanJsxIdentifier() {
if (tokenIsIdentifierOrKeyword(token)) {
- var firstCharPosition = pos;
+ // An identifier or keyword has already been parsed - check for a `-` and then append it and everything after it to the token
+ // Do note that this means that `scanJsxIdentifier` effectively _mutates_ the visible token without advancing to a new token
+ // Any caller should be expecting this behavior and should only read the pos or token value after calling it.
while (pos < end) {
var ch = text.charCodeAt(pos);
- if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
+ if (ch === 45 /* minus */) {
+ tokenValue += "-";
pos++;
+ continue;
}
- else {
+ var oldPos = pos;
+ tokenValue += scanIdentifierParts(); // reuse `scanIdentifierParts` so unicode escapes are handled
+ if (pos === oldPos) {
break;
}
}
- tokenValue += text.substring(firstCharPosition, pos);
}
return token;
}
@@ -8420,8 +8591,8 @@ var ts;
if (pos >= end) {
return token = 1 /* EndOfFileToken */;
}
- var ch = text.charCodeAt(pos);
- pos++;
+ var ch = codePointAt(text, pos);
+ pos += charSize(ch);
switch (ch) {
case 9 /* tab */:
case 11 /* verticalTab */:
@@ -8459,12 +8630,33 @@ var ts;
return token = 24 /* DotToken */;
case 96 /* backtick */:
return token = 59 /* BacktickToken */;
- }
- if (isIdentifierStart(ch, 8 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) {
+ case 92 /* backslash */:
+ pos--;
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
+ var cookedChar = peekUnicodeEscape();
+ if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
+ pos += 6;
+ tokenFlags |= 1024 /* UnicodeEscape */;
+ tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
pos++;
- }
+ return token = 0 /* Unknown */;
+ }
+ if (isIdentifierStart(ch, languageVersion)) {
+ var char = ch;
+ while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion))
+ pos += charSize(char);
tokenValue = text.substring(tokenPos, pos);
+ if (char === 92 /* backslash */) {
+ tokenValue += scanIdentifierParts();
+ }
return token = getIdentifierToken();
}
else {
@@ -8547,6 +8739,33 @@ var ts;
}
}
ts.createScanner = createScanner;
+ /* @internal */
+ var codePointAt = String.prototype.codePointAt ? function (s, i) { return s.codePointAt(i); } : function codePointAt(str, i) {
+ // from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt
+ var size = str.length;
+ // Account for out-of-bounds indices:
+ if (i < 0 || i >= size) {
+ return undefined; // String.codePointAt returns `undefined` for OOB indexes
+ }
+ // Get the first code unit
+ var first = str.charCodeAt(i);
+ // check if it’s the start of a surrogate pair
+ if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { // high surrogate and there is a next code unit
+ var second = str.charCodeAt(i + 1);
+ if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
+ // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
+ }
+ }
+ return first;
+ };
+ /* @internal */
+ function charSize(ch) {
+ if (ch >= 0x10000) {
+ return 2;
+ }
+ return 1;
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -9002,7 +9221,7 @@ var ts;
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 313 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 314 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -9060,6 +9279,8 @@ var ts;
return emitNode && emitNode.flags || 0;
}
ts.getEmitFlags = getEmitFlags;
+ var escapeNoSubstitutionTemplateLiteralText = ts.compose(escapeString, escapeTemplateSubstitution);
+ var escapeNonAsciiNoSubstitutionTemplateLiteralText = ts.compose(escapeNonAsciiString, escapeTemplateSubstitution);
function getLiteralText(node, sourceFile, neverAsciiEscape) {
// If we don't need to downlevel and we can reach the original source text using
// the node's parent reference, then simply get the text as it was originally written.
@@ -9067,7 +9288,11 @@ var ts;
ts.isBigIntLiteral(node))) {
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
}
- var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216 /* NoAsciiEscaping */) ? escapeString : escapeNonAsciiString;
+ // If a NoSubstitutionTemplateLiteral appears to have a substitution in it, the original text
+ // had to include a backslash: `not \${a} substitution`.
+ var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216 /* NoAsciiEscaping */) ?
+ node.kind === 14 /* NoSubstitutionTemplateLiteral */ ? escapeNoSubstitutionTemplateLiteralText : escapeString :
+ node.kind === 14 /* NoSubstitutionTemplateLiteral */ ? escapeNonAsciiNoSubstitutionTemplateLiteralText : escapeNonAsciiString;
// If we can't reach the original source text, use the canonical form if it's a number,
// or a (possibly escaped) quoted form of the original text if it's string-like.
switch (node.kind) {
@@ -9182,6 +9407,43 @@ var ts;
return ts.isExternalModule(node) || compilerOptions.isolatedModules || ((ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS) && !!node.commonJsModuleIndicator);
}
ts.isEffectiveExternalModule = isEffectiveExternalModule;
+ /**
+ * Returns whether the source file will be treated as if it were in strict mode at runtime.
+ */
+ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
+ // We can only verify strict mode for JS/TS files
+ switch (node.scriptKind) {
+ case 1 /* JS */:
+ case 3 /* TS */:
+ case 2 /* JSX */:
+ case 4 /* TSX */:
+ break;
+ default:
+ return false;
+ }
+ // Strict mode does not matter for declaration files.
+ if (node.isDeclarationFile) {
+ return false;
+ }
+ // If `alwaysStrict` is set, then treat the file as strict.
+ if (ts.getStrictOptionValue(compilerOptions, "alwaysStrict")) {
+ return true;
+ }
+ // Starting with a "use strict" directive indicates the file is strict.
+ if (ts.startsWithUseStrict(node.statements)) {
+ return true;
+ }
+ if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
+ // ECMAScript Modules are always strict.
+ if (ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
+ return true;
+ }
+ // Other modules are strict unless otherwise specified.
+ return !compilerOptions.noImplicitUseStrict;
+ }
+ return false;
+ }
+ ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile;
function isBlockScope(node, parentNode) {
switch (node.kind) {
case 285 /* SourceFile */:
@@ -9209,9 +9471,9 @@ var ts;
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
- case 299 /* JSDocSignature */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 300 /* JSDocSignature */:
return true;
default:
ts.assertType(node);
@@ -9232,7 +9494,7 @@ var ts;
case 210 /* ClassExpression */:
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
case 240 /* FunctionDeclaration */:
case 157 /* MethodDeclaration */:
case 158 /* Constructor */:
@@ -9460,6 +9722,12 @@ var ts;
return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */;
}
ts.isImportCall = isImportCall;
+ function isImportMeta(n) {
+ return ts.isMetaProperty(n)
+ && n.keywordToken === 93 /* ImportKeyword */
+ && n.name.escapedText === "meta";
+ }
+ ts.isImportMeta = isImportMeta;
function isLiteralImportTypeNode(n) {
return ts.isImportTypeNode(n) && ts.isLiteralTypeNode(n.argument) && ts.isStringLiteral(n.argument.literal);
}
@@ -9552,7 +9820,7 @@ var ts;
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
case 151 /* TypeParameter */:
return node === parent.constraint;
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return node === parent.constraint;
case 155 /* PropertyDeclaration */:
case 154 /* PropertySignature */:
@@ -10583,7 +10851,7 @@ var ts;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 311 /* JSDocTypedefTag */ || node.kind === 304 /* JSDocCallbackTag */;
+ return node.kind === 312 /* JSDocTypedefTag */ || node.kind === 305 /* JSDocCallbackTag */ || node.kind === 306 /* JSDocEnumTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -11033,6 +11301,10 @@ var ts;
return isKeyword(token) && !isContextualKeyword(token);
}
ts.isNonContextualKeyword = isNonContextualKeyword;
+ function isFutureReservedKeyword(token) {
+ return 110 /* FirstFutureReservedWord */ <= token && token <= 118 /* LastFutureReservedWord */;
+ }
+ ts.isFutureReservedKeyword = isFutureReservedKeyword;
function isStringANonContextualKeyword(name) {
var token = ts.stringToToken(name);
return token !== undefined && isNonContextualKeyword(token);
@@ -11292,7 +11564,7 @@ var ts;
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return 0;
case 209 /* SpreadElement */:
return 1;
@@ -11478,6 +11750,10 @@ var ts;
}
}
ts.createDiagnosticCollection = createDiagnosticCollection;
+ var templateSubstitutionRegExp = /\$\{/g;
+ function escapeTemplateSubstitution(str) {
+ return str.replace(templateSubstitutionRegExp, "\\${");
+ }
// This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator,
// paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in
// the language service. These characters should be escaped when printing, and if any characters are added,
@@ -11846,6 +12122,7 @@ var ts;
return accessor.parameters[hasThis ? 1 : 0];
}
}
+ ts.getSetAccessorValueParameter = getSetAccessorValueParameter;
/** Get the type annotation for the value parameter. */
function getSetAccessorTypeAnnotationNode(accessor) {
var parameter = getSetAccessorValueParameter(accessor);
@@ -11954,7 +12231,7 @@ var ts;
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
/** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 298 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
}
/**
* Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -12745,8 +13022,8 @@ var ts;
/**
* Mutates the map with newMap such that keys in map will be same as newMap.
*/
- function mutateMap(map, newMap, options) {
- var createNewValue = options.createNewValue, onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
+ function mutateMapSkippingNewValues(map, newMap, options) {
+ var onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
// Needs update
map.forEach(function (existingValue, key) {
var valueInNewMap = newMap.get(key);
@@ -12760,6 +13037,15 @@ var ts;
onExistingValue(existingValue, valueInNewMap, key);
}
});
+ }
+ ts.mutateMapSkippingNewValues = mutateMapSkippingNewValues;
+ /**
+ * Mutates the map with newMap such that keys in map will be same as newMap.
+ */
+ function mutateMap(map, newMap, options) {
+ // Needs update
+ mutateMapSkippingNewValues(map, newMap, options);
+ var createNewValue = options.createNewValue;
// Add new values that are not already present
newMap.forEach(function (valueInNewMap, key) {
if (!map.has(key)) {
@@ -12896,7 +13182,7 @@ var ts;
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 8 /* ESNext */:
+ case 99 /* ESNext */:
return "lib.esnext.full.d.ts";
case 7 /* ES2020 */:
return "lib.es2020.full.d.ts";
@@ -13316,6 +13602,9 @@ var ts;
break;
case 222 /* ExpressionStatement */:
var expr = hostNode.expression;
+ if (expr.kind === 205 /* BinaryExpression */ && expr.operatorToken.kind === 60 /* EqualsToken */) {
+ expr = expr.left;
+ }
switch (expr.kind) {
case 190 /* PropertyAccessExpression */:
return expr.name;
@@ -13355,8 +13644,8 @@ var ts;
switch (declaration.kind) {
case 73 /* Identifier */:
return declaration;
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */: {
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */: {
var name = declaration.name;
if (name.kind === 149 /* QualifiedName */) {
return name.right;
@@ -13380,8 +13669,10 @@ var ts;
return undefined;
}
}
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
+ case 306 /* JSDocEnumTag */:
+ return nameForNamelessJSDocTypedef(declaration);
case 255 /* ExportAssignment */: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
@@ -13587,7 +13878,7 @@ var ts;
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 298 /* JSDocComment */);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -13859,7 +14150,7 @@ var ts;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 315 /* PartiallyEmittedExpression */) {
+ while (node.kind === 316 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
@@ -14271,67 +14562,67 @@ var ts;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 297 /* JSDocComment */;
+ return node.kind === 298 /* JSDocComment */;
}
ts.isJSDoc = isJSDoc;
function isJSDocAuthorTag(node) {
- return node.kind === 302 /* JSDocAuthorTag */;
+ return node.kind === 303 /* JSDocAuthorTag */;
}
ts.isJSDocAuthorTag = isJSDocAuthorTag;
function isJSDocAugmentsTag(node) {
- return node.kind === 301 /* JSDocAugmentsTag */;
+ return node.kind === 302 /* JSDocAugmentsTag */;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 303 /* JSDocClassTag */;
+ return node.kind === 304 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 305 /* JSDocEnumTag */;
+ return node.kind === 306 /* JSDocEnumTag */;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 308 /* JSDocThisTag */;
+ return node.kind === 309 /* JSDocThisTag */;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 306 /* JSDocParameterTag */;
+ return node.kind === 307 /* JSDocParameterTag */;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 307 /* JSDocReturnTag */;
+ return node.kind === 308 /* JSDocReturnTag */;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 309 /* JSDocTypeTag */;
+ return node.kind === 310 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 310 /* JSDocTemplateTag */;
+ return node.kind === 311 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 311 /* JSDocTypedefTag */;
+ return node.kind === 312 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 312 /* JSDocPropertyTag */;
+ return node.kind === 313 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 312 /* JSDocPropertyTag */ || node.kind === 306 /* JSDocParameterTag */;
+ return node.kind === 313 /* JSDocPropertyTag */ || node.kind === 307 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 298 /* JSDocTypeLiteral */;
+ return node.kind === 299 /* JSDocTypeLiteral */;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 304 /* JSDocCallbackTag */;
+ return node.kind === 305 /* JSDocCallbackTag */;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 299 /* JSDocSignature */;
+ return node.kind === 300 /* JSDocSignature */;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
@@ -14342,7 +14633,7 @@ var ts;
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 313 /* SyntaxList */;
+ return n.kind === 314 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -14494,7 +14785,7 @@ var ts;
switch (kind) {
case 156 /* MethodSignature */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 162 /* ConstructSignature */:
case 163 /* IndexSignature */:
case 166 /* FunctionType */:
@@ -14789,8 +15080,8 @@ var ts;
case 209 /* SpreadElement */:
case 213 /* AsExpression */:
case 211 /* OmittedExpression */:
- case 316 /* CommaListExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 317 /* CommaListExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -14804,12 +15095,12 @@ var ts;
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 315 /* PartiallyEmittedExpression */;
+ return node.kind === 316 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 314 /* NotEmittedStatement */;
+ return node.kind === 315 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -14920,9 +15211,9 @@ var ts;
|| kind === 243 /* TypeAliasDeclaration */
|| kind === 151 /* TypeParameter */
|| kind === 238 /* VariableDeclaration */
- || kind === 311 /* JSDocTypedefTag */
- || kind === 304 /* JSDocCallbackTag */
- || kind === 312 /* JSDocPropertyTag */;
+ || kind === 312 /* JSDocTypedefTag */
+ || kind === 305 /* JSDocCallbackTag */
+ || kind === 313 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
return kind === 240 /* FunctionDeclaration */
@@ -14957,14 +15248,14 @@ var ts;
|| kind === 220 /* VariableStatement */
|| kind === 225 /* WhileStatement */
|| kind === 232 /* WithStatement */
- || kind === 314 /* NotEmittedStatement */
- || kind === 318 /* EndOfDeclarationMarker */
- || kind === 317 /* MergeDeclarationMarker */;
+ || kind === 315 /* NotEmittedStatement */
+ || kind === 319 /* EndOfDeclarationMarker */
+ || kind === 318 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
if (node.kind === 151 /* TypeParameter */) {
- return (node.parent && node.parent.kind !== 310 /* JSDocTemplateTag */) || ts.isInJSFile(node);
+ return (node.parent && node.parent.kind !== 311 /* JSDocTemplateTag */) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -15059,18 +15350,18 @@ var ts;
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 312 /* LastJSDocNode */;
+ return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 313 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 298 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 312 /* LastJSDocTagNode */;
+ return node.kind >= 301 /* FirstJSDocTagNode */ && node.kind <= 313 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
@@ -17101,7 +17392,7 @@ var ts;
return visitNode(cbNode, node.expression);
case 259 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
case 261 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
@@ -17139,26 +17430,26 @@ var ts;
case 295 /* JSDocFunctionType */:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 297 /* JSDocComment */:
+ case 298 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 302 /* JSDocAuthorTag */:
+ case 303 /* JSDocAuthorTag */:
return visitNode(cbNode, node.tagName);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
node.typeExpression.kind === 289 /* JSDocTypeExpression */
@@ -17166,26 +17457,26 @@ var ts;
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 304 /* JSDocCallbackTag */:
+ case 305 /* JSDocCallbackTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 308 /* JSDocThisTag */:
- case 305 /* JSDocEnumTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 309 /* JSDocThisTag */:
+ case 306 /* JSDocEnumTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 300 /* JSDocTag */:
- case 303 /* JSDocClassTag */:
+ case 301 /* JSDocTag */:
+ case 304 /* JSDocClassTag */:
return visitNode(cbNode, node.tagName);
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -17194,12 +17485,14 @@ var ts;
if (setParentNodes === void 0) { setParentNodes = false; }
ts.performance.mark("beforeParse");
var result;
+ ts.perfLogger.logStartParseSourceFile(fileName);
if (languageVersion === 100 /* JSON */) {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, 6 /* JSON */);
}
else {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
}
+ ts.perfLogger.logStopParseSourceFile();
ts.performance.mark("afterParse");
ts.performance.measure("Parse", "beforeParse", "afterParse");
return result;
@@ -17265,7 +17558,7 @@ var ts;
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
+ var scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ true);
var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
@@ -17283,6 +17576,7 @@ var ts;
var identifiers;
var identifierCount;
var parsingContext;
+ var notParenthesizedArrow;
// Flags that dictate what parsing context we're in. For example:
// Whether or not we are in strict parsing mode. All that changes in strict parsing mode is
// that some tokens that would be considered identifiers may be considered keywords.
@@ -17490,6 +17784,7 @@ var ts;
identifiers = undefined;
syntaxCursor = undefined;
sourceText = undefined;
+ notParenthesizedArrow = undefined;
}
function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {
var isDeclarationFile = isDeclarationFileName(fileName);
@@ -17699,9 +17994,17 @@ var ts;
function token() {
return currentToken;
}
- function nextToken() {
+ function nextTokenWithoutCheck() {
return currentToken = scanner.scan();
}
+ function nextToken() {
+ // if the keyword had an escape
+ if (ts.isKeyword(currentToken) && (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape())) {
+ // issue a parse error for the escape
+ parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), ts.Diagnostics.Keywords_cannot_contain_escape_characters);
+ }
+ return nextTokenWithoutCheck();
+ }
function nextTokenJSDoc() {
return currentToken = scanner.scanJsDocToken();
}
@@ -17940,7 +18243,7 @@ var ts;
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
- nextToken();
+ nextTokenWithoutCheck();
return finishNode(node);
}
// Only for end of file because the error gets reported incorrectly on embedded script tags.
@@ -18850,6 +19153,23 @@ var ts;
}
function parseJSDocType() {
scanner.setInJSDocType(true);
+ var moduleSpecifier = parseOptionalToken(131 /* ModuleKeyword */);
+ if (moduleSpecifier) {
+ var moduleTag = createNode(297 /* JSDocNamepathType */, moduleSpecifier.pos);
+ terminate: while (true) {
+ switch (token()) {
+ case 19 /* CloseBraceToken */:
+ case 1 /* EndOfFileToken */:
+ case 27 /* CommaToken */:
+ case 5 /* WhitespaceTrivia */:
+ break terminate;
+ default:
+ nextTokenJSDoc();
+ }
+ }
+ scanner.setInJSDocType(false);
+ return finishNode(moduleTag);
+ }
var dotdotdot = parseOptionalToken(25 /* DotDotDotToken */);
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
@@ -19973,7 +20293,15 @@ var ts;
}
}
function parsePossibleParenthesizedArrowFunctionExpressionHead() {
- return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ var tokenPos = scanner.getTokenPos();
+ if (notParenthesizedArrow && notParenthesizedArrow.has(tokenPos.toString())) {
+ return undefined;
+ }
+ var result = parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ if (!result) {
+ (notParenthesizedArrow || (notParenthesizedArrow = ts.createMap())).set(tokenPos.toString(), true);
+ }
+ return result;
}
function tryParseAsyncSimpleArrowFunctionExpression() {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
@@ -22384,8 +22712,8 @@ var ts;
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
+ initializeState(content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 99 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -22407,9 +22735,9 @@ var ts;
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion
- var jsDoc = parseJSDocCommentWorker(start, length);
+ var jsDoc = doInsideOfContext(2097152 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
var diagnostics = parseDiagnostics;
clearState();
return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined;
@@ -22420,7 +22748,7 @@ var ts;
var saveToken = currentToken;
var saveParseDiagnosticsLength = parseDiagnostics.length;
var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
- var comment = parseJSDocCommentWorker(start, length);
+ var comment = doInsideOfContext(2097152 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
if (comment) {
comment.parent = parent;
}
@@ -22559,7 +22887,7 @@ var ts;
}
}
function createJSDocComment() {
- var result = createNode(297 /* JSDocComment */, start);
+ var result = createNode(298 /* JSDocComment */, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -22759,7 +23087,7 @@ var ts;
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(300 /* JSDocTag */, start);
+ var result = createNode(301 /* JSDocTag */, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -22822,8 +23150,8 @@ var ts;
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(312 /* JSDocPropertyTag */, start) :
- createNode(306 /* JSDocParameterTag */, start);
+ createNode(313 /* JSDocPropertyTag */, start) :
+ createNode(307 /* JSDocParameterTag */, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -22843,15 +23171,15 @@ var ts;
var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
- var start_2 = scanner.getStartPos();
+ var start_3 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 306 /* JSDocParameterTag */ || child.kind === 312 /* JSDocPropertyTag */) {
+ if (child.kind === 307 /* JSDocParameterTag */ || child.kind === 313 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2);
+ jsdocTypeLiteral = createNode(299 /* JSDocTypeLiteral */, start_3);
jsdocTypeLiteral.jsDocPropertyTags = children;
if (typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
@@ -22865,7 +23193,7 @@ var ts;
if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307 /* JSDocReturnTag */, start);
+ var result = createNode(308 /* JSDocReturnTag */, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
@@ -22874,13 +23202,13 @@ var ts;
if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(309 /* JSDocTypeTag */, start);
+ var result = createNode(310 /* JSDocTypeTag */, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
return finishNode(result);
}
function parseAuthorTag(start, tagName, indent) {
- var result = createNode(302 /* JSDocAuthorTag */, start);
+ var result = createNode(303 /* JSDocAuthorTag */, start);
result.tagName = tagName;
var authorInfoWithEmail = tryParse(function () { return tryParseAuthorNameAndEmail(); });
if (!authorInfoWithEmail) {
@@ -22934,7 +23262,7 @@ var ts;
}
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(301 /* JSDocAugmentsTag */, start);
+ var result = createNode(302 /* JSDocAugmentsTag */, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
@@ -22961,19 +23289,19 @@ var ts;
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(303 /* JSDocClassTag */, start);
+ var tag = createNode(304 /* JSDocClassTag */, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(308 /* JSDocThisTag */, start);
+ var tag = createNode(309 /* JSDocThisTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(305 /* JSDocEnumTag */, start);
+ var tag = createNode(306 /* JSDocEnumTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
@@ -22982,7 +23310,7 @@ var ts;
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(311 /* JSDocTypedefTag */, start);
+ var typedefTag = createNode(312 /* JSDocTypedefTag */, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -22996,9 +23324,9 @@ var ts;
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start);
+ jsdocTypeLiteral = createNode(299 /* JSDocTypeLiteral */, start);
}
- if (child.kind === 309 /* JSDocTypeTag */) {
+ if (child.kind === 310 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -23044,14 +23372,14 @@ var ts;
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(304 /* JSDocCallbackTag */, start);
+ var callbackTag = createNode(305 /* JSDocCallbackTag */, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(299 /* JSDocSignature */, start);
+ var jsdocSignature = createNode(300 /* JSDocSignature */, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -23059,7 +23387,7 @@ var ts;
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58 /* AtToken */)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 307 /* JSDocReturnTag */) {
+ if (tag && tag.kind === 308 /* JSDocReturnTag */) {
return tag;
}
}
@@ -23104,7 +23432,7 @@ var ts;
case 58 /* AtToken */:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 306 /* JSDocParameterTag */ || child.kind === 312 /* JSDocPropertyTag */) &&
+ if (child && (child.kind === 307 /* JSDocParameterTag */ || child.kind === 313 /* JSDocPropertyTag */) &&
target !== 4 /* CallbackParameter */ &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -23174,7 +23502,7 @@ var ts;
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27 /* CommaToken */));
- var result = createNode(310 /* JSDocTemplateTag */, start);
+ var result = createNode(311 /* JSDocTemplateTag */, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
@@ -23209,16 +23537,19 @@ var ts;
if (!ts.tokenIsIdentifierOrKeyword(token())) {
return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
}
+ identifierCount++;
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
var result = createNode(73 /* Identifier */, pos);
- result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
+ if (token() !== 73 /* Identifier */) {
+ result.originalKeywordKind = token();
+ }
+ result.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
finishNode(result, end);
nextTokenJSDoc();
return result;
}
}
- JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker;
})(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {}));
})(Parser || (Parser = {}));
var IncrementalParser;
@@ -24135,7 +24466,7 @@ var ts;
es2018: 5 /* ES2018 */,
es2019: 6 /* ES2019 */,
es2020: 7 /* ES2020 */,
- esnext: 8 /* ESNext */,
+ esnext: 99 /* ESNext */,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
@@ -25503,10 +25834,10 @@ var ts;
var config = __assign({ compilerOptions: __assign({}, ts.arrayFrom(optionMap.entries()).reduce(function (prev, cur) {
var _a;
return (__assign({}, prev, (_a = {}, _a[cur[0]] = cur[1], _a)));
- }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath, originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
+ }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath ? r.originalPath : "", originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
include: filterSameAsDefaultInclude(configParseResult.configFileSpecs.validatedIncludeSpecs),
exclude: configParseResult.configFileSpecs.validatedExcludeSpecs
- } : {}), { compilerOnSave: !!configParseResult.compileOnSave ? true : undefined });
+ } : {}), { compileOnSave: !!configParseResult.compileOnSave ? true : undefined });
return config;
}
ts.convertToTSConfig = convertToTSConfig;
@@ -27031,6 +27362,7 @@ var ts;
trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
}
}
+ ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
switch (moduleResolution) {
case ts.ModuleResolutionKind.NodeJs:
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
@@ -27041,6 +27373,9 @@ var ts;
default:
return ts.Debug.fail("Unexpected moduleResolution: " + moduleResolution);
}
+ if (result && result.resolvedModule)
+ ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
+ ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
if (perFolderCache) {
perFolderCache.set(moduleName, result);
if (!ts.isExternalModuleNameRelative(moduleName)) {
@@ -27873,7 +28208,9 @@ var ts;
var binder = createBinder();
function bindSourceFile(file, options) {
ts.performance.mark("beforeBind");
+ ts.perfLogger.logStartBindFile("" + file.fileName);
binder(file, options);
+ ts.perfLogger.logStopBindFile();
ts.performance.mark("afterBind");
ts.performance.measure("Bind", "beforeBind", "afterBind");
}
@@ -27986,7 +28323,7 @@ var ts;
if (symbol.constEnumOnlyModule && (symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */))) {
symbol.constEnumOnlyModule = false;
}
- if (symbolFlags & 67220415 /* Value */) {
+ if (symbolFlags & 111551 /* Value */) {
setValueDeclaration(symbol, node);
}
}
@@ -28030,7 +28367,7 @@ var ts;
return "__constructor" /* Constructor */;
case 166 /* FunctionType */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return "__call" /* Call */;
case 167 /* ConstructorType */:
case 162 /* ConstructSignature */:
@@ -28215,10 +28552,10 @@ var ts;
if (ts.isJSDocTypeAlias(node))
ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file.
if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32 /* ExportContext */)) || ts.isJSDocTypeAlias(node)) {
- if (ts.hasModifier(node, 512 /* Default */) && !getDeclarationName(node)) {
+ if (!container.locals || (ts.hasModifier(node, 512 /* Default */) && !getDeclarationName(node))) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default!
}
- var exportKind = symbolFlags & 67220415 /* Value */ ? 1048576 /* ExportValue */ : 0;
+ var exportKind = symbolFlags & 111551 /* Value */ ? 1048576 /* ExportValue */ : 0;
var local = declareSymbol(container.locals, /*parent*/ undefined, node, exportKind, symbolExcludes);
local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
node.localSymbol = local;
@@ -28448,8 +28785,9 @@ var ts;
case 192 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
bindJSDocTypeAlias(node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
@@ -29106,7 +29444,7 @@ var ts;
}
function bindJSDocTypeAlias(node) {
node.tagName.parent = node;
- if (node.fullName) {
+ if (node.kind !== 306 /* JSDocEnumTag */ && node.fullName) {
setParentPointers(node, node.fullName);
}
}
@@ -29140,7 +29478,7 @@ var ts;
case 244 /* EnumDeclaration */:
case 189 /* ObjectLiteralExpression */:
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 269 /* JsxAttributes */:
return 1 /* IsContainer */;
case 242 /* InterfaceDeclaration */:
@@ -29162,7 +29500,7 @@ var ts;
case 159 /* GetAccessor */:
case 160 /* SetAccessor */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 295 /* JSDocFunctionType */:
case 166 /* FunctionType */:
case 162 /* ConstructSignature */:
@@ -29225,7 +29563,7 @@ var ts;
case 244 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 189 /* ObjectLiteralExpression */:
case 242 /* InterfaceDeclaration */:
case 269 /* JsxAttributes */:
@@ -29239,7 +29577,7 @@ var ts;
case 167 /* ConstructorType */:
case 161 /* CallSignature */:
case 162 /* ConstructSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 163 /* IndexSignature */:
case 157 /* MethodDeclaration */:
case 156 /* MethodSignature */:
@@ -29250,8 +29588,8 @@ var ts;
case 197 /* FunctionExpression */:
case 198 /* ArrowFunction */:
case 295 /* JSDocFunctionType */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
case 243 /* TypeAliasDeclaration */:
case 182 /* MappedType */:
// All the children of these container types are never visible through another
@@ -29432,9 +29770,21 @@ var ts;
currentFlow = { flags: 2 /* Start */ };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
+ var declName = ts.getNameOfDeclaration(typeAlias);
+ if ((ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName) && declName && ts.isPropertyAccessEntityNameExpression(declName.parent)) {
+ // typedef anchored to an A.B.C assignment - we need to bind into B's namespace under name C
+ var isTopLevel = isTopLevelNamespaceAssignment(declName.parent);
+ if (isTopLevel) {
+ bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
+ var oldContainer = container;
+ container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
+ declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
+ container = oldContainer;
+ }
+ }
+ else if (ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
parent = typeAlias.parent;
- bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
}
else {
bind(typeAlias.fullName);
@@ -29453,7 +29803,8 @@ var ts;
node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ &&
node.originalKeywordKind <= 118 /* LastFutureReservedWord */ &&
!ts.isIdentifierName(node) &&
- !(node.flags & 4194304 /* Ambient */)) {
+ !(node.flags & 4194304 /* Ambient */) &&
+ !(node.flags & 2097152 /* JSDoc */)) {
// Report error only if there are no parse errors in file
if (!file.parseDiagnostics.length) {
file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));
@@ -29706,7 +30057,7 @@ var ts;
while (parentNode && !ts.isJSDocTypeAlias(parentNode)) {
parentNode = parentNode.parent;
}
- bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
break;
}
// falls through
@@ -29727,7 +30078,7 @@ var ts;
file.commonJsModuleIndicator &&
ts.isModuleExportsPropertyAccessExpression(node) &&
!lookupSymbolForNameWorker(blockScopeContainer, "module")) {
- declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */);
+ declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 111550 /* FunctionScopedVariableExcludes */);
}
break;
case 205 /* BinaryExpression */:
@@ -29793,7 +30144,7 @@ var ts;
case 277 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
case 279 /* EnumMember */:
- return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */);
case 161 /* CallSignature */:
case 162 /* ConstructSignature */:
case 163 /* IndexSignature */:
@@ -29804,22 +30155,22 @@ var ts;
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
- return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */);
case 240 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
case 158 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
case 159 /* GetAccessor */:
- return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */);
case 160 /* SetAccessor */:
- return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 78783 /* SetAccessorExcludes */);
case 166 /* FunctionType */:
case 295 /* JSDocFunctionType */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 167 /* ConstructorType */:
return bindFunctionOrConstructorType(node);
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 182 /* MappedType */:
return bindAnonymousTypeWorker(node);
case 189 /* ObjectLiteralExpression */:
@@ -29852,9 +30203,9 @@ var ts;
inStrictMode = true;
return bindClassLikeDeclaration(node);
case 242 /* InterfaceDeclaration */:
- return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */);
+ return bindBlockScopedDeclaration(node, 64 /* Interface */, 788872 /* InterfaceExcludes */);
case 243 /* TypeAliasDeclaration */:
- return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
case 244 /* EnumDeclaration */:
return bindEnumDeclaration(node);
case 245 /* ModuleDeclaration */:
@@ -29888,22 +30239,23 @@ var ts;
// falls through
case 246 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
- case 306 /* JSDocParameterTag */:
- if (node.parent.kind === 299 /* JSDocSignature */) {
+ case 307 /* JSDocParameterTag */:
+ if (node.parent.kind === 300 /* JSDocSignature */) {
return bindParameter(node);
}
- if (node.parent.kind !== 298 /* JSDocTypeLiteral */) {
+ if (node.parent.kind !== 299 /* JSDocTypeLiteral */) {
break;
}
// falls through
- case 312 /* JSDocPropertyTag */:
+ case 313 /* JSDocPropertyTag */:
var propTag = node;
var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -30081,7 +30433,7 @@ var ts;
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220414 /* FunctionScopedVariableExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
}
break;
default:
@@ -30162,7 +30514,7 @@ var ts;
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false);
}
function bindPotentiallyMissingNamespaces(namespaceSymbol, entityName, isToplevel, isPrototypeProperty) {
- if (isToplevel && !isPrototypeProperty && (!namespaceSymbol || !(namespaceSymbol.flags & 1920 /* Namespace */))) {
+ if (isToplevel && !isPrototypeProperty) {
// make symbols or add declarations for intermediate containers
var flags_1 = 1536 /* Module */ | 67108864 /* Assignment */;
var excludeFlags_1 = 110735 /* ValueModuleExcludes */ & ~67108864 /* Assignment */;
@@ -30190,14 +30542,17 @@ var ts;
(namespaceSymbol.exports || (namespaceSymbol.exports = ts.createSymbolTable()));
var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedExpandoInitializer(declaration));
var includes = isMethod ? 8192 /* Method */ : 4 /* Property */;
- var excludes = isMethod ? 67212223 /* MethodExcludes */ : 0 /* PropertyExcludes */;
+ var excludes = isMethod ? 103359 /* MethodExcludes */ : 0 /* PropertyExcludes */;
declareSymbol(symbolTable, namespaceSymbol, declaration, includes | 67108864 /* Assignment */, excludes & ~67108864 /* Assignment */);
}
+ function isTopLevelNamespaceAssignment(propertyAccess) {
+ return ts.isBinaryExpression(propertyAccess.parent)
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
+ : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
+ }
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
- var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
- : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
+ var isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -30268,7 +30623,7 @@ var ts;
}
function bindClassLikeDeclaration(node) {
if (node.kind === 241 /* ClassDeclaration */) {
- bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */);
+ bindBlockScopedDeclaration(node, 32 /* Class */, 899503 /* ClassExcludes */);
}
else {
var bindingName = node.name ? node.name.escapedText : "__class" /* Class */;
@@ -30301,19 +30656,16 @@ var ts;
}
function bindEnumDeclaration(node) {
return ts.isEnumConst(node)
- ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 68008831 /* ConstEnumExcludes */)
- : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 68008191 /* RegularEnumExcludes */);
+ ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */)
+ : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */);
}
function bindVariableDeclarationOrBindingElement(node) {
if (inStrictMode) {
checkStrictModeEvalOrArguments(node, node.name);
}
if (!ts.isBindingPattern(node.name)) {
- var isEnum = ts.isInJSFile(node) && !!ts.getJSDocEnumTag(node);
- var enumFlags = (isEnum ? 256 /* RegularEnum */ : 0 /* None */);
- var enumExcludes = (isEnum ? 68008191 /* RegularEnumExcludes */ : 0 /* None */);
if (ts.isBlockOrCatchScoped(node)) {
- bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */ | enumFlags, 67220415 /* BlockScopedVariableExcludes */ | enumExcludes);
+ bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
}
else if (ts.isParameterDeclaration(node)) {
// It is safe to walk up parent chain to find whether the node is a destructuring parameter declaration
@@ -30325,15 +30677,15 @@ var ts;
// function foo([a,a]) {} // Duplicate Identifier error
// function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter
// // which correctly set excluded symbols
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220415 /* ParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */ | enumFlags, 67220414 /* FunctionScopedVariableExcludes */ | enumExcludes);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
}
}
}
function bindParameter(node) {
- if (node.kind === 306 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) {
+ if (node.kind === 307 /* JSDocParameterTag */ && container.kind !== 300 /* JSDocSignature */) {
return;
}
if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) {
@@ -30345,7 +30697,7 @@ var ts;
bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, "__" + node.parent.parameters.indexOf(node));
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220415 /* ParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
}
// If this is a property-parameter, then also declare the property symbol into the
// containing class.
@@ -30363,10 +30715,10 @@ var ts;
checkStrictModeFunctionName(node);
if (inStrictMode) {
checkStrictModeFunctionDeclaration(node);
- bindBlockScopedDeclaration(node, 16 /* Function */, 67219887 /* FunctionExcludes */);
+ bindBlockScopedDeclaration(node, 16 /* Function */, 110991 /* FunctionExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 67219887 /* FunctionExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 110991 /* FunctionExcludes */);
}
}
function bindFunctionExpression(node) {
@@ -30404,10 +30756,10 @@ var ts;
if (!container_1.locals) {
container_1.locals = ts.createSymbolTable();
}
- declareSymbol(container_1.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbol(container_1.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
}
else if (node.parent.kind === 177 /* InferType */) {
@@ -30416,14 +30768,14 @@ var ts;
if (!container_2.locals) {
container_2.locals = ts.createSymbolTable();
}
- declareSymbol(container_2.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbol(container_2.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
else {
bindAnonymousDeclaration(node, 262144 /* TypeParameter */, getDeclarationName(node)); // TODO: GH#18217
}
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
}
// reachability checks
@@ -31034,7 +31386,7 @@ var ts;
break;
case 195 /* TypeAssertionExpression */:
case 213 /* AsExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
excludeFlags = 536870912 /* OuterExpressionExcludes */;
@@ -31293,7 +31645,7 @@ var ts;
return 536875008 /* BindingPatternExcludes */;
case 195 /* TypeAssertionExpression */:
case 213 /* AsExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
case 196 /* ParenthesizedExpression */:
case 99 /* SuperKeyword */:
return 536870912 /* OuterExpressionExcludes */;
@@ -31524,6 +31876,179 @@ var ts;
WideningKind[WideningKind["Normal"] = 0] = "Normal";
WideningKind[WideningKind["GeneratorYield"] = 1] = "GeneratorYield";
})(WideningKind || (WideningKind = {}));
+ var TypeFacts;
+ (function (TypeFacts) {
+ TypeFacts[TypeFacts["None"] = 0] = "None";
+ TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
+ TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
+ TypeFacts[TypeFacts["TypeofEQBigInt"] = 4] = "TypeofEQBigInt";
+ TypeFacts[TypeFacts["TypeofEQBoolean"] = 8] = "TypeofEQBoolean";
+ TypeFacts[TypeFacts["TypeofEQSymbol"] = 16] = "TypeofEQSymbol";
+ TypeFacts[TypeFacts["TypeofEQObject"] = 32] = "TypeofEQObject";
+ TypeFacts[TypeFacts["TypeofEQFunction"] = 64] = "TypeofEQFunction";
+ TypeFacts[TypeFacts["TypeofEQHostObject"] = 128] = "TypeofEQHostObject";
+ TypeFacts[TypeFacts["TypeofNEString"] = 256] = "TypeofNEString";
+ TypeFacts[TypeFacts["TypeofNENumber"] = 512] = "TypeofNENumber";
+ TypeFacts[TypeFacts["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt";
+ TypeFacts[TypeFacts["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean";
+ TypeFacts[TypeFacts["TypeofNESymbol"] = 4096] = "TypeofNESymbol";
+ TypeFacts[TypeFacts["TypeofNEObject"] = 8192] = "TypeofNEObject";
+ TypeFacts[TypeFacts["TypeofNEFunction"] = 16384] = "TypeofNEFunction";
+ TypeFacts[TypeFacts["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject";
+ TypeFacts[TypeFacts["EQUndefined"] = 65536] = "EQUndefined";
+ TypeFacts[TypeFacts["EQNull"] = 131072] = "EQNull";
+ TypeFacts[TypeFacts["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull";
+ TypeFacts[TypeFacts["NEUndefined"] = 524288] = "NEUndefined";
+ TypeFacts[TypeFacts["NENull"] = 1048576] = "NENull";
+ TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
+ TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
+ TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
+ TypeFacts[TypeFacts["All"] = 16777215] = "All";
+ // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
+ // The presence of a particular fact means that the given test is true for some (and possibly all) values
+ // of that kind of type.
+ TypeFacts[TypeFacts["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts";
+ TypeFacts[TypeFacts["BaseStringFacts"] = 12582401] = "BaseStringFacts";
+ TypeFacts[TypeFacts["StringStrictFacts"] = 16317953] = "StringStrictFacts";
+ TypeFacts[TypeFacts["StringFacts"] = 16776705] = "StringFacts";
+ TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts";
+ TypeFacts[TypeFacts["EmptyStringFacts"] = 12582401] = "EmptyStringFacts";
+ TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts";
+ TypeFacts[TypeFacts["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts";
+ TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts";
+ TypeFacts[TypeFacts["BaseNumberFacts"] = 12582146] = "BaseNumberFacts";
+ TypeFacts[TypeFacts["NumberStrictFacts"] = 16317698] = "NumberStrictFacts";
+ TypeFacts[TypeFacts["NumberFacts"] = 16776450] = "NumberFacts";
+ TypeFacts[TypeFacts["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts";
+ TypeFacts[TypeFacts["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts";
+ TypeFacts[TypeFacts["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts";
+ TypeFacts[TypeFacts["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts";
+ TypeFacts[TypeFacts["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts";
+ TypeFacts[TypeFacts["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts";
+ TypeFacts[TypeFacts["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts";
+ TypeFacts[TypeFacts["BigIntFacts"] = 16775940] = "BigIntFacts";
+ TypeFacts[TypeFacts["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts";
+ TypeFacts[TypeFacts["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts";
+ TypeFacts[TypeFacts["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts";
+ TypeFacts[TypeFacts["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts";
+ TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts";
+ TypeFacts[TypeFacts["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts";
+ TypeFacts[TypeFacts["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts";
+ TypeFacts[TypeFacts["BooleanFacts"] = 16774920] = "BooleanFacts";
+ TypeFacts[TypeFacts["FalseStrictFacts"] = 12121864] = "FalseStrictFacts";
+ TypeFacts[TypeFacts["FalseFacts"] = 12580616] = "FalseFacts";
+ TypeFacts[TypeFacts["TrueStrictFacts"] = 7927560] = "TrueStrictFacts";
+ TypeFacts[TypeFacts["TrueFacts"] = 16774920] = "TrueFacts";
+ TypeFacts[TypeFacts["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts";
+ TypeFacts[TypeFacts["SymbolFacts"] = 16772880] = "SymbolFacts";
+ TypeFacts[TypeFacts["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts";
+ TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
+ TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
+ TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
+ TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
+ TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
+ TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
+ TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
+ })(TypeFacts || (TypeFacts = {}));
+ var typeofEQFacts = ts.createMapFromTemplate({
+ string: 1 /* TypeofEQString */,
+ number: 2 /* TypeofEQNumber */,
+ bigint: 4 /* TypeofEQBigInt */,
+ boolean: 8 /* TypeofEQBoolean */,
+ symbol: 16 /* TypeofEQSymbol */,
+ undefined: 65536 /* EQUndefined */,
+ object: 32 /* TypeofEQObject */,
+ function: 64 /* TypeofEQFunction */
+ });
+ var typeofNEFacts = ts.createMapFromTemplate({
+ string: 256 /* TypeofNEString */,
+ number: 512 /* TypeofNENumber */,
+ bigint: 1024 /* TypeofNEBigInt */,
+ boolean: 2048 /* TypeofNEBoolean */,
+ symbol: 4096 /* TypeofNESymbol */,
+ undefined: 524288 /* NEUndefined */,
+ object: 8192 /* TypeofNEObject */,
+ function: 16384 /* TypeofNEFunction */
+ });
+ var TypeSystemPropertyName;
+ (function (TypeSystemPropertyName) {
+ TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
+ TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
+ TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
+ TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
+ })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
+ var CheckMode;
+ (function (CheckMode) {
+ CheckMode[CheckMode["Normal"] = 0] = "Normal";
+ CheckMode[CheckMode["Contextual"] = 1] = "Contextual";
+ CheckMode[CheckMode["Inferential"] = 2] = "Inferential";
+ CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
+ CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
+ CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
+ })(CheckMode || (CheckMode = {}));
+ var ContextFlags;
+ (function (ContextFlags) {
+ ContextFlags[ContextFlags["None"] = 0] = "None";
+ ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
+ })(ContextFlags || (ContextFlags = {}));
+ var AccessFlags;
+ (function (AccessFlags) {
+ AccessFlags[AccessFlags["None"] = 0] = "None";
+ AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
+ AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
+ AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
+ AccessFlags[AccessFlags["NoTupleBoundsCheck"] = 8] = "NoTupleBoundsCheck";
+ })(AccessFlags || (AccessFlags = {}));
+ var CallbackCheck;
+ (function (CallbackCheck) {
+ CallbackCheck[CallbackCheck["None"] = 0] = "None";
+ CallbackCheck[CallbackCheck["Bivariant"] = 1] = "Bivariant";
+ CallbackCheck[CallbackCheck["Strict"] = 2] = "Strict";
+ })(CallbackCheck || (CallbackCheck = {}));
+ var MappedTypeModifiers;
+ (function (MappedTypeModifiers) {
+ MappedTypeModifiers[MappedTypeModifiers["IncludeReadonly"] = 1] = "IncludeReadonly";
+ MappedTypeModifiers[MappedTypeModifiers["ExcludeReadonly"] = 2] = "ExcludeReadonly";
+ MappedTypeModifiers[MappedTypeModifiers["IncludeOptional"] = 4] = "IncludeOptional";
+ MappedTypeModifiers[MappedTypeModifiers["ExcludeOptional"] = 8] = "ExcludeOptional";
+ })(MappedTypeModifiers || (MappedTypeModifiers = {}));
+ var ExpandingFlags;
+ (function (ExpandingFlags) {
+ ExpandingFlags[ExpandingFlags["None"] = 0] = "None";
+ ExpandingFlags[ExpandingFlags["Source"] = 1] = "Source";
+ ExpandingFlags[ExpandingFlags["Target"] = 2] = "Target";
+ ExpandingFlags[ExpandingFlags["Both"] = 3] = "Both";
+ })(ExpandingFlags || (ExpandingFlags = {}));
+ var MembersOrExportsResolutionKind;
+ (function (MembersOrExportsResolutionKind) {
+ MembersOrExportsResolutionKind["resolvedExports"] = "resolvedExports";
+ MembersOrExportsResolutionKind["resolvedMembers"] = "resolvedMembers";
+ })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {}));
+ var UnusedKind;
+ (function (UnusedKind) {
+ UnusedKind[UnusedKind["Local"] = 0] = "Local";
+ UnusedKind[UnusedKind["Parameter"] = 1] = "Parameter";
+ })(UnusedKind || (UnusedKind = {}));
+ var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
+ var DeclarationMeaning;
+ (function (DeclarationMeaning) {
+ DeclarationMeaning[DeclarationMeaning["GetAccessor"] = 1] = "GetAccessor";
+ DeclarationMeaning[DeclarationMeaning["SetAccessor"] = 2] = "SetAccessor";
+ DeclarationMeaning[DeclarationMeaning["PropertyAssignment"] = 4] = "PropertyAssignment";
+ DeclarationMeaning[DeclarationMeaning["Method"] = 8] = "Method";
+ DeclarationMeaning[DeclarationMeaning["GetOrSetAccessor"] = 3] = "GetOrSetAccessor";
+ DeclarationMeaning[DeclarationMeaning["PropertyAssignmentOrMethod"] = 12] = "PropertyAssignmentOrMethod";
+ })(DeclarationMeaning || (DeclarationMeaning = {}));
+ var DeclarationSpaces;
+ (function (DeclarationSpaces) {
+ DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None";
+ DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue";
+ DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType";
+ DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace";
+ })(DeclarationSpaces || (DeclarationSpaces = {}));
function getNodeId(node) {
if (!node.id) {
node.id = nextNodeId;
@@ -31849,7 +32374,7 @@ var ts;
// Ensure file is type checked
checkSourceFile(file);
ts.Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
- diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.get(file.fileName));
+ diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
if (!file.isDeclarationFile && (!unusedIsError(0 /* Local */) || !unusedIsError(1 /* Parameter */))) {
addUnusedDiagnostics();
}
@@ -32073,102 +32598,7 @@ var ts;
var potentialNewTargetCollisions = [];
var awaitedTypeStack = [];
var diagnostics = ts.createDiagnosticCollection();
- // Suggestion diagnostics must have a file. Keyed by source file name.
- var suggestionDiagnostics = ts.createMultiMap();
- var TypeFacts;
- (function (TypeFacts) {
- TypeFacts[TypeFacts["None"] = 0] = "None";
- TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
- TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
- TypeFacts[TypeFacts["TypeofEQBigInt"] = 4] = "TypeofEQBigInt";
- TypeFacts[TypeFacts["TypeofEQBoolean"] = 8] = "TypeofEQBoolean";
- TypeFacts[TypeFacts["TypeofEQSymbol"] = 16] = "TypeofEQSymbol";
- TypeFacts[TypeFacts["TypeofEQObject"] = 32] = "TypeofEQObject";
- TypeFacts[TypeFacts["TypeofEQFunction"] = 64] = "TypeofEQFunction";
- TypeFacts[TypeFacts["TypeofEQHostObject"] = 128] = "TypeofEQHostObject";
- TypeFacts[TypeFacts["TypeofNEString"] = 256] = "TypeofNEString";
- TypeFacts[TypeFacts["TypeofNENumber"] = 512] = "TypeofNENumber";
- TypeFacts[TypeFacts["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt";
- TypeFacts[TypeFacts["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean";
- TypeFacts[TypeFacts["TypeofNESymbol"] = 4096] = "TypeofNESymbol";
- TypeFacts[TypeFacts["TypeofNEObject"] = 8192] = "TypeofNEObject";
- TypeFacts[TypeFacts["TypeofNEFunction"] = 16384] = "TypeofNEFunction";
- TypeFacts[TypeFacts["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject";
- TypeFacts[TypeFacts["EQUndefined"] = 65536] = "EQUndefined";
- TypeFacts[TypeFacts["EQNull"] = 131072] = "EQNull";
- TypeFacts[TypeFacts["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull";
- TypeFacts[TypeFacts["NEUndefined"] = 524288] = "NEUndefined";
- TypeFacts[TypeFacts["NENull"] = 1048576] = "NENull";
- TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
- TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
- TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
- TypeFacts[TypeFacts["All"] = 16777215] = "All";
- // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
- // The presence of a particular fact means that the given test is true for some (and possibly all) values
- // of that kind of type.
- TypeFacts[TypeFacts["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts";
- TypeFacts[TypeFacts["BaseStringFacts"] = 12582401] = "BaseStringFacts";
- TypeFacts[TypeFacts["StringStrictFacts"] = 16317953] = "StringStrictFacts";
- TypeFacts[TypeFacts["StringFacts"] = 16776705] = "StringFacts";
- TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts";
- TypeFacts[TypeFacts["EmptyStringFacts"] = 12582401] = "EmptyStringFacts";
- TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts";
- TypeFacts[TypeFacts["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts";
- TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts";
- TypeFacts[TypeFacts["BaseNumberFacts"] = 12582146] = "BaseNumberFacts";
- TypeFacts[TypeFacts["NumberStrictFacts"] = 16317698] = "NumberStrictFacts";
- TypeFacts[TypeFacts["NumberFacts"] = 16776450] = "NumberFacts";
- TypeFacts[TypeFacts["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts";
- TypeFacts[TypeFacts["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts";
- TypeFacts[TypeFacts["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts";
- TypeFacts[TypeFacts["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts";
- TypeFacts[TypeFacts["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts";
- TypeFacts[TypeFacts["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts";
- TypeFacts[TypeFacts["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts";
- TypeFacts[TypeFacts["BigIntFacts"] = 16775940] = "BigIntFacts";
- TypeFacts[TypeFacts["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts";
- TypeFacts[TypeFacts["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts";
- TypeFacts[TypeFacts["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts";
- TypeFacts[TypeFacts["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts";
- TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts";
- TypeFacts[TypeFacts["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts";
- TypeFacts[TypeFacts["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts";
- TypeFacts[TypeFacts["BooleanFacts"] = 16774920] = "BooleanFacts";
- TypeFacts[TypeFacts["FalseStrictFacts"] = 12121864] = "FalseStrictFacts";
- TypeFacts[TypeFacts["FalseFacts"] = 12580616] = "FalseFacts";
- TypeFacts[TypeFacts["TrueStrictFacts"] = 7927560] = "TrueStrictFacts";
- TypeFacts[TypeFacts["TrueFacts"] = 16774920] = "TrueFacts";
- TypeFacts[TypeFacts["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts";
- TypeFacts[TypeFacts["SymbolFacts"] = 16772880] = "SymbolFacts";
- TypeFacts[TypeFacts["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts";
- TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
- TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
- TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
- TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
- TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
- TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
- TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
- })(TypeFacts || (TypeFacts = {}));
- var typeofEQFacts = ts.createMapFromTemplate({
- string: 1 /* TypeofEQString */,
- number: 2 /* TypeofEQNumber */,
- bigint: 4 /* TypeofEQBigInt */,
- boolean: 8 /* TypeofEQBoolean */,
- symbol: 16 /* TypeofEQSymbol */,
- undefined: 65536 /* EQUndefined */,
- object: 32 /* TypeofEQObject */,
- function: 64 /* TypeofEQFunction */
- });
- var typeofNEFacts = ts.createMapFromTemplate({
- string: 256 /* TypeofNEString */,
- number: 512 /* TypeofNENumber */,
- bigint: 1024 /* TypeofNEBigInt */,
- boolean: 2048 /* TypeofNEBoolean */,
- symbol: 4096 /* TypeofNESymbol */,
- undefined: 524288 /* NEUndefined */,
- object: 8192 /* TypeofNEObject */,
- function: 16384 /* TypeofNEFunction */
- });
+ var suggestionDiagnostics = ts.createDiagnosticCollection();
var typeofTypesByName = ts.createMapFromTemplate({
string: stringType,
number: numberType,
@@ -32186,71 +32616,8 @@ var ts;
var comparableRelation = ts.createMap();
var identityRelation = ts.createMap();
var enumRelation = ts.createMap();
- var TypeSystemPropertyName;
- (function (TypeSystemPropertyName) {
- TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
- TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
- TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
- TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
- TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
- TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
- TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
- })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
- var CheckMode;
- (function (CheckMode) {
- CheckMode[CheckMode["Normal"] = 0] = "Normal";
- CheckMode[CheckMode["Contextual"] = 1] = "Contextual";
- CheckMode[CheckMode["Inferential"] = 2] = "Inferential";
- CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
- CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
- CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
- })(CheckMode || (CheckMode = {}));
- var ContextFlags;
- (function (ContextFlags) {
- ContextFlags[ContextFlags["None"] = 0] = "None";
- ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
- })(ContextFlags || (ContextFlags = {}));
- var AccessFlags;
- (function (AccessFlags) {
- AccessFlags[AccessFlags["None"] = 0] = "None";
- AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
- AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
- AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
- AccessFlags[AccessFlags["NoTupleBoundsCheck"] = 8] = "NoTupleBoundsCheck";
- })(AccessFlags || (AccessFlags = {}));
- var CallbackCheck;
- (function (CallbackCheck) {
- CallbackCheck[CallbackCheck["None"] = 0] = "None";
- CallbackCheck[CallbackCheck["Bivariant"] = 1] = "Bivariant";
- CallbackCheck[CallbackCheck["Strict"] = 2] = "Strict";
- })(CallbackCheck || (CallbackCheck = {}));
- var MappedTypeModifiers;
- (function (MappedTypeModifiers) {
- MappedTypeModifiers[MappedTypeModifiers["IncludeReadonly"] = 1] = "IncludeReadonly";
- MappedTypeModifiers[MappedTypeModifiers["ExcludeReadonly"] = 2] = "ExcludeReadonly";
- MappedTypeModifiers[MappedTypeModifiers["IncludeOptional"] = 4] = "IncludeOptional";
- MappedTypeModifiers[MappedTypeModifiers["ExcludeOptional"] = 8] = "ExcludeOptional";
- })(MappedTypeModifiers || (MappedTypeModifiers = {}));
- var ExpandingFlags;
- (function (ExpandingFlags) {
- ExpandingFlags[ExpandingFlags["None"] = 0] = "None";
- ExpandingFlags[ExpandingFlags["Source"] = 1] = "Source";
- ExpandingFlags[ExpandingFlags["Target"] = 2] = "Target";
- ExpandingFlags[ExpandingFlags["Both"] = 3] = "Both";
- })(ExpandingFlags || (ExpandingFlags = {}));
- var MembersOrExportsResolutionKind;
- (function (MembersOrExportsResolutionKind) {
- MembersOrExportsResolutionKind["resolvedExports"] = "resolvedExports";
- MembersOrExportsResolutionKind["resolvedMembers"] = "resolvedMembers";
- })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {}));
- var UnusedKind;
- (function (UnusedKind) {
- UnusedKind[UnusedKind["Local"] = 0] = "Local";
- UnusedKind[UnusedKind["Parameter"] = 1] = "Parameter";
- })(UnusedKind || (UnusedKind = {}));
var builtinGlobals = ts.createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
- var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
initializeTypeChecker();
return checker;
function getJsxNamespace(location) {
@@ -32315,7 +32682,7 @@ var ts;
diagnostics.add(diagnostic);
}
else {
- suggestionDiagnostics.add(diagnostic.file.fileName, __assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
+ suggestionDiagnostics.add(__assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
}
}
function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
@@ -32341,35 +32708,35 @@ var ts;
function getExcludedSymbolFlags(flags) {
var result = 0;
if (flags & 2 /* BlockScopedVariable */)
- result |= 67220415 /* BlockScopedVariableExcludes */;
+ result |= 111551 /* BlockScopedVariableExcludes */;
if (flags & 1 /* FunctionScopedVariable */)
- result |= 67220414 /* FunctionScopedVariableExcludes */;
+ result |= 111550 /* FunctionScopedVariableExcludes */;
if (flags & 4 /* Property */)
result |= 0 /* PropertyExcludes */;
if (flags & 8 /* EnumMember */)
- result |= 68008959 /* EnumMemberExcludes */;
+ result |= 900095 /* EnumMemberExcludes */;
if (flags & 16 /* Function */)
- result |= 67219887 /* FunctionExcludes */;
+ result |= 110991 /* FunctionExcludes */;
if (flags & 32 /* Class */)
- result |= 68008383 /* ClassExcludes */;
+ result |= 899503 /* ClassExcludes */;
if (flags & 64 /* Interface */)
- result |= 67897736 /* InterfaceExcludes */;
+ result |= 788872 /* InterfaceExcludes */;
if (flags & 256 /* RegularEnum */)
- result |= 68008191 /* RegularEnumExcludes */;
+ result |= 899327 /* RegularEnumExcludes */;
if (flags & 128 /* ConstEnum */)
- result |= 68008831 /* ConstEnumExcludes */;
+ result |= 899967 /* ConstEnumExcludes */;
if (flags & 512 /* ValueModule */)
result |= 110735 /* ValueModuleExcludes */;
if (flags & 8192 /* Method */)
- result |= 67212223 /* MethodExcludes */;
+ result |= 103359 /* MethodExcludes */;
if (flags & 32768 /* GetAccessor */)
- result |= 67154879 /* GetAccessorExcludes */;
+ result |= 46015 /* GetAccessorExcludes */;
if (flags & 65536 /* SetAccessor */)
- result |= 67187647 /* SetAccessorExcludes */;
+ result |= 78783 /* SetAccessorExcludes */;
if (flags & 262144 /* TypeParameter */)
- result |= 67635688 /* TypeParameterExcludes */;
+ result |= 526824 /* TypeParameterExcludes */;
if (flags & 524288 /* TypeAlias */)
- result |= 67897832 /* TypeAliasExcludes */;
+ result |= 788968 /* TypeAliasExcludes */;
if (flags & 2097152 /* Alias */)
result |= 2097152 /* AliasExcludes */;
return result;
@@ -32622,8 +32989,8 @@ var ts;
function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) {
var constructorDeclaration = parameter.parent;
var classDeclaration = parameter.parent.parent;
- var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 67220415 /* Value */);
- var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 67220415 /* Value */);
+ var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 111551 /* Value */);
+ var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 111551 /* Value */);
if (parameterSymbol && propertySymbol) {
return [parameterSymbol, propertySymbol];
}
@@ -32802,7 +33169,7 @@ var ts;
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) {
+ if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 298 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
// type parameters are visible in parameter list, return type and type parameter list
? lastLocation === location.type ||
@@ -32905,7 +33272,7 @@ var ts;
if (!ts.hasModifier(location, 32 /* Static */)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
- if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) {
+ if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
// Remember the property node, it will be used later to report appropriate error
propertyWithInvalidInitializer = location;
}
@@ -32918,7 +33285,7 @@ var ts;
// The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals
// These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would
// trigger resolving late-bound names, which we may already be in the process of doing while we're here!
- if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 67897832 /* Type */)) {
+ if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
// ignore type parameters not declared in this container
result = undefined;
@@ -32945,7 +33312,7 @@ var ts;
// The type parameters of a class are not in scope in the base class expression.
if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) {
var container = location.parent.parent;
- if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) {
+ if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 788968 /* Type */))) {
if (nameNotFoundMessage) {
error(errorLocation, ts.Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
}
@@ -32965,7 +33332,7 @@ var ts;
grandparent = location.parent.parent;
if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
- if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) {
+ if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
return undefined;
}
@@ -33029,8 +33396,9 @@ var ts;
location = location.parent;
}
break;
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
break;
@@ -33128,21 +33496,21 @@ var ts;
// we want to check for block-scoped
if (errorLocation &&
(meaning & 2 /* BlockScopedVariable */ ||
- ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 67220415 /* Value */) === 67220415 /* Value */))) {
+ ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */))) {
var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
}
}
// If we're in an external module, we can't reference value symbols created from UMD export declarations
- if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
+ if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
}
}
// If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
- if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) {
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
var candidate = getMergedSymbol(getLateBoundSymbol(result));
var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
// A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
@@ -33259,9 +33627,9 @@ var ts;
}
}
function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
- var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(errorLocation) ? 67220415 /* Value */ : 0);
+ var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(errorLocation) ? 111551 /* Value */ : 0);
if (meaning === namespaceMeaning) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 /* Type */ & ~namespaceMeaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~namespaceMeaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
var parent = errorLocation.parent;
if (symbol) {
if (ts.isQualifiedName(parent)) {
@@ -33280,8 +33648,8 @@ var ts;
return false;
}
function checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning) {
- if (meaning & (67897832 /* Type */ & ~1920 /* Namespace */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, ~67897832 /* Type */ & 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ if (meaning & (788968 /* Type */ & ~1920 /* Namespace */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, ~788968 /* Type */ & 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol && !(symbol.flags & 1920 /* Namespace */)) {
error(errorLocation, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here, ts.unescapeLeadingUnderscores(name));
return true;
@@ -33290,12 +33658,12 @@ var ts;
return false;
}
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 /* Value */ & ~1024 /* NamespaceModule */)) {
+ if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
if (name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never") {
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
return true;
}
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 /* Type */ & ~67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol && !(symbol.flags & 1024 /* NamespaceModule */)) {
var message = isES2015OrLaterConstructorName(name)
? ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later
@@ -33319,15 +33687,15 @@ var ts;
return false;
}
function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 /* Value */ & ~1024 /* NamespaceModule */ & ~67897832 /* Type */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */ & ~788968 /* Type */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
return true;
}
}
- else if (meaning & (67897832 /* Type */ & ~1024 /* NamespaceModule */ & ~67220415 /* Value */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* ValueModule */ | 1024 /* NamespaceModule */) & ~67897832 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ else if (meaning & (788968 /* Type */ & ~1024 /* NamespaceModule */ & ~111551 /* Value */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* ValueModule */ | 1024 /* NamespaceModule */) & ~788968 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
return true;
@@ -33338,7 +33706,7 @@ var ts;
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
// Block-scoped variables cannot be used before their definition
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -33490,7 +33858,7 @@ var ts;
if (valueSymbol === unknownSymbol && typeSymbol === unknownSymbol) {
return unknownSymbol;
}
- if (valueSymbol.flags & (67897832 /* Type */ | 1920 /* Namespace */)) {
+ if (valueSymbol.flags & (788968 /* Type */ | 1920 /* Namespace */)) {
return valueSymbol;
}
var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName);
@@ -33580,7 +33948,7 @@ var ts;
if (ts.isClassExpression(expression)) {
return checkExpression(expression).symbol;
}
- var aliasLike = resolveEntityName(expression, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias);
+ var aliasLike = resolveEntityName(expression, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias);
if (aliasLike) {
return aliasLike;
}
@@ -33599,7 +33967,7 @@ var ts;
case 254 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
case 258 /* ExportSpecifier */:
- return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
+ return getTargetOfExportSpecifier(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
case 255 /* ExportAssignment */:
case 205 /* BinaryExpression */:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
@@ -33614,7 +33982,7 @@ var ts;
* OR Is a JSContainer which may merge an alias with a local declaration
*/
function isNonLocalAlias(symbol, excludes) {
- if (excludes === void 0) { excludes = 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */; }
+ if (excludes === void 0) { excludes = 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */; }
if (!symbol)
return false;
return (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */ || !!(symbol.flags & 2097152 /* Alias */ && symbol.flags & 67108864 /* Assignment */);
@@ -33648,7 +34016,7 @@ var ts;
var target = resolveAlias(symbol);
if (target) {
var markAlias = target === unknownSymbol ||
- ((target.flags & 67220415 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));
+ ((target.flags & 111551 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));
if (markAlias) {
markAliasSymbolAsReferenced(symbol);
}
@@ -33664,17 +34032,15 @@ var ts;
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 255 /* ExportAssignment */) {
- // export default
- checkExpressionCached(node.expression);
- }
- else if (node.kind === 258 /* ExportSpecifier */) {
- // export { } or export { as foo }
- checkExpressionCached(node.propertyName || node.name);
- }
- else if (ts.isInternalModuleImportEqualsDeclaration(node)) {
- // import foo =
- checkExpressionCached(node.moduleReference);
+ // We defer checking of the reference of an `import =` until the import itself is referenced,
+ // This way a chain of imports can be elided if ultimately the final input is only used in a type
+ // position.
+ if (ts.isInternalModuleImportEqualsDeclaration(node)) {
+ var target = resolveSymbol(symbol);
+ if (target === unknownSymbol || target.flags & 111551 /* Value */) {
+ // import foo =
+ checkExpressionCached(node.moduleReference);
+ }
}
}
}
@@ -33697,7 +34063,7 @@ var ts;
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */);
- return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
+ return resolveEntityName(entityName, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
function getFullyQualifiedName(symbol, containingLocation) {
@@ -33710,7 +34076,7 @@ var ts;
if (ts.nodeIsMissing(name)) {
return undefined;
}
- var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0);
+ var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 111551 /* Value */ : 0);
var symbol;
if (name.kind === 73 /* Identifier */) {
var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
@@ -34211,7 +34577,7 @@ var ts;
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 ? symbol.exportSymbol : symbol);
}
function symbolIsValue(symbol) {
- return !!(symbol.flags & 67220415 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 67220415 /* Value */);
+ return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */);
}
function findConstructorDeclaration(node) {
var members = node.members;
@@ -34319,7 +34685,7 @@ var ts;
}
function getQualifiedLeftMeaning(rightMeaning) {
// If we are looking in value space, the parent meaning is value, other wise it is namespace
- return rightMeaning === 67220415 /* Value */ ? 67220415 /* Value */ : 1920 /* Namespace */;
+ return rightMeaning === 111551 /* Value */ ? 111551 /* Value */ : 1920 /* Namespace */;
}
function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) {
if (visitedSymbolTablesMap === void 0) { visitedSymbolTablesMap = ts.createMap(); }
@@ -34437,11 +34803,11 @@ var ts;
return false;
}
function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67897832 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 788968 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false);
return access.accessibility === 0 /* Accessible */;
}
function isValueSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67220415 /* Value */, /*shouldComputeAliasesToMakeVisible*/ false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 111551 /* Value */, /*shouldComputeAliasesToMakeVisible*/ false);
return access.accessibility === 0 /* Accessible */;
}
function isAnySymbolAccessible(symbols, enclosingDeclaration, initialSymbol, meaning, shouldComputeAliasesToMakeVisible) {
@@ -34484,7 +34850,7 @@ var ts;
// from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however,
// we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal.
var firstDecl = ts.first(symbol.declarations);
- if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
+ if (!ts.length(containers) && meaning & 111551 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
containers = [getSymbolOfNode(firstDecl.parent)];
}
@@ -34597,7 +34963,7 @@ var ts;
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
entityName.parent.kind === 150 /* ComputedPropertyName */) {
// Typeof value
- meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
}
else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ ||
entityName.parent.kind === 249 /* ImportEqualsDeclaration */) {
@@ -34607,7 +34973,7 @@ var ts;
}
else {
// Type Reference or TypeAlias entity = Identifier
- meaning = 67897832 /* Type */;
+ meaning = 788968 /* Type */;
}
var firstIdentifier = getFirstIdentifier(entityName);
var symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
@@ -34779,14 +35145,14 @@ var ts;
}
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
var parentSymbol = getParentOfSymbol(type.symbol);
- var parentName = symbolToTypeNode(parentSymbol, context, 67897832 /* Type */);
+ var parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
var enumLiteralName = getDeclaredTypeOfSymbol(parentSymbol) === type
? parentName
: appendReferenceToType(parentName, ts.createTypeReferenceNode(ts.symbolName(type.symbol), /*typeArguments*/ undefined));
return enumLiteralName;
}
if (type.flags & 1056 /* EnumLike */) {
- return symbolToTypeNode(type.symbol, context, 67897832 /* Type */);
+ return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
}
if (type.flags & 128 /* StringLiteral */) {
context.approximateLength += (type.value.length + 2);
@@ -34809,7 +35175,7 @@ var ts;
if (!(context.flags & 1048576 /* AllowUniqueESSymbolType */)) {
if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
context.approximateLength += 6;
- return symbolToTypeNode(type.symbol, context, 67220415 /* Value */);
+ return symbolToTypeNode(type.symbol, context, 111551 /* Value */);
}
if (context.tracker.reportInaccessibleUniqueSymbolError) {
context.tracker.reportInaccessibleUniqueSymbolError();
@@ -34872,14 +35238,14 @@ var ts;
}
// Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter.
return type.symbol
- ? symbolToTypeNode(type.symbol, context, 67897832 /* Type */)
+ ? symbolToTypeNode(type.symbol, context, 788968 /* Type */)
: ts.createTypeReferenceNode(ts.createIdentifier("?"), /*typeArguments*/ undefined);
}
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */))
return ts.createTypeReferenceNode(ts.createIdentifier(""), typeArgumentNodes);
- return symbolToTypeNode(type.aliasSymbol, context, 67897832 /* Type */, typeArgumentNodes);
+ return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
}
if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) {
var types = type.flags & 1048576 /* Union */ ? formatUnionTypes(type.types) : type.types;
@@ -34958,21 +35324,21 @@ var ts;
id = (isConstructorObject ? "+" : "") + getSymbolId(symbol);
if (isJSConstructor(symbol.valueDeclaration)) {
// Instance and static types share the same symbol; only add 'typeof' for the static side.
- var isInstanceType = type === getInferredClassType(symbol) ? 67897832 /* Type */ : 67220415 /* Value */;
+ var isInstanceType = type === getInferredClassType(symbol) ? 788968 /* Type */ : 111551 /* Value */;
return symbolToTypeNode(symbol, context, isInstanceType);
}
// Always use 'typeof T' for type of class, enum, and module objects
else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) ||
shouldWriteTypeOfFunctionSymbol()) {
- return symbolToTypeNode(symbol, context, 67220415 /* Value */);
+ return symbolToTypeNode(symbol, context, 111551 /* Value */);
}
else if (context.visitedTypes && context.visitedTypes.has(typeId)) {
// If type is an anonymous type literal in a type alias declaration, use type alias name
var typeAlias = getTypeAliasForTypeLiteral(type);
if (typeAlias) {
// The specified symbol flags need to be reinterpreted as type flags
- return symbolToTypeNode(typeAlias, context, 67897832 /* Type */);
+ return symbolToTypeNode(typeAlias, context, 788968 /* Type */);
}
else {
return createElidedInformationPlaceholder(context);
@@ -35105,7 +35471,7 @@ var ts;
var typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
var flags_2 = context.flags;
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
- var ref = symbolToTypeNode(parent, context, 67897832 /* Type */, typeArgumentSlice);
+ var ref = symbolToTypeNode(parent, context, 788968 /* Type */, typeArgumentSlice);
context.flags = flags_2;
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
}
@@ -35118,7 +35484,7 @@ var ts;
}
var flags = context.flags;
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
- var finalRef = symbolToTypeNode(type.symbol, context, 67897832 /* Type */, typeArgumentNodes);
+ var finalRef = symbolToTypeNode(type.symbol, context, 788968 /* Type */, typeArgumentNodes);
context.flags = flags;
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
}
@@ -35235,7 +35601,7 @@ var ts;
trackComputedName(decl.name, saveEnclosingDeclaration, context);
}
}
- var propertyName = symbolToName(propertySymbol, context, 67220415 /* Value */, /*expectsIdentifier*/ true);
+ var propertyName = symbolToName(propertySymbol, context, 111551 /* Value */, /*expectsIdentifier*/ true);
context.approximateLength += (ts.symbolName(propertySymbol).length + 1);
context.enclosingDeclaration = saveEnclosingDeclaration;
var optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? ts.createToken(56 /* QuestionToken */) : undefined;
@@ -35385,7 +35751,7 @@ var ts;
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 306 /* JSDocParameterTag */);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 307 /* JSDocParameterTag */);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -35429,9 +35795,9 @@ var ts;
return;
// get symbol of the first identifier of the entityName
var firstIdentifier = getFirstIdentifier(node.expression);
- var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
+ var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (name) {
- context.tracker.trackSymbol(name, enclosingDeclaration, 67220415 /* Value */);
+ context.tracker.trackSymbol(name, enclosingDeclaration, 111551 /* Value */);
}
}
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
@@ -35593,7 +35959,7 @@ var ts;
}
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
- var isTypeOf = meaning === 67220415 /* Value */;
+ var isTypeOf = meaning === 111551 /* Value */;
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
// module is root, must use `ImportTypeNode`
var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
@@ -35672,7 +36038,7 @@ var ts;
}
}
function typeParameterShadowsNameInScope(escapedName, context) {
- return !!resolveName(context.enclosingDeclaration, escapedName, 67897832 /* Type */, /*nameNotFoundArg*/ undefined, escapedName, /*isUse*/ false);
+ return !!resolveName(context.enclosingDeclaration, escapedName, 788968 /* Type */, /*nameNotFoundArg*/ undefined, escapedName, /*isUse*/ false);
}
function typeParameterToName(type, context) {
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
@@ -35681,7 +36047,7 @@ var ts;
return cached;
}
}
- var result = symbolToName(type.symbol, context, 67897832 /* Type */, /*expectsIdentifier*/ true);
+ var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
var rawtext = result.escapedText;
var i = 0;
@@ -35908,8 +36274,9 @@ var ts;
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 306 /* JSDocEnumTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
@@ -35992,10 +36359,10 @@ var ts;
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
if (node.parent && node.parent.kind === 255 /* ExportAssignment */) {
- exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
+ exportSymbol = resolveName(node, node.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
}
else if (node.parent.kind === 258 /* ExportSpecifier */) {
- exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
var result;
if (exportSymbol) {
@@ -36016,7 +36383,7 @@ var ts;
// Add the referenced top container visible
var internalModuleReference = declaration.moduleReference;
var firstIdentifier = getFirstIdentifier(internalModuleReference);
- var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, undefined, undefined, /*isUse*/ false);
+ var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, undefined, undefined, /*isUse*/ false);
if (importSymbol) {
buildVisibleNodeList(importSymbol.declarations);
}
@@ -36080,8 +36447,10 @@ var ts;
}
return ts.Debug.assertNever(propertyName);
}
- // Pop an entry from the type resolution stack and return its associated result value. The result value will
- // be true if no circularities were detected, or false if a circularity was found.
+ /**
+ * Pop an entry from the type resolution stack and return its associated result value. The result value will
+ * be true if no circularities were detected, or false if a circularity was found.
+ */
function popTypeResolution() {
resolutionTargets.pop();
resolutionPropertyNames.pop();
@@ -36410,7 +36779,7 @@ var ts;
// No type specified and nothing can be inferred
return undefined;
}
- function getWidenedTypeFromAssignmentDeclaration(symbol, resolvedSymbol) {
+ function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
// function/class/{} initializers are themselves containers, so they won't merge in the same way as other initializers
var container = ts.getAssignedExpandoInitializer(symbol.valueDeclaration);
if (container) {
@@ -36443,7 +36812,7 @@ var ts;
}
}
if (!ts.isCallExpression(expression)) {
- jsdocType = getJSDocTypeFromAssignmentDeclaration(jsdocType, expression, symbol, declaration);
+ jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
}
if (!jsdocType) {
(types || (types = [])).push((ts.isBinaryExpression(expression) || ts.isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
@@ -36490,8 +36859,8 @@ var ts;
type.objectFlags |= 16384 /* JSLiteral */;
return type;
}
- function getJSDocTypeFromAssignmentDeclaration(declaredType, expression, _symbol, declaration) {
- var typeNode = ts.getJSDocType(expression.parent);
+ function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) {
+ var typeNode = ts.getEffectiveTypeAnnotationNode(expression.parent);
if (typeNode) {
var type = getWidenedType(getTypeFromTypeNode(typeNode));
if (!declaredType) {
@@ -36501,6 +36870,12 @@ var ts;
errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
}
}
+ if (symbol.parent) {
+ var typeNode_2 = ts.getEffectiveTypeAnnotationNode(symbol.parent.valueDeclaration);
+ if (typeNode_2) {
+ return getTypeOfPropertyOfType(getTypeFromTypeNode(typeNode_2), symbol.escapedName);
+ }
+ }
return declaredType;
}
/** If we don't have an explicit JSDoc type, get the type from the initializer. */
@@ -36771,7 +37146,7 @@ var ts;
}
else if (ts.isInJSFile(declaration) &&
(ts.isCallExpression(declaration) || ts.isBinaryExpression(declaration) || ts.isPropertyAccessExpression(declaration) && ts.isBinaryExpression(declaration.parent))) {
- type = getWidenedTypeFromAssignmentDeclaration(symbol);
+ type = getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (ts.isJSDocPropertyLikeTag(declaration)
|| ts.isPropertyAccessExpression(declaration)
@@ -36786,7 +37161,7 @@ var ts;
return getTypeOfFuncClassEnumModule(symbol);
}
type = ts.isBinaryExpression(declaration.parent) ?
- getWidenedTypeFromAssignmentDeclaration(symbol) :
+ getWidenedTypeForAssignmentDeclaration(symbol) :
tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
}
else if (ts.isPropertyAssignment(declaration)) {
@@ -36888,7 +37263,9 @@ var ts;
// Otherwise, fall back to 'any'.
else {
if (setter) {
- errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ if (!isPrivateWithinAmbient(setter)) {
+ errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ }
}
else {
ts.Debug.assert(!!getter, "there must existed getter as we are current checking either setter or getter in this function");
@@ -36943,7 +37320,7 @@ var ts;
}
else if (declaration.kind === 205 /* BinaryExpression */ ||
declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) {
- return getWidenedTypeFromAssignmentDeclaration(symbol);
+ return getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
var resolvedModule = resolveExternalModuleSymbol(symbol);
@@ -36952,7 +37329,7 @@ var ts;
return errorType;
}
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
- var type_2 = getWidenedTypeFromAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
+ var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
if (!popTypeResolution()) {
return reportCircularityError(symbol);
}
@@ -36981,7 +37358,7 @@ var ts;
// type symbol, call getDeclaredTypeOfSymbol.
// This check is important because without it, a call to getTypeOfSymbol could end
// up recursively calling getTypeOfAlias, causing a stack overflow.
- links.type = targetSymbol.flags & 67220415 /* Value */
+ links.type = targetSymbol.flags & 111551 /* Value */
? getTypeOfSymbol(targetSymbol)
: errorType;
}
@@ -37108,9 +37485,10 @@ var ts;
case 197 /* FunctionExpression */:
case 198 /* ArrowFunction */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 311 /* JSDocTemplateTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 306 /* JSDocEnumTag */:
+ case 305 /* JSDocCallbackTag */:
case 182 /* MappedType */:
case 176 /* ConditionalType */:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
@@ -37380,7 +37758,7 @@ var ts;
for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {
var node = baseTypeNodes_1[_b];
if (ts.isEntityNameExpression(node.expression)) {
- var baseSymbol = resolveEntityName(node.expression, 67897832 /* Type */, /*ignoreErrors*/ true);
+ var baseSymbol = resolveEntityName(node.expression, 788968 /* Type */, /*ignoreErrors*/ true);
if (!baseSymbol || !(baseSymbol.flags & 64 /* Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {
return false;
}
@@ -37427,9 +37805,10 @@ var ts;
if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {
return errorType;
}
- var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */;
- });
+ var declaration = ts.find(symbol.declarations, ts.isTypeAlias);
+ if (!declaration) {
+ return ts.Debug.fail("Type alias symbol with no valid declaration found");
+ }
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
// If typeNode is missing, we will error in checkJSDocTypedefTag.
var type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
@@ -37445,7 +37824,7 @@ var ts;
}
else {
type = errorType;
- error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
+ error(ts.isJSDocEnumTag(declaration) ? declaration : declaration.name || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
links.declaredType = type;
}
@@ -37762,7 +38141,7 @@ var ts;
else {
symbol.declarations.push(member);
}
- if (symbolFlags & 67220415 /* Value */) {
+ if (symbolFlags & 111551 /* Value */) {
if (!symbol.valueDeclaration || symbol.valueDeclaration.kind !== member.kind) {
symbol.valueDeclaration = member;
}
@@ -38068,8 +38447,9 @@ var ts;
}
var result;
for (var i = 0; i < signatureLists.length; i++) {
- // Allow matching non-generic signatures to have excess parameters and different return types
- var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true);
+ // Allow matching non-generic signatures to have excess parameters and different return types.
+ // Prefer matching this types if possible.
+ var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true);
if (!match) {
return undefined;
}
@@ -38093,7 +38473,7 @@ var ts;
for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {
var signature = _a[_i];
// Only process signatures with parameter lists that aren't already in the result list
- if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) {
+ if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true)) {
var unionSignatures = findMatchingSignatures(signatureLists, signature, i);
if (unionSignatures) {
var s = signature;
@@ -38102,7 +38482,7 @@ var ts;
var thisParameter = signature.thisParameter;
var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
if (firstThisParameterOfUnionSignatures) {
- var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */);
+ var thisType = getIntersectionType(ts.mapDefined(unionSignatures, function (sig) { return sig.thisParameter && getTypeOfSymbol(sig.thisParameter); }));
thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
@@ -38146,8 +38526,8 @@ var ts;
}
// A signature `this` type might be a read or a write position... It's very possible that it should be invariant
// and we should refuse to merge signatures if there are `this` types and they do not match. However, so as to be
- // permissive when calling, for now, we'll union the `this` types just like the overlapping-union-signature check does
- var thisType = getUnionType([getTypeOfSymbol(left), getTypeOfSymbol(right)], 2 /* Subtype */);
+ // permissive when calling, for now, we'll intersect the `this` types just like we do for param types in union signatures.
+ var thisType = getIntersectionType([getTypeOfSymbol(left), getTypeOfSymbol(right)]);
return createSymbolWithType(left, thisType);
}
function combineUnionParameters(left, right) {
@@ -38521,7 +38901,7 @@ var ts;
else {
// Otherwise, get the declared constraint type, and if the constraint type is a type parameter,
// get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T',
- // the modifiers type is T. Otherwise, the modifiers type is {}.
+ // the modifiers type is T. Otherwise, the modifiers type is unknown.
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint;
@@ -38966,7 +39346,7 @@ var ts;
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 /* StringLike */ ? globalStringType :
t.flags & 296 /* NumberLike */ ? globalNumberType :
- t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) :
+ t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 99 /* ESNext */) :
t.flags & 528 /* BooleanLike */ ? globalBooleanType :
t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) :
t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType :
@@ -39320,7 +39700,7 @@ var ts;
var type = ts.isJSDocParameterTag(param) ? (param.typeExpression && param.typeExpression.type) : param.type;
// Include parameter symbol instead of property symbol in the signature
if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !ts.isBindingPattern(param.name)) {
- var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 67220415 /* Value */, undefined, undefined, /*isUse*/ false);
+ var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 111551 /* Value */, undefined, undefined, /*isUse*/ false);
paramSymbol = resolvedSymbol;
}
if (i === 0 && paramSymbol.escapedName === "this" /* This */) {
@@ -39903,20 +40283,6 @@ var ts;
if (type) {
return type;
}
- // JS enums are 'string' or 'number', not an enum type.
- var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
- if (enumTag) {
- var links = getNodeLinks(enumTag);
- if (!pushTypeResolution(enumTag, 5 /* EnumTagType */)) {
- return errorType;
- }
- var type_4 = enumTag.typeExpression ? getTypeFromTypeNode(enumTag.typeExpression) : errorType;
- if (!popTypeResolution()) {
- type_4 = errorType;
- error(node, ts.Diagnostics.Enum_type_0_circularly_references_itself, symbolToString(symbol));
- }
- return (links.resolvedEnumType = type_4);
- }
// Get type from reference to named type that cannot be generic (enum or type parameter)
var res = tryGetDeclaredTypeOfSymbol(symbol);
if (res) {
@@ -39924,7 +40290,7 @@ var ts;
res.flags & 262144 /* TypeParameter */ ? getConstrainedTypeVariable(res, node) : getRegularTypeOfLiteralType(res) :
errorType;
}
- if (!(symbol.flags & 67220415 /* Value */ && isJSDocTypeReference(node))) {
+ if (!(symbol.flags & 111551 /* Value */ && isJSDocTypeReference(node))) {
return errorType;
}
var jsdocType = getJSDocTypeReference(node, symbol, typeArguments);
@@ -39932,7 +40298,7 @@ var ts;
return jsdocType;
}
// Resolve the type reference as a Type for the purpose of reporting errors.
- resolveTypeReferenceName(getTypeReferenceName(node), 67897832 /* Type */);
+ resolveTypeReferenceName(getTypeReferenceName(node), 788968 /* Type */);
return getTypeOfSymbol(symbol);
}
/**
@@ -40000,7 +40366,7 @@ var ts;
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) {
+ while (node && !ts.isStatement(node) && node.kind !== 298 /* JSDocComment */) {
var parent = node.parent;
if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
@@ -40078,10 +40444,10 @@ var ts;
if (!links.resolvedType) {
var symbol = void 0;
var type = void 0;
- var meaning = 67897832 /* Type */;
+ var meaning = 788968 /* Type */;
if (isJSDocTypeReference(node)) {
type = getIntendedTypeFromJSDocTypeReference(node);
- meaning |= 67220415 /* Value */;
+ meaning |= 111551 /* Value */;
}
if (!type) {
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
@@ -40136,10 +40502,10 @@ var ts;
return type;
}
function getGlobalValueSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67220415 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
+ return getGlobalSymbol(name, 111551 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
}
function getGlobalTypeSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67897832 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
+ return getGlobalSymbol(name, 788968 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
}
function getGlobalSymbol(name, meaning, diagnostic) {
// Don't track references for global symbols anyway, so value if `isReference` is arbitrary
@@ -40208,7 +40574,7 @@ var ts;
}
function getGlobalTypeOrUndefined(name, arity) {
if (arity === void 0) { arity = 0; }
- var symbol = getGlobalSymbol(name, 67897832 /* Type */, /*diagnostic*/ undefined);
+ var symbol = getGlobalSymbol(name, 788968 /* Type */, /*diagnostic*/ undefined);
return symbol && getTypeOfGlobalSymbol(symbol, arity);
}
function getGlobalExtractSymbol() {
@@ -40572,7 +40938,7 @@ var ts;
if (isEmptyAnonymousObjectType(type)) {
if (!(includes & 8388608 /* IncludesEmptyObject */)) {
includes |= 8388608 /* IncludesEmptyObject */;
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
}
else {
@@ -40580,13 +40946,13 @@ var ts;
if (type === wildcardType)
includes |= 4194304 /* IncludesWildcard */;
}
- else if ((strictNullChecks || !(flags & 98304 /* Nullable */)) && !ts.contains(typeSet, type)) {
+ else if ((strictNullChecks || !(flags & 98304 /* Nullable */)) && !typeSet.has(type.id.toString())) {
if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
// We have seen two distinct unit types which means we should reduce to an
// empty intersection. Adding TypeFlags.NonPrimitive causes that to happen.
includes |= 67108864 /* NonPrimitive */;
}
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
includes |= flags & 68943871 /* IncludesMask */;
}
@@ -40699,8 +41065,9 @@ var ts;
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
// for intersections of types with signatures can be deterministic.
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
- var typeSet = [];
- var includes = addTypesToIntersection(typeSet, 0, types);
+ var typeMembershipMap = ts.createMap();
+ var includes = addTypesToIntersection(typeMembershipMap, 0, types);
+ var typeSet = ts.arrayFrom(typeMembershipMap.values());
// An intersection type is considered empty if it contains
// the type never, or
// more than one unit type or,
@@ -41395,7 +41762,7 @@ var ts;
links.resolvedSymbol = unknownSymbol;
return links.resolvedType = errorType;
}
- var targetMeaning = node.isTypeOf ? 67220415 /* Value */ : node.flags & 2097152 /* JSDoc */ ? 67220415 /* Value */ | 67897832 /* Type */ : 67897832 /* Type */;
+ var targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 2097152 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */;
// TODO: Future work: support unions/generics/whatever via a deferred import-type
var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
if (!innerModuleSymbol) {
@@ -41425,7 +41792,7 @@ var ts;
resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
}
else {
- var errorMessage = targetMeaning === 67220415 /* Value */
+ var errorMessage = targetMeaning === 111551 /* Value */
? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here
: ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
error(node, errorMessage, node.argument.literal.text);
@@ -41439,7 +41806,7 @@ var ts;
function resolveImportSymbolType(node, links, symbol, meaning) {
var resolvedSymbol = resolveSymbol(symbol);
links.resolvedSymbol = resolvedSymbol;
- if (meaning === 67220415 /* Value */) {
+ if (meaning === 111551 /* Value */) {
return links.resolvedType = getTypeOfSymbol(symbol); // intentionally doesn't use resolved symbol so type is cached as expected on the alias
}
else {
@@ -41737,9 +42104,9 @@ var ts;
case 166 /* FunctionType */:
case 167 /* ConstructorType */:
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 295 /* JSDocFunctionType */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 180 /* TypeOperator */:
return getTypeFromTypeOperatorNode(node);
@@ -41966,7 +42333,8 @@ var ts;
}
function maybeTypeParameterReference(node) {
return !(node.kind === 149 /* QualifiedName */ ||
- node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
+ node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName ||
+ node.parent.kind === 184 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier);
}
function isTypeParameterPossiblyReferenced(tp, node) {
// If the type parameter doesn't have exactly one declaration, if there are invening statement blocks
@@ -43234,7 +43602,7 @@ var ts;
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */);
- var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
+ var isPerformingExcessPropertyChecks = !isApparentIntersectionConstituent && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
@@ -43244,11 +43612,11 @@ var ts;
return 0 /* False */;
}
}
- if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
+ var isPerformingCommonPropertyChecks = relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
target.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target) &&
- (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)) &&
- !hasCommonProperties(source, target, isComparingJsxAttributes)) {
+ (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
+ if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
if (reportErrors) {
var calls = getSignaturesOfType(source, 0 /* Call */);
var constructs = getSignaturesOfType(source, 1 /* Construct */);
@@ -43276,10 +43644,10 @@ var ts;
else {
if (target.flags & 1048576 /* Union */) {
result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
// Validate against excess props using the original `source`
var discriminantType = findMatchingDiscriminantType(source, target) || filterPrimitivesIfContainsNonPrimitive(target);
- if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined)) {
+ if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined, isIntersectionConstituent)) {
return 0 /* False */;
}
}
@@ -43287,9 +43655,9 @@ var ts;
else if (target.flags & 2097152 /* Intersection */) {
isIntersectionConstituent = true; // set here to affect the following trio of checks
result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
// Validate against excess props using the original `source`
- if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) {
+ if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, /*isIntersectionConstituent*/ false)) {
return 0 /* False */;
}
}
@@ -43604,7 +43972,7 @@ var ts;
}
return result;
}
- function typeArgumentsRelatedTo(sources, targets, variances, reportErrors) {
+ function typeArgumentsRelatedTo(sources, targets, variances, reportErrors, isIntersectionConstituent) {
if (sources === void 0) { sources = ts.emptyArray; }
if (targets === void 0) { targets = ts.emptyArray; }
if (variances === void 0) { variances = ts.emptyArray; }
@@ -43631,10 +43999,10 @@ var ts;
related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t);
}
else if (variance === 1 /* Covariant */) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
else if (variance === 2 /* Contravariant */) {
- related = isRelatedTo(t, s, reportErrors);
+ related = isRelatedTo(t, s, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
else if (variance === 3 /* Bivariant */) {
// In the bivariant case we first compare contravariantly without reporting
@@ -43643,16 +44011,16 @@ var ts;
// which is generally easier to reason about.
related = isRelatedTo(t, s, /*reportErrors*/ false);
if (!related) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
else {
// In the invariant case we first compare covariantly, and only when that
// succeeds do we proceed to compare contravariantly. Thus, error elaboration
// will typically be based on the covariant check.
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
if (related) {
- related &= isRelatedTo(t, s, reportErrors);
+ related &= isRelatedTo(t, s, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
if (!related) {
@@ -43795,7 +44163,7 @@ var ts;
source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
!(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
var variances = getAliasVariances(source.aliasSymbol);
- var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances);
+ var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -43970,13 +44338,16 @@ var ts;
if (relation !== identityRelation) {
source = getApparentType(source);
}
+ else if (isGenericMappedType(source)) {
+ return 0 /* False */;
+ }
if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target &&
!(ts.getObjectFlags(source) & 8192 /* MarkerType */ || ts.getObjectFlags(target) & 8192 /* MarkerType */)) {
// We have type references to the same generic type, and the type references are not marker
// type references (which are intended by be compared structurally). Obtain the variance
// information for the type parameters and relate the type arguments accordingly.
var variances = getVariances(source.target);
- var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances);
+ var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -44004,7 +44375,7 @@ var ts;
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) {
// Report structural errors only if we haven't reported any errors yet
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined, isIntersectionConstituent);
if (result) {
result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors);
if (result) {
@@ -44039,8 +44410,8 @@ var ts;
}
}
return 0 /* False */;
- function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
- if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
+ function relateVariances(sourceTypeArguments, targetTypeArguments, variances, isIntersectionConstituent) {
+ if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors, isIntersectionConstituent)) {
return result;
}
if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) {
@@ -44165,7 +44536,7 @@ var ts;
if (sourceProperty === targetProperty)
return "continue";
// We compare the source property to the target in the context of a single discriminant type.
- var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false);
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false, /*isIntersectionConstituent*/ false);
// If the target property could not be found, or if the properties were not related,
// then this constituent is not a match.
if (!related) {
@@ -44195,7 +44566,7 @@ var ts;
var result = -1 /* True */;
for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
var type = matchingTypes_1[_b];
- result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties);
+ result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties, /*isIntersectionConstituent*/ false);
if (result) {
result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false);
if (result) {
@@ -44230,7 +44601,7 @@ var ts;
}
return result || properties;
}
- function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */);
var source = getTypeOfSourceProperty(sourceProp);
if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) {
@@ -44270,10 +44641,10 @@ var ts;
return result_7;
}
else {
- return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
- function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {
@@ -44311,7 +44682,7 @@ var ts;
return 0 /* False */;
}
// If the target comes from a partial union prop, allow `undefined` in the target type
- var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
@@ -44334,7 +44705,7 @@ var ts;
}
return related;
}
- function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties, isIntersectionConstituent) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target, excludedProperties);
}
@@ -44423,7 +44794,7 @@ var ts;
if (!(targetProp.flags & 4194304 /* Prototype */)) {
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp && sourceProp !== targetProp) {
- var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, isIntersectionConstituent);
if (!related) {
return 0 /* False */;
}
@@ -44658,23 +45029,27 @@ var ts;
}
}
function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue) {
- var match;
+ // undefined=unknown, true=discriminated, false=not discriminated
+ // The state of each type progresses from left to right. Discriminated types stop at 'true'.
+ var discriminable = target.types.map(function (_) { return undefined; });
for (var _i = 0, discriminators_1 = discriminators; _i < discriminators_1.length; _i++) {
var _a = discriminators_1[_i], getDiscriminatingType = _a[0], propertyName = _a[1];
+ var i = 0;
for (var _b = 0, _c = target.types; _b < _c.length; _b++) {
var type = _c[_b];
var targetType = getTypeOfPropertyOfType(type, propertyName);
if (targetType && related(getDiscriminatingType(), targetType)) {
- if (match) {
- if (type === match)
- continue; // Finding multiple fields which discriminate to the same type is fine
- return defaultValue;
- }
- match = type;
+ discriminable[i] = discriminable[i] === undefined ? true : discriminable[i];
}
+ else {
+ discriminable[i] = false;
+ }
+ i++;
}
}
- return match || defaultValue;
+ var match = discriminable.indexOf(/*searchElement*/ true);
+ // make sure exactly 1 matches before returning it
+ return match === -1 || discriminable.indexOf(/*searchElement*/ true, match + 1) !== -1 ? defaultValue : target.types[match];
}
/**
* A type is 'weak' if it is an object type with at least one optional property
@@ -45486,7 +45861,7 @@ var ts;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
param.parent.parameters.indexOf(param) > -1 &&
- (resolveName(param, param.name.escapedText, 67897832 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
+ (resolveName(param, param.name.escapedText, 788968 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
param.name.originalKeywordKind && ts.isTypeNodeKind(param.name.originalKeywordKind))) {
var newName = "arg" + param.parent.parameters.indexOf(param);
errorOrSuggestion(noImplicitAny, declaration, ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, ts.declarationNameToString(param.name));
@@ -45650,7 +46025,7 @@ var ts;
objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
objectFlags & 32 /* Mapped */ ||
- type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));
+ type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && couldUnionOrIntersectionContainTypeVariables(type));
}
function couldUnionOrIntersectionContainTypeVariables(type) {
if (type.couldContainTypeVariables === undefined) {
@@ -45805,6 +46180,8 @@ var ts;
var visited;
var bivariant = false;
var propagationType;
+ var inferenceMatch = false;
+ var inferenceIncomplete = false;
var allowComplexConstraintInference = true;
inferFromTypes(originalSource, originalTarget);
function inferFromTypes(source, target) {
@@ -45827,43 +46204,54 @@ var ts;
inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
return;
}
- if (source.flags & 1048576 /* Union */ && target.flags & 1048576 /* Union */ && !(source.flags & 1024 /* EnumLiteral */ && target.flags & 1024 /* EnumLiteral */) ||
- source.flags & 2097152 /* Intersection */ && target.flags & 2097152 /* Intersection */) {
- // Source and target are both unions or both intersections. If source and target
- // are the same type, just relate each constituent type to itself.
- if (source === target) {
- for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
- var t = _a[_i];
- inferFromTypes(t, t);
- }
- return;
+ if (source === target && source.flags & 3145728 /* UnionOrIntersection */) {
+ // When source and target are the same union or intersection type, just relate each constituent
+ // type to itself.
+ for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ inferFromTypes(t, t);
}
- // Find each source constituent type that has an identically matching target constituent
- // type, and for each such type infer from the type to itself. When inferring from a
- // type to itself we effectively find all type parameter occurrences within that type
- // and infer themselves as their type arguments. We have special handling for numeric
- // and string literals because the number and string types are not represented as unions
- // of all their possible values.
- var matchingTypes = void 0;
- for (var _b = 0, _c = source.types; _b < _c.length; _b++) {
- var t = _c[_b];
- if (typeIdenticalToSomeType(t, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t);
- inferFromTypes(t, t);
- }
- else if (t.flags & (256 /* NumberLiteral */ | 128 /* StringLiteral */)) {
- var b = getBaseTypeOfLiteralType(t);
- if (typeIdenticalToSomeType(b, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t, b);
- }
+ return;
+ }
+ if (target.flags & 1048576 /* Union */) {
+ if (source.flags & 1048576 /* Union */) {
+ // First, infer between identically matching source and target constituents and remove the
+ // matching types.
+ var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
+ // Next, infer between closely matching source and target constituents and remove
+ // the matching types. Types closely match when they are instantiations of the same
+ // object type or instantiations of the same type alias.
+ var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
}
+ source = getUnionType(sources);
+ target = getUnionType(targets);
}
- // Next, to improve the quality of inferences, reduce the source and target types by
- // removing the identically matched constituents. For example, when inferring from
- // 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'.
- if (matchingTypes) {
- source = removeTypesFromUnionOrIntersection(source, matchingTypes);
- target = removeTypesFromUnionOrIntersection(target, matchingTypes);
+ else {
+ if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
+ return;
+ if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
+ return;
+ }
+ }
+ else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
+ // We reduce intersection types only when they contain naked type parameters. For example, when
+ // inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
+ // infer { extra: any } for T. But when inferring to 'string[] & Iterable' we want to keep the
+ // string[] on the source side and infer string for T.
+ if (source.flags & 2097152 /* Intersection */) {
+ // Infer between identically matching source and target constituents and remove the matching types.
+ var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
+ }
+ source = getIntersectionType(sources);
+ target = getIntersectionType(targets);
+ }
+ else if (!(source.flags & 1048576 /* Union */)) {
+ if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
+ return;
}
}
else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
@@ -45909,13 +46297,14 @@ var ts;
clearCachedInferences(inferences);
}
}
+ inferenceMatch = true;
return;
}
else {
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
var simplified = getSimplifiedType(target, /*writing*/ false);
if (simplified !== target) {
- inferFromTypesOnce(source, simplified);
+ invokeOnce(source, simplified, inferFromTypes);
}
else if (target.flags & 8388608 /* IndexedAccess */) {
var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
@@ -45924,13 +46313,13 @@ var ts;
if (indexType.flags & 63176704 /* Instantiable */) {
var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
if (simplified_1 && simplified_1 !== target) {
- inferFromTypesOnce(source, simplified_1);
+ invokeOnce(source, simplified_1, inferFromTypes);
}
}
}
}
}
- if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {
+ if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
// If source and target are references to the same generic type, infer from type arguments
inferFromTypeArguments(source.typeArguments || ts.emptyArray, target.typeArguments || ts.emptyArray, getVariances(source.target));
}
@@ -45960,16 +46349,16 @@ var ts;
}
else if (target.flags & 16777216 /* Conditional */ && !contravariant) {
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
- inferToMultipleTypes(source, targetTypes, /*isIntersection*/ false);
+ inferToMultipleTypes(source, targetTypes, target.flags);
}
else if (target.flags & 3145728 /* UnionOrIntersection */) {
- inferToMultipleTypes(source, target.types, !!(target.flags & 2097152 /* Intersection */));
+ inferToMultipleTypes(source, target.types, target.flags);
}
else if (source.flags & 1048576 /* Union */) {
// Source is a union or intersection type, infer from each constituent type
var sourceTypes = source.types;
- for (var _d = 0, sourceTypes_3 = sourceTypes; _d < sourceTypes_3.length; _d++) {
- var sourceType = sourceTypes_3[_d];
+ for (var _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) {
+ var sourceType = sourceTypes_3[_e];
inferFromTypes(sourceType, target);
}
}
@@ -45993,38 +46382,59 @@ var ts;
source = apparentSource;
}
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
- var key = source.id + "," + target.id;
- if (visited && visited.get(key)) {
- return;
- }
- (visited || (visited = ts.createMap())).set(key, true);
- // If we are already processing another target type with the same associated symbol (such as
- // an instantiation of the same generic type), we do not explore this target as it would yield
- // no further inferences. We exclude the static side of classes from this check since it shares
- // its symbol with the instance side which would lead to false positives.
- var isNonConstructorObject = target.flags & 524288 /* Object */ &&
- !(ts.getObjectFlags(target) & 16 /* Anonymous */ && target.symbol && target.symbol.flags & 32 /* Class */);
- var symbol = isNonConstructorObject ? target.symbol : undefined;
- if (symbol) {
- if (ts.contains(symbolStack, symbol)) {
- return;
- }
- (symbolStack || (symbolStack = [])).push(symbol);
- inferFromObjectTypes(source, target);
- symbolStack.pop();
- }
- else {
- inferFromObjectTypes(source, target);
+ invokeOnce(source, target, inferFromObjectTypes);
+ }
+ }
+ }
+ function invokeOnce(source, target, action) {
+ var key = source.id + "," + target.id;
+ var status = visited && visited.get(key);
+ if (status !== undefined) {
+ if (status & 1)
+ inferenceMatch = true;
+ if (status & 2)
+ inferenceIncomplete = true;
+ return;
+ }
+ (visited || (visited = ts.createMap())).set(key, 0);
+ var saveInferenceMatch = inferenceMatch;
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceMatch = false;
+ inferenceIncomplete = false;
+ action(source, target);
+ visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0));
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ }
+ function inferFromMatchingType(source, targets, matches) {
+ var matched = false;
+ for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
+ var t = targets_1[_i];
+ if (matches(source, t)) {
+ inferFromTypes(source, t);
+ matched = true;
+ }
+ }
+ return matched;
+ }
+ function inferFromMatchingTypes(sources, targets, matches) {
+ var matchedSources;
+ var matchedTargets;
+ for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
+ var t = targets_2[_i];
+ for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
+ var s = sources_1[_a];
+ if (matches(s, t)) {
+ inferFromTypes(s, t);
+ matchedSources = ts.appendIfUnique(matchedSources, s);
+ matchedTargets = ts.appendIfUnique(matchedTargets, t);
}
}
}
- function inferFromTypesOnce(source, target) {
- var key = source.id + "," + target.id;
- if (!visited || !visited.get(key)) {
- (visited || (visited = ts.createMap())).set(key, true);
- inferFromTypes(source, target);
- }
- }
+ return [
+ matchedSources ? ts.filter(sources, function (t) { return !ts.contains(matchedSources, t); }) : sources,
+ matchedTargets ? ts.filter(targets, function (t) { return !ts.contains(matchedTargets, t); }) : targets,
+ ];
}
function inferFromTypeArguments(sourceTypes, targetTypes, variances) {
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
@@ -46058,29 +46468,69 @@ var ts;
}
return undefined;
}
- function inferToMultipleTypes(source, targets, isIntersection) {
- // We infer from types that are not naked type variables first so that inferences we
- // make from nested naked type variables and given slightly higher priority by virtue
- // of being first in the candidates array.
+ function inferToMultipleTypes(source, targets, targetFlags) {
var typeVariableCount = 0;
- for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
- var t = targets_1[_i];
- if (getInferenceInfoForType(t)) {
- typeVariableCount++;
+ if (targetFlags & 1048576 /* Union */) {
+ var nakedTypeVariable = void 0;
+ var sources = source.flags & 1048576 /* Union */ ? source.types : [source];
+ var matched_1 = new Array(sources.length);
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceIncomplete = false;
+ // First infer to types that are not naked type variables. For each source type we
+ // track whether inferences were made from that particular type to some target.
+ for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
+ var t = targets_3[_i];
+ if (getInferenceInfoForType(t)) {
+ nakedTypeVariable = t;
+ typeVariableCount++;
+ }
+ else {
+ for (var i = 0; i < sources.length; i++) {
+ var saveInferenceMatch = inferenceMatch;
+ inferenceMatch = false;
+ inferFromTypes(sources[i], t);
+ if (inferenceMatch)
+ matched_1[i] = true;
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ }
+ }
}
- else {
- inferFromTypes(source, t);
+ var inferenceComplete = !inferenceIncomplete;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ // If the target has a single naked type variable and inference completed (meaning we
+ // explored the types fully), create a union of the source types from which no inferences
+ // have been made so far and infer from that union to the naked type variable.
+ if (typeVariableCount === 1 && inferenceComplete) {
+ var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; });
+ if (unmatched.length) {
+ inferFromTypes(getUnionType(unmatched), nakedTypeVariable);
+ return;
+ }
+ }
+ }
+ else {
+ // We infer from types that are not naked type variables first so that inferences we
+ // make from nested naked type variables and given slightly higher priority by virtue
+ // of being first in the candidates array.
+ for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
+ var t = targets_4[_a];
+ if (getInferenceInfoForType(t)) {
+ typeVariableCount++;
+ }
+ else {
+ inferFromTypes(source, t);
+ }
}
}
// Inferences directly to naked type variables are given lower priority as they are
// less specific. For example, when inferring from Promise to T | Promise,
// we want to infer string for T, not Promise | string. For intersection types
// we only infer to single naked type variables.
- if (isIntersection ? typeVariableCount === 1 : typeVariableCount !== 0) {
+ if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) {
var savePriority = priority;
priority |= 1 /* NakedTypeVariable */;
- for (var _a = 0, targets_2 = targets; _a < targets_2.length; _a++) {
- var t = targets_2[_a];
+ for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
+ var t = targets_5[_b];
if (getInferenceInfoForType(t)) {
inferFromTypes(source, t);
}
@@ -46145,6 +46595,27 @@ var ts;
return false;
}
function inferFromObjectTypes(source, target) {
+ // If we are already processing another target type with the same associated symbol (such as
+ // an instantiation of the same generic type), we do not explore this target as it would yield
+ // no further inferences. We exclude the static side of classes from this check since it shares
+ // its symbol with the instance side which would lead to false positives.
+ var isNonConstructorObject = target.flags & 524288 /* Object */ &&
+ !(ts.getObjectFlags(target) & 16 /* Anonymous */ && target.symbol && target.symbol.flags & 32 /* Class */);
+ var symbol = isNonConstructorObject ? target.symbol : undefined;
+ if (symbol) {
+ if (ts.contains(symbolStack, symbol)) {
+ inferenceIncomplete = true;
+ return;
+ }
+ (symbolStack || (symbolStack = [])).push(symbol);
+ inferFromObjectTypesWorker(source, target);
+ symbolStack.pop();
+ }
+ else {
+ inferFromObjectTypesWorker(source, target);
+ }
+ }
+ function inferFromObjectTypesWorker(source, target) {
if (isGenericMappedType(source) && isGenericMappedType(target)) {
// The source and target types are generic types { [P in S]: X } and { [P in T]: Y }, so we infer
// from S to T and from X to Y.
@@ -46243,28 +46714,12 @@ var ts;
}
}
}
- function typeIdenticalToSomeType(type, types) {
- for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
- var t = types_11[_i];
- if (isTypeIdenticalTo(t, type)) {
- return true;
- }
- }
- return false;
+ function isTypeOrBaseIdenticalTo(s, t) {
+ return isTypeIdenticalTo(s, t) || !!(s.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t);
}
- /**
- * Return a new union or intersection type computed by removing a given set of types
- * from a given union or intersection type.
- */
- function removeTypesFromUnionOrIntersection(type, typesToRemove) {
- var reducedTypes = [];
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (!typeIdenticalToSomeType(t, typesToRemove)) {
- reducedTypes.push(t);
- }
- }
- return type.flags & 1048576 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);
+ function isTypeCloselyMatchedBy(s, t) {
+ return !!(s.flags & 524288 /* Object */ && t.flags & 524288 /* Object */ && s.symbol && s.symbol === t.symbol ||
+ s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol);
}
function hasPrimitiveConstraint(type) {
var constraint = getConstraintOfTypeParameter(type);
@@ -46415,7 +46870,7 @@ var ts;
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
+ resolveName(node, node.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
/*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
@@ -46612,8 +47067,8 @@ var ts;
}
function getTypeFactsOfTypes(types) {
var result = 0 /* None */;
- for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
- var t = types_12[_i];
+ for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
+ var t = types_11[_i];
result |= getTypeFacts(t);
}
return result;
@@ -46988,8 +47443,8 @@ var ts;
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var t = types_13[_i];
+ for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
+ var t = types_12[_i];
if (!(t.flags & 131072 /* Never */)) {
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
return false;
@@ -47941,8 +48396,11 @@ var ts;
}
return type;
}
+ function isExportOrExportExpression(location) {
+ return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); });
+ }
function markAliasReferenced(symbol, location) {
- if (isNonLocalAlias(symbol, /*excludes*/ 67220415 /* Value */) && !isInTypeQuery(location) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && ((compilerOptions.preserveConstEnums && isExportOrExportExpression(location)) || !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol)))) {
markAliasSymbolAsReferenced(symbol);
}
}
@@ -48835,6 +49293,15 @@ var ts;
}
return false;
}
+ function getContextualIterationType(kind, functionDecl) {
+ var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2 /* Async */);
+ var contextualReturnType = getContextualReturnType(functionDecl);
+ if (contextualReturnType) {
+ return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
+ || undefined;
+ }
+ return undefined;
+ }
function getContextualReturnType(functionDecl) {
// If the containing function has a return type annotation, is a constructor, or is a get accessor whose
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
@@ -48928,7 +49395,7 @@ var ts;
}
else if (ts.isIdentifier(lhs.expression)) {
var id = lhs.expression;
- var parentSymbol = resolveName(id, id.escapedText, 67220415 /* Value */, undefined, id.escapedText, /*isUse*/ true);
+ var parentSymbol = resolveName(id, id.escapedText, 111551 /* Value */, undefined, id.escapedText, /*isUse*/ true);
if (parentSymbol) {
var annotated = ts.getEffectiveTypeAnnotationNode(parentSymbol.valueDeclaration);
if (annotated) {
@@ -49116,9 +49583,12 @@ var ts;
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
// be "pushed" onto a node using the contextualType property.
function getApparentTypeOfContextualType(node, contextFlags) {
- var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
- if (contextualType) {
- var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true);
+ var contextualType = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, contextFlags) :
+ getContextualType(node, contextFlags);
+ var instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
+ if (instantiatedType) {
+ var apparentType = mapType(instantiatedType, getApparentType, /*noReductions*/ true);
if (apparentType.flags & 1048576 /* Union */) {
if (ts.isObjectLiteralExpression(node)) {
return discriminateContextualTypeByObjectMembers(node, apparentType);
@@ -49168,7 +49638,7 @@ var ts;
return type;
}
/**
- * Woah! Do you really want to use this function?
+ * Whoa! Do you really want to use this function?
*
* Unless you're trying to get the *non-apparent* type for a
* value-literal type or you're authoring relevant portions of this algorithm,
@@ -49419,9 +49889,7 @@ var ts;
if (typeTagSignature) {
return typeTagSignature;
}
- var type = ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) :
- getApparentTypeOfContextualType(node, 1 /* Signature */);
+ var type = getApparentTypeOfContextualType(node, 1 /* Signature */);
if (!type) {
return undefined;
}
@@ -49430,8 +49898,8 @@ var ts;
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var current = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var current = types_13[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -49982,7 +50450,7 @@ var ts;
function getJsxType(name, location) {
var namespace = getJsxNamespaceAt(location);
var exports = namespace && getExportsOfSymbol(namespace);
- var typeSymbol = exports && getSymbol(exports, name, 67897832 /* Type */);
+ var typeSymbol = exports && getSymbol(exports, name, 788968 /* Type */);
return typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType;
}
/**
@@ -50056,7 +50524,7 @@ var ts;
*/
function getNameFromJsxElementAttributesContainer(nameOfAttribPropContainer, jsxNamespace) {
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [symbol]
- var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 67897832 /* Type */);
+ var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 788968 /* Type */);
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [type]
var jsxElementAttribPropInterfaceType = jsxElementAttribPropInterfaceSym && getDeclaredTypeOfSymbol(jsxElementAttribPropInterfaceSym);
// The properties of JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute
@@ -50080,7 +50548,7 @@ var ts;
}
function getJsxLibraryManagedAttributes(jsxNamespace) {
// JSX.LibraryManagedAttributes [symbol]
- return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 67897832 /* Type */);
+ return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 788968 /* Type */);
}
/// e.g. "props" for React.d.ts,
/// or 'undefined' if ElementAttributesProperty doesn't exist (which means all
@@ -50232,13 +50700,13 @@ var ts;
var reactRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
var reactNamespace = getJsxNamespace(node);
var reactLocation = isNodeOpeningLikeElement ? node.tagName : node;
- var reactSym = resolveName(reactLocation, reactNamespace, 67220415 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true);
+ var reactSym = resolveName(reactLocation, reactNamespace, 111551 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true);
if (reactSym) {
// Mark local symbol as referenced here because it might not have been marked
// if jsx emit was not react as there wont be error being emitted
reactSym.isReferenced = 67108863 /* All */;
- // If react symbol is alias, mark it as referenced
- if (reactSym.flags & 2097152 /* Alias */ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) {
+ // If react symbol is alias, mark it as refereced
+ if (reactSym.flags & 2097152 /* Alias */) {
markAliasSymbolAsReferenced(reactSym);
}
}
@@ -50563,7 +51031,7 @@ var ts;
}
function checkPropertyNotUsedBeforeDeclaration(prop, node, right) {
var valueDeclaration = prop.valueDeclaration;
- if (!valueDeclaration) {
+ if (!valueDeclaration || ts.getSourceFileOfNode(node).isDeclarationFile) {
return;
}
var diagnosticMessage;
@@ -50679,7 +51147,7 @@ var ts;
return prop !== undefined && prop.valueDeclaration && ts.hasModifier(prop.valueDeclaration, 32 /* Static */);
}
function getSuggestedSymbolForNonexistentProperty(name, containingType) {
- return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 67220415 /* Value */);
+ return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 111551 /* Value */);
}
function getSuggestionForNonexistentProperty(name, containingType) {
var suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
@@ -52163,8 +52631,8 @@ var ts;
if (apparentType.flags & 1048576 /* Union */) {
var types = apparentType.types;
var hasSignatures = false;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var constituent = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var constituent = types_14[_i];
var signatures = getSignaturesOfType(constituent, kind);
if (signatures.length !== 0) {
hasSignatures = true;
@@ -52315,8 +52783,8 @@ var ts;
var exports = namespace && getExportsOfSymbol(namespace);
// We fake up a SFC signature for each intrinsic, however a more specific per-element signature drawn from the JSX declaration
// file would probably be preferable.
- var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */);
- var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node);
+ var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* Type */);
+ var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* Type */, node);
var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */));
var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
parameterSymbol.type = result;
@@ -52545,7 +53013,7 @@ var ts;
if (!globalESSymbol) {
return false;
}
- return globalESSymbol === resolveName(left, "Symbol", 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
+ return globalESSymbol === resolveName(left, "Symbol", 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
}
function checkImportCallExpression(node) {
// Check grammar of dynamic import
@@ -52605,7 +53073,7 @@ var ts;
// Make sure require is not a local function
if (!ts.isIdentifier(node.expression))
return ts.Debug.fail();
- var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); // TODO: GH#18217
+ var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); // TODO: GH#18217
if (resolvedRequire === requireSymbol) {
return true;
}
@@ -52714,8 +53182,8 @@ var ts;
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
- error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
+ error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system);
}
var file = ts.getSourceFileOfNode(node);
ts.Debug.assert(!!(file.flags & 1048576 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
@@ -52905,7 +53373,7 @@ var ts;
links.type = contextualType;
var decl = parameter.valueDeclaration;
if (decl.name.kind !== 73 /* Identifier */) {
- // if inference didn't come up with anything but {}, fall back to the binding pattern if present.
+ // if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
@@ -53013,7 +53481,7 @@ var ts;
nextType && isUnitType(nextType)) {
var contextualType = !contextualSignature ? undefined :
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
- getReturnTypeOfSignature(contextualSignature);
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
if (isGenerator) {
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0 /* Yield */, isAsync);
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1 /* Return */, isAsync);
@@ -53031,7 +53499,7 @@ var ts;
nextType = getWidenedType(nextType);
}
if (isGenerator) {
- return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || unknownType, isAsync);
+ return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || getContextualIterationType(2 /* Next */, func) || unknownType, isAsync);
}
else {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -53151,8 +53619,8 @@ var ts;
var witnesses = getSwitchClauseTypeOfWitnesses(node);
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
- var type_5 = getBaseConstraintOfType(operandType) || operandType;
- return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
+ var type_4 = getBaseConstraintOfType(operandType) || operandType;
+ return !!(filterType(type_4, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
}
var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
@@ -53525,7 +53993,11 @@ var ts;
}
}
var operandType = checkExpression(node.expression);
- return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ var awaitedType = checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ if (awaitedType === operandType && awaitedType !== errorType && !(operandType.flags & 3 /* AnyOrUnknown */)) {
+ addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(node, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
+ }
+ return awaitedType;
}
function checkPrefixUnaryExpression(node) {
var operandType = checkExpression(node.operand);
@@ -53610,8 +54082,8 @@ var ts;
}
if (type.flags & 3145728 /* UnionOrIntersection */) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -53720,7 +54192,7 @@ var ts;
error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
else {
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(property, 4 /* Rest */);
}
var nonRestNames = [];
@@ -54094,7 +54566,7 @@ var ts;
var propType = getTypeOfSymbol(prop);
if (propType.symbol && propType.symbol.flags & 32 /* Class */) {
var name = prop.escapedName;
- var symbol = resolveName(prop.valueDeclaration, name, 67897832 /* Type */, undefined, name, /*isUse*/ false);
+ var symbol = resolveName(prop.valueDeclaration, name, 788968 /* Type */, undefined, name, /*isUse*/ false);
if (symbol && symbol.declarations.some(ts.isJSDocTypedefTag)) {
grammarErrorOnNode(symbol.declarations[0], ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
return grammarErrorOnNode(prop.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
@@ -54243,7 +54715,7 @@ var ts;
if (node.asteriskToken) {
// Async generator functions prior to ESNext require the __await, __asyncDelegator,
// and __asyncValues helpers
- if (isAsync && languageVersion < 8 /* ESNext */) {
+ if (isAsync && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 53248 /* AsyncDelegatorIncludes */);
}
// Generator functions prior to ES2015 require the __values helper
@@ -54273,7 +54745,7 @@ var ts;
return getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, isAsync)
|| anyType;
}
- return anyType;
+ return getContextualIterationType(2 /* Next */, func) || anyType;
}
function checkConditionalExpression(node, checkMode) {
checkTruthinessExpression(node.condition);
@@ -54623,7 +55095,8 @@ var ts;
var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) ||
(node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) ||
((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node));
+ (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node)) ||
+ (node.parent.kind === 258 /* ExportSpecifier */ && (compilerOptions.preserveConstEnums || node.flags & 4194304 /* Ambient */)); // We allow reexporting const enums
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -54888,7 +55361,7 @@ var ts;
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4 /* Invalid */)) {
// Async generators prior to ESNext require the __await and __asyncGenerator helpers
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) {
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 12288 /* AsyncGeneratorIncludes */);
}
// Async functions prior to ES2017 require the __awaiter helper
@@ -54951,13 +55424,6 @@ var ts;
}
}
function checkClassForDuplicateDeclarations(node) {
- var Declaration;
- (function (Declaration) {
- Declaration[Declaration["Getter"] = 1] = "Getter";
- Declaration[Declaration["Setter"] = 2] = "Setter";
- Declaration[Declaration["Method"] = 4] = "Method";
- Declaration[Declaration["Property"] = 3] = "Property";
- })(Declaration || (Declaration = {}));
var instanceNames = ts.createUnderscoreEscapedMap();
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
@@ -54966,7 +55432,7 @@ var ts;
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
- addName(instanceNames, param.name, param.name.escapedText, 3 /* Property */);
+ addName(instanceNames, param.name, param.name.escapedText, 3 /* GetOrSetAccessor */);
}
}
}
@@ -54978,16 +55444,16 @@ var ts;
if (name && memberName) {
switch (member.kind) {
case 159 /* GetAccessor */:
- addName(names, name, memberName, 1 /* Getter */);
+ addName(names, name, memberName, 1 /* GetAccessor */);
break;
case 160 /* SetAccessor */:
- addName(names, name, memberName, 2 /* Setter */);
+ addName(names, name, memberName, 2 /* SetAccessor */);
break;
case 155 /* PropertyDeclaration */:
- addName(names, name, memberName, 3 /* Property */);
+ addName(names, name, memberName, 3 /* GetOrSetAccessor */);
break;
case 157 /* MethodDeclaration */:
- addName(names, name, memberName, 4 /* Method */);
+ addName(names, name, memberName, 8 /* Method */);
break;
}
}
@@ -54996,8 +55462,8 @@ var ts;
function addName(names, location, name, meaning) {
var prev = names.get(name);
if (prev) {
- if (prev & 4 /* Method */) {
- if (meaning !== 4 /* Method */) {
+ if (prev & 8 /* Method */) {
+ if (meaning !== 8 /* Method */) {
error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));
}
}
@@ -55565,6 +56031,7 @@ var ts;
}
var duplicateFunctionDeclaration = false;
var multipleConstructorImplementation = false;
+ var hasNonAmbientClass = false;
for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
var current = declarations_4[_i];
var node = current;
@@ -55580,6 +56047,9 @@ var ts;
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
+ if ((node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */) && !inAmbientContext) {
+ hasNonAmbientClass = true;
+ }
if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
@@ -55621,6 +56091,15 @@ var ts;
error(ts.getNameOfDeclaration(declaration), ts.Diagnostics.Duplicate_function_implementation);
});
}
+ if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */) {
+ // A non-ambient class cannot be an implementation for a non-constructor function/class merge
+ // TODO: The below just replicates our older error from when classes and functions were
+ // entirely unable to merge - a more helpful message like "Class declaration cannot implement overload list"
+ // might be warranted. :shrug:
+ ts.forEach(declarations, function (declaration) {
+ addDuplicateDeclarationError(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Duplicate_identifier_0, ts.symbolName(symbol), ts.filter(declarations, function (d) { return d !== declaration; }));
+ });
+ }
// Abstract methods can't have an implementation -- in particular, they don't need one.
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&
!ts.hasModifier(lastSeenNonAmbientDeclaration, 128 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) {
@@ -55642,13 +56121,6 @@ var ts;
}
}
}
- var DeclarationSpaces;
- (function (DeclarationSpaces) {
- DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None";
- DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue";
- DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType";
- DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace";
- })(DeclarationSpaces || (DeclarationSpaces = {}));
function checkExportsOnMergedDeclarations(node) {
if (!produceDiagnostics) {
return;
@@ -55712,8 +56184,9 @@ var ts;
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return 2 /* ExportType */;
case 245 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
@@ -55811,9 +56284,6 @@ var ts;
*/
function checkAwaitedType(type, errorNode, diagnosticMessage, arg0) {
var awaitedType = getAwaitedType(type, errorNode, diagnosticMessage, arg0);
- if (awaitedType === type && !(type.flags & 3 /* AnyOrUnknown */)) {
- addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(errorNode, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
- }
return awaitedType || errorType;
}
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -55972,7 +56442,7 @@ var ts;
error(returnTypeNode, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
return;
}
- var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true);
+ var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 111551 /* Value */, /*ignoreErrors*/ true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
@@ -55995,7 +56465,7 @@ var ts;
}
// Verify there is no local declaration that could collide with the promise constructor.
var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
- var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 67220415 /* Value */);
+ var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 111551 /* Value */);
if (collidingSymbol) {
error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, ts.idText(rootName), ts.entityNameToString(promiseConstructorName));
return;
@@ -56052,7 +56522,7 @@ var ts;
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
+ var meaning = (typeName.kind === 73 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true);
if (rootSymbol
&& rootSymbol.flags & 2097152 /* Alias */
@@ -56091,8 +56561,8 @@ var ts;
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
@@ -56820,7 +57290,7 @@ var ts;
}
}
if (node.kind === 187 /* BindingElement */) {
- if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) {
+ if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 4 /* Rest */);
}
// check computed properties inside property names of binding elements
@@ -57034,7 +57504,7 @@ var ts;
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) {
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 99 /* ESNext */) {
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
checkExternalEmitHelpers(node, 32768 /* ForAwaitOfIncludes */);
}
@@ -58311,7 +58781,7 @@ var ts;
// derived class instance member variables and accessors, but not by other kinds of members.
// NOTE: assignability is checked in checkClassDeclaration
var baseProperties = getPropertiesOfType(baseType);
- for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
+ basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304 /* Prototype */) {
@@ -58320,54 +58790,65 @@ var ts;
var derived = getTargetSymbol(getPropertyOfObjectType(type, base.escapedName)); // TODO: GH#18217
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration.");
- if (derived) {
- // In order to resolve whether the inherited method was overridden in the base class or not,
- // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
- // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
- if (derived === base) {
- // derived class inherits base without override/redeclaration
- var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
- // It is an error to inherit an abstract member without implementing it or being declared abstract.
- // If there is no declaration for the derived class (as in the case of class expressions),
- // then the class cannot be declared abstract.
- if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 210 /* ClassExpression */) {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
- }
- else {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
+ // In order to resolve whether the inherited method was overridden in the base class or not,
+ // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
+ // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
+ if (derived === base) {
+ // derived class inherits base without override/redeclaration
+ var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
+ // It is an error to inherit an abstract member without implementing it or being declared abstract.
+ // If there is no declaration for the derived class (as in the case of class expressions),
+ // then the class cannot be declared abstract.
+ if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
+ // Searches other base types for a declaration that would satisfy the inherited abstract member.
+ // (The class may have more than one base type via declaration merging with an interface with the
+ // same name.)
+ for (var _a = 0, _b = getBaseTypes(type); _a < _b.length; _a++) {
+ var otherBaseType = _b[_a];
+ if (otherBaseType === baseType)
+ continue;
+ var baseSymbol = getPropertyOfObjectType(otherBaseType, base.escapedName);
+ var derivedElsewhere = baseSymbol && getTargetSymbol(baseSymbol);
+ if (derivedElsewhere && derivedElsewhere !== base) {
+ continue basePropertyCheck;
}
}
- }
- else {
- // derived overrides base.
- var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
- if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
- // either base or derived property is private - not override, skip it
- continue;
- }
- if (isPrototypeProperty(base) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) {
- // method is overridden with method or property/accessor is overridden with property/accessor - correct case
- continue;
- }
- var errorMessage = void 0;
- if (isPrototypeProperty(base)) {
- if (derived.flags & 98304 /* Accessor */) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
- }
- else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
- }
- }
- else if (base.flags & 98304 /* Accessor */) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ if (derivedClassDecl.kind === 210 /* ClassExpression */) {
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
}
- error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
}
}
+ else {
+ // derived overrides base.
+ var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
+ if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
+ // either base or derived property is private - not override, skip it
+ continue;
+ }
+ if (isPrototypeProperty(base) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) {
+ // method is overridden with method or property/accessor is overridden with property/accessor - correct case
+ continue;
+ }
+ var errorMessage = void 0;
+ if (isPrototypeProperty(base)) {
+ if (derived.flags & 98304 /* Accessor */) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
+ }
+ }
+ else if (base.flags & 98304 /* Accessor */) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
+ }
}
}
function checkInheritedPropertiesAreIdentical(type, typeNode) {
@@ -58911,15 +59392,16 @@ var ts;
function checkAliasSymbol(node) {
var symbol = getSymbolOfNode(node);
var target = resolveAlias(symbol);
- if (target !== unknownSymbol) {
- // For external modules symbol represent local symbol for an alias.
+ var shouldSkipWithJSExpandoTargets = symbol.flags & 67108864 /* Assignment */;
+ if (!shouldSkipWithJSExpandoTargets && target !== unknownSymbol) {
+ // For external modules symbol represents local symbol for an alias.
// This local symbol will merge any other local declarations (excluding other aliases)
// and symbol.flags will contains combined representation for all merged declaration.
// Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,
// otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export*
// in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).
- var excludedMeanings = (symbol.flags & (67220415 /* Value */ | 1048576 /* ExportValue */) ? 67220415 /* Value */ : 0) |
- (symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) |
+ var excludedMeanings = (symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */) ? 111551 /* Value */ : 0) |
+ (symbol.flags & 788968 /* Type */ ? 788968 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
var message = node.kind === 258 /* ExportSpecifier */ ?
@@ -58930,7 +59412,7 @@ var ts;
// Don't allow to re-export something with no value side when `--isolatedModules` is set.
if (compilerOptions.isolatedModules
&& node.kind === 258 /* ExportSpecifier */
- && !(target.flags & 67220415 /* Value */)
+ && !(target.flags & 111551 /* Value */)
&& !(node.flags & 4194304 /* Ambient */)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
}
@@ -58983,14 +59465,14 @@ var ts;
if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
- if (target.flags & 67220415 /* Value */) {
+ if (target.flags & 111551 /* Value */) {
// Target is a value symbol, check that it is not hidden by a local declaration with the same name
var moduleName = getFirstIdentifier(node.moduleReference);
- if (!(resolveEntityName(moduleName, 67220415 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
+ if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
}
}
- if (target.flags & 67897832 /* Type */) {
+ if (target.flags & 788968 /* Type */) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
}
}
@@ -59050,13 +59532,17 @@ var ts;
if (!node.parent.parent.moduleSpecifier) {
var exportedName = node.propertyName || node.name;
// find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases)
- var symbol = resolveName(exportedName, exportedName.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
+ var symbol = resolveName(exportedName, exportedName.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
/*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
}
else {
markExportAsReferenced(node);
+ var target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
+ if (!target || target === unknownSymbol || target.flags & 111551 /* Value */) {
+ checkExpressionCached(node.propertyName || node.name);
+ }
}
}
}
@@ -59080,7 +59566,17 @@ var ts;
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
if (node.expression.kind === 73 /* Identifier */) {
- markExportAsReferenced(node);
+ var id = node.expression;
+ var sym = resolveEntityName(id, 67108863 /* All */, /*ignoreErrors*/ true, /*dontResolveAlias*/ true, node);
+ if (sym) {
+ markAliasReferenced(sym, id);
+ // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
+ var target = sym.flags & 2097152 /* Alias */ ? resolveAlias(sym) : sym;
+ if (target === unknownSymbol || target.flags & 111551 /* Value */) {
+ // However if it is a value, we need to check it's being used correctly
+ checkExpressionCached(node.expression);
+ }
+ }
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, /*setVisibility*/ true);
}
@@ -59149,14 +59645,6 @@ var ts;
links.exportsChecked = true;
}
}
- function isNotAccessor(declaration) {
- // Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
- return !ts.isAccessor(declaration);
- }
- function isNotOverload(declaration) {
- return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
- !!declaration.body;
- }
function checkSourceElement(node) {
if (node) {
var saveCurrentNode = currentNode;
@@ -59236,16 +59724,17 @@ var ts;
return checkInferType(node);
case 184 /* ImportType */:
return checkImportType(node);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return checkJSDocTypeAliasTag(node);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return checkJSDocTemplateTag(node);
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
return checkJSDocTypeTag(node);
- case 306 /* JSDocParameterTag */:
+ case 307 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
case 295 /* JSDocFunctionType */:
checkJSDocFunctionType(node);
@@ -59254,7 +59743,7 @@ var ts;
case 292 /* JSDocNullableType */:
case 290 /* JSDocAllType */:
case 291 /* JSDocUnknownType */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
@@ -59595,7 +60084,7 @@ var ts;
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
// Note: that the memberFlags come from previous iteration.
if (!isStatic) {
- copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */);
+ copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* Type */);
}
break;
case 197 /* FunctionExpression */:
@@ -59748,7 +60237,7 @@ var ts;
if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
// Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression
var success = resolveEntityName(entityName,
- /*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
+ /*all meanings*/ 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
if (success && success !== unknownSymbol) {
return success;
}
@@ -59774,10 +60263,10 @@ var ts;
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) {
- meaning = 67897832 /* Type */;
+ meaning = 788968 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
- meaning |= 67220415 /* Value */;
+ meaning |= 111551 /* Value */;
}
}
else {
@@ -59789,10 +60278,10 @@ var ts;
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 306 /* JSDocParameterTag */) {
+ if (entityName.parent.kind === 307 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 310 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 311 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -59807,7 +60296,7 @@ var ts;
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
- return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
+ return resolveEntityName(entityName, 111551 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) {
var links = getNodeLinks(entityName);
@@ -59824,7 +60313,7 @@ var ts;
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
+ var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
if (entityName.parent.kind === 164 /* TypePredicate */) {
@@ -59934,7 +60423,7 @@ var ts;
}
function getShorthandAssignmentValueSymbol(location) {
if (location && location.kind === 277 /* ShorthandPropertyAssignment */) {
- return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */);
+ return resolveEntityName(location.name, 111551 /* Value */ | 2097152 /* Alias */);
}
return undefined;
}
@@ -59942,7 +60431,7 @@ var ts;
function getExportSpecifierLocalTargetSymbol(node) {
return node.parent.parent.moduleSpecifier ?
getExternalModuleMember(node.parent.parent, node) :
- resolveEntityName(node.propertyName || node.name, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ resolveEntityName(node.propertyName || node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
function getTypeOfNode(node) {
if (node.flags & 8388608 /* InWithStatement */) {
@@ -60143,13 +60632,13 @@ var ts;
// for export assignments - check if resolved symbol for RHS is itself a value
// otherwise - check if at least one export is value
symbolLinks.exportsSomeValue = hasExportAssignment
- ? !!(moduleSymbol.flags & 67220415 /* Value */)
+ ? !!(moduleSymbol.flags & 111551 /* Value */)
: ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue);
}
return symbolLinks.exportsSomeValue;
function isValue(s) {
s = resolveSymbol(s);
- return s && !!(s.flags & 67220415 /* Value */);
+ return s && !!(s.flags & 111551 /* Value */);
}
}
function isNameOfModuleOrEnumDeclaration(node) {
@@ -60198,7 +60687,7 @@ var ts;
var symbol = getReferencedValueSymbol(node);
// We should only get the declaration of an alias if there isn't a local value
// declaration for the symbol
- if (isNonLocalAlias(symbol, /*excludes*/ 67220415 /* Value */)) {
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */)) {
return getDeclarationOfAliasSymbol(symbol);
}
}
@@ -60215,7 +60704,7 @@ var ts;
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
- if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
+ if (resolveName(container.parent, symbol.escapedName, 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
// redeclaration - always should be renamed
links.isDeclarationWithCollidingName = true;
}
@@ -60311,7 +60800,7 @@ var ts;
}
// const enums and modules that contain only const enums are not considered values from the emit perspective
// unless 'preserveConstEnums' option is set to true
- return !!(target.flags & 67220415 /* Value */) &&
+ return !!(target.flags & 111551 /* Value */) &&
(compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));
}
function isConstEnumOrConstEnumOnlyModule(s) {
@@ -60325,7 +60814,7 @@ var ts;
}
var target = getSymbolLinks(symbol).target; // TODO: GH#18217
if (target && ts.getModifierFlags(node) & 1 /* Export */ &&
- target.flags & 67220415 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
+ target.flags & 111551 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
// An `export import ... =` of a value symbol is always considered referenced
return true;
}
@@ -60379,7 +60868,7 @@ var ts;
if (!symbol || !(symbol.flags & 16 /* Function */)) {
return false;
}
- return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 67220415 /* Value */ && ts.isPropertyAccessExpression(p.valueDeclaration); });
+ return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 111551 /* Value */ && p.valueDeclaration && ts.isPropertyAccessExpression(p.valueDeclaration); });
}
function getPropertiesOfContainerFunction(node) {
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
@@ -60433,9 +60922,9 @@ var ts;
return ts.TypeReferenceSerializationKind.Unknown;
}
// Resolve the symbol as a value to ensure the type can be reached at runtime during emit.
- var valueSymbol = resolveEntityName(typeName, 67220415 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
+ var valueSymbol = resolveEntityName(typeName, 111551 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
// Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.
- var typeSymbol = resolveEntityName(typeName, 67897832 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
+ var typeSymbol = resolveEntityName(typeName, 788968 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
if (valueSymbol && valueSymbol === typeSymbol) {
var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(/*reportErrors*/ false);
if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) {
@@ -60540,7 +61029,7 @@ var ts;
location = getDeclarationContainer(parent);
}
}
- return resolveName(location, reference.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
+ return resolveName(location, reference.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
}
function getReferencedValueDeclaration(referenceIn) {
if (!ts.isGeneratedIdentifier(referenceIn)) {
@@ -60561,7 +61050,7 @@ var ts;
return false;
}
function literalTypeToNode(type, enclosing, tracker) {
- var enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(type.symbol, 67220415 /* Value */, enclosing, /*flags*/ undefined, tracker)
+ var enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(type.symbol, 111551 /* Value */, enclosing, /*flags*/ undefined, tracker)
: type === trueType ? ts.createTrue() : type === falseType && ts.createFalse();
return enumResult || ts.createLiteral(type.value);
}
@@ -60674,9 +61163,9 @@ var ts;
// property access can only be used as values, or types when within an expression with type arguments inside a heritage clause
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
- var meaning = 67897832 /* Type */ | 1920 /* Namespace */;
+ var meaning = 788968 /* Type */ | 1920 /* Namespace */;
if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
- meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
}
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
@@ -60899,7 +61388,7 @@ var ts;
for (var helper = 1 /* FirstEmitHelper */; helper <= 131072 /* LastEmitHelper */; helper <<= 1) {
if (uncheckedHelpers & helper) {
var name = getHelperName(helper);
- var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 67220415 /* Value */);
+ var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 111551 /* Value */);
if (!symbol) {
error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name);
}
@@ -61478,13 +61967,6 @@ var ts;
return !!exclamationToken && grammarErrorOnNode(exclamationToken, message);
}
function checkGrammarObjectLiteralExpression(node, inDestructuring) {
- var Flags;
- (function (Flags) {
- Flags[Flags["Property"] = 1] = "Property";
- Flags[Flags["GetAccessor"] = 2] = "GetAccessor";
- Flags[Flags["SetAccessor"] = 4] = "SetAccessor";
- Flags[Flags["GetOrSetAccessor"] = 6] = "GetOrSetAccessor";
- })(Flags || (Flags = {}));
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
@@ -61536,15 +62018,16 @@ var ts;
if (name.kind === 8 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
- // falls through
+ currentKind = 4 /* PropertyAssignment */;
+ break;
case 157 /* MethodDeclaration */:
- currentKind = 1 /* Property */;
+ currentKind = 8 /* Method */;
break;
case 159 /* GetAccessor */:
- currentKind = 2 /* GetAccessor */;
+ currentKind = 1 /* GetAccessor */;
break;
case 160 /* SetAccessor */:
- currentKind = 4 /* SetAccessor */;
+ currentKind = 2 /* SetAccessor */;
break;
default:
throw ts.Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
@@ -61558,11 +62041,11 @@ var ts;
seen.set(effectiveName, currentKind);
}
else {
- if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) {
+ if ((currentKind & 12 /* PropertyAssignmentOrMethod */) && (existingKind & 12 /* PropertyAssignmentOrMethod */)) {
grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name));
}
- else if ((currentKind & 6 /* GetOrSetAccessor */) && (existingKind & 6 /* GetOrSetAccessor */)) {
- if (existingKind !== 6 /* GetOrSetAccessor */ && currentKind !== existingKind) {
+ else if ((currentKind & 3 /* GetOrSetAccessor */) && (existingKind & 3 /* GetOrSetAccessor */)) {
+ if (existingKind !== 3 /* GetOrSetAccessor */ && currentKind !== existingKind) {
seen.set(effectiveName, currentKind | existingKind);
}
else {
@@ -61660,42 +62143,38 @@ var ts;
return false;
}
function checkGrammarAccessor(accessor) {
- var kind = accessor.kind;
- if (languageVersion < 1 /* ES5 */) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ if (!(accessor.flags & 4194304 /* Ambient */)) {
+ if (languageVersion < 1 /* ES5 */) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ }
+ if (accessor.body === undefined && !ts.hasModifier(accessor, 128 /* Abstract */)) {
+ return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
+ }
}
- else if (accessor.flags & 4194304 /* Ambient */) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);
- }
- else if (accessor.body === undefined && !ts.hasModifier(accessor, 128 /* Abstract */)) {
- return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
- }
- else if (accessor.body && ts.hasModifier(accessor, 128 /* Abstract */)) {
+ if (accessor.body && ts.hasModifier(accessor, 128 /* Abstract */)) {
return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
}
- else if (accessor.typeParameters) {
+ if (accessor.typeParameters) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
- else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ?
+ if (!doesAccessorHaveCorrectParameterCount(accessor)) {
+ return grammarErrorOnNode(accessor.name, accessor.kind === 159 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 160 /* SetAccessor */) {
+ if (accessor.kind === 160 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
- else {
- var parameter = accessor.parameters[0];
- if (parameter.dotDotDotToken) {
- return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
- }
- else if (parameter.questionToken) {
- return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
- }
- else if (parameter.initializer) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
- }
+ var parameter = ts.Debug.assertDefined(ts.getSetAccessorValueParameter(accessor), "Return value does not match parameter count assertion.");
+ if (parameter.dotDotDotToken) {
+ return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
+ }
+ if (parameter.questionToken) {
+ return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
+ }
+ if (parameter.initializer) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
}
}
return false;
@@ -62130,13 +62609,9 @@ var ts;
}
function checkGrammarStatementInAmbientContext(node) {
if (node.flags & 4194304 /* Ambient */) {
- // An accessors is already reported about the ambient context
- if (ts.isAccessor(node.parent)) {
- return getNodeLinks(node).hasReportedStatementInAmbientContext = true;
- }
// Find containing block which is either Block, ModuleBlock, SourceFile
var links = getNodeLinks(node);
- if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) {
+ if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
}
// We are either parented by another statement, or some sort of block.
@@ -62184,7 +62659,7 @@ var ts;
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -62234,6 +62709,14 @@ var ts;
}
}
ts.createTypeChecker = createTypeChecker;
+ function isNotAccessor(declaration) {
+ // Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
+ return !ts.isAccessor(declaration);
+ }
+ function isNotOverload(declaration) {
+ return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
+ !!declaration.body;
+ }
/** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
@@ -64212,7 +64695,7 @@ var ts;
ts.createJSDocTypeExpression = createJSDocTypeExpression;
/* @internal */
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(309 /* JSDocTypeTag */, "type");
+ var tag = createJSDocTag(310 /* JSDocTypeTag */, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -64220,7 +64703,7 @@ var ts;
ts.createJSDocTypeTag = createJSDocTypeTag;
/* @internal */
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(307 /* JSDocReturnTag */, "returns");
+ var tag = createJSDocTag(308 /* JSDocReturnTag */, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -64228,14 +64711,14 @@ var ts;
ts.createJSDocReturnTag = createJSDocReturnTag;
/** @internal */
function createJSDocThisTag(typeExpression) {
- var tag = createJSDocTag(308 /* JSDocThisTag */, "this");
+ var tag = createJSDocTag(309 /* JSDocThisTag */, "this");
tag.typeExpression = typeExpression;
return tag;
}
ts.createJSDocThisTag = createJSDocThisTag;
/* @internal */
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(306 /* JSDocParameterTag */, "param");
+ var tag = createJSDocTag(307 /* JSDocParameterTag */, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -64245,7 +64728,7 @@ var ts;
ts.createJSDocParamTag = createJSDocParamTag;
/* @internal */
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(297 /* JSDocComment */);
+ var node = createSynthesizedNode(298 /* JSDocComment */);
node.comment = comment;
node.tags = tags;
return node;
@@ -64610,7 +65093,7 @@ var ts;
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(314 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(315 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -64622,7 +65105,7 @@ var ts;
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(318 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(319 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -64634,7 +65117,7 @@ var ts;
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(317 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(318 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -64649,7 +65132,7 @@ var ts;
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(315 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(316 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -64665,7 +65148,7 @@ var ts;
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 316 /* CommaListExpression */) {
+ if (node.kind === 317 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) {
@@ -64675,7 +65158,7 @@ var ts;
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(316 /* CommaListExpression */);
+ var node = createSynthesizedNode(317 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -65523,29 +66006,34 @@ var ts;
}
ts.createExpressionForJsxFragment = createExpressionForJsxFragment;
// Helpers
- function getHelperName(name) {
+ /**
+ * Gets an identifier for the name of an *unscoped* emit helper.
+ */
+ function getUnscopedHelperName(name) {
return ts.setEmitFlags(ts.createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */);
}
- ts.getHelperName = getHelperName;
+ ts.getUnscopedHelperName = getUnscopedHelperName;
ts.valuesHelper = {
name: "typescript:values",
+ importName: "__values",
scoped: false,
- text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };"
+ text: "\n var __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n };"
};
function createValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.valuesHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__values"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__values"),
/*typeArguments*/ undefined, [expression]), location);
}
ts.createValuesHelper = createValuesHelper;
ts.readHelper = {
name: "typescript:read",
+ importName: "__read",
scoped: false,
text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };"
};
function createReadHelper(context, iteratorRecord, count, location) {
context.requestEmitHelper(ts.readHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__read"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__read"),
/*typeArguments*/ undefined, count !== undefined
? [iteratorRecord, ts.createLiteral(count)]
: [iteratorRecord]), location);
@@ -65553,24 +66041,26 @@ var ts;
ts.createReadHelper = createReadHelper;
ts.spreadHelper = {
name: "typescript:spread",
+ importName: "__spread",
scoped: false,
text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };"
};
function createSpreadHelper(context, argumentList, location) {
context.requestEmitHelper(ts.readHelper);
context.requestEmitHelper(ts.spreadHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spread"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spread"),
/*typeArguments*/ undefined, argumentList), location);
}
ts.createSpreadHelper = createSpreadHelper;
ts.spreadArraysHelper = {
name: "typescript:spreadArrays",
+ importName: "__spreadArrays",
scoped: false,
text: "\n var __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n };"
};
function createSpreadArraysHelper(context, argumentList, location) {
context.requestEmitHelper(ts.spreadArraysHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spreadArrays"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spreadArrays"),
/*typeArguments*/ undefined, argumentList), location);
}
ts.createSpreadArraysHelper = createSpreadArraysHelper;
@@ -66415,7 +66905,7 @@ var ts;
case 191 /* ElementAccessExpression */:
case 190 /* PropertyAccessExpression */:
case 214 /* NonNullExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -66432,7 +66922,7 @@ var ts;
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
- node.kind === 316 /* CommaListExpression */;
+ node.kind === 317 /* CommaListExpression */;
}
ts.isCommaSequence = isCommaSequence;
var OuterExpressionKinds;
@@ -66451,7 +66941,7 @@ var ts;
case 213 /* AsExpression */:
case 214 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -66488,7 +66978,7 @@ var ts;
case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 315 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 316 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -66531,6 +67021,60 @@ var ts;
return emitNode && emitNode.externalHelpersModuleName;
}
ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function hasRecordedExternalHelpers(sourceFile) {
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return !!emitNode && (!!emitNode.externalHelpersModuleName || !!emitNode.externalHelpers);
+ }
+ ts.hasRecordedExternalHelpers = hasRecordedExternalHelpers;
+ function createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) {
+ if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
+ var namedBindings = void 0;
+ var moduleKind = ts.getEmitModuleKind(compilerOptions);
+ if (moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) {
+ // use named imports
+ var helpers = ts.getEmitHelpers(sourceFile);
+ if (helpers) {
+ var helperNames = [];
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!helper.scoped) {
+ var importName = helper.importName;
+ if (importName) {
+ ts.pushIfUnique(helperNames, importName);
+ }
+ }
+ }
+ if (ts.some(helperNames)) {
+ helperNames.sort(ts.compareStringsCaseSensitive);
+ // Alias the imports if the names are used somewhere in the file.
+ // NOTE: We don't need to care about global import collisions as this is a module.
+ namedBindings = ts.createNamedImports(ts.map(helperNames, function (name) { return ts.isFileLevelUniqueName(sourceFile, name)
+ ? ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(name))
+ : ts.createImportSpecifier(ts.createIdentifier(name), getUnscopedHelperName(name)); }));
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = ts.getOrCreateEmitNode(parseNode);
+ emitNode.externalHelpers = true;
+ }
+ }
+ }
+ else {
+ // use a namespace import
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
+ if (externalHelpersModuleName) {
+ namedBindings = ts.createNamespaceImport(externalHelpersModuleName);
+ }
+ }
+ if (namedBindings) {
+ var externalHelpersImportDeclaration = ts.createImportDeclaration(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, namedBindings), ts.createLiteral(ts.externalHelpersModuleNameText));
+ ts.addEmitFlags(externalHelpersImportDeclaration, 67108864 /* NeverApplyImportHelper */);
+ return externalHelpersImportDeclaration;
+ }
+ }
+ }
+ ts.createExternalHelpersImportDeclarationIfNeeded = createExternalHelpersImportDeclarationIfNeeded;
function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(node, compilerOptions)) {
var externalHelpersModuleName = getExternalHelpersModuleName(node);
@@ -66545,8 +67089,8 @@ var ts;
if (!create) {
var helpers = ts.getEmitHelpers(node);
if (helpers) {
- for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
- var helper = helpers_2[_i];
+ for (var _i = 0, helpers_3 = helpers; _i < helpers_3.length; _i++) {
+ var helper = helpers_3[_i];
if (!helper.scoped) {
create = true;
break;
@@ -67285,9 +67829,9 @@ var ts;
case 285 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -67343,7 +67887,7 @@ var ts;
case 221 /* EmptyStatement */:
case 211 /* OmittedExpression */:
case 237 /* DebuggerStatement */:
- case 314 /* NotEmittedStatement */:
+ case 315 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
@@ -67724,10 +68268,10 @@ var ts;
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -68515,7 +69059,8 @@ var ts;
var hasExportDefault = false;
var exportEquals;
var hasExportStarsToExportValues = false;
- var hasImportStarOrImportDefault = false;
+ var hasImportStar = false;
+ var hasImportDefault = false;
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
@@ -68525,7 +69070,12 @@ var ts;
// import * as x from "mod"
// import { x, y } from "mod"
externalImports.push(node);
- hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
+ if (!hasImportStar && getImportNeedsImportStarHelper(node)) {
+ hasImportStar = true;
+ }
+ if (!hasImportDefault && getImportNeedsImportDefaultHelper(node)) {
+ hasImportDefault = true;
+ }
break;
case 249 /* ImportEqualsDeclaration */:
if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
@@ -68619,12 +69169,8 @@ var ts;
break;
}
}
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault);
- var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault);
if (externalHelpersImportDeclaration) {
- ts.addEmitFlags(externalHelpersImportDeclaration, 67108864 /* NeverApplyImportHelper */);
externalImports.unshift(externalHelpersImportDeclaration);
}
return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
@@ -69212,6 +69758,7 @@ var ts;
}
ts.restHelper = {
name: "typescript:rest",
+ importName: "__rest",
scoped: false,
text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
@@ -69236,7 +69783,7 @@ var ts;
}
}
}
- return ts.createCall(ts.getHelperName("__rest"),
+ return ts.createCall(ts.getUnscopedHelperName("__rest"),
/*typeArguments*/ undefined, [
value,
ts.setTextRange(ts.createArrayLiteral(propertyNames), location)
@@ -70601,8 +71148,8 @@ var ts;
// Note when updating logic here also update getEntityNameForDecoratorMetadata
// so that aliases can be marked as referenced
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
@@ -70744,7 +71291,7 @@ var ts;
* available.
*/
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 8 /* ESNext */
+ return languageVersion < 99 /* ESNext */
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -71882,18 +72429,19 @@ var ts;
}
}
context.requestEmitHelper(ts.decorateHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__decorate"),
/*typeArguments*/ undefined, argumentsArray), location);
}
ts.decorateHelper = {
name: "typescript:decorate",
+ importName: "__decorate",
scoped: false,
priority: 2,
text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
};
function createMetadataHelper(context, metadataKey, metadataValue) {
context.requestEmitHelper(ts.metadataHelper);
- return ts.createCall(ts.getHelperName("__metadata"),
+ return ts.createCall(ts.getUnscopedHelperName("__metadata"),
/*typeArguments*/ undefined, [
ts.createLiteral(metadataKey),
metadataValue
@@ -71901,13 +72449,14 @@ var ts;
}
ts.metadataHelper = {
name: "typescript:metadata",
+ importName: "__metadata",
scoped: false,
priority: 3,
text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
};
function createParamHelper(context, expression, parameterOffset, location) {
context.requestEmitHelper(ts.paramHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__param"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__param"),
/*typeArguments*/ undefined, [
ts.createLiteral(parameterOffset),
expression
@@ -71915,6 +72464,7 @@ var ts;
}
ts.paramHelper = {
name: "typescript:param",
+ importName: "__param",
scoped: false,
priority: 4,
text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
@@ -72359,6 +72909,7 @@ var ts;
var hasSuperElementAccess;
/** A set of node IDs for generated super accessors (variable statements). */
var substitutedSuperAccessors = [];
+ var topLevel;
// Save the previous transformation hooks.
var previousOnEmitNode = context.onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
@@ -72370,10 +72921,23 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitor(node) {
if ((node.transformFlags & 32 /* ContainsES2017 */) === 0) {
return node;
@@ -72385,11 +72949,11 @@ var ts;
case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
case 157 /* MethodDeclaration */:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 240 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197 /* FunctionExpression */:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198 /* ArrowFunction */:
return visitArrowFunction(node);
case 190 /* PropertyAccessExpression */:
@@ -72402,6 +72966,12 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -72653,7 +73223,7 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.body.statements, /*ensureUseStrict*/ false, visitor);
- statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
@@ -72680,7 +73250,7 @@ var ts;
result = block;
}
else {
- var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
+ var expression = createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
var declarations = endLexicalEnvironment();
if (ts.some(declarations)) {
var block = ts.convertToFunctionBody(expression);
@@ -72879,11 +73449,12 @@ var ts;
ts.createSuperAccessVariableStatement = createSuperAccessVariableStatement;
ts.awaiterHelper = {
name: "typescript:awaiter",
+ importName: "__awaiter",
scoped: false,
priority: 5,
- text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
};
- function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ function createAwaiterHelper(context, hasLexicalThis, hasLexicalArguments, promiseConstructor, body) {
context.requestEmitHelper(ts.awaiterHelper);
var generatorFunc = ts.createFunctionExpression(
/*modifiers*/ undefined, ts.createToken(40 /* AsteriskToken */),
@@ -72893,9 +73464,9 @@ var ts;
/*type*/ undefined, body);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */ | 524288 /* ReuseTempVariableScope */;
- return ts.createCall(ts.getHelperName("__awaiter"),
+ return ts.createCall(ts.getUnscopedHelperName("__awaiter"),
/*typeArguments*/ undefined, [
- ts.createThis(),
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
generatorFunc
@@ -72929,9 +73500,11 @@ var ts;
context.onEmitNode = onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
+ var exportedVariableStatement = false;
var enabledSubstitutions;
var enclosingFunctionFlags;
var enclosingSuperContainerFlags = 0;
+ var topLevel;
/** Keeps track of property names accessed on super (`super.x`) within async functions. */
var capturedSuperProperties;
/** Whether the async function contains an element access on super (`super[x]`). */
@@ -72943,6 +73516,8 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ exportedVariableStatement = false;
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
@@ -72959,6 +73534,18 @@ var ts;
}
return node;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitorWorker(node, noDestructuringValue) {
if ((node.transformFlags & 16 /* ContainsES2018 */) === 0) {
return node;
@@ -72978,6 +73565,8 @@ var ts;
return visitBinaryExpression(node, noDestructuringValue);
case 275 /* CatchClause */:
return visitCatchClause(node);
+ case 220 /* VariableStatement */:
+ return visitVariableStatement(node);
case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
case 228 /* ForOfStatement */:
@@ -72987,17 +73576,17 @@ var ts;
case 201 /* VoidExpression */:
return visitVoidExpression(node);
case 158 /* Constructor */:
- return visitConstructorDeclaration(node);
+ return doOutsideOfTopLevel(visitConstructorDeclaration, node);
case 157 /* MethodDeclaration */:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 159 /* GetAccessor */:
- return visitGetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitGetAccessorDeclaration, node);
case 160 /* SetAccessor */:
- return visitSetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitSetAccessorDeclaration, node);
case 240 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197 /* FunctionExpression */:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198 /* ArrowFunction */:
return visitArrowFunction(node);
case 152 /* Parameter */:
@@ -73016,6 +73605,9 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -73083,14 +73675,39 @@ var ts;
if (node.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
// spread elements emit like so:
// non-spread elements are chunked together into object literals, and then all are passed to __assign:
- // { a, ...o, b } => __assign({a}, o, {b});
+ // { a, ...o, b } => __assign(__assign({a}, o), {b});
// If the first element is a spread element, then the first argument to __assign is {}:
- // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
+ // { ...o, a, b, ...o2 } => __assign(__assign(__assign({}, o), {a, b}), o2)
+ //
+ // We cannot call __assign with more than two elements, since any element could cause side effects. For
+ // example:
+ // var k = { a: 1, b: 2 };
+ // var o = { a: 3, ...k, b: k.a++ };
+ // // expected: { a: 1, b: 1 }
+ // If we translate the above to `__assign({ a: 3 }, k, { b: k.a++ })`, the `k.a++` will evaluate before
+ // `k` is spread and we end up with `{ a: 2, b: 1 }`.
+ //
+ // This also occurs for spread elements, not just property assignments:
+ // var k = { a: 1, get b() { l = { z: 9 }; return 2; } };
+ // var l = { c: 3 };
+ // var o = { ...k, ...l };
+ // // expected: { a: 1, b: 2, z: 9 }
+ // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we
+ // end up with `{ a: 1, b: 2, c: 3 }`
var objects = chunkObjectLiteralElements(node.properties);
if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) {
objects.unshift(ts.createObjectLiteral());
}
- return createAssignHelper(context, objects);
+ var expression = objects[0];
+ if (objects.length > 1) {
+ for (var i = 1; i < objects.length; i++) {
+ expression = createAssignHelper(context, [expression, objects[i]]);
+ }
+ return expression;
+ }
+ else {
+ return createAssignHelper(context, objects);
+ }
}
return ts.visitEachChild(node, visitor, context);
}
@@ -73131,15 +73748,36 @@ var ts;
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitVariableStatement(node) {
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = true;
+ var visited = ts.visitEachChild(node, visitor, context);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
/**
* Visits a VariableDeclaration node with a binding pattern.
*
* @param node A VariableDeclaration node.
*/
function visitVariableDeclaration(node) {
+ if (exportedVariableStatement) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = false;
+ var visited = visitVariableDeclarationWorker(node, /*exportedVariableStatement*/ true);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return visitVariableDeclarationWorker(node, /*exportedVariableStatement*/ false);
+ }
+ function visitVariableDeclarationWorker(node, exportedVariableStatement) {
// If we are here it is because the name contains a binding pattern with a rest somewhere in it.
if (ts.isBindingPattern(node.name) && node.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
- return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */);
+ return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */,
+ /*rval*/ undefined, exportedVariableStatement);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -73357,7 +73995,7 @@ var ts;
/*modifiers*/ undefined, ts.createToken(40 /* AsteriskToken */), node.name && ts.getGeneratedNameForNode(node.name),
/*typeParameters*/ undefined,
/*parameters*/ [],
- /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))));
+ /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !topLevel));
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
var emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* AsyncMethodWithSuperBinding */ | 2048 /* AsyncMethodWithSuper */);
@@ -73537,6 +74175,7 @@ var ts;
ts.transformES2018 = transformES2018;
ts.assignHelper = {
name: "typescript:assign",
+ importName: "__assign",
scoped: false,
priority: 1,
text: "\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"
@@ -73547,55 +74186,59 @@ var ts;
/*typeArguments*/ undefined, attributesSegments);
}
context.requestEmitHelper(ts.assignHelper);
- return ts.createCall(ts.getHelperName("__assign"),
+ return ts.createCall(ts.getUnscopedHelperName("__assign"),
/*typeArguments*/ undefined, attributesSegments);
}
ts.createAssignHelper = createAssignHelper;
ts.awaitHelper = {
name: "typescript:await",
+ importName: "__await",
scoped: false,
text: "\n var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }"
};
function createAwaitHelper(context, expression) {
context.requestEmitHelper(ts.awaitHelper);
- return ts.createCall(ts.getHelperName("__await"), /*typeArguments*/ undefined, [expression]);
+ return ts.createCall(ts.getUnscopedHelperName("__await"), /*typeArguments*/ undefined, [expression]);
}
ts.asyncGeneratorHelper = {
name: "typescript:asyncGenerator",
+ importName: "__asyncGenerator",
scoped: false,
text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n };"
};
- function createAsyncGeneratorHelper(context, generatorFunc) {
+ function createAsyncGeneratorHelper(context, generatorFunc, hasLexicalThis) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncGeneratorHelper);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */;
- return ts.createCall(ts.getHelperName("__asyncGenerator"),
+ return ts.createCall(ts.getUnscopedHelperName("__asyncGenerator"),
/*typeArguments*/ undefined, [
- ts.createThis(),
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
ts.createIdentifier("arguments"),
generatorFunc
]);
}
ts.asyncDelegator = {
name: "typescript:asyncDelegator",
+ importName: "__asyncDelegator",
scoped: false,
text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n };"
};
function createAsyncDelegatorHelper(context, expression, location) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncDelegator);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncDelegator"),
/*typeArguments*/ undefined, [expression]), location);
}
ts.asyncValues = {
name: "typescript:asyncValues",
+ importName: "__asyncValues",
scoped: false,
text: "\n var __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n };"
};
function createAsyncValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.asyncValues);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncValues"),
/*typeArguments*/ undefined, [expression]), location);
}
})(ts || (ts = {}));
@@ -77407,7 +78050,7 @@ var ts;
ts.transformES2015 = transformES2015;
function createExtendsHelper(context, name) {
context.requestEmitHelper(ts.extendsHelper);
- return ts.createCall(ts.getHelperName("__extends"),
+ return ts.createCall(ts.getUnscopedHelperName("__extends"),
/*typeArguments*/ undefined, [
name,
ts.createFileLevelUniqueName("_super")
@@ -77415,7 +78058,7 @@ var ts;
}
function createTemplateObjectHelper(context, cooked, raw) {
context.requestEmitHelper(ts.templateObjectHelper);
- return ts.createCall(ts.getHelperName("__makeTemplateObject"),
+ return ts.createCall(ts.getUnscopedHelperName("__makeTemplateObject"),
/*typeArguments*/ undefined, [
cooked,
raw
@@ -77423,12 +78066,14 @@ var ts;
}
ts.extendsHelper = {
name: "typescript:extends",
+ importName: "__extends",
scoped: false,
priority: 0,
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
};
ts.templateObjectHelper = {
name: "typescript:makeTemplateObject",
+ importName: "__makeTemplateObject",
scoped: false,
priority: 0,
text: "\n var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n };"
@@ -80122,7 +80767,7 @@ var ts;
ts.transformGenerators = transformGenerators;
function createGeneratorHelper(context, body) {
context.requestEmitHelper(ts.generatorHelper);
- return ts.createCall(ts.getHelperName("__generator"),
+ return ts.createCall(ts.getUnscopedHelperName("__generator"),
/*typeArguments*/ undefined, [ts.createThis(), body]);
}
// The __generator helper is used by down-level transformations to emulate the runtime
@@ -80186,6 +80831,7 @@ var ts;
// For examples of how these are used, see the comments in ./transformers/generators.ts
ts.generatorHelper = {
name: "typescript:generator",
+ importName: "__generator",
scoped: false,
priority: 6,
text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
@@ -80559,9 +81205,9 @@ var ts;
return visitFunctionDeclaration(node);
case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 317 /* MergeDeclarationMarker */:
+ case 318 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 318 /* EndOfDeclarationMarker */:
+ case 319 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -80720,7 +81366,7 @@ var ts;
var promise = ts.createNew(ts.createIdentifier("Promise"), /*typeArguments*/ undefined, [func]);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), /*typeArguments*/ undefined, [ts.getHelperName("__importStar")]);
+ return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), /*typeArguments*/ undefined, [ts.getUnscopedHelperName("__importStar")]);
}
return promise;
}
@@ -80734,7 +81380,7 @@ var ts;
var requireCall = ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- requireCall = ts.createCall(ts.getHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
+ requireCall = ts.createCall(ts.getUnscopedHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
}
var func;
if (languageVersion >= 2 /* ES2015 */) {
@@ -80768,11 +81414,11 @@ var ts;
}
if (ts.getImportNeedsImportStarHelper(node)) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.getHelperName("__importStar"), /*typeArguments*/ undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importStar"), /*typeArguments*/ undefined, [innerExpr]);
}
if (ts.getImportNeedsImportDefaultHelper(node)) {
context.requestEmitHelper(ts.importDefaultHelper);
- return ts.createCall(ts.getHelperName("__importDefault"), /*typeArguments*/ undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importDefault"), /*typeArguments*/ undefined, [innerExpr]);
}
return innerExpr;
}
@@ -81544,7 +82190,7 @@ var ts;
function createExportStarHelper(context, module) {
var compilerOptions = context.getCompilerOptions();
return compilerOptions.importHelpers
- ? ts.createCall(ts.getHelperName("__exportStar"), /*typeArguments*/ undefined, [module, ts.createIdentifier("exports")])
+ ? ts.createCall(ts.getUnscopedHelperName("__exportStar"), /*typeArguments*/ undefined, [module, ts.createIdentifier("exports")])
: ts.createCall(ts.createIdentifier("__export"), /*typeArguments*/ undefined, [module]);
}
// emit helper for dynamic import
@@ -81556,12 +82202,14 @@ var ts;
// emit helper for `import * as Name from "foo"`
ts.importStarHelper = {
name: "typescript:commonjsimportstar",
+ importName: "__importStar",
scoped: false,
text: "\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};"
};
// emit helper for `import Name from "foo"`
ts.importDefaultHelper = {
name: "typescript:commonjsimportdefault",
+ importName: "__importDefault",
scoped: false,
text: "\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};"
};
@@ -81583,11 +82231,13 @@ var ts;
context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(215 /* MetaProperty */); // Substitutes 'import.meta'
context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var exportFunctionsMap = []; // The export function associated with a source file.
var noSubstitutionMap = []; // Set of nodes for which substitution rules should be ignored for each file.
+ var contextObjectMap = []; // The context object associated with a source file.
var currentSourceFile; // The current file.
var moduleInfo; // ExternalModuleInfo for the current file.
var exportFunction; // The export function for the current file.
@@ -81626,7 +82276,7 @@ var ts;
// existing identifiers.
exportFunction = ts.createUniqueName("exports");
exportFunctionsMap[id] = exportFunction;
- contextObject = ts.createUniqueName("context");
+ contextObject = contextObjectMap[id] = ts.createUniqueName("context");
// Add the body of the module.
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
@@ -82496,9 +83146,9 @@ var ts;
return visitCatchClause(node);
case 219 /* Block */:
return visitBlock(node);
- case 317 /* MergeDeclarationMarker */:
+ case 318 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 318 /* EndOfDeclarationMarker */:
+ case 319 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -82784,6 +83434,7 @@ var ts;
moduleInfo = moduleInfoMap[id];
exportFunction = exportFunctionsMap[id];
noSubstitution = noSubstitutionMap[id];
+ contextObject = contextObjectMap[id];
if (noSubstitution) {
delete noSubstitutionMap[id];
}
@@ -82791,6 +83442,7 @@ var ts;
currentSourceFile = undefined;
moduleInfo = undefined;
exportFunction = undefined;
+ contextObject = undefined;
noSubstitution = undefined;
}
else {
@@ -82867,6 +83519,8 @@ var ts;
case 203 /* PrefixUnaryExpression */:
case 204 /* PostfixUnaryExpression */:
return substituteUnaryExpression(node);
+ case 215 /* MetaProperty */:
+ return substituteMetaProperty(node);
}
return node;
}
@@ -82975,6 +83629,12 @@ var ts;
}
return node;
}
+ function substituteMetaProperty(node) {
+ if (ts.isImportMeta(node)) {
+ return ts.createPropertyAccess(contextObject, ts.createIdentifier("meta"));
+ }
+ return node;
+ }
/**
* Gets the exports of a name.
*
@@ -83028,22 +83688,18 @@ var ts;
context.onSubstituteNode = onSubstituteNode;
context.enableEmitNotification(285 /* SourceFile */);
context.enableSubstitution(73 /* Identifier */);
- var currentSourceFile;
+ var helperNameSubstitutions;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
if (node.isDeclarationFile) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
- if (externalHelpersModuleName) {
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(node, compilerOptions);
+ if (externalHelpersImportDeclaration) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.statements);
- var tslibImport = ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- ts.addEmitFlags(tslibImport, 67108864 /* NeverApplyImportHelper */);
- ts.append(statements, tslibImport);
+ ts.append(statements, externalHelpersImportDeclaration);
ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements));
}
@@ -83079,9 +83735,9 @@ var ts;
*/
function onEmitNode(hint, node, emitCallback) {
if (ts.isSourceFile(node)) {
- currentSourceFile = node;
+ helperNameSubstitutions = ts.createMap();
previousOnEmitNode(hint, node, emitCallback);
- currentSourceFile = undefined;
+ helperNameSubstitutions = undefined;
}
else {
previousOnEmitNode(hint, node, emitCallback);
@@ -83098,19 +83754,18 @@ var ts;
*/
function onSubstituteNode(hint, node) {
node = previousOnSubstituteNode(hint, node);
- if (ts.isIdentifier(node) && hint === 1 /* Expression */) {
- return substituteExpressionIdentifier(node);
+ if (helperNameSubstitutions && ts.isIdentifier(node) && ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ return substituteHelperName(node);
}
return node;
}
- function substituteExpressionIdentifier(node) {
- if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
- var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
- if (externalHelpersModuleName) {
- return ts.createPropertyAccess(externalHelpersModuleName, node);
- }
+ function substituteHelperName(node) {
+ var name = ts.idText(node);
+ var substitution = helperNameSubstitutions.get(name);
+ if (!substitution) {
+ helperNameSubstitutions.set(name, substitution = ts.createFileLevelUniqueName(name));
}
- return node;
+ return substitution;
}
}
ts.transformES2015Module = transformES2015Module;
@@ -83609,6 +84264,7 @@ var ts;
var currentSourceFile;
var refs;
var libs;
+ var emittedImports; // must be declared in container so it can be `undefined` while transformer's first pass
var resolver = context.getEmitResolver();
var options = context.getCompilerOptions();
var newLine = ts.getNewLineCharacter(options);
@@ -83771,7 +84427,7 @@ var ts;
var statements = ts.visitNodes(node.statements, visitDeclarationStatements);
var combinedStatements = ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
refs.forEach(referenceVisitor);
- var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
+ emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
if (ts.isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) {
combinedStatements = ts.setTextRange(ts.createNodeArray(__spreadArrays(combinedStatements, [createEmptyExports()])), combinedStatements);
}
@@ -83869,14 +84525,14 @@ var ts;
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
}
}
- function ensureParameter(p, modifierMask) {
+ function ensureParameter(p, modifierMask, type) {
var oldDiag;
if (!suppressNewDiagnosticContexts) {
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
}
var newParam = ts.updateParameter(p,
- /*decorators*/ undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56 /* QuestionToken */)) : undefined, ensureType(p, p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
+ /*decorators*/ undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56 /* QuestionToken */)) : undefined, ensureType(p, type || p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
ensureNoInitializer(p));
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
@@ -83983,6 +84639,33 @@ var ts;
}
return ts.createNodeArray(newParams, params.hasTrailingComma);
}
+ function updateAccessorParamsList(input, isPrivate) {
+ var newParams;
+ if (!isPrivate) {
+ var thisParameter = ts.getThisParameter(input);
+ if (thisParameter) {
+ newParams = [ensureParameter(thisParameter)];
+ }
+ }
+ if (ts.isSetAccessorDeclaration(input)) {
+ var newValueParameter = void 0;
+ if (!isPrivate) {
+ var valueParameter = ts.getSetAccessorValueParameter(input);
+ if (valueParameter) {
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ newValueParameter = ensureParameter(valueParameter, /*modifierMask*/ undefined, accessorType);
+ }
+ }
+ if (!newValueParameter) {
+ newValueParameter = ts.createParameter(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*dotDotDotToken*/ undefined, "value");
+ }
+ newParams = ts.append(newParams, newValueParameter);
+ }
+ return ts.createNodeArray(newParams || ts.emptyArray);
+ }
function ensureTypeParams(node, params) {
return ts.hasModifier(node, 8 /* Private */) ? undefined : ts.visitNodes(params, visitDeclarationSubtree);
}
@@ -84149,6 +84832,11 @@ var ts;
enclosingDeclaration = input;
}
var oldDiag = getSymbolAccessibilityDiagnostic;
+ // Setup diagnostic-related flags before first potential `cleanup` call, otherwise
+ // We'd see a TDZ violation at runtime
+ var canProduceDiagnostic = ts.canProduceDiagnostics(input);
+ var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
// Emit methods which are private as properties with no type information
if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) {
if (ts.hasModifier(input, 8 /* Private */)) {
@@ -84157,15 +84845,12 @@ var ts;
return cleanup(ts.createProperty(/*decorators*/ undefined, ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined));
}
}
- var canProdiceDiagnostic = ts.canProduceDiagnostics(input);
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input);
}
if (ts.isTypeQueryNode(input)) {
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
- var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
// We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
suppressNewDiagnosticContexts = true;
@@ -84204,10 +84889,24 @@ var ts;
return cleanup(sig);
}
case 159 /* GetAccessor */: {
+ // For now, only emit class accessors as accessors if they were already declared in an ambient context.
+ if (input.flags & 4194304 /* Ambient */) {
+ var isPrivate = ts.hasModifier(input, 8 /* Private */);
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ return cleanup(ts.updateGetAccessor(input,
+ /*decorators*/ undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, isPrivate), !isPrivate ? ensureType(input, accessorType) : undefined,
+ /*body*/ undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
case 160 /* SetAccessor */: {
+ // For now, only emit class accessors as accessors if they were already declared in an ambient context.
+ if (input.flags & 4194304 /* Ambient */) {
+ return cleanup(ts.updateSetAccessor(input,
+ /*decorators*/ undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasModifier(input, 8 /* Private */)),
+ /*body*/ undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
@@ -84268,13 +84967,13 @@ var ts;
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
function cleanup(returnValue) {
- if (returnValue && canProdiceDiagnostic && ts.hasDynamicName(input)) {
+ if (returnValue && canProduceDiagnostic && ts.hasDynamicName(input)) {
checkName(input);
}
if (isEnclosingDeclaration(input)) {
enclosingDeclaration = previousEnclosingDeclaration;
}
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
if (shouldEnterSuppressNewDiagnosticsContextContext) {
@@ -84643,17 +85342,26 @@ var ts;
}
return maskModifierFlags(node, mask, additions);
}
+ function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) {
+ var accessorType = getTypeAnnotationFromAccessor(node);
+ if (!accessorType && node !== accessors.firstAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.firstAccessor);
+ // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.firstAccessor);
+ }
+ if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
+ // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
+ }
+ return accessorType;
+ }
function ensureAccessor(node) {
var accessors = resolver.getAllAccessorDeclarations(node);
if (node.kind !== accessors.firstAccessor.kind) {
return;
}
- var accessorType = getTypeAnnotationFromAccessor(node);
- if (!accessorType && accessors.secondAccessor) {
- accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
- // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
- getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
- }
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessors);
var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
@@ -84816,7 +85524,7 @@ var ts;
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6 /* ES2019 */) {
@@ -84892,7 +85600,7 @@ var ts;
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(319 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(320 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -86417,30 +87125,30 @@ var ts;
case 279 /* EnumMember */:
return emitEnumMember(node);
// JSDoc nodes (only used in codefixes currently)
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return emitJSDocPropertyLikeTag(node);
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 308 /* JSDocThisTag */:
- case 305 /* JSDocEnumTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 309 /* JSDocThisTag */:
+ case 306 /* JSDocEnumTag */:
return emitJSDocSimpleTypedTag(node);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return emitJSDocAugmentsTag(node);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return emitJSDocTemplateTag(node);
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return emitJSDocTypedefTag(node);
- case 304 /* JSDocCallbackTag */:
+ case 305 /* JSDocCallbackTag */:
return emitJSDocCallbackTag(node);
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return emitJSDocSignature(node);
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
return emitJSDocTypeLiteral(node);
- case 303 /* JSDocClassTag */:
- case 300 /* JSDocTag */:
+ case 304 /* JSDocClassTag */:
+ case 301 /* JSDocTag */:
return emitJSDocSimpleTag(node);
- case 297 /* JSDocComment */:
+ case 298 /* JSDocComment */:
return emitJSDoc(node);
// Transformation nodes (ignored)
}
@@ -86539,9 +87247,9 @@ var ts;
case 265 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -86569,8 +87277,8 @@ var ts;
var helpers = getSortedEmitHelpers(sourceFile);
if (!helpers)
continue;
- for (var _c = 0, helpers_3 = helpers; _c < helpers_3.length; _c++) {
- var helper = helpers_3[_c];
+ for (var _c = 0, helpers_4 = helpers; _c < helpers_4.length; _c++) {
+ var helper = helpers_4[_c];
if (!helper.scoped && !shouldSkip && !bundledHelpers.get(helper.name)) {
bundledHelpers.set(helper.name, true);
(result || (result = [])).push(helper.name);
@@ -86590,12 +87298,12 @@ var ts;
for (var i = 0; i < numNodes; i++) {
var currentNode = bundle ? i < numPrepends ? bundle.prepends[i] : bundle.sourceFiles[i - numPrepends] : node;
var sourceFile = ts.isSourceFile(currentNode) ? currentNode : ts.isUnparsedSource(currentNode) ? undefined : currentSourceFile;
- var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.hasRecordedExternalHelpers(sourceFile));
var shouldBundle = (ts.isSourceFile(currentNode) || ts.isUnparsedSource(currentNode)) && !isOwnFileEmit;
var helpers = ts.isUnparsedSource(currentNode) ? currentNode.helpers : getSortedEmitHelpers(currentNode);
if (helpers) {
- for (var _a = 0, helpers_4 = helpers; _a < helpers_4.length; _a++) {
- var helper = helpers_4[_a];
+ for (var _a = 0, helpers_5 = helpers; _a < helpers_5.length; _a++) {
+ var helper = helpers_5[_a];
if (!helper.scoped) {
// Skip the helper if it can be skipped and the noEmitHelpers compiler
// option is set, or if it can be imported and the importHelpers compiler
@@ -88035,7 +88743,7 @@ var ts;
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 309 /* JSDocTypeTag */ && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 310 /* JSDocTypeTag */ && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -88088,7 +88796,7 @@ var ts;
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) {
+ if (tag.typeExpression && tag.typeExpression.kind === 299 /* JSDocTypeLiteral */) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -88222,8 +88930,8 @@ var ts;
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// ");
if (bundleFileInfo)
@@ -89077,7 +89785,7 @@ var ts;
if (node.locals) {
var local = node.locals.get(ts.escapeLeadingUnderscores(name));
// We conservatively include alias symbols to cover cases where they're emitted as locals
- if (local && local.flags & (67220415 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
+ if (local && local.flags & (111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
return false;
}
}
@@ -89264,7 +89972,7 @@ var ts;
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 314 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 315 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
@@ -89545,7 +90253,7 @@ var ts;
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 314 /* NotEmittedStatement */
+ if (node.kind !== 315 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -89558,7 +90266,7 @@ var ts;
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 314 /* NotEmittedStatement */
+ if (node.kind !== 315 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -89926,6 +90634,9 @@ var ts;
var createFileWatcher = getCreateFileWatcher(watchLogLevel, watchFile);
var createFilePathWatcher = watchLogLevel === WatchLogLevel.None ? watchFilePath : createFileWatcher;
var createDirectoryWatcher = getCreateFileWatcher(watchLogLevel, watchDirectory);
+ if (watchLogLevel === WatchLogLevel.Verbose && ts.sysLog === ts.noop) {
+ ts.sysLog = function (s) { return log(s); };
+ }
return {
watchFile: function (host, file, callback, pollingInterval, detailInfo1, detailInfo2) {
return createFileWatcher(host, file, callback, pollingInterval, /*passThrough*/ undefined, detailInfo1, detailInfo2, watchFile, log, "FileWatcher", getDetailWatchInfo);
@@ -90470,8 +91181,8 @@ var ts;
}
var resolutions = [];
var cache = ts.createMap();
- for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name = names_1[_i];
+ for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
+ var name = names_2[_i];
var result = void 0;
if (cache.has(name)) {
result = cache.get(name);
@@ -90632,7 +91343,7 @@ var ts;
var resolveModuleNamesWorker;
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
if (host.resolveModuleNames) {
- resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference).map(function (resolved) {
+ resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference, options).map(function (resolved) {
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
if (!resolved || resolved.extension !== undefined) {
return resolved;
@@ -90649,7 +91360,7 @@ var ts;
}
var resolveTypeReferenceDirectiveNamesWorker;
if (host.resolveTypeReferenceDirectives) {
- resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference); };
+ resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference, options); };
}
else {
var loader_2 = function (typesRef, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference).resolvedTypeReferenceDirective; }; // TODO: GH#18217
@@ -90679,7 +91390,10 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
- var structuralIsReused = tryReuseStructureFromOldProgram();
+ // We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks
+ // `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`.
+ var structuralIsReused;
+ structuralIsReused = tryReuseStructureFromOldProgram();
if (structuralIsReused !== 2 /* Completely */) {
processingDefaultLibFiles = [];
processingOtherFiles = [];
@@ -94348,8 +95062,8 @@ var ts;
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
!!redirectedReference;
var seenNamesInFile = ts.createMap();
- for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
- var name = names_2[_i];
+ for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
+ var name = names_3[_i];
var resolution = resolutionsInFile.get(name);
// Resolution is valid if it is present and not invalidated
if (!seenNamesInFile.has(name) &&
@@ -94855,7 +95569,7 @@ var ts;
return [ambient];
var info = getInfo(importingSourceFile.path, host);
var moduleSourceFile = ts.getSourceFileOfNode(moduleSymbol.valueDeclaration || ts.getNonAugmentationDeclaration(moduleSymbol));
- var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.fileName, info.getCanonicalFileName, host, redirectTargetsMap);
+ var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.originalFileName, info.getCanonicalFileName, host, redirectTargetsMap);
var preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
var global = ts.mapDefined(modulePaths, function (moduleFileName) { return tryGetModuleNameAsNodeModule(moduleFileName, info, host, compilerOptions); });
return global.length ? global : modulePaths.map(function (moduleFileName) { return getLocalModuleSpecifier(moduleFileName, info, compilerOptions, preferences); });
@@ -94871,7 +95585,7 @@ var ts;
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
var ending = _b.ending, relativePreference = _b.relativePreference;
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
- var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) ||
+ var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
if (!baseUrl || relativePreference === 0 /* Relative */) {
return relativePath;
@@ -94997,14 +95711,16 @@ var ts;
}
}
}
- function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) {
+ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
if (normalizedTargetPath === undefined) {
return undefined;
}
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
- return ts.removeFileExtension(relativePath);
+ return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
+ ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
+ : ts.removeFileExtension(relativePath);
}
function tryGetModuleNameAsNodeModule(moduleFileName, _a, host, options) {
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
@@ -95654,10 +96370,22 @@ var ts;
/*logChangesWhenResolvingModule*/ false);
// Resolve module using host module resolution strategy if provided otherwise use resolution cache to resolve module names
compilerHost.resolveModuleNames = host.resolveModuleNames ?
- (function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveModuleNames.apply(host, args);
+ }) :
(function (moduleNames, containingFile, reusedNames, redirectedReference) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); });
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
- (function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveTypeReferenceDirectives.apply(host, args);
+ }) :
(function (typeDirectiveNames, containingFile, redirectedReference) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); });
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
@@ -95883,13 +96611,19 @@ var ts;
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
switch (reloadLevel) {
case ts.ConfigFileProgramReloadLevel.Partial:
- return reloadFileNamesFromConfigFile();
+ ts.perfLogger.logStartUpdateProgram("PartialConfigReload");
+ reloadFileNamesFromConfigFile();
+ break;
case ts.ConfigFileProgramReloadLevel.Full:
- return reloadConfigFile();
+ ts.perfLogger.logStartUpdateProgram("FullConfigReload");
+ reloadConfigFile();
+ break;
default:
+ ts.perfLogger.logStartUpdateProgram("SynchronizeProgram");
synchronizeProgram();
- return;
+ break;
}
+ ts.perfLogger.logStopUpdateProgram("Done");
}
function reloadFileNamesFromConfigFile() {
writeLog("Reloading new file names and options");
@@ -96268,8 +97002,31 @@ var ts;
}
}
function getBuildOrder(state) {
- return state.buildOrder ||
- (state.buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); })));
+ return state.buildOrder || createStateBuildOrder(state);
+ }
+ function createStateBuildOrder(state) {
+ var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
+ if (ts.arrayIsEqualTo(state.buildOrder, buildOrder))
+ return state.buildOrder;
+ // Clear all to ResolvedConfigFilePaths cache to start fresh
+ state.resolvedConfigFilePaths.clear();
+ var currentProjects = ts.arrayToSet(buildOrder, function (resolved) { return toResolvedConfigFilePath(state, resolved); });
+ var noopOnDelete = { onDeleteValue: ts.noop };
+ // Config file cache
+ ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
+ // Remove watches for the program no longer in the solution
+ if (state.watch) {
+ ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
+ ts.mutateMapSkippingNewValues(state.allWatchedWildcardDirectories, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcherOf); } });
+ ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
+ }
+ return state.buildOrder = buildOrder;
}
function getBuildOrderFor(state, project, onlyReferences) {
var resolvedProject = project && resolveProjectName(state, project);
@@ -97726,66 +98483,82 @@ var ts;
}
}
JsTyping.discoverTypings = discoverTypings;
- var PackageNameValidationResult;
- (function (PackageNameValidationResult) {
- PackageNameValidationResult[PackageNameValidationResult["Ok"] = 0] = "Ok";
- PackageNameValidationResult[PackageNameValidationResult["ScopedPackagesNotSupported"] = 1] = "ScopedPackagesNotSupported";
- PackageNameValidationResult[PackageNameValidationResult["EmptyName"] = 2] = "EmptyName";
- PackageNameValidationResult[PackageNameValidationResult["NameTooLong"] = 3] = "NameTooLong";
- PackageNameValidationResult[PackageNameValidationResult["NameStartsWithDot"] = 4] = "NameStartsWithDot";
- PackageNameValidationResult[PackageNameValidationResult["NameStartsWithUnderscore"] = 5] = "NameStartsWithUnderscore";
- PackageNameValidationResult[PackageNameValidationResult["NameContainsNonURISafeCharacters"] = 6] = "NameContainsNonURISafeCharacters";
- })(PackageNameValidationResult = JsTyping.PackageNameValidationResult || (JsTyping.PackageNameValidationResult = {}));
+ var NameValidationResult;
+ (function (NameValidationResult) {
+ NameValidationResult[NameValidationResult["Ok"] = 0] = "Ok";
+ NameValidationResult[NameValidationResult["EmptyName"] = 1] = "EmptyName";
+ NameValidationResult[NameValidationResult["NameTooLong"] = 2] = "NameTooLong";
+ NameValidationResult[NameValidationResult["NameStartsWithDot"] = 3] = "NameStartsWithDot";
+ NameValidationResult[NameValidationResult["NameStartsWithUnderscore"] = 4] = "NameStartsWithUnderscore";
+ NameValidationResult[NameValidationResult["NameContainsNonURISafeCharacters"] = 5] = "NameContainsNonURISafeCharacters";
+ })(NameValidationResult = JsTyping.NameValidationResult || (JsTyping.NameValidationResult = {}));
var maxPackageNameLength = 214;
/**
* Validates package name using rules defined at https://docs.npmjs.com/files/package.json
*/
function validatePackageName(packageName) {
+ return validatePackageNameWorker(packageName, /*supportScopedPackage*/ true);
+ }
+ JsTyping.validatePackageName = validatePackageName;
+ function validatePackageNameWorker(packageName, supportScopedPackage) {
if (!packageName) {
- return 2 /* EmptyName */;
+ return 1 /* EmptyName */;
}
if (packageName.length > maxPackageNameLength) {
- return 3 /* NameTooLong */;
+ return 2 /* NameTooLong */;
}
if (packageName.charCodeAt(0) === 46 /* dot */) {
- return 4 /* NameStartsWithDot */;
+ return 3 /* NameStartsWithDot */;
}
if (packageName.charCodeAt(0) === 95 /* _ */) {
- return 5 /* NameStartsWithUnderscore */;
+ return 4 /* NameStartsWithUnderscore */;
}
// check if name is scope package like: starts with @ and has one '/' in the middle
// scoped packages are not currently supported
- // TODO: when support will be added we'll need to split and check both scope and package name
- if (/^@[^/]+\/[^/]+$/.test(packageName)) {
- return 1 /* ScopedPackagesNotSupported */;
+ if (supportScopedPackage) {
+ var matches = /^@([^/]+)\/([^/]+)$/.exec(packageName);
+ if (matches) {
+ var scopeResult = validatePackageNameWorker(matches[1], /*supportScopedPackage*/ false);
+ if (scopeResult !== 0 /* Ok */) {
+ return { name: matches[1], isScopeName: true, result: scopeResult };
+ }
+ var packageResult = validatePackageNameWorker(matches[2], /*supportScopedPackage*/ false);
+ if (packageResult !== 0 /* Ok */) {
+ return { name: matches[2], isScopeName: false, result: packageResult };
+ }
+ return 0 /* Ok */;
+ }
}
if (encodeURIComponent(packageName) !== packageName) {
- return 6 /* NameContainsNonURISafeCharacters */;
+ return 5 /* NameContainsNonURISafeCharacters */;
}
return 0 /* Ok */;
}
- JsTyping.validatePackageName = validatePackageName;
function renderPackageNameValidationFailure(result, typing) {
+ return typeof result === "object" ?
+ renderPackageNameValidationFailureWorker(typing, result.result, result.name, result.isScopeName) :
+ renderPackageNameValidationFailureWorker(typing, result, typing, /*isScopeName*/ false);
+ }
+ JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
+ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeName) {
+ var kind = isScopeName ? "Scope" : "Package";
switch (result) {
- case 2 /* EmptyName */:
- return "Package name '" + typing + "' cannot be empty";
- case 3 /* NameTooLong */:
- return "Package name '" + typing + "' should be less than " + maxPackageNameLength + " characters";
- case 4 /* NameStartsWithDot */:
- return "Package name '" + typing + "' cannot start with '.'";
- case 5 /* NameStartsWithUnderscore */:
- return "Package name '" + typing + "' cannot start with '_'";
- case 1 /* ScopedPackagesNotSupported */:
- return "Package '" + typing + "' is scoped and currently is not supported";
- case 6 /* NameContainsNonURISafeCharacters */:
- return "Package name '" + typing + "' contains non URI safe characters";
+ case 1 /* EmptyName */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot be empty";
+ case 2 /* NameTooLong */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' should be less than " + maxPackageNameLength + " characters";
+ case 3 /* NameStartsWithDot */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot start with '.'";
+ case 4 /* NameStartsWithUnderscore */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot start with '_'";
+ case 5 /* NameContainsNonURISafeCharacters */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' contains non URI safe characters";
case 0 /* Ok */:
return ts.Debug.fail(); // Shouldn't have called this.
default:
throw ts.Debug.assertNever(result);
}
}
- JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
})(JsTyping = ts.JsTyping || (ts.JsTyping = {}));
})(ts || (ts = {}));
var ts;
@@ -98070,7 +98843,7 @@ var ts;
/* @internal */
var ts;
(function (ts) {
- ts.scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
+ ts.scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ true);
var SemanticMeaning;
(function (SemanticMeaning) {
SemanticMeaning[SemanticMeaning["None"] = 0] = "None";
@@ -98105,7 +98878,7 @@ var ts;
case 243 /* TypeAliasDeclaration */:
case 169 /* TypeLiteral */:
return 2 /* Type */;
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
// If it has no name node, it shares the name with the value declaration below it.
return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */;
case 279 /* EnumMember */:
@@ -98370,8 +99143,8 @@ var ts;
return "class" /* classElement */;
case 242 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
case 243 /* TypeAliasDeclaration */:
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
return "type" /* typeElement */;
case 244 /* EnumDeclaration */: return "enum" /* enumElement */;
case 238 /* VariableDeclaration */:
@@ -99990,8 +100763,9 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ /** The classifier is used for syntactic highlighting in editors via the TSServer */
function createClassifier() {
- var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false);
+ var scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false);
function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {
return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
}
@@ -100545,8 +101319,8 @@ var ts;
var spanStart = span.start;
var spanLength = span.length;
// Make a scanner we can get trivia from.
- var triviaScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var triviaScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
var result = [];
processElement(sourceFile);
return { spans: result, endOfLineState: 0 /* None */ };
@@ -100618,6 +101392,11 @@ var ts;
return;
}
}
+ else if (kind === 2 /* SingleLineCommentTrivia */) {
+ if (tryClassifyTripleSlashComment(start, width)) {
+ return;
+ }
+ }
// Simple comment. Just add as is.
pushCommentRange(start, width);
}
@@ -100638,18 +101417,18 @@ var ts;
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param"
pos = tag.tagName.end;
switch (tag.kind) {
- case 306 /* JSDocParameterTag */:
+ case 307 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
pos = tag.end;
break;
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
- case 307 /* JSDocReturnTag */:
+ case 308 /* JSDocReturnTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
@@ -100678,6 +101457,65 @@ var ts;
}
}
}
+ function tryClassifyTripleSlashComment(start, width) {
+ var tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/im;
+ var attributeRegex = /(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/img;
+ var text = sourceFile.text.substr(start, width);
+ var match = tripleSlashXMLCommentRegEx.exec(text);
+ if (!match) {
+ return false;
+ }
+ var pos = start;
+ pushCommentRange(pos, match[1].length); // ///
+ pos += match[1].length;
+ pushClassification(pos, match[2].length, 10 /* punctuation */); // <
+ pos += match[2].length;
+ if (!match[3]) {
+ return true;
+ }
+ pushClassification(pos, match[3].length, 21 /* jsxSelfClosingTagName */); // element name
+ pos += match[3].length;
+ var attrText = match[4];
+ var attrPos = pos;
+ while (true) {
+ var attrMatch = attributeRegex.exec(attrText);
+ if (!attrMatch) {
+ break;
+ }
+ var newAttrPos = pos + attrMatch.index;
+ if (newAttrPos > attrPos) {
+ pushCommentRange(attrPos, newAttrPos - attrPos);
+ attrPos = newAttrPos;
+ }
+ pushClassification(attrPos, attrMatch[1].length, 22 /* jsxAttribute */); // attribute name
+ attrPos += attrMatch[1].length;
+ if (attrMatch[2].length) {
+ pushCommentRange(attrPos, attrMatch[2].length); // whitespace
+ attrPos += attrMatch[2].length;
+ }
+ pushClassification(attrPos, attrMatch[3].length, 5 /* operator */); // =
+ attrPos += attrMatch[3].length;
+ if (attrMatch[4].length) {
+ pushCommentRange(attrPos, attrMatch[4].length); // whitespace
+ attrPos += attrMatch[4].length;
+ }
+ pushClassification(attrPos, attrMatch[5].length, 24 /* jsxAttributeStringLiteralValue */); // attribute value
+ attrPos += attrMatch[5].length;
+ }
+ pos += match[4].length;
+ if (pos > attrPos) {
+ pushCommentRange(attrPos, pos - attrPos);
+ }
+ if (match[5]) {
+ pushClassification(pos, match[5].length, 10 /* punctuation */); // />
+ pos += match[5].length;
+ }
+ var end = start + width;
+ if (pos < end) {
+ pushCommentRange(pos, end - pos);
+ }
+ return true;
+ }
function processJSDocTemplateTag(tag) {
for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) {
var child = _a[_i];
@@ -100902,7 +101740,7 @@ var ts;
return convertPathCompletions(completion.paths);
case 1 /* Properties */: {
var entries = [];
- Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 8 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
+ Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 99 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, entries: entries };
}
case 2 /* Types */: {
@@ -101481,7 +102319,7 @@ var ts;
var offset = index !== -1 ? index + 1 : 0;
// If the range is an identifier, span is unnecessary.
var length = text.length - offset;
- return length === 0 || ts.isIdentifierText(text.substr(offset, length), 8 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
+ return length === 0 || ts.isIdentifierText(text.substr(offset, length), 99 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
}
// Returns true if the path is explicitly relative to the script (i.e. relative to . or ..)
function isPathRelativeToScript(path) {
@@ -102043,7 +102881,7 @@ var ts;
currentToken = ts.getTokenAtPosition(sourceFile, position);
if (!currentToken ||
(!ts.isDeclarationName(currentToken) &&
- (currentToken.parent.kind !== 312 /* JSDocPropertyTag */ ||
+ (currentToken.parent.kind !== 313 /* JSDocPropertyTag */ ||
currentToken.parent.name !== currentToken))) {
// Use as type location if inside tag's type expression
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
@@ -102239,11 +103077,11 @@ var ts;
};
function isTagWithTypeExpression(tag) {
switch (tag.kind) {
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 311 /* JSDocTypedefTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 312 /* JSDocTypedefTag */:
return true;
default:
return false;
@@ -102252,11 +103090,13 @@ var ts;
function getTypeScriptMemberSymbols() {
// Right of dot member completion list
completionKind = 2 /* PropertyAccess */;
- // Since this is qualified name check its a type node location
+ // Since this is qualified name check it's a type node location
var isImportType = ts.isLiteralImportTypeNode(node);
- var isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !node.isTypeOf) || ts.isPartOfTypeNode(node.parent);
+ var isTypeLocation = insideJsDocTagTypeExpression
+ || (isImportType && !node.isTypeOf)
+ || ts.isPartOfTypeNode(node.parent)
+ || ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
var isRhsOfImportDeclaration = ts.isInRightSideOfInternalImportEqualsDeclaration(node);
- var allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker));
if (ts.isEntityName(node) || isImportType) {
var isNamespaceName = ts.isModuleDeclaration(node.parent);
if (isNamespaceName)
@@ -102272,7 +103112,7 @@ var ts;
var isValidAccess = isNamespaceName
// At `namespace N.M/**/`, if this is the only declaration of `M`, don't include `M` as a completion.
? function (symbol) { return !!(symbol.flags & 1920 /* Namespace */) && !symbol.declarations.every(function (d) { return d.parent === node.parent; }); }
- : allowTypeOrValue ?
+ : isRhsOfImportDeclaration ?
// Any kind is allowed when dotting off namespace in internal import equals declaration
function (symbol) { return isValidTypeAccess_1(symbol) || isValidValueAccess_1(symbol); } :
isTypeLocation ? isValidTypeAccess_1 : isValidValueAccess_1;
@@ -102418,7 +103258,7 @@ var ts;
var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
isInSnippetScope = isSnippetScope(scopeNode);
var isTypeOnly = isTypeOnlyCompletion();
- var symbolMeanings = (isTypeOnly ? 0 /* None */ : 67220415 /* Value */) | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
+ var symbolMeanings = (isTypeOnly ? 0 /* None */ : 111551 /* Value */) | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined");
for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
var symbol = symbols_2[_i];
@@ -102473,7 +103313,6 @@ var ts;
}
function filterGlobalCompletion(symbols) {
var isTypeOnly = isTypeOnlyCompletion();
- var allowTypes = isTypeOnly || !isContextTokenValueLocation(contextToken) && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
if (isTypeOnly) {
keywordFilters = isTypeAssertion()
? 6 /* TypeAssertionKeywords */
@@ -102490,23 +103329,24 @@ var ts;
if (ts.isInRightSideOfInternalImportEqualsDeclaration(location)) {
return !!(symbol.flags & 1920 /* Namespace */);
}
- if (allowTypes) {
- // Its a type, but you can reach it by namespace.type as well
- var symbolAllowedAsType = symbolCanBeReferencedAtTypeLocation(symbol);
- if (symbolAllowedAsType || isTypeOnly) {
- return symbolAllowedAsType;
- }
+ if (isTypeOnly) {
+ // It's a type, but you can reach it by namespace.type as well
+ return symbolCanBeReferencedAtTypeLocation(symbol);
}
}
// expressions are value space (which includes the value namespaces)
- return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 67220415 /* Value */);
+ return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 111551 /* Value */);
});
}
function isTypeAssertion() {
return ts.isAssertionExpression(contextToken.parent);
}
function isTypeOnlyCompletion() {
- return insideJsDocTagTypeExpression || !isContextTokenValueLocation(contextToken) && (ts.isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
+ return insideJsDocTagTypeExpression
+ || !isContextTokenValueLocation(contextToken) &&
+ (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
+ || ts.isPartOfTypeNode(location)
+ || isContextTokenTypeLocation(contextToken));
}
function isContextTokenValueLocation(contextToken) {
return contextToken &&
@@ -102540,7 +103380,7 @@ var ts;
function symbolCanBeReferencedAtTypeLocation(symbol, seenModules) {
if (seenModules === void 0) { seenModules = ts.createMap(); }
var sym = ts.skipAlias(symbol.exportSymbol || symbol, typeChecker);
- return !!(sym.flags & 67897832 /* Type */) ||
+ return !!(sym.flags & 788968 /* Type */) ||
!!(sym.flags & 1536 /* Module */) &&
ts.addToSeen(seenModules, ts.getSymbolId(sym)) &&
typeChecker.getExportsOfModule(sym).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, seenModules); });
@@ -103245,16 +104085,18 @@ var ts;
case 0 /* None */:
return false;
case 1 /* All */:
- return kind === 122 /* AsyncKeyword */ || 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 126 /* DeclareKeyword */ || kind === 131 /* ModuleKeyword */
+ return isFunctionLikeBodyKeyword(kind)
+ || kind === 126 /* DeclareKeyword */
+ || kind === 131 /* ModuleKeyword */
|| ts.isTypeKeyword(kind) && kind !== 142 /* UndefinedKeyword */;
+ case 5 /* FunctionLikeBodyKeywords */:
+ return isFunctionLikeBodyKeyword(kind);
case 2 /* ClassElementKeywords */:
return isClassMemberCompletionKeyword(kind);
case 3 /* InterfaceElementKeywords */:
return isInterfaceOrTypeLiteralCompletionKeyword(kind);
case 4 /* ConstructorParameterKeywords */:
return ts.isParameterPropertyModifier(kind);
- case 5 /* FunctionLikeBodyKeywords */:
- return isFunctionLikeBodyKeyword(kind);
case 6 /* TypeAssertionKeywords */:
return ts.isTypeKeyword(kind) || kind === 78 /* ConstKeyword */;
case 7 /* TypeKeywords */:
@@ -103313,7 +104155,9 @@ var ts;
}
}
function isFunctionLikeBodyKeyword(kind) {
- return kind === 122 /* AsyncKeyword */ || kind === 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
+ return kind === 122 /* AsyncKeyword */
+ || kind === 123 /* AwaitKeyword */
+ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}
function keywordForNode(node) {
return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind;
@@ -103350,7 +104194,7 @@ var ts;
function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) {
// class c { method() { } | method2() { } }
switch (location.kind) {
- case 313 /* SyntaxList */:
+ case 314 /* SyntaxList */:
return ts.tryCast(location.parent, ts.isObjectTypeDeclaration);
case 1 /* EndOfFileToken */:
var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration);
@@ -103620,10 +104464,12 @@ var ts;
return __spreadArrays(container.parameters, (ts.isClassLike(container.parent) ? container.parent.members : []));
case 241 /* ClassDeclaration */:
case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 169 /* TypeLiteral */:
var nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
- if (modifierFlag & 28 /* AccessibilityModifier */) {
+ if (modifierFlag & (28 /* AccessibilityModifier */ | 64 /* Readonly */)) {
var constructor = ts.find(container.members, ts.isConstructorDeclaration);
if (constructor) {
return __spreadArrays(nodes, constructor.parameters);
@@ -104355,7 +105201,7 @@ var ts;
/**
* Given a local reference, we might notice that it's an import/export and recursively search for references of that.
* If at an import, look locally for the symbol it imports.
- * If an an export, look for all imports of it.
+ * If at an export, look for all imports of it.
* This doesn't handle export specifiers; that is done in `getReferencesAtExportSpecifier`.
* @param comingFromExport If we are doing a search for all exports, don't bother looking backwards for the imported symbol, since that's the reason we're here.
*/
@@ -104487,10 +105333,10 @@ var ts;
// If a reference is a class expression, the exported node would be its parent.
// If a reference is a variable declaration, the exported node would be the variable statement.
function getExportNode(parent, node) {
- if (parent.kind === 238 /* VariableDeclaration */) {
- var p = parent;
- return p.name !== node ? undefined :
- p.parent.kind === 275 /* CatchClause */ ? undefined : p.parent.parent.kind === 220 /* VariableStatement */ ? p.parent.parent : undefined;
+ var declaration = ts.isVariableDeclaration(parent) ? parent : ts.isBindingElement(parent) ? ts.walkUpBindingElementsAndPatterns(parent) : undefined;
+ if (declaration) {
+ return parent.name !== node ? undefined :
+ ts.isCatchClause(declaration.parent) ? undefined : ts.isVariableStatement(declaration.parent.parent) ? declaration.parent.parent : undefined;
}
else {
return parent;
@@ -104954,8 +105800,8 @@ var ts;
case 249 /* ImportEqualsDeclaration */:
case 254 /* ImportSpecifier */:
case 242 /* InterfaceDeclaration */:
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
case 268 /* JsxAttribute */:
case 245 /* ModuleDeclaration */:
case 248 /* NamespaceExportDeclaration */:
@@ -104980,8 +105826,8 @@ var ts;
return !!decl.initializer || ts.isCatchClause(decl.parent);
case 156 /* MethodSignature */:
case 154 /* PropertySignature */:
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
return false;
default:
return ts.Debug.failBadSyntaxKind(decl);
@@ -105172,10 +106018,23 @@ var ts;
}
return references.length ? [{ definition: { type: 0 /* Symbol */, symbol: symbol }, references: references }] : ts.emptyArray;
}
+ /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */
+ function isReadonlyTypeOperator(node) {
+ return node.kind === 134 /* ReadonlyKeyword */
+ && ts.isTypeOperatorNode(node.parent)
+ && node.parent.operator === 134 /* ReadonlyKeyword */;
+ }
/** getReferencedSymbols for special node kinds. */
function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) {
if (ts.isTypeKeyword(node.kind)) {
- return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken);
+ // A modifier readonly (like on a property declaration) is not special;
+ // a readonly type keyword (like `readonly string[]`) is.
+ if (node.kind === 134 /* ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) {
+ return undefined;
+ }
+ // Likewise, when we *are* looking for a special keyword, make sure we
+ // *don’t* include readonly member modifiers.
+ return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 134 /* ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined);
}
// Labels
if (ts.isJumpStatementTarget(node)) {
@@ -105600,8 +106459,8 @@ var ts;
// We found a match. Make sure it's not part of a larger word (i.e. the char
// before and after it have to be a non-identifier char).
var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 8 /* Latest */)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 8 /* Latest */))) {
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 99 /* Latest */)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 99 /* Latest */))) {
// Found a real match. Keep searching.
positions.push(position);
}
@@ -105636,11 +106495,13 @@ var ts;
return false;
}
}
- function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) {
+ function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken, filter) {
var references = ts.flatMap(sourceFiles, function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
return ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, ts.tokenToString(keywordKind), sourceFile), function (referenceLocation) {
- return referenceLocation.kind === keywordKind ? FindAllReferences.nodeEntry(referenceLocation) : undefined;
+ if (referenceLocation.kind === keywordKind && (!filter || filter(referenceLocation))) {
+ return FindAllReferences.nodeEntry(referenceLocation);
+ }
});
});
return references.length ? [{ definition: { type: 2 /* Keyword */, node: references[0].node }, references: references }] : undefined;
@@ -106782,18 +107643,21 @@ var ts;
}
}
function getDefinitionFromSymbol(typeChecker, symbol, node) {
- return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(symbol.declarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
+ // There are cases when you extend a function by adding properties to it afterwards,
+ // we want to strip those extra properties
+ var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return !ts.isAssignmentDeclaration(d) || d === symbol.valueDeclaration; }) || undefined;
+ return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(filteredDeclarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
function getConstructSignatureDefinition() {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 125 /* ConstructorKeyword */)) {
- var cls = ts.find(symbol.declarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
+ var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
return getSignatureDefinition(cls.members, /*selectConstructors*/ true);
}
}
function getCallSignatureDefinition() {
return ts.isCallOrNewExpressionTarget(node) || ts.isNameOfFunctionDeclaration(node)
- ? getSignatureDefinition(symbol.declarations, /*selectConstructors*/ false)
+ ? getSignatureDefinition(filteredDeclarations, /*selectConstructors*/ false)
: undefined;
}
function getSignatureDefinition(signatureDeclarations, selectConstructors) {
@@ -106975,11 +107839,11 @@ var ts;
JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
function getCommentHavingNodes(declaration) {
switch (declaration.kind) {
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return [declaration];
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
return [declaration, declaration.parent];
default:
return ts.getJSDocCommentsAndTags(declaration);
@@ -107000,16 +107864,16 @@ var ts;
function getCommentText(tag) {
var comment = tag.comment;
switch (tag.kind) {
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return withNode(tag.class);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return withList(tag.typeParameters);
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
return withNode(tag.typeExpression);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
var name = tag.name;
return name ? withNode(name) : comment;
default:
@@ -107834,8 +108698,8 @@ var ts;
case 245 /* ModuleDeclaration */:
case 285 /* SourceFile */:
case 243 /* TypeAliasDeclaration */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
return true;
case 158 /* Constructor */:
case 157 /* MethodDeclaration */:
@@ -108388,9 +109252,9 @@ var ts;
function addRegionOutliningSpans(sourceFile, out) {
var regions = [];
var lineStarts = sourceFile.getLineStarts();
- for (var i = 0; i < lineStarts.length; i++) {
- var currentLineStart = lineStarts[i];
- var lineEnd = i + 1 === lineStarts.length ? sourceFile.getEnd() : lineStarts[i + 1] - 1;
+ for (var _i = 0, lineStarts_1 = lineStarts; _i < lineStarts_1.length; _i++) {
+ var currentLineStart = lineStarts_1[_i];
+ var lineEnd = sourceFile.getLineEndOfPosition(currentLineStart);
var lineText = sourceFile.text.substring(currentLineStart, lineEnd);
var result = isRegionDelimiter(lineText);
if (!result || ts.isInComment(sourceFile, currentLineStart)) {
@@ -108825,7 +109689,7 @@ var ts;
if (ch >= 65 /* A */ && ch <= 90 /* Z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 99 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -108838,7 +109702,7 @@ var ts;
if (ch >= 97 /* a */ && ch <= 122 /* z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 99 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -109488,7 +110352,7 @@ var ts;
if (node.getStart(sourceFile) > pos) {
break outer;
}
- if (positionShouldSnapToNode(pos, node, nextNode)) {
+ if (positionShouldSnapToNode(sourceFile, pos, node)) {
// 1. Blocks are effectively redundant with SyntaxLists.
// 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
// of things that should be considered independently.
@@ -109531,6 +110395,12 @@ var ts;
parentNode = node;
break;
}
+ // If we made it to the end of the for loop, we’re done.
+ // In practice, I’ve only seen this happen at the very end
+ // of a SourceFile.
+ if (i === children.length - 1) {
+ break outer;
+ }
}
}
return selectionRange;
@@ -109554,12 +110424,11 @@ var ts;
* count too, unless that position belongs to the next node. In effect, makes
* selections able to snap to preceding tokens when the cursor is on the tail
* end of them with only whitespace ahead.
+ * @param sourceFile The source file containing the nodes.
* @param pos The position to check.
* @param node The candidate node to snap to.
- * @param nextNode The next sibling node in the tree.
- * @param sourceFile The source file containing the nodes.
*/
- function positionShouldSnapToNode(pos, node, nextNode) {
+ function positionShouldSnapToNode(sourceFile, pos, node) {
// Can’t use 'ts.positionBelongsToNode()' here because it cleverly accounts
// for missing nodes, which can’t really be considered when deciding what
// to select.
@@ -109568,9 +110437,8 @@ var ts;
return true;
}
var nodeEnd = node.getEnd();
- var nextNodeStart = nextNode && nextNode.getStart();
if (nodeEnd === pos) {
- return pos !== nextNodeStart;
+ return ts.getTouchingPropertyName(sourceFile, pos).pos < node.end;
}
return false;
}
@@ -109719,7 +110587,7 @@ var ts;
}
function createSyntaxList(children) {
ts.Debug.assertGreaterThanOrEqual(children.length, 1);
- var syntaxList = ts.createNode(313 /* SyntaxList */, children[0].pos, ts.last(children).end);
+ var syntaxList = ts.createNode(314 /* SyntaxList */, children[0].pos, ts.last(children).end);
syntaxList._children = children;
return syntaxList;
}
@@ -111228,7 +112096,14 @@ var ts;
*/
function transpileModule(input, transpileOptions) {
var diagnostics = [];
- var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : ts.getDefaultCompilerOptions();
+ var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
+ // mix in default options
+ var defaultOptions = ts.getDefaultCompilerOptions();
+ for (var key in defaultOptions) {
+ if (ts.hasProperty(defaultOptions, key) && options[key] === undefined) {
+ options[key] = defaultOptions[key];
+ }
+ }
options.isolatedModules = true;
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
options.suppressOutputPathCheck = true;
@@ -111434,8 +112309,8 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
- var standardScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
- var jsxScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
+ var standardScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
+ var jsxScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
var ScanAction;
(function (ScanAction) {
ScanAction[ScanAction["Scan"] = 0] = "Scan";
@@ -113770,7 +114645,7 @@ var ts;
case 210 /* ClassExpression */:
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return getList(node.typeParameters);
case 193 /* NewExpression */:
case 192 /* CallExpression */:
@@ -114663,7 +115538,7 @@ var ts;
function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) {
// TODO: this emits the file, parses it back, then formats it that -- may be a less roundabout way to do this
var nonFormattedText = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
- var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 8 /* ESNext */, /*setParentNodes*/ true, scriptKind);
+ var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 99 /* ESNext */, /*setParentNodes*/ true, scriptKind);
var changes = ts.formatting.formatDocument(sourceFile, formatContext);
return applyChanges(nonFormattedText, changes) + newLineCharacter;
}
@@ -116033,14 +116908,14 @@ var ts;
return undefined;
}
switch (oldTag.kind) {
- case 306 /* JSDocParameterTag */: {
+ case 307 /* JSDocParameterTag */: {
var oldParam = oldTag;
var newParam = newTag;
return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
? ts.createJSDocParamTag(newParam.name, newParam.isBracketed, newParam.typeExpression, oldParam.comment)
: undefined;
}
- case 307 /* JSDocReturnTag */:
+ case 308 /* JSDocReturnTag */:
return ts.createJSDocReturnTag(newTag.typeExpression, oldTag.comment);
}
}
@@ -117345,7 +118220,7 @@ var ts;
forEachExportReference(sourceFile, function (node) {
var _a = node.name, text = _a.text, originalKeywordKind = _a.originalKeywordKind;
if (!res.has(text) && (originalKeywordKind !== undefined && ts.isNonContextualKeyword(originalKeywordKind)
- || checker.resolveName(node.name.text, node, 67220415 /* Value */, /*excludeGlobals*/ true))) {
+ || checker.resolveName(node.name.text, node, 111551 /* Value */, /*excludeGlobals*/ true))) {
// Unconditionally add an underscore in case `text` is a keyword.
res.set(text, makeUniqueName("_" + text, identifiers));
}
@@ -117946,9 +118821,10 @@ var ts;
ImportKind[ImportKind["Default"] = 1] = "Default";
ImportKind[ImportKind["Namespace"] = 2] = "Namespace";
ImportKind[ImportKind["Equals"] = 3] = "Equals";
+ ImportKind[ImportKind["ConstEquals"] = 4] = "ConstEquals";
})(ImportKind || (ImportKind = {}));
function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
- var exportInfos = getAllReExportingModules(exportedSymbol, moduleSymbol, symbolName, sourceFile, program.getCompilerOptions(), program.getTypeChecker(), program.getSourceFiles());
+ var exportInfos = getAllReExportingModules(sourceFile, exportedSymbol, moduleSymbol, symbolName, sourceFile, program.getCompilerOptions(), program.getTypeChecker(), program.getSourceFiles());
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol; }));
// We sort the best codefixes first, so taking `first` is best for completions.
var moduleSpecifier = ts.first(getNewImportInfos(program, sourceFile, position, exportInfos, host, preferences)).moduleSpecifier;
@@ -117960,14 +118836,14 @@ var ts;
var description = _a.description, changes = _a.changes, commands = _a.commands;
return { description: description, changes: changes, commands: commands };
}
- function getAllReExportingModules(exportedSymbol, exportingModuleSymbol, symbolName, sourceFile, compilerOptions, checker, allSourceFiles) {
+ function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, sourceFile, compilerOptions, checker, allSourceFiles) {
var result = [];
forEachExternalModule(checker, allSourceFiles, function (moduleSymbol, moduleFile) {
// Don't import from a re-export when looking "up" like to `./index` or `../index`.
if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(sourceFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) {
return;
}
- var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
+ var defaultInfo = getDefaultLikeExportInfo(importingFile, moduleSymbol, checker, compilerOptions);
if (defaultInfo && defaultInfo.name === symbolName && ts.skipAlias(defaultInfo.symbol, checker) === exportedSymbol) {
result.push({ moduleSymbol: moduleSymbol, importKind: defaultInfo.kind, exportedSymbolIsTypeOnly: isTypeOnlySymbol(defaultInfo.symbol, checker) });
}
@@ -117981,7 +118857,7 @@ var ts;
return result;
}
function isTypeOnlySymbol(s, checker) {
- return !(ts.skipAlias(s, checker).flags & 67220415 /* Value */);
+ return !(ts.skipAlias(s, checker).flags & 111551 /* Value */);
}
function getFixForImport(exportInfos, symbolName, position, program, sourceFile, host, preferences) {
var checker = program.getTypeChecker();
@@ -118089,7 +118965,7 @@ var ts;
return undefined;
var symbol = checker.getAliasedSymbol(umdSymbol);
var symbolName = umdSymbol.name;
- var exportInfos = [{ moduleSymbol: symbol, importKind: getUmdImportKind(program.getCompilerOptions()), exportedSymbolIsTypeOnly: false }];
+ var exportInfos = [{ moduleSymbol: symbol, importKind: getUmdImportKind(sourceFile, program.getCompilerOptions()), exportedSymbolIsTypeOnly: false }];
var fixes = getFixForImport(exportInfos, symbolName, ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined, program, sourceFile, host, preferences);
return { fixes: fixes, symbolName: symbolName };
}
@@ -118101,10 +118977,10 @@ var ts;
// The error wasn't for the symbolAtLocation, it was for the JSX tag itself, which needs access to e.g. `React`.
var parent = token.parent;
return (ts.isJsxOpeningLikeElement(parent) && parent.tagName === token) || ts.isJsxOpeningFragment(parent)
- ? ts.tryCast(checker.resolveName(checker.getJsxNamespace(parent), ts.isJsxOpeningLikeElement(parent) ? token : parent, 67220415 /* Value */, /*excludeGlobals*/ false), ts.isUMDExportSymbol)
+ ? ts.tryCast(checker.resolveName(checker.getJsxNamespace(parent), ts.isJsxOpeningLikeElement(parent) ? token : parent, 111551 /* Value */, /*excludeGlobals*/ false), ts.isUMDExportSymbol)
: undefined;
}
- function getUmdImportKind(compilerOptions) {
+ function getUmdImportKind(importingFile, compilerOptions) {
// Import a synthetic `default` if enabled.
if (ts.getAllowSyntheticDefaultImports(compilerOptions)) {
return 1 /* Default */;
@@ -118115,6 +118991,9 @@ var ts;
case ts.ModuleKind.AMD:
case ts.ModuleKind.CommonJS:
case ts.ModuleKind.UMD:
+ if (ts.isInJSFile(importingFile)) {
+ return ts.isExternalModule(importingFile) ? 2 /* Namespace */ : 4 /* ConstEquals */;
+ }
return 3 /* Equals */;
case ts.ModuleKind.System:
case ts.ModuleKind.ES2015:
@@ -118153,7 +119032,7 @@ var ts;
}
forEachExternalModuleToImportFrom(checker, sourceFile, program.getSourceFiles(), function (moduleSymbol) {
cancellationToken.throwIfCancellationRequested();
- var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, program.getCompilerOptions());
+ var defaultInfo = getDefaultLikeExportInfo(sourceFile, moduleSymbol, checker, program.getCompilerOptions());
if (defaultInfo && defaultInfo.name === symbolName && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
addSymbol(moduleSymbol, defaultInfo.symbol, defaultInfo.kind);
}
@@ -118165,20 +119044,41 @@ var ts;
});
return originalSymbolToExportInfos;
}
- function getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions) {
- var exported = getDefaultLikeExportWorker(moduleSymbol, checker);
+ function getDefaultLikeExportInfo(importingFile, moduleSymbol, checker, compilerOptions) {
+ var exported = getDefaultLikeExportWorker(importingFile, moduleSymbol, checker, compilerOptions);
if (!exported)
return undefined;
var symbol = exported.symbol, kind = exported.kind;
var info = getDefaultExportInfoWorker(symbol, moduleSymbol, checker, compilerOptions);
return info && __assign({ symbol: symbol, kind: kind }, info);
}
- function getDefaultLikeExportWorker(moduleSymbol, checker) {
+ function getDefaultLikeExportWorker(importingFile, moduleSymbol, checker, compilerOptions) {
var defaultExport = checker.tryGetMemberInModuleExports("default" /* Default */, moduleSymbol);
if (defaultExport)
return { symbol: defaultExport, kind: 1 /* Default */ };
var exportEquals = checker.resolveExternalModuleSymbol(moduleSymbol);
- return exportEquals === moduleSymbol ? undefined : { symbol: exportEquals, kind: 3 /* Equals */ };
+ return exportEquals === moduleSymbol ? undefined : { symbol: exportEquals, kind: getExportEqualsImportKind(importingFile, compilerOptions, checker) };
+ }
+ function getExportEqualsImportKind(importingFile, compilerOptions, checker) {
+ if (ts.getAllowSyntheticDefaultImports(compilerOptions) && ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
+ return 1 /* Default */;
+ }
+ if (ts.isInJSFile(importingFile)) {
+ return ts.isExternalModule(importingFile) ? 1 /* Default */ : 4 /* ConstEquals */;
+ }
+ for (var _i = 0, _a = importingFile.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ if (ts.isImportEqualsDeclaration(statement)) {
+ return 3 /* Equals */;
+ }
+ if (ts.isImportDeclaration(statement) && statement.importClause && statement.importClause.name) {
+ var moduleSymbol = checker.getImmediateAliasedSymbol(statement.importClause.symbol);
+ if (moduleSymbol && moduleSymbol.name !== "default" /* Default */) {
+ return 1 /* Default */;
+ }
+ }
+ }
+ return 3 /* Equals */;
}
function getDefaultExportInfoWorker(defaultExport, moduleSymbol, checker, compilerOptions) {
var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport);
@@ -118191,9 +119091,11 @@ var ts;
var aliased = checker.getImmediateAliasedSymbol(defaultExport);
return aliased && getDefaultExportInfoWorker(aliased, ts.Debug.assertDefined(aliased.parent), checker, compilerOptions);
}
- else {
- return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) };
+ if (defaultExport.escapedName !== "default" /* Default */ &&
+ defaultExport.escapedName !== "export=" /* ExportEquals */) {
+ return { symbolForMeaning: defaultExport, name: defaultExport.getName() };
}
+ return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) };
}
function getNameForExportDefault(symbol) {
return symbol.declarations && ts.firstDefined(symbol.declarations, function (declaration) {
@@ -118285,11 +119187,17 @@ var ts;
ts.insertImport(changes, sourceFile, ts.makeImport(defaultImport === undefined ? undefined : ts.createIdentifier(defaultImport), namedImports.map(function (n) { return ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(n)); }), moduleSpecifier, quotePreference));
}
if (namespaceLikeImport) {
- ts.insertImport(changes, sourceFile, namespaceLikeImport.importKind === 3 /* Equals */
- ? ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createIdentifier(namespaceLikeImport.name), ts.createExternalModuleReference(quotedModuleSpecifier))
- : ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(ts.createIdentifier(namespaceLikeImport.name))), quotedModuleSpecifier));
+ ts.insertImport(changes, sourceFile, namespaceLikeImport.importKind === 3 /* Equals */ ? ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createIdentifier(namespaceLikeImport.name), ts.createExternalModuleReference(quotedModuleSpecifier)) :
+ namespaceLikeImport.importKind === 4 /* ConstEquals */ ? createConstEqualsRequireDeclaration(namespaceLikeImport.name, quotedModuleSpecifier) :
+ ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(ts.createIdentifier(namespaceLikeImport.name))), quotedModuleSpecifier));
}
}
+ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
+ return ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(ts.createIdentifier(name),
+ /*type*/ undefined, ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, [quotedModuleSpecifier]))
+ ], 2 /* Const */));
+ }
function symbolHasMeaning(_a, meaning) {
var declarations = _a.declarations;
return ts.some(declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); });
@@ -118431,10 +119339,10 @@ var ts;
flags |= 1920 /* Namespace */;
}
if (meaning & 2 /* Type */) {
- flags |= 67897832 /* Type */;
+ flags |= 788968 /* Type */;
}
if (meaning & 1 /* Value */) {
- flags |= 67220415 /* Value */;
+ flags |= 111551 /* Value */;
}
return flags;
}
@@ -119659,9 +120567,8 @@ var ts;
var modifiers = visibilityModifier ? ts.createNodeArray([visibilityModifier]) : undefined;
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
var optional = !!(symbol.flags & 16777216 /* Optional */);
+ var ambient = !!(enclosingDeclaration.flags & 4194304 /* Ambient */);
switch (declaration.kind) {
- case 159 /* GetAccessor */:
- case 160 /* SetAccessor */:
case 154 /* PropertySignature */:
case 155 /* PropertyDeclaration */:
var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
@@ -119669,6 +120576,29 @@ var ts;
/*decorators*/ undefined, modifiers, name, optional ? ts.createToken(56 /* QuestionToken */) : undefined, typeNode,
/*initializer*/ undefined));
break;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */: {
+ var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration);
+ var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
+ var orderedAccessors = allAccessors.secondAccessor
+ ? [allAccessors.firstAccessor, allAccessors.secondAccessor]
+ : [allAccessors.firstAccessor];
+ for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) {
+ var accessor = orderedAccessors_1[_i];
+ if (ts.isGetAccessorDeclaration(accessor)) {
+ out(ts.createGetAccessor(
+ /*decorators*/ undefined, modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : createStubbedMethodBody(preferences)));
+ }
+ else {
+ ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration);
+ var parameter = ts.getSetAccessorValueParameter(accessor);
+ var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined;
+ out(ts.createSetAccessor(
+ /*decorators*/ undefined, modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : createStubbedMethodBody(preferences)));
+ }
+ }
+ break;
+ }
case 156 /* MethodSignature */:
case 157 /* MethodDeclaration */:
// The signature for the implementation appears as an entry in `signatures` iff
@@ -119685,21 +120615,23 @@ var ts;
if (declarations.length === 1) {
ts.Debug.assert(signatures.length === 1);
var signature = signatures[0];
- outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
+ outputMethod(signature, modifiers, name, ambient ? undefined : createStubbedMethodBody(preferences));
break;
}
- for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
- var signature = signatures_1[_i];
+ for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) {
+ var signature = signatures_1[_a];
// Need to ensure nodes are fresh each time so they can have different positions.
outputMethod(signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
}
- if (declarations.length > signatures.length) {
- var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
- outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
- }
- else {
- ts.Debug.assert(declarations.length === signatures.length);
- out(createMethodImplementingSignatures(signatures, name, optional, modifiers, preferences));
+ if (!ambient) {
+ if (declarations.length > signatures.length) {
+ var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
+ outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
+ }
+ else {
+ ts.Debug.assert(declarations.length === signatures.length);
+ out(createMethodImplementingSignatures(signatures, name, optional, modifiers, preferences));
+ }
}
break;
}
@@ -120536,7 +121468,7 @@ var ts;
function doChangeNamedToNamespace(sourceFile, checker, changes, toConvert) {
var importDecl = toConvert.parent.parent;
var moduleSpecifier = importDecl.moduleSpecifier;
- var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 8 /* ESNext */) : "module";
+ var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 99 /* ESNext */) : "module";
var namespaceNameConflicts = toConvert.elements.some(function (element) {
return ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
return !!checker.resolveName(preferredName, id, 67108863 /* All */, /*excludeGlobals*/ true);
@@ -122165,7 +123097,7 @@ var ts;
}
else if (ts.isTypeQueryNode(node)) {
if (ts.isIdentifier(node.exprName)) {
- var symbol = checker.resolveName(node.exprName.text, node.exprName, 67220415 /* Value */, /* excludeGlobals */ false);
+ var symbol = checker.resolveName(node.exprName.text, node.exprName, 111551 /* Value */, /* excludeGlobals */ false);
if (symbol && rangeContainsSkipTrivia(statement, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) {
return true;
}
@@ -122187,7 +123119,7 @@ var ts;
changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
}
function doTypedefChange(changes, file, name, firstStatement, selection, typeParameters) {
- var node = ts.createNode(311 /* JSDocTypedefTag */);
+ var node = ts.createNode(312 /* JSDocTypedefTag */);
node.tagName = ts.createIdentifier("typedef"); // TODO: jsdoc factory https://github.com/Microsoft/TypeScript/pull/29539
node.fullName = ts.createIdentifier(name);
node.name = node.fullName;
@@ -122195,7 +123127,7 @@ var ts;
var templates = [];
ts.forEach(typeParameters, function (typeParameter) {
var constraint = ts.getEffectiveConstraintOfTypeParameter(typeParameter);
- var template = ts.createNode(310 /* JSDocTemplateTag */);
+ var template = ts.createNode(311 /* JSDocTemplateTag */);
template.tagName = ts.createIdentifier("template");
template.constraint = constraint && ts.cast(constraint, ts.isJSDocTypeExpression);
var parameter = ts.createNode(151 /* TypeParameter */);
@@ -122561,7 +123493,7 @@ var ts;
}
}
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) {
- var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 8 /* ESNext */);
+ var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 99 /* ESNext */);
var needUniqueName = false;
var toChange = [];
ts.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function (ref) {
@@ -122699,7 +123631,7 @@ var ts;
}
if (namedBindings) {
if (namedBindingsUnused) {
- changes.delete(sourceFile, namedBindings);
+ changes.replaceNode(sourceFile, importDecl.importClause, ts.updateImportClause(importDecl.importClause, name, /*namedBindings*/ undefined));
}
else if (namedBindings.kind === 253 /* NamedImports */) {
for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
@@ -123747,7 +124679,7 @@ var ts;
if (!children.length) {
return undefined;
}
- var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 312 /* LastJSDocNode */; });
+ var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 313 /* LastJSDocNode */; });
return child.kind < 149 /* FirstNode */ ?
child :
child.getFirstToken(sourceFile);
@@ -123817,7 +124749,7 @@ var ts;
}
}
function createSyntaxList(nodes, parent) {
- var list = createNode(313 /* SyntaxList */, nodes.pos, nodes.end, parent);
+ var list = createNode(314 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
@@ -124412,7 +125344,7 @@ var ts;
var sourceFile;
if (this.currentFileName !== fileName) {
// This is a new file, just parse it
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 8 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 99 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
}
else if (this.currentFileVersion !== version) {
// This is the same file, just a newer version. Incrementally parse the file.
@@ -124569,7 +125501,11 @@ var ts;
function getValidSourceFile(fileName) {
var sourceFile = program.getSourceFile(fileName);
if (!sourceFile) {
- throw new Error("Could not find sourceFile: '" + fileName + "' in " + (program && JSON.stringify(program.getSourceFiles().map(function (f) { return f.fileName; }))) + ".");
+ var error = new Error("Could not find source file: '" + fileName + "'.");
+ // We've been having trouble debugging this, so attach sidecar data for the tsserver log.
+ // See https://github.com/microsoft/TypeScript/issues/30180.
+ error.ProgramFiles = program.getSourceFiles().map(function (f) { return f.fileName; });
+ throw error;
}
return sourceFile;
}
@@ -124638,11 +125574,21 @@ var ts;
compilerHost.trace = function (message) { return host.trace(message); };
}
if (host.resolveModuleNames) {
- compilerHost.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); };
+ compilerHost.resolveModuleNames = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveModuleNames.apply(host, args);
+ };
}
if (host.resolveTypeReferenceDirectives) {
- compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference) {
- return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile, redirectedReference);
+ compilerHost.resolveTypeReferenceDirectives = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveTypeReferenceDirectives.apply(host, args);
};
}
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
@@ -124889,7 +125835,7 @@ var ts;
var normalizedFileName = ts.normalizePath(fileName);
ts.Debug.assert(filesToSearch.some(function (f) { return ts.normalizePath(f) === normalizedFileName; }));
synchronizeHostData();
- var sourceFilesToSearch = filesToSearch.map(getValidSourceFile);
+ var sourceFilesToSearch = ts.mapDefined(filesToSearch, function (fileName) { return program.getSourceFile(fileName); });
var sourceFile = getValidSourceFile(fileName);
return ts.DocumentHighlights.getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch);
}
@@ -127052,11 +127998,13 @@ var ts;
}
};
ThrottledOperations.run = function (self, operationId, cb) {
+ ts.perfLogger.logStartScheduledOperation(operationId);
self.pendingTimeouts.delete(operationId);
if (self.logger) {
self.logger.info("Running: " + operationId);
}
cb();
+ ts.perfLogger.logStopScheduledOperation();
};
return ThrottledOperations;
}());
@@ -127076,6 +128024,7 @@ var ts;
};
GcTimer.run = function (self) {
self.timerId = undefined;
+ ts.perfLogger.logStartScheduledOperation("GC collect");
var log = self.logger.hasLevel(server.LogLevel.requestTime);
var before = log && self.host.getMemoryUsage(); // TODO: GH#18217
self.host.gc(); // TODO: GH#18217
@@ -127083,6 +128032,7 @@ var ts;
var after = self.host.getMemoryUsage(); // TODO: GH#18217
self.logger.perftrc("GC::before " + before + ", after " + after);
}
+ ts.perfLogger.logStopScheduledOperation();
};
return GcTimer;
}());
@@ -128603,6 +129553,7 @@ var ts;
* @returns: true if set of files in the project stays the same and false - otherwise.
*/
Project.prototype.updateGraph = function () {
+ ts.perfLogger.logStartUpdateGraph();
this.resolutionCache.startRecordingFilesWithChangedResolutions();
var hasNewProgram = this.updateGraphWorker();
var hasAddedorRemovedFiles = this.hasAddedorRemovedFiles;
@@ -128633,6 +129584,7 @@ var ts;
if (hasNewProgram) {
this.projectProgramVersion++;
}
+ ts.perfLogger.logStopUpdateGraph();
return !hasNewProgram;
};
/*@internal*/
@@ -128733,9 +129685,12 @@ var ts;
}, function (removed) { return _this.detachScriptInfoFromProject(removed); });
var elapsed = ts.timestamp() - start;
this.writeLog("Finishing updateGraphWorker: Project: " + this.getProjectName() + " Version: " + this.getProjectVersion() + " structureChanged: " + hasNewProgram + " Elapsed: " + elapsed + "ms");
- if (this.program !== oldProgram) {
+ if (this.hasAddedorRemovedFiles) {
this.print();
}
+ else if (this.program !== oldProgram) {
+ this.writeLog("Different program with same set of files:: oldProgram.structureIsReused:: " + (oldProgram && oldProgram.structureIsReused));
+ }
return hasNewProgram;
};
Project.prototype.detachScriptInfoFromProject = function (uncheckedFileName, noRemoveResolution) {
@@ -128970,7 +129925,7 @@ var ts;
Project.prototype.enableProxy = function (pluginModuleFactory, configEntry) {
try {
if (typeof pluginModuleFactory !== "function") {
- this.projectService.logger.info("Skipped loading plugin " + configEntry.name + " because it did expose a proper factory function");
+ this.projectService.logger.info("Skipped loading plugin " + configEntry.name + " because it did not expose a proper factory function");
return;
}
var info = {
@@ -130084,7 +131039,13 @@ var ts;
project.print();
project.close();
if (ts.Debug.shouldAssert(1 /* Normal */)) {
- this.filenameToScriptInfo.forEach(function (info) { return ts.Debug.assert(!info.isAttached(project), "Found script Info still attached to project", function () { return project.projectName + ": ScriptInfos still attached: " + JSON.stringify(ts.mapDefined(ts.arrayFrom(_this.filenameToScriptInfo.values()), function (info) { return info.isAttached(project) ? info : undefined; })); }); });
+ this.filenameToScriptInfo.forEach(function (info) { return ts.Debug.assert(!info.isAttached(project), "Found script Info still attached to project", function () { return project.projectName + ": ScriptInfos still attached: " + JSON.stringify(ts.arrayFrom(ts.mapDefinedIterator(_this.filenameToScriptInfo.values(), function (info) { return info.isAttached(project) ?
+ {
+ fileName: info.fileName,
+ projects: info.containingProjects.map(function (p) { return p.projectName; }),
+ hasMixedContent: info.hasMixedContent
+ } : undefined; })),
+ /*replacer*/ undefined, " "); }); });
}
// Remove the project from pending project updates
this.pendingProjectUpdates.delete(project.getProjectName());
@@ -131441,6 +132402,7 @@ var ts;
var configFileName;
var configFileErrors;
var project = this.findExternalProjectContainingOpenScriptInfo(info);
+ var defaultConfigProject;
if (!project && !this.syntaxOnly) { // Checking syntaxOnly is an optimization
configFileName = this.getConfigFileNameForFile(info);
if (configFileName) {
@@ -131461,6 +132423,7 @@ var ts;
// Ensure project is ready to check if it contains opened script info
updateProjectIfDirty(project);
}
+ defaultConfigProject = project;
}
}
// Project we have at this point is going to be updated since its either found through
@@ -131477,12 +132440,12 @@ var ts;
this.assignOrphanScriptInfoToInferredProject(info, this.openFiles.get(info.path));
}
ts.Debug.assert(!info.isOrphan());
- return { configFileName: configFileName, configFileErrors: configFileErrors };
+ return { configFileName: configFileName, configFileErrors: configFileErrors, defaultConfigProject: defaultConfigProject };
};
- ProjectService.prototype.cleanupAfterOpeningFile = function () {
+ ProjectService.prototype.cleanupAfterOpeningFile = function (toRetainConfigProjects) {
// This was postponed from closeOpenFile to after opening next file,
// so that we can reuse the project if we need to right away
- this.removeOrphanConfiguredProjects();
+ this.removeOrphanConfiguredProjects(toRetainConfigProjects);
// Remove orphan inferred projects now that we have reused projects
// We need to create a duplicate because we cant guarantee order after removal
for (var _i = 0, _a = this.inferredProjects.slice(); _i < _a.length; _i++) {
@@ -131500,21 +132463,29 @@ var ts;
};
ProjectService.prototype.openClientFileWithNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent, projectRootPath) {
var info = this.getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath);
- var result = this.assignProjectToOpenedScriptInfo(info);
- this.cleanupAfterOpeningFile();
+ var _a = this.assignProjectToOpenedScriptInfo(info), defaultConfigProject = _a.defaultConfigProject, result = __rest(_a, ["defaultConfigProject"]);
+ this.cleanupAfterOpeningFile(defaultConfigProject);
this.telemetryOnOpenFile(info);
return result;
};
- ProjectService.prototype.removeOrphanConfiguredProjects = function () {
+ ProjectService.prototype.removeOrphanConfiguredProjects = function (toRetainConfiguredProjects) {
var _this = this;
var toRemoveConfiguredProjects = ts.cloneMap(this.configuredProjects);
+ if (toRetainConfiguredProjects) {
+ if (ts.isArray(toRetainConfiguredProjects)) {
+ toRetainConfiguredProjects.forEach(retainConfiguredProject);
+ }
+ else {
+ retainConfiguredProject(toRetainConfiguredProjects);
+ }
+ }
// Do not remove configured projects that are used as original projects of other
this.inferredProjects.forEach(markOriginalProjectsAsUsed);
this.externalProjects.forEach(markOriginalProjectsAsUsed);
this.configuredProjects.forEach(function (project) {
// If project has open ref (there are more than zero references from external project/open file), keep it alive as well as any project it references
if (project.hasOpenRef()) {
- toRemoveConfiguredProjects.delete(project.canonicalConfigFilePath);
+ retainConfiguredProject(project);
markOriginalProjectsAsUsed(project);
}
else {
@@ -131523,7 +132494,7 @@ var ts;
if (ref) {
var refProject = _this.configuredProjects.get(ref.sourceFile.path);
if (refProject && refProject.hasOpenRef()) {
- toRemoveConfiguredProjects.delete(project.canonicalConfigFilePath);
+ retainConfiguredProject(project);
}
}
});
@@ -131536,6 +132507,9 @@ var ts;
project.originalConfiguredProjects.forEach(function (_value, configuredProjectPath) { return toRemoveConfiguredProjects.delete(configuredProjectPath); });
}
}
+ function retainConfiguredProject(project) {
+ toRemoveConfiguredProjects.delete(project.canonicalConfigFilePath);
+ }
};
ProjectService.prototype.removeOrphanScriptInfos = function () {
var _this = this;
@@ -131663,15 +132637,16 @@ var ts;
}
}
// All the script infos now exist, so ok to go update projects for open files
+ var defaultConfigProjects;
if (openScriptInfos) {
- openScriptInfos.forEach(function (info) { return _this.assignProjectToOpenedScriptInfo(info); });
+ defaultConfigProjects = ts.mapDefined(openScriptInfos, function (info) { return _this.assignProjectToOpenedScriptInfo(info).defaultConfigProject; });
}
// While closing files there could be open files that needed assigning new inferred projects, do it now
if (assignOrphanScriptInfosToInferredProject) {
this.assignOrphanScriptInfosToInferredProject();
}
// Cleanup projects
- this.cleanupAfterOpeningFile();
+ this.cleanupAfterOpeningFile(defaultConfigProjects);
// Telemetry
ts.forEach(openScriptInfos, function (info) { return _this.telemetryOnOpenFile(info); });
this.printProjects();
@@ -132046,6 +133021,9 @@ var ts;
}
return false;
}
+ function dtsChangeCanAffectEmit(compilationSettings) {
+ return ts.getEmitDeclarations(compilationSettings) || !!compilationSettings.emitDecoratorMetadata;
+ }
function formatDiag(fileName, project, diag) {
var scriptInfo = project.getScriptInfoForNormalizedPath(fileName); // TODO: GH#18217
return {
@@ -132862,7 +133840,8 @@ var ts;
}
catch (_b) { } // tslint:disable-line no-empty
}
- if (err.message && err.message.indexOf("Could not find sourceFile:") !== -1) {
+ if (err.ProgramFiles) {
+ msg += "\n\nProgram files: " + JSON.stringify(err.ProgramFiles) + "\n";
msg += "\n\nProjects::\n";
var counter_1 = 0;
var addProjectInfo = function (project) {
@@ -132885,7 +133864,9 @@ var ts;
}
return;
}
- this.host.write(formatMessage(msg, this.logger, this.byteLength, this.host.newLine));
+ var msgText = formatMessage(msg, this.logger, this.byteLength, this.host.newLine);
+ ts.perfLogger.logEvent("Response message size: " + msgText.length);
+ this.host.write(msgText);
};
Session.prototype.event = function (body, eventName) {
this.send(toEvent(eventName, body));
@@ -133617,15 +134598,19 @@ var ts;
return server.emptyArray;
}
return combineProjectOutput(info, function (path) { return _this.projectService.getScriptInfoForPath(path); }, projects, function (project, info) {
- var result;
- if (project.compileOnSaveEnabled && project.languageServiceEnabled && !project.isOrphan() && !project.getCompilationSettings().noEmit) {
- result = {
- projectFileName: project.getProjectName(),
- fileNames: project.getCompileOnSaveAffectedFileList(info),
- projectUsesOutFile: !!project.getCompilationSettings().outFile || !!project.getCompilationSettings().out
- };
+ if (!project.compileOnSaveEnabled || !project.languageServiceEnabled || project.isOrphan()) {
+ return undefined;
}
- return result;
+ var compilationSettings = project.getCompilationSettings();
+ if (!!compilationSettings.noEmit || ts.fileExtensionIs(info.fileName, ".d.ts" /* Dts */) && !dtsChangeCanAffectEmit(compilationSettings)) {
+ // avoid triggering emit when a change is made in a .d.ts when declaration emit and decorator metadata emit are disabled
+ return undefined;
+ }
+ return {
+ projectFileName: project.getProjectName(),
+ fileNames: project.getCompileOnSaveAffectedFileList(info),
+ projectUsesOutFile: !!compilationSettings.outFile || !!compilationSettings.out
+ };
});
};
Session.prototype.emitFile = function (args) {
@@ -134106,6 +135091,7 @@ var ts;
try {
request = JSON.parse(message);
relevantFile = request.arguments && request.arguments.file ? request.arguments : undefined;
+ ts.perfLogger.logStartCommand("" + request.command, message.substring(0, 100));
var _a = this.executeCommand(request), response = _a.response, responseRequired = _a.responseRequired;
if (this.logger.hasLevel(server.LogLevel.requestTime)) {
var elapsedTime = hrTimeToMilliseconds(this.hrtime(start)).toFixed(4);
@@ -134116,6 +135102,8 @@ var ts;
this.logger.perftrc(request.seq + "::" + request.command + ": async elapsed time (in milliseconds) " + elapsedTime);
}
}
+ // Note: Log before writing the response, else the editor can complete its activity before the server does
+ ts.perfLogger.logStopCommand("" + request.command, "Success");
if (response) {
this.doOutput(response, request.command, request.seq, /*success*/ true);
}
@@ -134126,10 +135114,12 @@ var ts;
catch (err) {
if (err instanceof ts.OperationCanceledException) {
// Handle cancellation exceptions
+ ts.perfLogger.logStopCommand("" + (request && request.command), "Canceled: " + err);
this.doOutput({ canceled: true }, request.command, request.seq, /*success*/ true);
return;
}
this.logErrorWorker(err, message, relevantFile);
+ ts.perfLogger.logStopCommand("" + (request && request.command), "Error: " + err);
this.doOutput(
/*info*/ undefined, request ? request.command : server.CommandNames.Unknown, request ? request.seq : 0,
/*success*/ false, "Error processing request. " + err.message + "\n" + err.stack);
diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts
index 2773975519c..bb30ccc908d 100644
--- a/lib/typescript.d.ts
+++ b/lib/typescript.d.ts
@@ -374,29 +374,30 @@ declare namespace ts {
JSDocOptionalType = 294,
JSDocFunctionType = 295,
JSDocVariadicType = 296,
- JSDocComment = 297,
- JSDocTypeLiteral = 298,
- JSDocSignature = 299,
- JSDocTag = 300,
- JSDocAugmentsTag = 301,
- JSDocAuthorTag = 302,
- JSDocClassTag = 303,
- JSDocCallbackTag = 304,
- JSDocEnumTag = 305,
- JSDocParameterTag = 306,
- JSDocReturnTag = 307,
- JSDocThisTag = 308,
- JSDocTypeTag = 309,
- JSDocTemplateTag = 310,
- JSDocTypedefTag = 311,
- JSDocPropertyTag = 312,
- SyntaxList = 313,
- NotEmittedStatement = 314,
- PartiallyEmittedExpression = 315,
- CommaListExpression = 316,
- MergeDeclarationMarker = 317,
- EndOfDeclarationMarker = 318,
- Count = 319,
+ JSDocNamepathType = 297,
+ JSDocComment = 298,
+ JSDocTypeLiteral = 299,
+ JSDocSignature = 300,
+ JSDocTag = 301,
+ JSDocAugmentsTag = 302,
+ JSDocAuthorTag = 303,
+ JSDocClassTag = 304,
+ JSDocCallbackTag = 305,
+ JSDocEnumTag = 306,
+ JSDocParameterTag = 307,
+ JSDocReturnTag = 308,
+ JSDocThisTag = 309,
+ JSDocTypeTag = 310,
+ JSDocTemplateTag = 311,
+ JSDocTypedefTag = 312,
+ JSDocPropertyTag = 313,
+ SyntaxList = 314,
+ NotEmittedStatement = 315,
+ PartiallyEmittedExpression = 316,
+ CommaListExpression = 317,
+ MergeDeclarationMarker = 318,
+ EndOfDeclarationMarker = 319,
+ Count = 320,
FirstAssignment = 60,
LastAssignment = 72,
FirstCompoundAssignment = 61,
@@ -423,9 +424,9 @@ declare namespace ts {
LastBinaryOperator = 72,
FirstNode = 149,
FirstJSDocNode = 289,
- LastJSDocNode = 312,
- FirstJSDocTagNode = 300,
- LastJSDocTagNode = 312,
+ LastJSDocNode = 313,
+ FirstJSDocTagNode = 301,
+ LastJSDocTagNode = 313,
}
export enum NodeFlags {
None = 0,
@@ -1558,6 +1559,10 @@ declare namespace ts {
kind: SyntaxKind.JSDocVariadicType;
type: TypeNode;
}
+ export interface JSDocNamepathType extends JSDocType {
+ kind: SyntaxKind.JSDocNamepathType;
+ type: TypeNode;
+ }
export type JSDocTypeReferencingNode = JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
export interface JSDoc extends Node {
kind: SyntaxKind.JSDocComment;
@@ -1589,7 +1594,8 @@ declare namespace ts {
export interface JSDocClassTag extends JSDocTag {
kind: SyntaxKind.JSDocClassTag;
}
- export interface JSDocEnumTag extends JSDocTag {
+ export interface JSDocEnumTag extends JSDocTag, Declaration {
+ parent: JSDoc;
kind: SyntaxKind.JSDocEnumTag;
typeExpression?: JSDocTypeExpression;
}
@@ -2126,28 +2132,28 @@ declare namespace ts {
ModuleExports = 134217728,
Enum = 384,
Variable = 3,
- Value = 67220415,
- Type = 67897832,
+ Value = 111551,
+ Type = 788968,
Namespace = 1920,
Module = 1536,
Accessor = 98304,
- FunctionScopedVariableExcludes = 67220414,
- BlockScopedVariableExcludes = 67220415,
- ParameterExcludes = 67220415,
+ FunctionScopedVariableExcludes = 111550,
+ BlockScopedVariableExcludes = 111551,
+ ParameterExcludes = 111551,
PropertyExcludes = 0,
- EnumMemberExcludes = 68008959,
- FunctionExcludes = 67219887,
- ClassExcludes = 68008383,
- InterfaceExcludes = 67897736,
- RegularEnumExcludes = 68008191,
- ConstEnumExcludes = 68008831,
+ EnumMemberExcludes = 900095,
+ FunctionExcludes = 110991,
+ ClassExcludes = 899503,
+ InterfaceExcludes = 788872,
+ RegularEnumExcludes = 899327,
+ ConstEnumExcludes = 899967,
ValueModuleExcludes = 110735,
NamespaceModuleExcludes = 0,
- MethodExcludes = 67212223,
- GetAccessorExcludes = 67154879,
- SetAccessorExcludes = 67187647,
- TypeParameterExcludes = 67635688,
- TypeAliasExcludes = 67897832,
+ MethodExcludes = 103359,
+ GetAccessorExcludes = 46015,
+ SetAccessorExcludes = 78783,
+ TypeParameterExcludes = 526824,
+ TypeAliasExcludes = 788968,
AliasExcludes = 2097152,
ModuleMember = 2623475,
ExportHasLocal = 944,
@@ -2600,7 +2606,7 @@ declare namespace ts {
UMD = 3,
System = 4,
ES2015 = 5,
- ESNext = 6
+ ESNext = 99
}
export enum JsxEmit {
None = 0,
@@ -2640,9 +2646,9 @@ declare namespace ts {
ES2018 = 5,
ES2019 = 6,
ES2020 = 7,
- ESNext = 8,
+ ESNext = 99,
JSON = 100,
- Latest = 8
+ Latest = 99
}
export enum LanguageVariant {
Standard = 0,
@@ -2768,11 +2774,11 @@ declare namespace ts {
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
readDirectory?(rootDir: string, extensions: ReadonlyArray, excludes: ReadonlyArray | undefined, includes: ReadonlyArray, depth?: number): string[];
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
/**
* This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
*/
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
getEnvironmentVariable?(name: string): string | undefined;
createHash?(data: string): string;
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
@@ -3168,6 +3174,7 @@ declare namespace ts {
getTokenPos(): number;
getTokenText(): string;
getTokenValue(): string;
+ hasUnicodeEscape(): boolean;
hasExtendedUnicodeEscape(): boolean;
hasPrecedingLineBreak(): boolean;
isIdentifier(): boolean;
@@ -4528,9 +4535,9 @@ declare namespace ts {
/** If provided is used to get the environment variable */
getEnvironmentVariable?(name: string): string | undefined;
/** If provided, used to resolve the module names, otherwise typescript's default module resolution */
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
/** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
}
interface WatchCompilerHost extends ProgramHost, WatchHost {
/** If provided, callback to invoke after every new program creation */
@@ -4885,9 +4892,9 @@ declare namespace ts {
realpath?(path: string): string;
fileExists?(path: string): boolean;
getTypeRootsVersion?(): number;
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined;
- resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
+ resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
getDirectories?(directoryName: string): string[];
/**
* Gets a set of custom transformers to use during emit.
@@ -5670,6 +5677,7 @@ declare namespace ts {
}
}
declare namespace ts {
+ /** The classifier is used for syntactic highlighting in editors via the TSServer */
function createClassifier(): Classifier;
}
declare namespace ts {
diff --git a/lib/typescript.js b/lib/typescript.js
index f075e0c8df9..4bb7cc4a477 100644
--- a/lib/typescript.js
+++ b/lib/typescript.js
@@ -82,7 +82,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.6";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".0-beta";
+ ts.version = ts.versionMajorMinor + ".1-rc";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -1237,6 +1237,18 @@ var ts;
return keys;
}
ts.getOwnKeys = getOwnKeys;
+ function getAllKeys(obj) {
+ var result = [];
+ do {
+ var names = Object.getOwnPropertyNames(obj);
+ for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
+ var name = names_1[_i];
+ pushIfUnique(result, name);
+ }
+ } while (obj = Object.getPrototypeOf(obj));
+ return result;
+ }
+ ts.getAllKeys = getAllKeys;
function getOwnValues(sparseArray) {
var values = [];
for (var key in sparseArray) {
@@ -2376,6 +2388,46 @@ var ts;
})(ts || (ts = {}));
/* @internal */
var ts;
+(function (ts) {
+ var nullLogger = {
+ logEvent: ts.noop,
+ logErrEvent: ts.noop,
+ logPerfEvent: ts.noop,
+ logInfoEvent: ts.noop,
+ logStartCommand: ts.noop,
+ logStopCommand: ts.noop,
+ logStartUpdateProgram: ts.noop,
+ logStopUpdateProgram: ts.noop,
+ logStartUpdateGraph: ts.noop,
+ logStopUpdateGraph: ts.noop,
+ logStartResolveModule: ts.noop,
+ logStopResolveModule: ts.noop,
+ logStartParseSourceFile: ts.noop,
+ logStopParseSourceFile: ts.noop,
+ logStartReadFile: ts.noop,
+ logStopReadFile: ts.noop,
+ logStartBindFile: ts.noop,
+ logStopBindFile: ts.noop,
+ logStartScheduledOperation: ts.noop,
+ logStopScheduledOperation: ts.noop,
+ };
+ // Load optional module to enable Event Tracing for Windows
+ // See https://github.com/microsoft/typescript-etw for more information
+ var etwModule;
+ try {
+ // require() will throw an exception if the module is not installed
+ // It may also return undefined if not installed properly
+ etwModule = require("@microsoft/typescript-etw"); // tslint:disable-line:no-implicit-dependencies
+ }
+ catch (e) {
+ etwModule = undefined;
+ }
+ /** Performance logger that will generate ETW events if possible */
+ ts.perfLogger = etwModule ? etwModule : nullLogger;
+ ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
(function (ts) {
// https://semver.org/#spec-item-2
// > A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative
@@ -3068,32 +3120,34 @@ var ts;
SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType";
SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType";
SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature";
- SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag";
- SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 302] = "JSDocAuthorTag";
- SyntaxKind[SyntaxKind["JSDocClassTag"] = 303] = "JSDocClassTag";
- SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 304] = "JSDocCallbackTag";
- SyntaxKind[SyntaxKind["JSDocEnumTag"] = 305] = "JSDocEnumTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 306] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 307] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocThisTag"] = 308] = "JSDocThisTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 309] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 310] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 311] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 312] = "JSDocPropertyTag";
+ // https://jsdoc.app/about-namepaths.html
+ SyntaxKind[SyntaxKind["JSDocNamepathType"] = 297] = "JSDocNamepathType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 298] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 299] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocSignature"] = 300] = "JSDocSignature";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 301] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 302] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 303] = "JSDocAuthorTag";
+ SyntaxKind[SyntaxKind["JSDocClassTag"] = 304] = "JSDocClassTag";
+ SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 305] = "JSDocCallbackTag";
+ SyntaxKind[SyntaxKind["JSDocEnumTag"] = 306] = "JSDocEnumTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 307] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 308] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 309] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 310] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 311] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 312] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 313] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 313] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 314] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 314] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 315] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 316] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 317] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 318] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 315] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 316] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 317] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 318] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 319] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 319] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 320] = "Count";
// Markers
SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment";
@@ -3121,9 +3175,9 @@ var ts;
SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator";
SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode";
SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 312] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 312] = "LastJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 313] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 301] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 313] = "LastJSDocTagNode";
/* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword";
/* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
@@ -3249,6 +3303,8 @@ var ts;
/* @internal */
TokenFlags[TokenFlags["ContainsSeparator"] = 512] = "ContainsSeparator";
/* @internal */
+ TokenFlags[TokenFlags["UnicodeEscape"] = 1024] = "UnicodeEscape";
+ /* @internal */
TokenFlags[TokenFlags["BinaryOrOctalSpecifier"] = 384] = "BinaryOrOctalSpecifier";
/* @internal */
TokenFlags[TokenFlags["NumericLiteralFlags"] = 1008] = "NumericLiteralFlags";
@@ -3472,32 +3528,32 @@ var ts;
SymbolFlags[SymbolFlags["All"] = 67108863] = "All";
SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum";
SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable";
- SymbolFlags[SymbolFlags["Value"] = 67220415] = "Value";
- SymbolFlags[SymbolFlags["Type"] = 67897832] = "Type";
+ SymbolFlags[SymbolFlags["Value"] = 111551] = "Value";
+ SymbolFlags[SymbolFlags["Type"] = 788968] = "Type";
SymbolFlags[SymbolFlags["Namespace"] = 1920] = "Namespace";
SymbolFlags[SymbolFlags["Module"] = 1536] = "Module";
SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor";
// Variables can be redeclared, but can not redeclare a block-scoped declaration with the
// same name, or any other value that is not a variable, e.g. ValueModule or Class
- SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 67220414] = "FunctionScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 111550] = "FunctionScopedVariableExcludes";
// Block-scoped declarations are not allowed to be re-declared
// they can not merge with anything in the value space
- SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 67220415] = "BlockScopedVariableExcludes";
- SymbolFlags[SymbolFlags["ParameterExcludes"] = 67220415] = "ParameterExcludes";
+ SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 111551] = "BlockScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["ParameterExcludes"] = 111551] = "ParameterExcludes";
SymbolFlags[SymbolFlags["PropertyExcludes"] = 0] = "PropertyExcludes";
- SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 68008959] = "EnumMemberExcludes";
- SymbolFlags[SymbolFlags["FunctionExcludes"] = 67219887] = "FunctionExcludes";
- SymbolFlags[SymbolFlags["ClassExcludes"] = 68008383] = "ClassExcludes";
- SymbolFlags[SymbolFlags["InterfaceExcludes"] = 67897736] = "InterfaceExcludes";
- SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 68008191] = "RegularEnumExcludes";
- SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 68008831] = "ConstEnumExcludes";
+ SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes";
+ SymbolFlags[SymbolFlags["FunctionExcludes"] = 110991] = "FunctionExcludes";
+ SymbolFlags[SymbolFlags["ClassExcludes"] = 899503] = "ClassExcludes";
+ SymbolFlags[SymbolFlags["InterfaceExcludes"] = 788872] = "InterfaceExcludes";
+ SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes";
+ SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes";
SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 110735] = "ValueModuleExcludes";
SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes";
- SymbolFlags[SymbolFlags["MethodExcludes"] = 67212223] = "MethodExcludes";
- SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 67154879] = "GetAccessorExcludes";
- SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 67187647] = "SetAccessorExcludes";
- SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 67635688] = "TypeParameterExcludes";
- SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 67897832] = "TypeAliasExcludes";
+ SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes";
+ SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes";
+ SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes";
+ SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes";
+ SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes";
SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes";
SymbolFlags[SymbolFlags["ModuleMember"] = 2623475] = "ModuleMember";
SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal";
@@ -3825,8 +3881,11 @@ var ts;
ModuleKind[ModuleKind["AMD"] = 2] = "AMD";
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
ModuleKind[ModuleKind["System"] = 4] = "System";
+ // NOTE: ES module kinds should be contiguous to more easily check whether a module kind is *any* ES module kind.
+ // Non-ES module kinds should not come between ES2015 (the earliest ES module kind) and ESNext (the last ES
+ // module kind).
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
- ModuleKind[ModuleKind["ESNext"] = 6] = "ESNext";
+ ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
var JsxEmit;
(function (JsxEmit) {
@@ -3865,9 +3924,9 @@ var ts;
ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018";
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
- ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext";
+ ScriptTarget[ScriptTarget["ESNext"] = 99] = "ESNext";
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
- ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest";
+ ScriptTarget[ScriptTarget["Latest"] = 99] = "Latest";
})(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
var LanguageVariant;
(function (LanguageVariant) {
@@ -4563,6 +4622,38 @@ var ts;
}
}
ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
+ /* @internal */
+ function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
+ var cache = ts.createMap();
+ var callbacksCache = ts.createMultiMap();
+ var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
+ return function (fileName, callback, pollingInterval) {
+ var path = toCanonicalFileName(fileName);
+ var existing = cache.get(path);
+ if (existing) {
+ existing.refCount++;
+ }
+ else {
+ cache.set(path, {
+ watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval),
+ refCount: 1
+ });
+ }
+ callbacksCache.add(path, callback);
+ return {
+ close: function () {
+ var watcher = ts.Debug.assertDefined(cache.get(path));
+ callbacksCache.remove(path, callback);
+ watcher.refCount--;
+ if (watcher.refCount)
+ return;
+ cache.delete(path);
+ ts.closeFileWatcherOf(watcher);
+ }
+ };
+ };
+ }
+ ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
/**
* Returns true if file status changed
*/
@@ -4589,6 +4680,8 @@ var ts;
ts.getFileWatcherEventKind = getFileWatcherEventKind;
/*@internal*/
ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
+ /*@internal*/
+ ts.sysLog = ts.noop;
/**
* Watch the directory recursively using host provided method to watch child directories
* that means if this is recursive watcher, watch the children directories as well
@@ -4729,6 +4822,7 @@ var ts;
var Buffer = require("buffer").Buffer;
var nodeVersion = getNodeMajorVersion();
var isNode4OrLater = nodeVersion >= 4;
+ var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
var platform = _os.platform();
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
var FileSystemEntryKind;
@@ -4739,6 +4833,7 @@ var ts;
var useNonPollingWatchers = process.env.TSC_NONPOLLING_WATCHER;
var tscWatchFile = process.env.TSC_WATCHFILE;
var tscWatchDirectory = process.env.TSC_WATCHDIRECTORY;
+ var fsWatchFile = createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames);
var dynamicPollingWatchFile;
var nodeSystem = {
args: process.argv.slice(2),
@@ -4875,7 +4970,7 @@ var ts;
return useNonPollingWatchers ?
createNonPollingWatchFile() :
// Default to do not use polling interval as it is before this experiment branch
- function (fileName, callback) { return fsWatchFile(fileName, callback); };
+ function (fileName, callback) { return fsWatchFile(fileName, callback, /*pollingInterval*/ undefined); };
}
function getWatchDirectory() {
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
@@ -4949,7 +5044,7 @@ var ts;
return watcher;
}
}
- function fsWatchFile(fileName, callback, pollingInterval) {
+ function fsWatchFileWorker(fileName, callback, pollingInterval) {
_fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
var eventKind;
return {
@@ -5007,6 +5102,12 @@ var ts;
}
function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingWatchFile, pollingInterval) {
var options;
+ var lastDirectoryPartWithDirectorySeparator;
+ var lastDirectoryPart;
+ if (isLinuxOrMacOs) {
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
+ }
/** Watcher for the file system entry depending on whether it is missing or present */
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
watchMissingFileSystemEntry() :
@@ -5023,6 +5124,7 @@ var ts;
* @param createWatcher
*/
function invokeCallbackAndUpdateWatcher(createWatcher) {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
// Call the callback for current directory
callback("rename", "");
// If watcher is not closed, update it
@@ -5047,7 +5149,9 @@ var ts;
}
}
try {
- var presentWatcher = _fs.watch(fileOrDirectory, options, callback);
+ var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
+ callbackChangingToMissingFileSystemEntry :
+ callback);
// Watch the missing file or directory or error
presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
return presentWatcher;
@@ -5059,11 +5163,23 @@ var ts;
return watchPresentFileSystemEntryWithFsWatchFile();
}
}
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
+ return event === "rename" &&
+ (!relativeName ||
+ relativeName === lastDirectoryPart ||
+ relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length) &&
+ !fileSystemEntryExists(fileOrDirectory, entryKind) ?
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
+ callback(event, relativeName);
+ }
/**
* Watch the file or directory using fs.watchFile since fs.watch threw exception
* Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
*/
function watchPresentFileSystemEntryWithFsWatchFile() {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
return fallbackPollingWatchFile(fileOrDirectory, createFileWatcherCallback(callback), pollingInterval);
}
/**
@@ -5096,7 +5212,7 @@ var ts;
function createWatchDirectoryUsing(fsWatchFile) {
return function (directoryName, callback) { return fsWatchFile(directoryName, function () { return callback(directoryName); }, PollingInterval.Medium); };
}
- function readFile(fileName, _encoding) {
+ function readFileWorker(fileName, _encoding) {
if (!fileExists(fileName)) {
return undefined;
}
@@ -5124,7 +5240,14 @@ var ts;
// Default is UTF-8 with no byte order mark
return buffer.toString("utf8");
}
+ function readFile(fileName, _encoding) {
+ ts.perfLogger.logStartReadFile(fileName);
+ var file = readFileWorker(fileName, _encoding);
+ ts.perfLogger.logStopReadFile();
+ return file;
+ }
function writeFile(fileName, data, writeByteOrderMark) {
+ ts.perfLogger.logEvent("WriteFile: " + fileName);
// If a BOM is required, emit one
if (writeByteOrderMark) {
data = byteOrderMarkIndicator + data;
@@ -5141,6 +5264,7 @@ var ts;
}
}
function getAccessibleFileSystemEntries(path) {
+ ts.perfLogger.logEvent("ReadDir: " + (path || "."));
try {
var entries = _fs.readdirSync(path || ".").sort();
var files = [];
@@ -5196,6 +5320,7 @@ var ts;
return fileSystemEntryExists(path, 1 /* Directory */);
}
function getDirectories(path) {
+ ts.perfLogger.logEvent("ReadDir: " + path);
return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); });
}
function realpath(path) {
@@ -5386,7 +5511,6 @@ var ts;
A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."),
Invalid_reference_directive_syntax: diag(1084, ts.DiagnosticCategory.Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, ts.DiagnosticCategory.Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."),
- An_accessor_cannot_be_declared_in_an_ambient_context: diag(1086, ts.DiagnosticCategory.Error, "An_accessor_cannot_be_declared_in_an_ambient_context_1086", "An accessor cannot be declared in an ambient context."),
_0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."),
_0_modifier_cannot_appear_on_a_parameter: diag(1090, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."),
Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."),
@@ -5539,6 +5663,7 @@ var ts;
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
+ Keywords_cannot_contain_escape_characters: diag(1260, ts.DiagnosticCategory.Error, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -5571,7 +5696,7 @@ var ts;
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
- The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_option_1343", "The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options."),
+ The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system_1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'esnext' or 'system'."),
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness"),
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
@@ -6694,7 +6819,7 @@ var ts;
_a.of = 148 /* OfKeyword */,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */, "`": 59 /* BacktickToken */ }));
/*
As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
IdentifierStart ::
@@ -6741,6 +6866,14 @@ var ts;
*/
var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
+ /**
+ * Generated by scripts/regenerate-unicode-identifier-parts.js on node v12.4.0 with unicode 12.1
+ * based on http://www.unicode.org/reports/tr31/ and https://www.ecma-international.org/ecma-262/6.0/#sec-names-and-keywords
+ * unicodeESNextIdentifierStart corresponds to the ID_Start and Other_ID_Start property, and
+ * unicodeESNextIdentifierPart corresponds to ID_Continue, Other_ID_Continue, plus ID_Start and Other_ID_Start
+ */
+ var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3133, 3160, 3162, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101];
+ var unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3328, 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7673, 7675, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65071, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69376, 69404, 69415, 69415, 69424, 69456, 69600, 69622, 69632, 69702, 69734, 69743, 69759, 69818, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69958, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70096, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70206, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70751, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71680, 71738, 71840, 71913, 71935, 71935, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123584, 123641, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101, 917760, 917999];
function lookupInUnicodeMap(code, map) {
// Bail out quickly if it couldn't possibly be in the map.
if (code < map[0]) {
@@ -6767,15 +6900,17 @@ var ts;
return false;
}
/* @internal */ function isUnicodeIdentifierStart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
- lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierStart);
+ return languageVersion >= 2 /* ES2015 */ ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierStart) :
+ languageVersion === 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierStart);
}
ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;
function isUnicodeIdentifierPart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
- lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierPart);
+ return languageVersion >= 2 /* ES2015 */ ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierPart) :
+ languageVersion === 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierPart);
}
function makeReverseMap(source) {
var result = [];
@@ -7271,11 +7406,12 @@ var ts;
ts.isIdentifierPart = isIdentifierPart;
/* @internal */
function isIdentifierText(name, languageVersion) {
- if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {
+ var ch = codePointAt(name, 0);
+ if (!isIdentifierStart(ch, languageVersion)) {
return false;
}
- for (var i = 1; i < name.length; i++) {
- if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {
+ for (var i = charSize(ch); i < name.length; i += charSize(ch)) {
+ if (!isIdentifierPart(ch = codePointAt(name, i), languageVersion)) {
return false;
}
}
@@ -7306,6 +7442,7 @@ var ts;
getTokenPos: function () { return tokenPos; },
getTokenText: function () { return text.substring(tokenPos, pos); },
getTokenValue: function () { return tokenValue; },
+ hasUnicodeEscape: function () { return (tokenFlags & 1024 /* UnicodeEscape */) !== 0; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; },
@@ -7432,7 +7569,7 @@ var ts;
}
}
function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
- if (!isIdentifierStart(text.charCodeAt(pos), languageVersion)) {
+ if (!isIdentifierStart(codePointAt(text, pos), languageVersion)) {
return;
}
var identifierStart = pos;
@@ -7640,6 +7777,7 @@ var ts;
pos++;
return scanExtendedUnicodeEscape();
}
+ tokenFlags |= 1024 /* UnicodeEscape */;
// '\uDDDD'
return scanHexadecimalEscape(/*numDigits*/ 4);
case 120 /* x */:
@@ -7722,21 +7860,41 @@ var ts;
}
return -1;
}
+ function peekExtendedUnicodeEscape() {
+ if (languageVersion >= 2 /* ES2015 */ && codePointAt(text, pos + 1) === 117 /* u */ && codePointAt(text, pos + 2) === 123 /* openBrace */) {
+ var start_2 = pos;
+ pos += 3;
+ var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
+ var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
+ pos = start_2;
+ return escapedValue;
+ }
+ return -1;
+ }
function scanIdentifierParts() {
var result = "";
var start = pos;
while (pos < end) {
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
if (isIdentifierPart(ch, languageVersion)) {
- pos++;
+ pos += charSize(ch);
}
else if (ch === 92 /* backslash */) {
+ ch = peekExtendedUnicodeEscape();
+ if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ result += scanExtendedUnicodeEscape();
+ start = pos;
+ continue;
+ }
ch = peekUnicodeEscape();
if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
break;
}
+ tokenFlags |= 1024 /* UnicodeEscape */;
result += text.substring(start, pos);
- result += String.fromCharCode(ch);
+ result += utf16EncodeAsString(ch);
// Valid Unicode escape is always six characters
pos += 6;
start = pos;
@@ -7831,7 +7989,7 @@ var ts;
if (pos >= end) {
return token = 1 /* EndOfFileToken */;
}
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
// Special handling for shebang
if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) {
pos = scanShebangTrivia(text, pos);
@@ -8196,9 +8354,17 @@ var ts;
pos++;
return token = 58 /* AtToken */;
case 92 /* backslash */:
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
var cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
pos += 6;
+ tokenFlags |= 1024 /* UnicodeEscape */;
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
return token = getIdentifierToken();
}
@@ -8207,9 +8373,9 @@ var ts;
return token = 0 /* Unknown */;
default:
if (isIdentifierStart(ch, languageVersion)) {
- pos++;
- while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))
- pos++;
+ pos += charSize(ch);
+ while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion))
+ pos += charSize(ch);
tokenValue = text.substring(tokenPos, pos);
if (ch === 92 /* backslash */) {
tokenValue += scanIdentifierParts();
@@ -8217,16 +8383,16 @@ var ts;
return token = getIdentifierToken();
}
else if (isWhiteSpaceSingleLine(ch)) {
- pos++;
+ pos += charSize(ch);
continue;
}
else if (isLineBreak(ch)) {
tokenFlags |= 1 /* PrecedingLineBreak */;
- pos++;
+ pos += charSize(ch);
continue;
}
error(ts.Diagnostics.Invalid_character);
- pos++;
+ pos += charSize(ch);
return token = 0 /* Unknown */;
}
}
@@ -8343,7 +8509,7 @@ var ts;
// First non-whitespace character on this line.
var firstNonWhitespace = 0;
// These initial values are special because the first line is:
- // firstNonWhitespace = 0 to indicate that we want leading whitspace,
+ // firstNonWhitespace = 0 to indicate that we want leading whitespace,
while (pos < end) {
char = text.charCodeAt(pos);
if (char === 123 /* openBrace */) {
@@ -8377,17 +8543,22 @@ var ts;
// they allow dashes
function scanJsxIdentifier() {
if (tokenIsIdentifierOrKeyword(token)) {
- var firstCharPosition = pos;
+ // An identifier or keyword has already been parsed - check for a `-` and then append it and everything after it to the token
+ // Do note that this means that `scanJsxIdentifier` effectively _mutates_ the visible token without advancing to a new token
+ // Any caller should be expecting this behavior and should only read the pos or token value after calling it.
while (pos < end) {
var ch = text.charCodeAt(pos);
- if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
+ if (ch === 45 /* minus */) {
+ tokenValue += "-";
pos++;
+ continue;
}
- else {
+ var oldPos = pos;
+ tokenValue += scanIdentifierParts(); // reuse `scanIdentifierParts` so unicode escapes are handled
+ if (pos === oldPos) {
break;
}
}
- tokenValue += text.substring(firstCharPosition, pos);
}
return token;
}
@@ -8409,8 +8580,8 @@ var ts;
if (pos >= end) {
return token = 1 /* EndOfFileToken */;
}
- var ch = text.charCodeAt(pos);
- pos++;
+ var ch = codePointAt(text, pos);
+ pos += charSize(ch);
switch (ch) {
case 9 /* tab */:
case 11 /* verticalTab */:
@@ -8448,12 +8619,33 @@ var ts;
return token = 24 /* DotToken */;
case 96 /* backtick */:
return token = 59 /* BacktickToken */;
- }
- if (isIdentifierStart(ch, 8 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) {
+ case 92 /* backslash */:
+ pos--;
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
+ var cookedChar = peekUnicodeEscape();
+ if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
+ pos += 6;
+ tokenFlags |= 1024 /* UnicodeEscape */;
+ tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
pos++;
- }
+ return token = 0 /* Unknown */;
+ }
+ if (isIdentifierStart(ch, languageVersion)) {
+ var char = ch;
+ while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion))
+ pos += charSize(char);
tokenValue = text.substring(tokenPos, pos);
+ if (char === 92 /* backslash */) {
+ tokenValue += scanIdentifierParts();
+ }
return token = getIdentifierToken();
}
else {
@@ -8536,6 +8728,33 @@ var ts;
}
}
ts.createScanner = createScanner;
+ /* @internal */
+ var codePointAt = String.prototype.codePointAt ? function (s, i) { return s.codePointAt(i); } : function codePointAt(str, i) {
+ // from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt
+ var size = str.length;
+ // Account for out-of-bounds indices:
+ if (i < 0 || i >= size) {
+ return undefined; // String.codePointAt returns `undefined` for OOB indexes
+ }
+ // Get the first code unit
+ var first = str.charCodeAt(i);
+ // check if it’s the start of a surrogate pair
+ if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { // high surrogate and there is a next code unit
+ var second = str.charCodeAt(i + 1);
+ if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
+ // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
+ }
+ }
+ return first;
+ };
+ /* @internal */
+ function charSize(ch) {
+ if (ch >= 0x10000) {
+ return 2;
+ }
+ return 1;
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -8991,7 +9210,7 @@ var ts;
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 313 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 314 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -9049,6 +9268,8 @@ var ts;
return emitNode && emitNode.flags || 0;
}
ts.getEmitFlags = getEmitFlags;
+ var escapeNoSubstitutionTemplateLiteralText = ts.compose(escapeString, escapeTemplateSubstitution);
+ var escapeNonAsciiNoSubstitutionTemplateLiteralText = ts.compose(escapeNonAsciiString, escapeTemplateSubstitution);
function getLiteralText(node, sourceFile, neverAsciiEscape) {
// If we don't need to downlevel and we can reach the original source text using
// the node's parent reference, then simply get the text as it was originally written.
@@ -9056,7 +9277,11 @@ var ts;
ts.isBigIntLiteral(node))) {
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
}
- var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216 /* NoAsciiEscaping */) ? escapeString : escapeNonAsciiString;
+ // If a NoSubstitutionTemplateLiteral appears to have a substitution in it, the original text
+ // had to include a backslash: `not \${a} substitution`.
+ var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216 /* NoAsciiEscaping */) ?
+ node.kind === 14 /* NoSubstitutionTemplateLiteral */ ? escapeNoSubstitutionTemplateLiteralText : escapeString :
+ node.kind === 14 /* NoSubstitutionTemplateLiteral */ ? escapeNonAsciiNoSubstitutionTemplateLiteralText : escapeNonAsciiString;
// If we can't reach the original source text, use the canonical form if it's a number,
// or a (possibly escaped) quoted form of the original text if it's string-like.
switch (node.kind) {
@@ -9171,6 +9396,43 @@ var ts;
return ts.isExternalModule(node) || compilerOptions.isolatedModules || ((ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS) && !!node.commonJsModuleIndicator);
}
ts.isEffectiveExternalModule = isEffectiveExternalModule;
+ /**
+ * Returns whether the source file will be treated as if it were in strict mode at runtime.
+ */
+ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
+ // We can only verify strict mode for JS/TS files
+ switch (node.scriptKind) {
+ case 1 /* JS */:
+ case 3 /* TS */:
+ case 2 /* JSX */:
+ case 4 /* TSX */:
+ break;
+ default:
+ return false;
+ }
+ // Strict mode does not matter for declaration files.
+ if (node.isDeclarationFile) {
+ return false;
+ }
+ // If `alwaysStrict` is set, then treat the file as strict.
+ if (ts.getStrictOptionValue(compilerOptions, "alwaysStrict")) {
+ return true;
+ }
+ // Starting with a "use strict" directive indicates the file is strict.
+ if (ts.startsWithUseStrict(node.statements)) {
+ return true;
+ }
+ if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
+ // ECMAScript Modules are always strict.
+ if (ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
+ return true;
+ }
+ // Other modules are strict unless otherwise specified.
+ return !compilerOptions.noImplicitUseStrict;
+ }
+ return false;
+ }
+ ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile;
function isBlockScope(node, parentNode) {
switch (node.kind) {
case 285 /* SourceFile */:
@@ -9198,9 +9460,9 @@ var ts;
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
- case 299 /* JSDocSignature */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 300 /* JSDocSignature */:
return true;
default:
ts.assertType(node);
@@ -9221,7 +9483,7 @@ var ts;
case 210 /* ClassExpression */:
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
case 240 /* FunctionDeclaration */:
case 157 /* MethodDeclaration */:
case 158 /* Constructor */:
@@ -9449,6 +9711,12 @@ var ts;
return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */;
}
ts.isImportCall = isImportCall;
+ function isImportMeta(n) {
+ return ts.isMetaProperty(n)
+ && n.keywordToken === 93 /* ImportKeyword */
+ && n.name.escapedText === "meta";
+ }
+ ts.isImportMeta = isImportMeta;
function isLiteralImportTypeNode(n) {
return ts.isImportTypeNode(n) && ts.isLiteralTypeNode(n.argument) && ts.isStringLiteral(n.argument.literal);
}
@@ -9541,7 +9809,7 @@ var ts;
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
case 151 /* TypeParameter */:
return node === parent.constraint;
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return node === parent.constraint;
case 155 /* PropertyDeclaration */:
case 154 /* PropertySignature */:
@@ -10572,7 +10840,7 @@ var ts;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 311 /* JSDocTypedefTag */ || node.kind === 304 /* JSDocCallbackTag */;
+ return node.kind === 312 /* JSDocTypedefTag */ || node.kind === 305 /* JSDocCallbackTag */ || node.kind === 306 /* JSDocEnumTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -11022,6 +11290,10 @@ var ts;
return isKeyword(token) && !isContextualKeyword(token);
}
ts.isNonContextualKeyword = isNonContextualKeyword;
+ function isFutureReservedKeyword(token) {
+ return 110 /* FirstFutureReservedWord */ <= token && token <= 118 /* LastFutureReservedWord */;
+ }
+ ts.isFutureReservedKeyword = isFutureReservedKeyword;
function isStringANonContextualKeyword(name) {
var token = ts.stringToToken(name);
return token !== undefined && isNonContextualKeyword(token);
@@ -11281,7 +11553,7 @@ var ts;
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return 0;
case 209 /* SpreadElement */:
return 1;
@@ -11467,6 +11739,10 @@ var ts;
}
}
ts.createDiagnosticCollection = createDiagnosticCollection;
+ var templateSubstitutionRegExp = /\$\{/g;
+ function escapeTemplateSubstitution(str) {
+ return str.replace(templateSubstitutionRegExp, "\\${");
+ }
// This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator,
// paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in
// the language service. These characters should be escaped when printing, and if any characters are added,
@@ -11835,6 +12111,7 @@ var ts;
return accessor.parameters[hasThis ? 1 : 0];
}
}
+ ts.getSetAccessorValueParameter = getSetAccessorValueParameter;
/** Get the type annotation for the value parameter. */
function getSetAccessorTypeAnnotationNode(accessor) {
var parameter = getSetAccessorValueParameter(accessor);
@@ -11943,7 +12220,7 @@ var ts;
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
/** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 298 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
}
/**
* Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -12734,8 +13011,8 @@ var ts;
/**
* Mutates the map with newMap such that keys in map will be same as newMap.
*/
- function mutateMap(map, newMap, options) {
- var createNewValue = options.createNewValue, onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
+ function mutateMapSkippingNewValues(map, newMap, options) {
+ var onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
// Needs update
map.forEach(function (existingValue, key) {
var valueInNewMap = newMap.get(key);
@@ -12749,6 +13026,15 @@ var ts;
onExistingValue(existingValue, valueInNewMap, key);
}
});
+ }
+ ts.mutateMapSkippingNewValues = mutateMapSkippingNewValues;
+ /**
+ * Mutates the map with newMap such that keys in map will be same as newMap.
+ */
+ function mutateMap(map, newMap, options) {
+ // Needs update
+ mutateMapSkippingNewValues(map, newMap, options);
+ var createNewValue = options.createNewValue;
// Add new values that are not already present
newMap.forEach(function (valueInNewMap, key) {
if (!map.has(key)) {
@@ -12885,7 +13171,7 @@ var ts;
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 8 /* ESNext */:
+ case 99 /* ESNext */:
return "lib.esnext.full.d.ts";
case 7 /* ES2020 */:
return "lib.es2020.full.d.ts";
@@ -13305,6 +13591,9 @@ var ts;
break;
case 222 /* ExpressionStatement */:
var expr = hostNode.expression;
+ if (expr.kind === 205 /* BinaryExpression */ && expr.operatorToken.kind === 60 /* EqualsToken */) {
+ expr = expr.left;
+ }
switch (expr.kind) {
case 190 /* PropertyAccessExpression */:
return expr.name;
@@ -13344,8 +13633,8 @@ var ts;
switch (declaration.kind) {
case 73 /* Identifier */:
return declaration;
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */: {
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */: {
var name = declaration.name;
if (name.kind === 149 /* QualifiedName */) {
return name.right;
@@ -13369,8 +13658,10 @@ var ts;
return undefined;
}
}
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
+ case 306 /* JSDocEnumTag */:
+ return nameForNamelessJSDocTypedef(declaration);
case 255 /* ExportAssignment */: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
@@ -13576,7 +13867,7 @@ var ts;
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 298 /* JSDocComment */);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -13848,7 +14139,7 @@ var ts;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 315 /* PartiallyEmittedExpression */) {
+ while (node.kind === 316 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
@@ -14260,67 +14551,67 @@ var ts;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 297 /* JSDocComment */;
+ return node.kind === 298 /* JSDocComment */;
}
ts.isJSDoc = isJSDoc;
function isJSDocAuthorTag(node) {
- return node.kind === 302 /* JSDocAuthorTag */;
+ return node.kind === 303 /* JSDocAuthorTag */;
}
ts.isJSDocAuthorTag = isJSDocAuthorTag;
function isJSDocAugmentsTag(node) {
- return node.kind === 301 /* JSDocAugmentsTag */;
+ return node.kind === 302 /* JSDocAugmentsTag */;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 303 /* JSDocClassTag */;
+ return node.kind === 304 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 305 /* JSDocEnumTag */;
+ return node.kind === 306 /* JSDocEnumTag */;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 308 /* JSDocThisTag */;
+ return node.kind === 309 /* JSDocThisTag */;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 306 /* JSDocParameterTag */;
+ return node.kind === 307 /* JSDocParameterTag */;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 307 /* JSDocReturnTag */;
+ return node.kind === 308 /* JSDocReturnTag */;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 309 /* JSDocTypeTag */;
+ return node.kind === 310 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 310 /* JSDocTemplateTag */;
+ return node.kind === 311 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 311 /* JSDocTypedefTag */;
+ return node.kind === 312 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 312 /* JSDocPropertyTag */;
+ return node.kind === 313 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 312 /* JSDocPropertyTag */ || node.kind === 306 /* JSDocParameterTag */;
+ return node.kind === 313 /* JSDocPropertyTag */ || node.kind === 307 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 298 /* JSDocTypeLiteral */;
+ return node.kind === 299 /* JSDocTypeLiteral */;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 304 /* JSDocCallbackTag */;
+ return node.kind === 305 /* JSDocCallbackTag */;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 299 /* JSDocSignature */;
+ return node.kind === 300 /* JSDocSignature */;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
@@ -14331,7 +14622,7 @@ var ts;
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 313 /* SyntaxList */;
+ return n.kind === 314 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -14483,7 +14774,7 @@ var ts;
switch (kind) {
case 156 /* MethodSignature */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 162 /* ConstructSignature */:
case 163 /* IndexSignature */:
case 166 /* FunctionType */:
@@ -14778,8 +15069,8 @@ var ts;
case 209 /* SpreadElement */:
case 213 /* AsExpression */:
case 211 /* OmittedExpression */:
- case 316 /* CommaListExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 317 /* CommaListExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -14793,12 +15084,12 @@ var ts;
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 315 /* PartiallyEmittedExpression */;
+ return node.kind === 316 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 314 /* NotEmittedStatement */;
+ return node.kind === 315 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -14909,9 +15200,9 @@ var ts;
|| kind === 243 /* TypeAliasDeclaration */
|| kind === 151 /* TypeParameter */
|| kind === 238 /* VariableDeclaration */
- || kind === 311 /* JSDocTypedefTag */
- || kind === 304 /* JSDocCallbackTag */
- || kind === 312 /* JSDocPropertyTag */;
+ || kind === 312 /* JSDocTypedefTag */
+ || kind === 305 /* JSDocCallbackTag */
+ || kind === 313 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
return kind === 240 /* FunctionDeclaration */
@@ -14946,14 +15237,14 @@ var ts;
|| kind === 220 /* VariableStatement */
|| kind === 225 /* WhileStatement */
|| kind === 232 /* WithStatement */
- || kind === 314 /* NotEmittedStatement */
- || kind === 318 /* EndOfDeclarationMarker */
- || kind === 317 /* MergeDeclarationMarker */;
+ || kind === 315 /* NotEmittedStatement */
+ || kind === 319 /* EndOfDeclarationMarker */
+ || kind === 318 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
if (node.kind === 151 /* TypeParameter */) {
- return (node.parent && node.parent.kind !== 310 /* JSDocTemplateTag */) || ts.isInJSFile(node);
+ return (node.parent && node.parent.kind !== 311 /* JSDocTemplateTag */) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -15048,18 +15339,18 @@ var ts;
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 312 /* LastJSDocNode */;
+ return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 313 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 298 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 312 /* LastJSDocTagNode */;
+ return node.kind >= 301 /* FirstJSDocTagNode */ && node.kind <= 313 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
@@ -17090,7 +17381,7 @@ var ts;
return visitNode(cbNode, node.expression);
case 259 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
case 261 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
@@ -17128,26 +17419,26 @@ var ts;
case 295 /* JSDocFunctionType */:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 297 /* JSDocComment */:
+ case 298 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 302 /* JSDocAuthorTag */:
+ case 303 /* JSDocAuthorTag */:
return visitNode(cbNode, node.tagName);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
node.typeExpression.kind === 289 /* JSDocTypeExpression */
@@ -17155,26 +17446,26 @@ var ts;
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 304 /* JSDocCallbackTag */:
+ case 305 /* JSDocCallbackTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 308 /* JSDocThisTag */:
- case 305 /* JSDocEnumTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 309 /* JSDocThisTag */:
+ case 306 /* JSDocEnumTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 300 /* JSDocTag */:
- case 303 /* JSDocClassTag */:
+ case 301 /* JSDocTag */:
+ case 304 /* JSDocClassTag */:
return visitNode(cbNode, node.tagName);
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -17183,12 +17474,14 @@ var ts;
if (setParentNodes === void 0) { setParentNodes = false; }
ts.performance.mark("beforeParse");
var result;
+ ts.perfLogger.logStartParseSourceFile(fileName);
if (languageVersion === 100 /* JSON */) {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, 6 /* JSON */);
}
else {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
}
+ ts.perfLogger.logStopParseSourceFile();
ts.performance.mark("afterParse");
ts.performance.measure("Parse", "beforeParse", "afterParse");
return result;
@@ -17254,7 +17547,7 @@ var ts;
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
+ var scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ true);
var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
@@ -17272,6 +17565,7 @@ var ts;
var identifiers;
var identifierCount;
var parsingContext;
+ var notParenthesizedArrow;
// Flags that dictate what parsing context we're in. For example:
// Whether or not we are in strict parsing mode. All that changes in strict parsing mode is
// that some tokens that would be considered identifiers may be considered keywords.
@@ -17479,6 +17773,7 @@ var ts;
identifiers = undefined;
syntaxCursor = undefined;
sourceText = undefined;
+ notParenthesizedArrow = undefined;
}
function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {
var isDeclarationFile = isDeclarationFileName(fileName);
@@ -17688,9 +17983,17 @@ var ts;
function token() {
return currentToken;
}
- function nextToken() {
+ function nextTokenWithoutCheck() {
return currentToken = scanner.scan();
}
+ function nextToken() {
+ // if the keyword had an escape
+ if (ts.isKeyword(currentToken) && (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape())) {
+ // issue a parse error for the escape
+ parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), ts.Diagnostics.Keywords_cannot_contain_escape_characters);
+ }
+ return nextTokenWithoutCheck();
+ }
function nextTokenJSDoc() {
return currentToken = scanner.scanJsDocToken();
}
@@ -17929,7 +18232,7 @@ var ts;
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
- nextToken();
+ nextTokenWithoutCheck();
return finishNode(node);
}
// Only for end of file because the error gets reported incorrectly on embedded script tags.
@@ -18839,6 +19142,23 @@ var ts;
}
function parseJSDocType() {
scanner.setInJSDocType(true);
+ var moduleSpecifier = parseOptionalToken(131 /* ModuleKeyword */);
+ if (moduleSpecifier) {
+ var moduleTag = createNode(297 /* JSDocNamepathType */, moduleSpecifier.pos);
+ terminate: while (true) {
+ switch (token()) {
+ case 19 /* CloseBraceToken */:
+ case 1 /* EndOfFileToken */:
+ case 27 /* CommaToken */:
+ case 5 /* WhitespaceTrivia */:
+ break terminate;
+ default:
+ nextTokenJSDoc();
+ }
+ }
+ scanner.setInJSDocType(false);
+ return finishNode(moduleTag);
+ }
var dotdotdot = parseOptionalToken(25 /* DotDotDotToken */);
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
@@ -19962,7 +20282,15 @@ var ts;
}
}
function parsePossibleParenthesizedArrowFunctionExpressionHead() {
- return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ var tokenPos = scanner.getTokenPos();
+ if (notParenthesizedArrow && notParenthesizedArrow.has(tokenPos.toString())) {
+ return undefined;
+ }
+ var result = parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ if (!result) {
+ (notParenthesizedArrow || (notParenthesizedArrow = ts.createMap())).set(tokenPos.toString(), true);
+ }
+ return result;
}
function tryParseAsyncSimpleArrowFunctionExpression() {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
@@ -22373,8 +22701,8 @@ var ts;
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
+ initializeState(content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 99 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -22396,9 +22724,9 @@ var ts;
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion
- var jsDoc = parseJSDocCommentWorker(start, length);
+ var jsDoc = doInsideOfContext(2097152 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
var diagnostics = parseDiagnostics;
clearState();
return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined;
@@ -22409,7 +22737,7 @@ var ts;
var saveToken = currentToken;
var saveParseDiagnosticsLength = parseDiagnostics.length;
var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
- var comment = parseJSDocCommentWorker(start, length);
+ var comment = doInsideOfContext(2097152 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
if (comment) {
comment.parent = parent;
}
@@ -22548,7 +22876,7 @@ var ts;
}
}
function createJSDocComment() {
- var result = createNode(297 /* JSDocComment */, start);
+ var result = createNode(298 /* JSDocComment */, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -22748,7 +23076,7 @@ var ts;
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(300 /* JSDocTag */, start);
+ var result = createNode(301 /* JSDocTag */, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -22811,8 +23139,8 @@ var ts;
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(312 /* JSDocPropertyTag */, start) :
- createNode(306 /* JSDocParameterTag */, start);
+ createNode(313 /* JSDocPropertyTag */, start) :
+ createNode(307 /* JSDocParameterTag */, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -22832,15 +23160,15 @@ var ts;
var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
- var start_2 = scanner.getStartPos();
+ var start_3 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 306 /* JSDocParameterTag */ || child.kind === 312 /* JSDocPropertyTag */) {
+ if (child.kind === 307 /* JSDocParameterTag */ || child.kind === 313 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2);
+ jsdocTypeLiteral = createNode(299 /* JSDocTypeLiteral */, start_3);
jsdocTypeLiteral.jsDocPropertyTags = children;
if (typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
@@ -22854,7 +23182,7 @@ var ts;
if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307 /* JSDocReturnTag */, start);
+ var result = createNode(308 /* JSDocReturnTag */, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
@@ -22863,13 +23191,13 @@ var ts;
if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(309 /* JSDocTypeTag */, start);
+ var result = createNode(310 /* JSDocTypeTag */, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
return finishNode(result);
}
function parseAuthorTag(start, tagName, indent) {
- var result = createNode(302 /* JSDocAuthorTag */, start);
+ var result = createNode(303 /* JSDocAuthorTag */, start);
result.tagName = tagName;
var authorInfoWithEmail = tryParse(function () { return tryParseAuthorNameAndEmail(); });
if (!authorInfoWithEmail) {
@@ -22923,7 +23251,7 @@ var ts;
}
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(301 /* JSDocAugmentsTag */, start);
+ var result = createNode(302 /* JSDocAugmentsTag */, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
@@ -22950,19 +23278,19 @@ var ts;
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(303 /* JSDocClassTag */, start);
+ var tag = createNode(304 /* JSDocClassTag */, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(308 /* JSDocThisTag */, start);
+ var tag = createNode(309 /* JSDocThisTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(305 /* JSDocEnumTag */, start);
+ var tag = createNode(306 /* JSDocEnumTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
@@ -22971,7 +23299,7 @@ var ts;
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(311 /* JSDocTypedefTag */, start);
+ var typedefTag = createNode(312 /* JSDocTypedefTag */, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -22985,9 +23313,9 @@ var ts;
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start);
+ jsdocTypeLiteral = createNode(299 /* JSDocTypeLiteral */, start);
}
- if (child.kind === 309 /* JSDocTypeTag */) {
+ if (child.kind === 310 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -23033,14 +23361,14 @@ var ts;
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(304 /* JSDocCallbackTag */, start);
+ var callbackTag = createNode(305 /* JSDocCallbackTag */, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(299 /* JSDocSignature */, start);
+ var jsdocSignature = createNode(300 /* JSDocSignature */, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -23048,7 +23376,7 @@ var ts;
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58 /* AtToken */)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 307 /* JSDocReturnTag */) {
+ if (tag && tag.kind === 308 /* JSDocReturnTag */) {
return tag;
}
}
@@ -23093,7 +23421,7 @@ var ts;
case 58 /* AtToken */:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 306 /* JSDocParameterTag */ || child.kind === 312 /* JSDocPropertyTag */) &&
+ if (child && (child.kind === 307 /* JSDocParameterTag */ || child.kind === 313 /* JSDocPropertyTag */) &&
target !== 4 /* CallbackParameter */ &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -23163,7 +23491,7 @@ var ts;
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27 /* CommaToken */));
- var result = createNode(310 /* JSDocTemplateTag */, start);
+ var result = createNode(311 /* JSDocTemplateTag */, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
@@ -23198,16 +23526,19 @@ var ts;
if (!ts.tokenIsIdentifierOrKeyword(token())) {
return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
}
+ identifierCount++;
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
var result = createNode(73 /* Identifier */, pos);
- result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
+ if (token() !== 73 /* Identifier */) {
+ result.originalKeywordKind = token();
+ }
+ result.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
finishNode(result, end);
nextTokenJSDoc();
return result;
}
}
- JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker;
})(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {}));
})(Parser || (Parser = {}));
var IncrementalParser;
@@ -24124,7 +24455,7 @@ var ts;
es2018: 5 /* ES2018 */,
es2019: 6 /* ES2019 */,
es2020: 7 /* ES2020 */,
- esnext: 8 /* ESNext */,
+ esnext: 99 /* ESNext */,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
@@ -25492,10 +25823,10 @@ var ts;
var config = __assign({ compilerOptions: __assign({}, ts.arrayFrom(optionMap.entries()).reduce(function (prev, cur) {
var _a;
return (__assign({}, prev, (_a = {}, _a[cur[0]] = cur[1], _a)));
- }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath, originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
+ }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath ? r.originalPath : "", originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
include: filterSameAsDefaultInclude(configParseResult.configFileSpecs.validatedIncludeSpecs),
exclude: configParseResult.configFileSpecs.validatedExcludeSpecs
- } : {}), { compilerOnSave: !!configParseResult.compileOnSave ? true : undefined });
+ } : {}), { compileOnSave: !!configParseResult.compileOnSave ? true : undefined });
return config;
}
ts.convertToTSConfig = convertToTSConfig;
@@ -27020,6 +27351,7 @@ var ts;
trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
}
}
+ ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
switch (moduleResolution) {
case ts.ModuleResolutionKind.NodeJs:
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
@@ -27030,6 +27362,9 @@ var ts;
default:
return ts.Debug.fail("Unexpected moduleResolution: " + moduleResolution);
}
+ if (result && result.resolvedModule)
+ ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
+ ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
if (perFolderCache) {
perFolderCache.set(moduleName, result);
if (!ts.isExternalModuleNameRelative(moduleName)) {
@@ -27862,7 +28197,9 @@ var ts;
var binder = createBinder();
function bindSourceFile(file, options) {
ts.performance.mark("beforeBind");
+ ts.perfLogger.logStartBindFile("" + file.fileName);
binder(file, options);
+ ts.perfLogger.logStopBindFile();
ts.performance.mark("afterBind");
ts.performance.measure("Bind", "beforeBind", "afterBind");
}
@@ -27975,7 +28312,7 @@ var ts;
if (symbol.constEnumOnlyModule && (symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */))) {
symbol.constEnumOnlyModule = false;
}
- if (symbolFlags & 67220415 /* Value */) {
+ if (symbolFlags & 111551 /* Value */) {
setValueDeclaration(symbol, node);
}
}
@@ -28019,7 +28356,7 @@ var ts;
return "__constructor" /* Constructor */;
case 166 /* FunctionType */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return "__call" /* Call */;
case 167 /* ConstructorType */:
case 162 /* ConstructSignature */:
@@ -28204,10 +28541,10 @@ var ts;
if (ts.isJSDocTypeAlias(node))
ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file.
if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32 /* ExportContext */)) || ts.isJSDocTypeAlias(node)) {
- if (ts.hasModifier(node, 512 /* Default */) && !getDeclarationName(node)) {
+ if (!container.locals || (ts.hasModifier(node, 512 /* Default */) && !getDeclarationName(node))) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default!
}
- var exportKind = symbolFlags & 67220415 /* Value */ ? 1048576 /* ExportValue */ : 0;
+ var exportKind = symbolFlags & 111551 /* Value */ ? 1048576 /* ExportValue */ : 0;
var local = declareSymbol(container.locals, /*parent*/ undefined, node, exportKind, symbolExcludes);
local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
node.localSymbol = local;
@@ -28437,8 +28774,9 @@ var ts;
case 192 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
bindJSDocTypeAlias(node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
@@ -29095,7 +29433,7 @@ var ts;
}
function bindJSDocTypeAlias(node) {
node.tagName.parent = node;
- if (node.fullName) {
+ if (node.kind !== 306 /* JSDocEnumTag */ && node.fullName) {
setParentPointers(node, node.fullName);
}
}
@@ -29129,7 +29467,7 @@ var ts;
case 244 /* EnumDeclaration */:
case 189 /* ObjectLiteralExpression */:
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 269 /* JsxAttributes */:
return 1 /* IsContainer */;
case 242 /* InterfaceDeclaration */:
@@ -29151,7 +29489,7 @@ var ts;
case 159 /* GetAccessor */:
case 160 /* SetAccessor */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 295 /* JSDocFunctionType */:
case 166 /* FunctionType */:
case 162 /* ConstructSignature */:
@@ -29214,7 +29552,7 @@ var ts;
case 244 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 189 /* ObjectLiteralExpression */:
case 242 /* InterfaceDeclaration */:
case 269 /* JsxAttributes */:
@@ -29228,7 +29566,7 @@ var ts;
case 167 /* ConstructorType */:
case 161 /* CallSignature */:
case 162 /* ConstructSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 163 /* IndexSignature */:
case 157 /* MethodDeclaration */:
case 156 /* MethodSignature */:
@@ -29239,8 +29577,8 @@ var ts;
case 197 /* FunctionExpression */:
case 198 /* ArrowFunction */:
case 295 /* JSDocFunctionType */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
case 243 /* TypeAliasDeclaration */:
case 182 /* MappedType */:
// All the children of these container types are never visible through another
@@ -29421,9 +29759,21 @@ var ts;
currentFlow = { flags: 2 /* Start */ };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
+ var declName = ts.getNameOfDeclaration(typeAlias);
+ if ((ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName) && declName && ts.isPropertyAccessEntityNameExpression(declName.parent)) {
+ // typedef anchored to an A.B.C assignment - we need to bind into B's namespace under name C
+ var isTopLevel = isTopLevelNamespaceAssignment(declName.parent);
+ if (isTopLevel) {
+ bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
+ var oldContainer = container;
+ container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
+ declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
+ container = oldContainer;
+ }
+ }
+ else if (ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
parent = typeAlias.parent;
- bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
}
else {
bind(typeAlias.fullName);
@@ -29442,7 +29792,8 @@ var ts;
node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ &&
node.originalKeywordKind <= 118 /* LastFutureReservedWord */ &&
!ts.isIdentifierName(node) &&
- !(node.flags & 4194304 /* Ambient */)) {
+ !(node.flags & 4194304 /* Ambient */) &&
+ !(node.flags & 2097152 /* JSDoc */)) {
// Report error only if there are no parse errors in file
if (!file.parseDiagnostics.length) {
file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));
@@ -29695,7 +30046,7 @@ var ts;
while (parentNode && !ts.isJSDocTypeAlias(parentNode)) {
parentNode = parentNode.parent;
}
- bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
break;
}
// falls through
@@ -29716,7 +30067,7 @@ var ts;
file.commonJsModuleIndicator &&
ts.isModuleExportsPropertyAccessExpression(node) &&
!lookupSymbolForNameWorker(blockScopeContainer, "module")) {
- declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */);
+ declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 111550 /* FunctionScopedVariableExcludes */);
}
break;
case 205 /* BinaryExpression */:
@@ -29782,7 +30133,7 @@ var ts;
case 277 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
case 279 /* EnumMember */:
- return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */);
case 161 /* CallSignature */:
case 162 /* ConstructSignature */:
case 163 /* IndexSignature */:
@@ -29793,22 +30144,22 @@ var ts;
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
- return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */);
case 240 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
case 158 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
case 159 /* GetAccessor */:
- return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */);
case 160 /* SetAccessor */:
- return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 78783 /* SetAccessorExcludes */);
case 166 /* FunctionType */:
case 295 /* JSDocFunctionType */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 167 /* ConstructorType */:
return bindFunctionOrConstructorType(node);
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 182 /* MappedType */:
return bindAnonymousTypeWorker(node);
case 189 /* ObjectLiteralExpression */:
@@ -29841,9 +30192,9 @@ var ts;
inStrictMode = true;
return bindClassLikeDeclaration(node);
case 242 /* InterfaceDeclaration */:
- return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */);
+ return bindBlockScopedDeclaration(node, 64 /* Interface */, 788872 /* InterfaceExcludes */);
case 243 /* TypeAliasDeclaration */:
- return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
case 244 /* EnumDeclaration */:
return bindEnumDeclaration(node);
case 245 /* ModuleDeclaration */:
@@ -29877,22 +30228,23 @@ var ts;
// falls through
case 246 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
- case 306 /* JSDocParameterTag */:
- if (node.parent.kind === 299 /* JSDocSignature */) {
+ case 307 /* JSDocParameterTag */:
+ if (node.parent.kind === 300 /* JSDocSignature */) {
return bindParameter(node);
}
- if (node.parent.kind !== 298 /* JSDocTypeLiteral */) {
+ if (node.parent.kind !== 299 /* JSDocTypeLiteral */) {
break;
}
// falls through
- case 312 /* JSDocPropertyTag */:
+ case 313 /* JSDocPropertyTag */:
var propTag = node;
var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -30070,7 +30422,7 @@ var ts;
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220414 /* FunctionScopedVariableExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
}
break;
default:
@@ -30151,7 +30503,7 @@ var ts;
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false);
}
function bindPotentiallyMissingNamespaces(namespaceSymbol, entityName, isToplevel, isPrototypeProperty) {
- if (isToplevel && !isPrototypeProperty && (!namespaceSymbol || !(namespaceSymbol.flags & 1920 /* Namespace */))) {
+ if (isToplevel && !isPrototypeProperty) {
// make symbols or add declarations for intermediate containers
var flags_1 = 1536 /* Module */ | 67108864 /* Assignment */;
var excludeFlags_1 = 110735 /* ValueModuleExcludes */ & ~67108864 /* Assignment */;
@@ -30179,14 +30531,17 @@ var ts;
(namespaceSymbol.exports || (namespaceSymbol.exports = ts.createSymbolTable()));
var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedExpandoInitializer(declaration));
var includes = isMethod ? 8192 /* Method */ : 4 /* Property */;
- var excludes = isMethod ? 67212223 /* MethodExcludes */ : 0 /* PropertyExcludes */;
+ var excludes = isMethod ? 103359 /* MethodExcludes */ : 0 /* PropertyExcludes */;
declareSymbol(symbolTable, namespaceSymbol, declaration, includes | 67108864 /* Assignment */, excludes & ~67108864 /* Assignment */);
}
+ function isTopLevelNamespaceAssignment(propertyAccess) {
+ return ts.isBinaryExpression(propertyAccess.parent)
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
+ : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
+ }
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
- var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
- : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
+ var isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -30257,7 +30612,7 @@ var ts;
}
function bindClassLikeDeclaration(node) {
if (node.kind === 241 /* ClassDeclaration */) {
- bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */);
+ bindBlockScopedDeclaration(node, 32 /* Class */, 899503 /* ClassExcludes */);
}
else {
var bindingName = node.name ? node.name.escapedText : "__class" /* Class */;
@@ -30290,19 +30645,16 @@ var ts;
}
function bindEnumDeclaration(node) {
return ts.isEnumConst(node)
- ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 68008831 /* ConstEnumExcludes */)
- : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 68008191 /* RegularEnumExcludes */);
+ ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */)
+ : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */);
}
function bindVariableDeclarationOrBindingElement(node) {
if (inStrictMode) {
checkStrictModeEvalOrArguments(node, node.name);
}
if (!ts.isBindingPattern(node.name)) {
- var isEnum = ts.isInJSFile(node) && !!ts.getJSDocEnumTag(node);
- var enumFlags = (isEnum ? 256 /* RegularEnum */ : 0 /* None */);
- var enumExcludes = (isEnum ? 68008191 /* RegularEnumExcludes */ : 0 /* None */);
if (ts.isBlockOrCatchScoped(node)) {
- bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */ | enumFlags, 67220415 /* BlockScopedVariableExcludes */ | enumExcludes);
+ bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
}
else if (ts.isParameterDeclaration(node)) {
// It is safe to walk up parent chain to find whether the node is a destructuring parameter declaration
@@ -30314,15 +30666,15 @@ var ts;
// function foo([a,a]) {} // Duplicate Identifier error
// function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter
// // which correctly set excluded symbols
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220415 /* ParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */ | enumFlags, 67220414 /* FunctionScopedVariableExcludes */ | enumExcludes);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
}
}
}
function bindParameter(node) {
- if (node.kind === 306 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) {
+ if (node.kind === 307 /* JSDocParameterTag */ && container.kind !== 300 /* JSDocSignature */) {
return;
}
if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) {
@@ -30334,7 +30686,7 @@ var ts;
bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, "__" + node.parent.parameters.indexOf(node));
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220415 /* ParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
}
// If this is a property-parameter, then also declare the property symbol into the
// containing class.
@@ -30352,10 +30704,10 @@ var ts;
checkStrictModeFunctionName(node);
if (inStrictMode) {
checkStrictModeFunctionDeclaration(node);
- bindBlockScopedDeclaration(node, 16 /* Function */, 67219887 /* FunctionExcludes */);
+ bindBlockScopedDeclaration(node, 16 /* Function */, 110991 /* FunctionExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 67219887 /* FunctionExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 110991 /* FunctionExcludes */);
}
}
function bindFunctionExpression(node) {
@@ -30393,10 +30745,10 @@ var ts;
if (!container_1.locals) {
container_1.locals = ts.createSymbolTable();
}
- declareSymbol(container_1.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbol(container_1.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
}
else if (node.parent.kind === 177 /* InferType */) {
@@ -30405,14 +30757,14 @@ var ts;
if (!container_2.locals) {
container_2.locals = ts.createSymbolTable();
}
- declareSymbol(container_2.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbol(container_2.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
else {
bindAnonymousDeclaration(node, 262144 /* TypeParameter */, getDeclarationName(node)); // TODO: GH#18217
}
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
}
// reachability checks
@@ -31023,7 +31375,7 @@ var ts;
break;
case 195 /* TypeAssertionExpression */:
case 213 /* AsExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
excludeFlags = 536870912 /* OuterExpressionExcludes */;
@@ -31282,7 +31634,7 @@ var ts;
return 536875008 /* BindingPatternExcludes */;
case 195 /* TypeAssertionExpression */:
case 213 /* AsExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
case 196 /* ParenthesizedExpression */:
case 99 /* SuperKeyword */:
return 536870912 /* OuterExpressionExcludes */;
@@ -31513,6 +31865,179 @@ var ts;
WideningKind[WideningKind["Normal"] = 0] = "Normal";
WideningKind[WideningKind["GeneratorYield"] = 1] = "GeneratorYield";
})(WideningKind || (WideningKind = {}));
+ var TypeFacts;
+ (function (TypeFacts) {
+ TypeFacts[TypeFacts["None"] = 0] = "None";
+ TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
+ TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
+ TypeFacts[TypeFacts["TypeofEQBigInt"] = 4] = "TypeofEQBigInt";
+ TypeFacts[TypeFacts["TypeofEQBoolean"] = 8] = "TypeofEQBoolean";
+ TypeFacts[TypeFacts["TypeofEQSymbol"] = 16] = "TypeofEQSymbol";
+ TypeFacts[TypeFacts["TypeofEQObject"] = 32] = "TypeofEQObject";
+ TypeFacts[TypeFacts["TypeofEQFunction"] = 64] = "TypeofEQFunction";
+ TypeFacts[TypeFacts["TypeofEQHostObject"] = 128] = "TypeofEQHostObject";
+ TypeFacts[TypeFacts["TypeofNEString"] = 256] = "TypeofNEString";
+ TypeFacts[TypeFacts["TypeofNENumber"] = 512] = "TypeofNENumber";
+ TypeFacts[TypeFacts["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt";
+ TypeFacts[TypeFacts["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean";
+ TypeFacts[TypeFacts["TypeofNESymbol"] = 4096] = "TypeofNESymbol";
+ TypeFacts[TypeFacts["TypeofNEObject"] = 8192] = "TypeofNEObject";
+ TypeFacts[TypeFacts["TypeofNEFunction"] = 16384] = "TypeofNEFunction";
+ TypeFacts[TypeFacts["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject";
+ TypeFacts[TypeFacts["EQUndefined"] = 65536] = "EQUndefined";
+ TypeFacts[TypeFacts["EQNull"] = 131072] = "EQNull";
+ TypeFacts[TypeFacts["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull";
+ TypeFacts[TypeFacts["NEUndefined"] = 524288] = "NEUndefined";
+ TypeFacts[TypeFacts["NENull"] = 1048576] = "NENull";
+ TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
+ TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
+ TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
+ TypeFacts[TypeFacts["All"] = 16777215] = "All";
+ // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
+ // The presence of a particular fact means that the given test is true for some (and possibly all) values
+ // of that kind of type.
+ TypeFacts[TypeFacts["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts";
+ TypeFacts[TypeFacts["BaseStringFacts"] = 12582401] = "BaseStringFacts";
+ TypeFacts[TypeFacts["StringStrictFacts"] = 16317953] = "StringStrictFacts";
+ TypeFacts[TypeFacts["StringFacts"] = 16776705] = "StringFacts";
+ TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts";
+ TypeFacts[TypeFacts["EmptyStringFacts"] = 12582401] = "EmptyStringFacts";
+ TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts";
+ TypeFacts[TypeFacts["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts";
+ TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts";
+ TypeFacts[TypeFacts["BaseNumberFacts"] = 12582146] = "BaseNumberFacts";
+ TypeFacts[TypeFacts["NumberStrictFacts"] = 16317698] = "NumberStrictFacts";
+ TypeFacts[TypeFacts["NumberFacts"] = 16776450] = "NumberFacts";
+ TypeFacts[TypeFacts["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts";
+ TypeFacts[TypeFacts["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts";
+ TypeFacts[TypeFacts["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts";
+ TypeFacts[TypeFacts["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts";
+ TypeFacts[TypeFacts["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts";
+ TypeFacts[TypeFacts["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts";
+ TypeFacts[TypeFacts["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts";
+ TypeFacts[TypeFacts["BigIntFacts"] = 16775940] = "BigIntFacts";
+ TypeFacts[TypeFacts["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts";
+ TypeFacts[TypeFacts["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts";
+ TypeFacts[TypeFacts["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts";
+ TypeFacts[TypeFacts["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts";
+ TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts";
+ TypeFacts[TypeFacts["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts";
+ TypeFacts[TypeFacts["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts";
+ TypeFacts[TypeFacts["BooleanFacts"] = 16774920] = "BooleanFacts";
+ TypeFacts[TypeFacts["FalseStrictFacts"] = 12121864] = "FalseStrictFacts";
+ TypeFacts[TypeFacts["FalseFacts"] = 12580616] = "FalseFacts";
+ TypeFacts[TypeFacts["TrueStrictFacts"] = 7927560] = "TrueStrictFacts";
+ TypeFacts[TypeFacts["TrueFacts"] = 16774920] = "TrueFacts";
+ TypeFacts[TypeFacts["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts";
+ TypeFacts[TypeFacts["SymbolFacts"] = 16772880] = "SymbolFacts";
+ TypeFacts[TypeFacts["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts";
+ TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
+ TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
+ TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
+ TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
+ TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
+ TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
+ TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
+ })(TypeFacts || (TypeFacts = {}));
+ var typeofEQFacts = ts.createMapFromTemplate({
+ string: 1 /* TypeofEQString */,
+ number: 2 /* TypeofEQNumber */,
+ bigint: 4 /* TypeofEQBigInt */,
+ boolean: 8 /* TypeofEQBoolean */,
+ symbol: 16 /* TypeofEQSymbol */,
+ undefined: 65536 /* EQUndefined */,
+ object: 32 /* TypeofEQObject */,
+ function: 64 /* TypeofEQFunction */
+ });
+ var typeofNEFacts = ts.createMapFromTemplate({
+ string: 256 /* TypeofNEString */,
+ number: 512 /* TypeofNENumber */,
+ bigint: 1024 /* TypeofNEBigInt */,
+ boolean: 2048 /* TypeofNEBoolean */,
+ symbol: 4096 /* TypeofNESymbol */,
+ undefined: 524288 /* NEUndefined */,
+ object: 8192 /* TypeofNEObject */,
+ function: 16384 /* TypeofNEFunction */
+ });
+ var TypeSystemPropertyName;
+ (function (TypeSystemPropertyName) {
+ TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
+ TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
+ TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
+ TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
+ })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
+ var CheckMode;
+ (function (CheckMode) {
+ CheckMode[CheckMode["Normal"] = 0] = "Normal";
+ CheckMode[CheckMode["Contextual"] = 1] = "Contextual";
+ CheckMode[CheckMode["Inferential"] = 2] = "Inferential";
+ CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
+ CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
+ CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
+ })(CheckMode || (CheckMode = {}));
+ var ContextFlags;
+ (function (ContextFlags) {
+ ContextFlags[ContextFlags["None"] = 0] = "None";
+ ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
+ })(ContextFlags || (ContextFlags = {}));
+ var AccessFlags;
+ (function (AccessFlags) {
+ AccessFlags[AccessFlags["None"] = 0] = "None";
+ AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
+ AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
+ AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
+ AccessFlags[AccessFlags["NoTupleBoundsCheck"] = 8] = "NoTupleBoundsCheck";
+ })(AccessFlags || (AccessFlags = {}));
+ var CallbackCheck;
+ (function (CallbackCheck) {
+ CallbackCheck[CallbackCheck["None"] = 0] = "None";
+ CallbackCheck[CallbackCheck["Bivariant"] = 1] = "Bivariant";
+ CallbackCheck[CallbackCheck["Strict"] = 2] = "Strict";
+ })(CallbackCheck || (CallbackCheck = {}));
+ var MappedTypeModifiers;
+ (function (MappedTypeModifiers) {
+ MappedTypeModifiers[MappedTypeModifiers["IncludeReadonly"] = 1] = "IncludeReadonly";
+ MappedTypeModifiers[MappedTypeModifiers["ExcludeReadonly"] = 2] = "ExcludeReadonly";
+ MappedTypeModifiers[MappedTypeModifiers["IncludeOptional"] = 4] = "IncludeOptional";
+ MappedTypeModifiers[MappedTypeModifiers["ExcludeOptional"] = 8] = "ExcludeOptional";
+ })(MappedTypeModifiers || (MappedTypeModifiers = {}));
+ var ExpandingFlags;
+ (function (ExpandingFlags) {
+ ExpandingFlags[ExpandingFlags["None"] = 0] = "None";
+ ExpandingFlags[ExpandingFlags["Source"] = 1] = "Source";
+ ExpandingFlags[ExpandingFlags["Target"] = 2] = "Target";
+ ExpandingFlags[ExpandingFlags["Both"] = 3] = "Both";
+ })(ExpandingFlags || (ExpandingFlags = {}));
+ var MembersOrExportsResolutionKind;
+ (function (MembersOrExportsResolutionKind) {
+ MembersOrExportsResolutionKind["resolvedExports"] = "resolvedExports";
+ MembersOrExportsResolutionKind["resolvedMembers"] = "resolvedMembers";
+ })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {}));
+ var UnusedKind;
+ (function (UnusedKind) {
+ UnusedKind[UnusedKind["Local"] = 0] = "Local";
+ UnusedKind[UnusedKind["Parameter"] = 1] = "Parameter";
+ })(UnusedKind || (UnusedKind = {}));
+ var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
+ var DeclarationMeaning;
+ (function (DeclarationMeaning) {
+ DeclarationMeaning[DeclarationMeaning["GetAccessor"] = 1] = "GetAccessor";
+ DeclarationMeaning[DeclarationMeaning["SetAccessor"] = 2] = "SetAccessor";
+ DeclarationMeaning[DeclarationMeaning["PropertyAssignment"] = 4] = "PropertyAssignment";
+ DeclarationMeaning[DeclarationMeaning["Method"] = 8] = "Method";
+ DeclarationMeaning[DeclarationMeaning["GetOrSetAccessor"] = 3] = "GetOrSetAccessor";
+ DeclarationMeaning[DeclarationMeaning["PropertyAssignmentOrMethod"] = 12] = "PropertyAssignmentOrMethod";
+ })(DeclarationMeaning || (DeclarationMeaning = {}));
+ var DeclarationSpaces;
+ (function (DeclarationSpaces) {
+ DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None";
+ DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue";
+ DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType";
+ DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace";
+ })(DeclarationSpaces || (DeclarationSpaces = {}));
function getNodeId(node) {
if (!node.id) {
node.id = nextNodeId;
@@ -31838,7 +32363,7 @@ var ts;
// Ensure file is type checked
checkSourceFile(file);
ts.Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
- diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.get(file.fileName));
+ diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
if (!file.isDeclarationFile && (!unusedIsError(0 /* Local */) || !unusedIsError(1 /* Parameter */))) {
addUnusedDiagnostics();
}
@@ -32062,102 +32587,7 @@ var ts;
var potentialNewTargetCollisions = [];
var awaitedTypeStack = [];
var diagnostics = ts.createDiagnosticCollection();
- // Suggestion diagnostics must have a file. Keyed by source file name.
- var suggestionDiagnostics = ts.createMultiMap();
- var TypeFacts;
- (function (TypeFacts) {
- TypeFacts[TypeFacts["None"] = 0] = "None";
- TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
- TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
- TypeFacts[TypeFacts["TypeofEQBigInt"] = 4] = "TypeofEQBigInt";
- TypeFacts[TypeFacts["TypeofEQBoolean"] = 8] = "TypeofEQBoolean";
- TypeFacts[TypeFacts["TypeofEQSymbol"] = 16] = "TypeofEQSymbol";
- TypeFacts[TypeFacts["TypeofEQObject"] = 32] = "TypeofEQObject";
- TypeFacts[TypeFacts["TypeofEQFunction"] = 64] = "TypeofEQFunction";
- TypeFacts[TypeFacts["TypeofEQHostObject"] = 128] = "TypeofEQHostObject";
- TypeFacts[TypeFacts["TypeofNEString"] = 256] = "TypeofNEString";
- TypeFacts[TypeFacts["TypeofNENumber"] = 512] = "TypeofNENumber";
- TypeFacts[TypeFacts["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt";
- TypeFacts[TypeFacts["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean";
- TypeFacts[TypeFacts["TypeofNESymbol"] = 4096] = "TypeofNESymbol";
- TypeFacts[TypeFacts["TypeofNEObject"] = 8192] = "TypeofNEObject";
- TypeFacts[TypeFacts["TypeofNEFunction"] = 16384] = "TypeofNEFunction";
- TypeFacts[TypeFacts["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject";
- TypeFacts[TypeFacts["EQUndefined"] = 65536] = "EQUndefined";
- TypeFacts[TypeFacts["EQNull"] = 131072] = "EQNull";
- TypeFacts[TypeFacts["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull";
- TypeFacts[TypeFacts["NEUndefined"] = 524288] = "NEUndefined";
- TypeFacts[TypeFacts["NENull"] = 1048576] = "NENull";
- TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
- TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
- TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
- TypeFacts[TypeFacts["All"] = 16777215] = "All";
- // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
- // The presence of a particular fact means that the given test is true for some (and possibly all) values
- // of that kind of type.
- TypeFacts[TypeFacts["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts";
- TypeFacts[TypeFacts["BaseStringFacts"] = 12582401] = "BaseStringFacts";
- TypeFacts[TypeFacts["StringStrictFacts"] = 16317953] = "StringStrictFacts";
- TypeFacts[TypeFacts["StringFacts"] = 16776705] = "StringFacts";
- TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts";
- TypeFacts[TypeFacts["EmptyStringFacts"] = 12582401] = "EmptyStringFacts";
- TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts";
- TypeFacts[TypeFacts["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts";
- TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts";
- TypeFacts[TypeFacts["BaseNumberFacts"] = 12582146] = "BaseNumberFacts";
- TypeFacts[TypeFacts["NumberStrictFacts"] = 16317698] = "NumberStrictFacts";
- TypeFacts[TypeFacts["NumberFacts"] = 16776450] = "NumberFacts";
- TypeFacts[TypeFacts["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts";
- TypeFacts[TypeFacts["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts";
- TypeFacts[TypeFacts["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts";
- TypeFacts[TypeFacts["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts";
- TypeFacts[TypeFacts["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts";
- TypeFacts[TypeFacts["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts";
- TypeFacts[TypeFacts["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts";
- TypeFacts[TypeFacts["BigIntFacts"] = 16775940] = "BigIntFacts";
- TypeFacts[TypeFacts["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts";
- TypeFacts[TypeFacts["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts";
- TypeFacts[TypeFacts["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts";
- TypeFacts[TypeFacts["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts";
- TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts";
- TypeFacts[TypeFacts["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts";
- TypeFacts[TypeFacts["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts";
- TypeFacts[TypeFacts["BooleanFacts"] = 16774920] = "BooleanFacts";
- TypeFacts[TypeFacts["FalseStrictFacts"] = 12121864] = "FalseStrictFacts";
- TypeFacts[TypeFacts["FalseFacts"] = 12580616] = "FalseFacts";
- TypeFacts[TypeFacts["TrueStrictFacts"] = 7927560] = "TrueStrictFacts";
- TypeFacts[TypeFacts["TrueFacts"] = 16774920] = "TrueFacts";
- TypeFacts[TypeFacts["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts";
- TypeFacts[TypeFacts["SymbolFacts"] = 16772880] = "SymbolFacts";
- TypeFacts[TypeFacts["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts";
- TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
- TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
- TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
- TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
- TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
- TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
- TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
- })(TypeFacts || (TypeFacts = {}));
- var typeofEQFacts = ts.createMapFromTemplate({
- string: 1 /* TypeofEQString */,
- number: 2 /* TypeofEQNumber */,
- bigint: 4 /* TypeofEQBigInt */,
- boolean: 8 /* TypeofEQBoolean */,
- symbol: 16 /* TypeofEQSymbol */,
- undefined: 65536 /* EQUndefined */,
- object: 32 /* TypeofEQObject */,
- function: 64 /* TypeofEQFunction */
- });
- var typeofNEFacts = ts.createMapFromTemplate({
- string: 256 /* TypeofNEString */,
- number: 512 /* TypeofNENumber */,
- bigint: 1024 /* TypeofNEBigInt */,
- boolean: 2048 /* TypeofNEBoolean */,
- symbol: 4096 /* TypeofNESymbol */,
- undefined: 524288 /* NEUndefined */,
- object: 8192 /* TypeofNEObject */,
- function: 16384 /* TypeofNEFunction */
- });
+ var suggestionDiagnostics = ts.createDiagnosticCollection();
var typeofTypesByName = ts.createMapFromTemplate({
string: stringType,
number: numberType,
@@ -32175,71 +32605,8 @@ var ts;
var comparableRelation = ts.createMap();
var identityRelation = ts.createMap();
var enumRelation = ts.createMap();
- var TypeSystemPropertyName;
- (function (TypeSystemPropertyName) {
- TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
- TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
- TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
- TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
- TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
- TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
- TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
- })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
- var CheckMode;
- (function (CheckMode) {
- CheckMode[CheckMode["Normal"] = 0] = "Normal";
- CheckMode[CheckMode["Contextual"] = 1] = "Contextual";
- CheckMode[CheckMode["Inferential"] = 2] = "Inferential";
- CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
- CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
- CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
- })(CheckMode || (CheckMode = {}));
- var ContextFlags;
- (function (ContextFlags) {
- ContextFlags[ContextFlags["None"] = 0] = "None";
- ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
- })(ContextFlags || (ContextFlags = {}));
- var AccessFlags;
- (function (AccessFlags) {
- AccessFlags[AccessFlags["None"] = 0] = "None";
- AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
- AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
- AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
- AccessFlags[AccessFlags["NoTupleBoundsCheck"] = 8] = "NoTupleBoundsCheck";
- })(AccessFlags || (AccessFlags = {}));
- var CallbackCheck;
- (function (CallbackCheck) {
- CallbackCheck[CallbackCheck["None"] = 0] = "None";
- CallbackCheck[CallbackCheck["Bivariant"] = 1] = "Bivariant";
- CallbackCheck[CallbackCheck["Strict"] = 2] = "Strict";
- })(CallbackCheck || (CallbackCheck = {}));
- var MappedTypeModifiers;
- (function (MappedTypeModifiers) {
- MappedTypeModifiers[MappedTypeModifiers["IncludeReadonly"] = 1] = "IncludeReadonly";
- MappedTypeModifiers[MappedTypeModifiers["ExcludeReadonly"] = 2] = "ExcludeReadonly";
- MappedTypeModifiers[MappedTypeModifiers["IncludeOptional"] = 4] = "IncludeOptional";
- MappedTypeModifiers[MappedTypeModifiers["ExcludeOptional"] = 8] = "ExcludeOptional";
- })(MappedTypeModifiers || (MappedTypeModifiers = {}));
- var ExpandingFlags;
- (function (ExpandingFlags) {
- ExpandingFlags[ExpandingFlags["None"] = 0] = "None";
- ExpandingFlags[ExpandingFlags["Source"] = 1] = "Source";
- ExpandingFlags[ExpandingFlags["Target"] = 2] = "Target";
- ExpandingFlags[ExpandingFlags["Both"] = 3] = "Both";
- })(ExpandingFlags || (ExpandingFlags = {}));
- var MembersOrExportsResolutionKind;
- (function (MembersOrExportsResolutionKind) {
- MembersOrExportsResolutionKind["resolvedExports"] = "resolvedExports";
- MembersOrExportsResolutionKind["resolvedMembers"] = "resolvedMembers";
- })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {}));
- var UnusedKind;
- (function (UnusedKind) {
- UnusedKind[UnusedKind["Local"] = 0] = "Local";
- UnusedKind[UnusedKind["Parameter"] = 1] = "Parameter";
- })(UnusedKind || (UnusedKind = {}));
var builtinGlobals = ts.createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
- var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
initializeTypeChecker();
return checker;
function getJsxNamespace(location) {
@@ -32304,7 +32671,7 @@ var ts;
diagnostics.add(diagnostic);
}
else {
- suggestionDiagnostics.add(diagnostic.file.fileName, __assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
+ suggestionDiagnostics.add(__assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
}
}
function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
@@ -32330,35 +32697,35 @@ var ts;
function getExcludedSymbolFlags(flags) {
var result = 0;
if (flags & 2 /* BlockScopedVariable */)
- result |= 67220415 /* BlockScopedVariableExcludes */;
+ result |= 111551 /* BlockScopedVariableExcludes */;
if (flags & 1 /* FunctionScopedVariable */)
- result |= 67220414 /* FunctionScopedVariableExcludes */;
+ result |= 111550 /* FunctionScopedVariableExcludes */;
if (flags & 4 /* Property */)
result |= 0 /* PropertyExcludes */;
if (flags & 8 /* EnumMember */)
- result |= 68008959 /* EnumMemberExcludes */;
+ result |= 900095 /* EnumMemberExcludes */;
if (flags & 16 /* Function */)
- result |= 67219887 /* FunctionExcludes */;
+ result |= 110991 /* FunctionExcludes */;
if (flags & 32 /* Class */)
- result |= 68008383 /* ClassExcludes */;
+ result |= 899503 /* ClassExcludes */;
if (flags & 64 /* Interface */)
- result |= 67897736 /* InterfaceExcludes */;
+ result |= 788872 /* InterfaceExcludes */;
if (flags & 256 /* RegularEnum */)
- result |= 68008191 /* RegularEnumExcludes */;
+ result |= 899327 /* RegularEnumExcludes */;
if (flags & 128 /* ConstEnum */)
- result |= 68008831 /* ConstEnumExcludes */;
+ result |= 899967 /* ConstEnumExcludes */;
if (flags & 512 /* ValueModule */)
result |= 110735 /* ValueModuleExcludes */;
if (flags & 8192 /* Method */)
- result |= 67212223 /* MethodExcludes */;
+ result |= 103359 /* MethodExcludes */;
if (flags & 32768 /* GetAccessor */)
- result |= 67154879 /* GetAccessorExcludes */;
+ result |= 46015 /* GetAccessorExcludes */;
if (flags & 65536 /* SetAccessor */)
- result |= 67187647 /* SetAccessorExcludes */;
+ result |= 78783 /* SetAccessorExcludes */;
if (flags & 262144 /* TypeParameter */)
- result |= 67635688 /* TypeParameterExcludes */;
+ result |= 526824 /* TypeParameterExcludes */;
if (flags & 524288 /* TypeAlias */)
- result |= 67897832 /* TypeAliasExcludes */;
+ result |= 788968 /* TypeAliasExcludes */;
if (flags & 2097152 /* Alias */)
result |= 2097152 /* AliasExcludes */;
return result;
@@ -32611,8 +32978,8 @@ var ts;
function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) {
var constructorDeclaration = parameter.parent;
var classDeclaration = parameter.parent.parent;
- var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 67220415 /* Value */);
- var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 67220415 /* Value */);
+ var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 111551 /* Value */);
+ var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 111551 /* Value */);
if (parameterSymbol && propertySymbol) {
return [parameterSymbol, propertySymbol];
}
@@ -32791,7 +33158,7 @@ var ts;
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) {
+ if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 298 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
// type parameters are visible in parameter list, return type and type parameter list
? lastLocation === location.type ||
@@ -32894,7 +33261,7 @@ var ts;
if (!ts.hasModifier(location, 32 /* Static */)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
- if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) {
+ if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
// Remember the property node, it will be used later to report appropriate error
propertyWithInvalidInitializer = location;
}
@@ -32907,7 +33274,7 @@ var ts;
// The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals
// These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would
// trigger resolving late-bound names, which we may already be in the process of doing while we're here!
- if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 67897832 /* Type */)) {
+ if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
// ignore type parameters not declared in this container
result = undefined;
@@ -32934,7 +33301,7 @@ var ts;
// The type parameters of a class are not in scope in the base class expression.
if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) {
var container = location.parent.parent;
- if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) {
+ if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 788968 /* Type */))) {
if (nameNotFoundMessage) {
error(errorLocation, ts.Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
}
@@ -32954,7 +33321,7 @@ var ts;
grandparent = location.parent.parent;
if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
- if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) {
+ if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
return undefined;
}
@@ -33018,8 +33385,9 @@ var ts;
location = location.parent;
}
break;
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
break;
@@ -33117,21 +33485,21 @@ var ts;
// we want to check for block-scoped
if (errorLocation &&
(meaning & 2 /* BlockScopedVariable */ ||
- ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 67220415 /* Value */) === 67220415 /* Value */))) {
+ ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */))) {
var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
}
}
// If we're in an external module, we can't reference value symbols created from UMD export declarations
- if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
+ if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
}
}
// If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
- if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) {
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
var candidate = getMergedSymbol(getLateBoundSymbol(result));
var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
// A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
@@ -33248,9 +33616,9 @@ var ts;
}
}
function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
- var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(errorLocation) ? 67220415 /* Value */ : 0);
+ var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(errorLocation) ? 111551 /* Value */ : 0);
if (meaning === namespaceMeaning) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 /* Type */ & ~namespaceMeaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~namespaceMeaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
var parent = errorLocation.parent;
if (symbol) {
if (ts.isQualifiedName(parent)) {
@@ -33269,8 +33637,8 @@ var ts;
return false;
}
function checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning) {
- if (meaning & (67897832 /* Type */ & ~1920 /* Namespace */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, ~67897832 /* Type */ & 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ if (meaning & (788968 /* Type */ & ~1920 /* Namespace */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, ~788968 /* Type */ & 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol && !(symbol.flags & 1920 /* Namespace */)) {
error(errorLocation, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here, ts.unescapeLeadingUnderscores(name));
return true;
@@ -33279,12 +33647,12 @@ var ts;
return false;
}
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 /* Value */ & ~1024 /* NamespaceModule */)) {
+ if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
if (name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never") {
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
return true;
}
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 /* Type */ & ~67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol && !(symbol.flags & 1024 /* NamespaceModule */)) {
var message = isES2015OrLaterConstructorName(name)
? ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later
@@ -33308,15 +33676,15 @@ var ts;
return false;
}
function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 /* Value */ & ~1024 /* NamespaceModule */ & ~67897832 /* Type */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */ & ~788968 /* Type */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
return true;
}
}
- else if (meaning & (67897832 /* Type */ & ~1024 /* NamespaceModule */ & ~67220415 /* Value */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* ValueModule */ | 1024 /* NamespaceModule */) & ~67897832 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ else if (meaning & (788968 /* Type */ & ~1024 /* NamespaceModule */ & ~111551 /* Value */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* ValueModule */ | 1024 /* NamespaceModule */) & ~788968 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
return true;
@@ -33327,7 +33695,7 @@ var ts;
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
// Block-scoped variables cannot be used before their definition
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -33479,7 +33847,7 @@ var ts;
if (valueSymbol === unknownSymbol && typeSymbol === unknownSymbol) {
return unknownSymbol;
}
- if (valueSymbol.flags & (67897832 /* Type */ | 1920 /* Namespace */)) {
+ if (valueSymbol.flags & (788968 /* Type */ | 1920 /* Namespace */)) {
return valueSymbol;
}
var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName);
@@ -33569,7 +33937,7 @@ var ts;
if (ts.isClassExpression(expression)) {
return checkExpression(expression).symbol;
}
- var aliasLike = resolveEntityName(expression, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias);
+ var aliasLike = resolveEntityName(expression, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias);
if (aliasLike) {
return aliasLike;
}
@@ -33588,7 +33956,7 @@ var ts;
case 254 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
case 258 /* ExportSpecifier */:
- return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
+ return getTargetOfExportSpecifier(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
case 255 /* ExportAssignment */:
case 205 /* BinaryExpression */:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
@@ -33603,7 +33971,7 @@ var ts;
* OR Is a JSContainer which may merge an alias with a local declaration
*/
function isNonLocalAlias(symbol, excludes) {
- if (excludes === void 0) { excludes = 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */; }
+ if (excludes === void 0) { excludes = 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */; }
if (!symbol)
return false;
return (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */ || !!(symbol.flags & 2097152 /* Alias */ && symbol.flags & 67108864 /* Assignment */);
@@ -33637,7 +34005,7 @@ var ts;
var target = resolveAlias(symbol);
if (target) {
var markAlias = target === unknownSymbol ||
- ((target.flags & 67220415 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));
+ ((target.flags & 111551 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));
if (markAlias) {
markAliasSymbolAsReferenced(symbol);
}
@@ -33653,17 +34021,15 @@ var ts;
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 255 /* ExportAssignment */) {
- // export default
- checkExpressionCached(node.expression);
- }
- else if (node.kind === 258 /* ExportSpecifier */) {
- // export { } or export { as foo }
- checkExpressionCached(node.propertyName || node.name);
- }
- else if (ts.isInternalModuleImportEqualsDeclaration(node)) {
- // import foo =
- checkExpressionCached(node.moduleReference);
+ // We defer checking of the reference of an `import =` until the import itself is referenced,
+ // This way a chain of imports can be elided if ultimately the final input is only used in a type
+ // position.
+ if (ts.isInternalModuleImportEqualsDeclaration(node)) {
+ var target = resolveSymbol(symbol);
+ if (target === unknownSymbol || target.flags & 111551 /* Value */) {
+ // import foo =
+ checkExpressionCached(node.moduleReference);
+ }
}
}
}
@@ -33686,7 +34052,7 @@ var ts;
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */);
- return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
+ return resolveEntityName(entityName, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
function getFullyQualifiedName(symbol, containingLocation) {
@@ -33699,7 +34065,7 @@ var ts;
if (ts.nodeIsMissing(name)) {
return undefined;
}
- var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0);
+ var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 111551 /* Value */ : 0);
var symbol;
if (name.kind === 73 /* Identifier */) {
var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
@@ -34200,7 +34566,7 @@ var ts;
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 ? symbol.exportSymbol : symbol);
}
function symbolIsValue(symbol) {
- return !!(symbol.flags & 67220415 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 67220415 /* Value */);
+ return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */);
}
function findConstructorDeclaration(node) {
var members = node.members;
@@ -34308,7 +34674,7 @@ var ts;
}
function getQualifiedLeftMeaning(rightMeaning) {
// If we are looking in value space, the parent meaning is value, other wise it is namespace
- return rightMeaning === 67220415 /* Value */ ? 67220415 /* Value */ : 1920 /* Namespace */;
+ return rightMeaning === 111551 /* Value */ ? 111551 /* Value */ : 1920 /* Namespace */;
}
function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) {
if (visitedSymbolTablesMap === void 0) { visitedSymbolTablesMap = ts.createMap(); }
@@ -34426,11 +34792,11 @@ var ts;
return false;
}
function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67897832 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 788968 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false);
return access.accessibility === 0 /* Accessible */;
}
function isValueSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67220415 /* Value */, /*shouldComputeAliasesToMakeVisible*/ false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 111551 /* Value */, /*shouldComputeAliasesToMakeVisible*/ false);
return access.accessibility === 0 /* Accessible */;
}
function isAnySymbolAccessible(symbols, enclosingDeclaration, initialSymbol, meaning, shouldComputeAliasesToMakeVisible) {
@@ -34473,7 +34839,7 @@ var ts;
// from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however,
// we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal.
var firstDecl = ts.first(symbol.declarations);
- if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
+ if (!ts.length(containers) && meaning & 111551 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
containers = [getSymbolOfNode(firstDecl.parent)];
}
@@ -34586,7 +34952,7 @@ var ts;
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
entityName.parent.kind === 150 /* ComputedPropertyName */) {
// Typeof value
- meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
}
else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ ||
entityName.parent.kind === 249 /* ImportEqualsDeclaration */) {
@@ -34596,7 +34962,7 @@ var ts;
}
else {
// Type Reference or TypeAlias entity = Identifier
- meaning = 67897832 /* Type */;
+ meaning = 788968 /* Type */;
}
var firstIdentifier = getFirstIdentifier(entityName);
var symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
@@ -34768,14 +35134,14 @@ var ts;
}
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
var parentSymbol = getParentOfSymbol(type.symbol);
- var parentName = symbolToTypeNode(parentSymbol, context, 67897832 /* Type */);
+ var parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
var enumLiteralName = getDeclaredTypeOfSymbol(parentSymbol) === type
? parentName
: appendReferenceToType(parentName, ts.createTypeReferenceNode(ts.symbolName(type.symbol), /*typeArguments*/ undefined));
return enumLiteralName;
}
if (type.flags & 1056 /* EnumLike */) {
- return symbolToTypeNode(type.symbol, context, 67897832 /* Type */);
+ return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
}
if (type.flags & 128 /* StringLiteral */) {
context.approximateLength += (type.value.length + 2);
@@ -34798,7 +35164,7 @@ var ts;
if (!(context.flags & 1048576 /* AllowUniqueESSymbolType */)) {
if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
context.approximateLength += 6;
- return symbolToTypeNode(type.symbol, context, 67220415 /* Value */);
+ return symbolToTypeNode(type.symbol, context, 111551 /* Value */);
}
if (context.tracker.reportInaccessibleUniqueSymbolError) {
context.tracker.reportInaccessibleUniqueSymbolError();
@@ -34861,14 +35227,14 @@ var ts;
}
// Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter.
return type.symbol
- ? symbolToTypeNode(type.symbol, context, 67897832 /* Type */)
+ ? symbolToTypeNode(type.symbol, context, 788968 /* Type */)
: ts.createTypeReferenceNode(ts.createIdentifier("?"), /*typeArguments*/ undefined);
}
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */))
return ts.createTypeReferenceNode(ts.createIdentifier(""), typeArgumentNodes);
- return symbolToTypeNode(type.aliasSymbol, context, 67897832 /* Type */, typeArgumentNodes);
+ return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
}
if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) {
var types = type.flags & 1048576 /* Union */ ? formatUnionTypes(type.types) : type.types;
@@ -34947,21 +35313,21 @@ var ts;
id = (isConstructorObject ? "+" : "") + getSymbolId(symbol);
if (isJSConstructor(symbol.valueDeclaration)) {
// Instance and static types share the same symbol; only add 'typeof' for the static side.
- var isInstanceType = type === getInferredClassType(symbol) ? 67897832 /* Type */ : 67220415 /* Value */;
+ var isInstanceType = type === getInferredClassType(symbol) ? 788968 /* Type */ : 111551 /* Value */;
return symbolToTypeNode(symbol, context, isInstanceType);
}
// Always use 'typeof T' for type of class, enum, and module objects
else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) ||
shouldWriteTypeOfFunctionSymbol()) {
- return symbolToTypeNode(symbol, context, 67220415 /* Value */);
+ return symbolToTypeNode(symbol, context, 111551 /* Value */);
}
else if (context.visitedTypes && context.visitedTypes.has(typeId)) {
// If type is an anonymous type literal in a type alias declaration, use type alias name
var typeAlias = getTypeAliasForTypeLiteral(type);
if (typeAlias) {
// The specified symbol flags need to be reinterpreted as type flags
- return symbolToTypeNode(typeAlias, context, 67897832 /* Type */);
+ return symbolToTypeNode(typeAlias, context, 788968 /* Type */);
}
else {
return createElidedInformationPlaceholder(context);
@@ -35094,7 +35460,7 @@ var ts;
var typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
var flags_2 = context.flags;
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
- var ref = symbolToTypeNode(parent, context, 67897832 /* Type */, typeArgumentSlice);
+ var ref = symbolToTypeNode(parent, context, 788968 /* Type */, typeArgumentSlice);
context.flags = flags_2;
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
}
@@ -35107,7 +35473,7 @@ var ts;
}
var flags = context.flags;
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
- var finalRef = symbolToTypeNode(type.symbol, context, 67897832 /* Type */, typeArgumentNodes);
+ var finalRef = symbolToTypeNode(type.symbol, context, 788968 /* Type */, typeArgumentNodes);
context.flags = flags;
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
}
@@ -35224,7 +35590,7 @@ var ts;
trackComputedName(decl.name, saveEnclosingDeclaration, context);
}
}
- var propertyName = symbolToName(propertySymbol, context, 67220415 /* Value */, /*expectsIdentifier*/ true);
+ var propertyName = symbolToName(propertySymbol, context, 111551 /* Value */, /*expectsIdentifier*/ true);
context.approximateLength += (ts.symbolName(propertySymbol).length + 1);
context.enclosingDeclaration = saveEnclosingDeclaration;
var optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? ts.createToken(56 /* QuestionToken */) : undefined;
@@ -35374,7 +35740,7 @@ var ts;
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 306 /* JSDocParameterTag */);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 307 /* JSDocParameterTag */);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -35418,9 +35784,9 @@ var ts;
return;
// get symbol of the first identifier of the entityName
var firstIdentifier = getFirstIdentifier(node.expression);
- var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
+ var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (name) {
- context.tracker.trackSymbol(name, enclosingDeclaration, 67220415 /* Value */);
+ context.tracker.trackSymbol(name, enclosingDeclaration, 111551 /* Value */);
}
}
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
@@ -35582,7 +35948,7 @@ var ts;
}
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
- var isTypeOf = meaning === 67220415 /* Value */;
+ var isTypeOf = meaning === 111551 /* Value */;
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
// module is root, must use `ImportTypeNode`
var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
@@ -35661,7 +36027,7 @@ var ts;
}
}
function typeParameterShadowsNameInScope(escapedName, context) {
- return !!resolveName(context.enclosingDeclaration, escapedName, 67897832 /* Type */, /*nameNotFoundArg*/ undefined, escapedName, /*isUse*/ false);
+ return !!resolveName(context.enclosingDeclaration, escapedName, 788968 /* Type */, /*nameNotFoundArg*/ undefined, escapedName, /*isUse*/ false);
}
function typeParameterToName(type, context) {
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
@@ -35670,7 +36036,7 @@ var ts;
return cached;
}
}
- var result = symbolToName(type.symbol, context, 67897832 /* Type */, /*expectsIdentifier*/ true);
+ var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
var rawtext = result.escapedText;
var i = 0;
@@ -35897,8 +36263,9 @@ var ts;
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 306 /* JSDocEnumTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
@@ -35981,10 +36348,10 @@ var ts;
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
if (node.parent && node.parent.kind === 255 /* ExportAssignment */) {
- exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
+ exportSymbol = resolveName(node, node.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
}
else if (node.parent.kind === 258 /* ExportSpecifier */) {
- exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
var result;
if (exportSymbol) {
@@ -36005,7 +36372,7 @@ var ts;
// Add the referenced top container visible
var internalModuleReference = declaration.moduleReference;
var firstIdentifier = getFirstIdentifier(internalModuleReference);
- var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, undefined, undefined, /*isUse*/ false);
+ var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, undefined, undefined, /*isUse*/ false);
if (importSymbol) {
buildVisibleNodeList(importSymbol.declarations);
}
@@ -36069,8 +36436,10 @@ var ts;
}
return ts.Debug.assertNever(propertyName);
}
- // Pop an entry from the type resolution stack and return its associated result value. The result value will
- // be true if no circularities were detected, or false if a circularity was found.
+ /**
+ * Pop an entry from the type resolution stack and return its associated result value. The result value will
+ * be true if no circularities were detected, or false if a circularity was found.
+ */
function popTypeResolution() {
resolutionTargets.pop();
resolutionPropertyNames.pop();
@@ -36399,7 +36768,7 @@ var ts;
// No type specified and nothing can be inferred
return undefined;
}
- function getWidenedTypeFromAssignmentDeclaration(symbol, resolvedSymbol) {
+ function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
// function/class/{} initializers are themselves containers, so they won't merge in the same way as other initializers
var container = ts.getAssignedExpandoInitializer(symbol.valueDeclaration);
if (container) {
@@ -36432,7 +36801,7 @@ var ts;
}
}
if (!ts.isCallExpression(expression)) {
- jsdocType = getJSDocTypeFromAssignmentDeclaration(jsdocType, expression, symbol, declaration);
+ jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
}
if (!jsdocType) {
(types || (types = [])).push((ts.isBinaryExpression(expression) || ts.isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
@@ -36479,8 +36848,8 @@ var ts;
type.objectFlags |= 16384 /* JSLiteral */;
return type;
}
- function getJSDocTypeFromAssignmentDeclaration(declaredType, expression, _symbol, declaration) {
- var typeNode = ts.getJSDocType(expression.parent);
+ function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) {
+ var typeNode = ts.getEffectiveTypeAnnotationNode(expression.parent);
if (typeNode) {
var type = getWidenedType(getTypeFromTypeNode(typeNode));
if (!declaredType) {
@@ -36490,6 +36859,12 @@ var ts;
errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
}
}
+ if (symbol.parent) {
+ var typeNode_2 = ts.getEffectiveTypeAnnotationNode(symbol.parent.valueDeclaration);
+ if (typeNode_2) {
+ return getTypeOfPropertyOfType(getTypeFromTypeNode(typeNode_2), symbol.escapedName);
+ }
+ }
return declaredType;
}
/** If we don't have an explicit JSDoc type, get the type from the initializer. */
@@ -36760,7 +37135,7 @@ var ts;
}
else if (ts.isInJSFile(declaration) &&
(ts.isCallExpression(declaration) || ts.isBinaryExpression(declaration) || ts.isPropertyAccessExpression(declaration) && ts.isBinaryExpression(declaration.parent))) {
- type = getWidenedTypeFromAssignmentDeclaration(symbol);
+ type = getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (ts.isJSDocPropertyLikeTag(declaration)
|| ts.isPropertyAccessExpression(declaration)
@@ -36775,7 +37150,7 @@ var ts;
return getTypeOfFuncClassEnumModule(symbol);
}
type = ts.isBinaryExpression(declaration.parent) ?
- getWidenedTypeFromAssignmentDeclaration(symbol) :
+ getWidenedTypeForAssignmentDeclaration(symbol) :
tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
}
else if (ts.isPropertyAssignment(declaration)) {
@@ -36877,7 +37252,9 @@ var ts;
// Otherwise, fall back to 'any'.
else {
if (setter) {
- errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ if (!isPrivateWithinAmbient(setter)) {
+ errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ }
}
else {
ts.Debug.assert(!!getter, "there must existed getter as we are current checking either setter or getter in this function");
@@ -36932,7 +37309,7 @@ var ts;
}
else if (declaration.kind === 205 /* BinaryExpression */ ||
declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) {
- return getWidenedTypeFromAssignmentDeclaration(symbol);
+ return getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
var resolvedModule = resolveExternalModuleSymbol(symbol);
@@ -36941,7 +37318,7 @@ var ts;
return errorType;
}
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
- var type_2 = getWidenedTypeFromAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
+ var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
if (!popTypeResolution()) {
return reportCircularityError(symbol);
}
@@ -36970,7 +37347,7 @@ var ts;
// type symbol, call getDeclaredTypeOfSymbol.
// This check is important because without it, a call to getTypeOfSymbol could end
// up recursively calling getTypeOfAlias, causing a stack overflow.
- links.type = targetSymbol.flags & 67220415 /* Value */
+ links.type = targetSymbol.flags & 111551 /* Value */
? getTypeOfSymbol(targetSymbol)
: errorType;
}
@@ -37097,9 +37474,10 @@ var ts;
case 197 /* FunctionExpression */:
case 198 /* ArrowFunction */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 311 /* JSDocTemplateTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 306 /* JSDocEnumTag */:
+ case 305 /* JSDocCallbackTag */:
case 182 /* MappedType */:
case 176 /* ConditionalType */:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
@@ -37369,7 +37747,7 @@ var ts;
for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {
var node = baseTypeNodes_1[_b];
if (ts.isEntityNameExpression(node.expression)) {
- var baseSymbol = resolveEntityName(node.expression, 67897832 /* Type */, /*ignoreErrors*/ true);
+ var baseSymbol = resolveEntityName(node.expression, 788968 /* Type */, /*ignoreErrors*/ true);
if (!baseSymbol || !(baseSymbol.flags & 64 /* Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {
return false;
}
@@ -37416,9 +37794,10 @@ var ts;
if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {
return errorType;
}
- var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */;
- });
+ var declaration = ts.find(symbol.declarations, ts.isTypeAlias);
+ if (!declaration) {
+ return ts.Debug.fail("Type alias symbol with no valid declaration found");
+ }
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
// If typeNode is missing, we will error in checkJSDocTypedefTag.
var type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
@@ -37434,7 +37813,7 @@ var ts;
}
else {
type = errorType;
- error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
+ error(ts.isJSDocEnumTag(declaration) ? declaration : declaration.name || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
links.declaredType = type;
}
@@ -37751,7 +38130,7 @@ var ts;
else {
symbol.declarations.push(member);
}
- if (symbolFlags & 67220415 /* Value */) {
+ if (symbolFlags & 111551 /* Value */) {
if (!symbol.valueDeclaration || symbol.valueDeclaration.kind !== member.kind) {
symbol.valueDeclaration = member;
}
@@ -38057,8 +38436,9 @@ var ts;
}
var result;
for (var i = 0; i < signatureLists.length; i++) {
- // Allow matching non-generic signatures to have excess parameters and different return types
- var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true);
+ // Allow matching non-generic signatures to have excess parameters and different return types.
+ // Prefer matching this types if possible.
+ var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true);
if (!match) {
return undefined;
}
@@ -38082,7 +38462,7 @@ var ts;
for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {
var signature = _a[_i];
// Only process signatures with parameter lists that aren't already in the result list
- if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) {
+ if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true)) {
var unionSignatures = findMatchingSignatures(signatureLists, signature, i);
if (unionSignatures) {
var s = signature;
@@ -38091,7 +38471,7 @@ var ts;
var thisParameter = signature.thisParameter;
var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
if (firstThisParameterOfUnionSignatures) {
- var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */);
+ var thisType = getIntersectionType(ts.mapDefined(unionSignatures, function (sig) { return sig.thisParameter && getTypeOfSymbol(sig.thisParameter); }));
thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
@@ -38135,8 +38515,8 @@ var ts;
}
// A signature `this` type might be a read or a write position... It's very possible that it should be invariant
// and we should refuse to merge signatures if there are `this` types and they do not match. However, so as to be
- // permissive when calling, for now, we'll union the `this` types just like the overlapping-union-signature check does
- var thisType = getUnionType([getTypeOfSymbol(left), getTypeOfSymbol(right)], 2 /* Subtype */);
+ // permissive when calling, for now, we'll intersect the `this` types just like we do for param types in union signatures.
+ var thisType = getIntersectionType([getTypeOfSymbol(left), getTypeOfSymbol(right)]);
return createSymbolWithType(left, thisType);
}
function combineUnionParameters(left, right) {
@@ -38510,7 +38890,7 @@ var ts;
else {
// Otherwise, get the declared constraint type, and if the constraint type is a type parameter,
// get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T',
- // the modifiers type is T. Otherwise, the modifiers type is {}.
+ // the modifiers type is T. Otherwise, the modifiers type is unknown.
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint;
@@ -38955,7 +39335,7 @@ var ts;
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 /* StringLike */ ? globalStringType :
t.flags & 296 /* NumberLike */ ? globalNumberType :
- t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) :
+ t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 99 /* ESNext */) :
t.flags & 528 /* BooleanLike */ ? globalBooleanType :
t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) :
t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType :
@@ -39309,7 +39689,7 @@ var ts;
var type = ts.isJSDocParameterTag(param) ? (param.typeExpression && param.typeExpression.type) : param.type;
// Include parameter symbol instead of property symbol in the signature
if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !ts.isBindingPattern(param.name)) {
- var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 67220415 /* Value */, undefined, undefined, /*isUse*/ false);
+ var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 111551 /* Value */, undefined, undefined, /*isUse*/ false);
paramSymbol = resolvedSymbol;
}
if (i === 0 && paramSymbol.escapedName === "this" /* This */) {
@@ -39892,20 +40272,6 @@ var ts;
if (type) {
return type;
}
- // JS enums are 'string' or 'number', not an enum type.
- var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
- if (enumTag) {
- var links = getNodeLinks(enumTag);
- if (!pushTypeResolution(enumTag, 5 /* EnumTagType */)) {
- return errorType;
- }
- var type_4 = enumTag.typeExpression ? getTypeFromTypeNode(enumTag.typeExpression) : errorType;
- if (!popTypeResolution()) {
- type_4 = errorType;
- error(node, ts.Diagnostics.Enum_type_0_circularly_references_itself, symbolToString(symbol));
- }
- return (links.resolvedEnumType = type_4);
- }
// Get type from reference to named type that cannot be generic (enum or type parameter)
var res = tryGetDeclaredTypeOfSymbol(symbol);
if (res) {
@@ -39913,7 +40279,7 @@ var ts;
res.flags & 262144 /* TypeParameter */ ? getConstrainedTypeVariable(res, node) : getRegularTypeOfLiteralType(res) :
errorType;
}
- if (!(symbol.flags & 67220415 /* Value */ && isJSDocTypeReference(node))) {
+ if (!(symbol.flags & 111551 /* Value */ && isJSDocTypeReference(node))) {
return errorType;
}
var jsdocType = getJSDocTypeReference(node, symbol, typeArguments);
@@ -39921,7 +40287,7 @@ var ts;
return jsdocType;
}
// Resolve the type reference as a Type for the purpose of reporting errors.
- resolveTypeReferenceName(getTypeReferenceName(node), 67897832 /* Type */);
+ resolveTypeReferenceName(getTypeReferenceName(node), 788968 /* Type */);
return getTypeOfSymbol(symbol);
}
/**
@@ -39989,7 +40355,7 @@ var ts;
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) {
+ while (node && !ts.isStatement(node) && node.kind !== 298 /* JSDocComment */) {
var parent = node.parent;
if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
@@ -40067,10 +40433,10 @@ var ts;
if (!links.resolvedType) {
var symbol = void 0;
var type = void 0;
- var meaning = 67897832 /* Type */;
+ var meaning = 788968 /* Type */;
if (isJSDocTypeReference(node)) {
type = getIntendedTypeFromJSDocTypeReference(node);
- meaning |= 67220415 /* Value */;
+ meaning |= 111551 /* Value */;
}
if (!type) {
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
@@ -40125,10 +40491,10 @@ var ts;
return type;
}
function getGlobalValueSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67220415 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
+ return getGlobalSymbol(name, 111551 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
}
function getGlobalTypeSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67897832 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
+ return getGlobalSymbol(name, 788968 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
}
function getGlobalSymbol(name, meaning, diagnostic) {
// Don't track references for global symbols anyway, so value if `isReference` is arbitrary
@@ -40197,7 +40563,7 @@ var ts;
}
function getGlobalTypeOrUndefined(name, arity) {
if (arity === void 0) { arity = 0; }
- var symbol = getGlobalSymbol(name, 67897832 /* Type */, /*diagnostic*/ undefined);
+ var symbol = getGlobalSymbol(name, 788968 /* Type */, /*diagnostic*/ undefined);
return symbol && getTypeOfGlobalSymbol(symbol, arity);
}
function getGlobalExtractSymbol() {
@@ -40561,7 +40927,7 @@ var ts;
if (isEmptyAnonymousObjectType(type)) {
if (!(includes & 8388608 /* IncludesEmptyObject */)) {
includes |= 8388608 /* IncludesEmptyObject */;
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
}
else {
@@ -40569,13 +40935,13 @@ var ts;
if (type === wildcardType)
includes |= 4194304 /* IncludesWildcard */;
}
- else if ((strictNullChecks || !(flags & 98304 /* Nullable */)) && !ts.contains(typeSet, type)) {
+ else if ((strictNullChecks || !(flags & 98304 /* Nullable */)) && !typeSet.has(type.id.toString())) {
if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
// We have seen two distinct unit types which means we should reduce to an
// empty intersection. Adding TypeFlags.NonPrimitive causes that to happen.
includes |= 67108864 /* NonPrimitive */;
}
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
includes |= flags & 68943871 /* IncludesMask */;
}
@@ -40688,8 +41054,9 @@ var ts;
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
// for intersections of types with signatures can be deterministic.
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
- var typeSet = [];
- var includes = addTypesToIntersection(typeSet, 0, types);
+ var typeMembershipMap = ts.createMap();
+ var includes = addTypesToIntersection(typeMembershipMap, 0, types);
+ var typeSet = ts.arrayFrom(typeMembershipMap.values());
// An intersection type is considered empty if it contains
// the type never, or
// more than one unit type or,
@@ -41384,7 +41751,7 @@ var ts;
links.resolvedSymbol = unknownSymbol;
return links.resolvedType = errorType;
}
- var targetMeaning = node.isTypeOf ? 67220415 /* Value */ : node.flags & 2097152 /* JSDoc */ ? 67220415 /* Value */ | 67897832 /* Type */ : 67897832 /* Type */;
+ var targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 2097152 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */;
// TODO: Future work: support unions/generics/whatever via a deferred import-type
var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
if (!innerModuleSymbol) {
@@ -41414,7 +41781,7 @@ var ts;
resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
}
else {
- var errorMessage = targetMeaning === 67220415 /* Value */
+ var errorMessage = targetMeaning === 111551 /* Value */
? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here
: ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
error(node, errorMessage, node.argument.literal.text);
@@ -41428,7 +41795,7 @@ var ts;
function resolveImportSymbolType(node, links, symbol, meaning) {
var resolvedSymbol = resolveSymbol(symbol);
links.resolvedSymbol = resolvedSymbol;
- if (meaning === 67220415 /* Value */) {
+ if (meaning === 111551 /* Value */) {
return links.resolvedType = getTypeOfSymbol(symbol); // intentionally doesn't use resolved symbol so type is cached as expected on the alias
}
else {
@@ -41726,9 +42093,9 @@ var ts;
case 166 /* FunctionType */:
case 167 /* ConstructorType */:
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 295 /* JSDocFunctionType */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 180 /* TypeOperator */:
return getTypeFromTypeOperatorNode(node);
@@ -41955,7 +42322,8 @@ var ts;
}
function maybeTypeParameterReference(node) {
return !(node.kind === 149 /* QualifiedName */ ||
- node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
+ node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName ||
+ node.parent.kind === 184 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier);
}
function isTypeParameterPossiblyReferenced(tp, node) {
// If the type parameter doesn't have exactly one declaration, if there are invening statement blocks
@@ -43223,7 +43591,7 @@ var ts;
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */);
- var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
+ var isPerformingExcessPropertyChecks = !isApparentIntersectionConstituent && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
@@ -43233,11 +43601,11 @@ var ts;
return 0 /* False */;
}
}
- if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
+ var isPerformingCommonPropertyChecks = relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
target.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target) &&
- (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)) &&
- !hasCommonProperties(source, target, isComparingJsxAttributes)) {
+ (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
+ if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
if (reportErrors) {
var calls = getSignaturesOfType(source, 0 /* Call */);
var constructs = getSignaturesOfType(source, 1 /* Construct */);
@@ -43265,10 +43633,10 @@ var ts;
else {
if (target.flags & 1048576 /* Union */) {
result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
// Validate against excess props using the original `source`
var discriminantType = findMatchingDiscriminantType(source, target) || filterPrimitivesIfContainsNonPrimitive(target);
- if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined)) {
+ if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined, isIntersectionConstituent)) {
return 0 /* False */;
}
}
@@ -43276,9 +43644,9 @@ var ts;
else if (target.flags & 2097152 /* Intersection */) {
isIntersectionConstituent = true; // set here to affect the following trio of checks
result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
// Validate against excess props using the original `source`
- if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) {
+ if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, /*isIntersectionConstituent*/ false)) {
return 0 /* False */;
}
}
@@ -43593,7 +43961,7 @@ var ts;
}
return result;
}
- function typeArgumentsRelatedTo(sources, targets, variances, reportErrors) {
+ function typeArgumentsRelatedTo(sources, targets, variances, reportErrors, isIntersectionConstituent) {
if (sources === void 0) { sources = ts.emptyArray; }
if (targets === void 0) { targets = ts.emptyArray; }
if (variances === void 0) { variances = ts.emptyArray; }
@@ -43620,10 +43988,10 @@ var ts;
related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t);
}
else if (variance === 1 /* Covariant */) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
else if (variance === 2 /* Contravariant */) {
- related = isRelatedTo(t, s, reportErrors);
+ related = isRelatedTo(t, s, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
else if (variance === 3 /* Bivariant */) {
// In the bivariant case we first compare contravariantly without reporting
@@ -43632,16 +44000,16 @@ var ts;
// which is generally easier to reason about.
related = isRelatedTo(t, s, /*reportErrors*/ false);
if (!related) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
else {
// In the invariant case we first compare covariantly, and only when that
// succeeds do we proceed to compare contravariantly. Thus, error elaboration
// will typically be based on the covariant check.
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
if (related) {
- related &= isRelatedTo(t, s, reportErrors);
+ related &= isRelatedTo(t, s, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
if (!related) {
@@ -43784,7 +44152,7 @@ var ts;
source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
!(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
var variances = getAliasVariances(source.aliasSymbol);
- var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances);
+ var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -43959,13 +44327,16 @@ var ts;
if (relation !== identityRelation) {
source = getApparentType(source);
}
+ else if (isGenericMappedType(source)) {
+ return 0 /* False */;
+ }
if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target &&
!(ts.getObjectFlags(source) & 8192 /* MarkerType */ || ts.getObjectFlags(target) & 8192 /* MarkerType */)) {
// We have type references to the same generic type, and the type references are not marker
// type references (which are intended by be compared structurally). Obtain the variance
// information for the type parameters and relate the type arguments accordingly.
var variances = getVariances(source.target);
- var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances);
+ var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -43993,7 +44364,7 @@ var ts;
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) {
// Report structural errors only if we haven't reported any errors yet
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined, isIntersectionConstituent);
if (result) {
result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors);
if (result) {
@@ -44028,8 +44399,8 @@ var ts;
}
}
return 0 /* False */;
- function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
- if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
+ function relateVariances(sourceTypeArguments, targetTypeArguments, variances, isIntersectionConstituent) {
+ if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors, isIntersectionConstituent)) {
return result;
}
if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) {
@@ -44154,7 +44525,7 @@ var ts;
if (sourceProperty === targetProperty)
return "continue";
// We compare the source property to the target in the context of a single discriminant type.
- var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false);
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false, /*isIntersectionConstituent*/ false);
// If the target property could not be found, or if the properties were not related,
// then this constituent is not a match.
if (!related) {
@@ -44184,7 +44555,7 @@ var ts;
var result = -1 /* True */;
for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
var type = matchingTypes_1[_b];
- result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties);
+ result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties, /*isIntersectionConstituent*/ false);
if (result) {
result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false);
if (result) {
@@ -44219,7 +44590,7 @@ var ts;
}
return result || properties;
}
- function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */);
var source = getTypeOfSourceProperty(sourceProp);
if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) {
@@ -44259,10 +44630,10 @@ var ts;
return result_7;
}
else {
- return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
- function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {
@@ -44300,7 +44671,7 @@ var ts;
return 0 /* False */;
}
// If the target comes from a partial union prop, allow `undefined` in the target type
- var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
@@ -44323,7 +44694,7 @@ var ts;
}
return related;
}
- function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties, isIntersectionConstituent) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target, excludedProperties);
}
@@ -44412,7 +44783,7 @@ var ts;
if (!(targetProp.flags & 4194304 /* Prototype */)) {
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp && sourceProp !== targetProp) {
- var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, isIntersectionConstituent);
if (!related) {
return 0 /* False */;
}
@@ -44647,23 +45018,27 @@ var ts;
}
}
function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue) {
- var match;
+ // undefined=unknown, true=discriminated, false=not discriminated
+ // The state of each type progresses from left to right. Discriminated types stop at 'true'.
+ var discriminable = target.types.map(function (_) { return undefined; });
for (var _i = 0, discriminators_1 = discriminators; _i < discriminators_1.length; _i++) {
var _a = discriminators_1[_i], getDiscriminatingType = _a[0], propertyName = _a[1];
+ var i = 0;
for (var _b = 0, _c = target.types; _b < _c.length; _b++) {
var type = _c[_b];
var targetType = getTypeOfPropertyOfType(type, propertyName);
if (targetType && related(getDiscriminatingType(), targetType)) {
- if (match) {
- if (type === match)
- continue; // Finding multiple fields which discriminate to the same type is fine
- return defaultValue;
- }
- match = type;
+ discriminable[i] = discriminable[i] === undefined ? true : discriminable[i];
}
+ else {
+ discriminable[i] = false;
+ }
+ i++;
}
}
- return match || defaultValue;
+ var match = discriminable.indexOf(/*searchElement*/ true);
+ // make sure exactly 1 matches before returning it
+ return match === -1 || discriminable.indexOf(/*searchElement*/ true, match + 1) !== -1 ? defaultValue : target.types[match];
}
/**
* A type is 'weak' if it is an object type with at least one optional property
@@ -45475,7 +45850,7 @@ var ts;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
param.parent.parameters.indexOf(param) > -1 &&
- (resolveName(param, param.name.escapedText, 67897832 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
+ (resolveName(param, param.name.escapedText, 788968 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
param.name.originalKeywordKind && ts.isTypeNodeKind(param.name.originalKeywordKind))) {
var newName = "arg" + param.parent.parameters.indexOf(param);
errorOrSuggestion(noImplicitAny, declaration, ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, ts.declarationNameToString(param.name));
@@ -45639,7 +46014,7 @@ var ts;
objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
objectFlags & 32 /* Mapped */ ||
- type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));
+ type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && couldUnionOrIntersectionContainTypeVariables(type));
}
function couldUnionOrIntersectionContainTypeVariables(type) {
if (type.couldContainTypeVariables === undefined) {
@@ -45794,6 +46169,8 @@ var ts;
var visited;
var bivariant = false;
var propagationType;
+ var inferenceMatch = false;
+ var inferenceIncomplete = false;
var allowComplexConstraintInference = true;
inferFromTypes(originalSource, originalTarget);
function inferFromTypes(source, target) {
@@ -45816,43 +46193,54 @@ var ts;
inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
return;
}
- if (source.flags & 1048576 /* Union */ && target.flags & 1048576 /* Union */ && !(source.flags & 1024 /* EnumLiteral */ && target.flags & 1024 /* EnumLiteral */) ||
- source.flags & 2097152 /* Intersection */ && target.flags & 2097152 /* Intersection */) {
- // Source and target are both unions or both intersections. If source and target
- // are the same type, just relate each constituent type to itself.
- if (source === target) {
- for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
- var t = _a[_i];
- inferFromTypes(t, t);
- }
- return;
+ if (source === target && source.flags & 3145728 /* UnionOrIntersection */) {
+ // When source and target are the same union or intersection type, just relate each constituent
+ // type to itself.
+ for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ inferFromTypes(t, t);
}
- // Find each source constituent type that has an identically matching target constituent
- // type, and for each such type infer from the type to itself. When inferring from a
- // type to itself we effectively find all type parameter occurrences within that type
- // and infer themselves as their type arguments. We have special handling for numeric
- // and string literals because the number and string types are not represented as unions
- // of all their possible values.
- var matchingTypes = void 0;
- for (var _b = 0, _c = source.types; _b < _c.length; _b++) {
- var t = _c[_b];
- if (typeIdenticalToSomeType(t, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t);
- inferFromTypes(t, t);
- }
- else if (t.flags & (256 /* NumberLiteral */ | 128 /* StringLiteral */)) {
- var b = getBaseTypeOfLiteralType(t);
- if (typeIdenticalToSomeType(b, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t, b);
- }
+ return;
+ }
+ if (target.flags & 1048576 /* Union */) {
+ if (source.flags & 1048576 /* Union */) {
+ // First, infer between identically matching source and target constituents and remove the
+ // matching types.
+ var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
+ // Next, infer between closely matching source and target constituents and remove
+ // the matching types. Types closely match when they are instantiations of the same
+ // object type or instantiations of the same type alias.
+ var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
}
+ source = getUnionType(sources);
+ target = getUnionType(targets);
}
- // Next, to improve the quality of inferences, reduce the source and target types by
- // removing the identically matched constituents. For example, when inferring from
- // 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'.
- if (matchingTypes) {
- source = removeTypesFromUnionOrIntersection(source, matchingTypes);
- target = removeTypesFromUnionOrIntersection(target, matchingTypes);
+ else {
+ if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
+ return;
+ if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
+ return;
+ }
+ }
+ else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
+ // We reduce intersection types only when they contain naked type parameters. For example, when
+ // inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
+ // infer { extra: any } for T. But when inferring to 'string[] & Iterable' we want to keep the
+ // string[] on the source side and infer string for T.
+ if (source.flags & 2097152 /* Intersection */) {
+ // Infer between identically matching source and target constituents and remove the matching types.
+ var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
+ }
+ source = getIntersectionType(sources);
+ target = getIntersectionType(targets);
+ }
+ else if (!(source.flags & 1048576 /* Union */)) {
+ if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
+ return;
}
}
else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
@@ -45898,13 +46286,14 @@ var ts;
clearCachedInferences(inferences);
}
}
+ inferenceMatch = true;
return;
}
else {
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
var simplified = getSimplifiedType(target, /*writing*/ false);
if (simplified !== target) {
- inferFromTypesOnce(source, simplified);
+ invokeOnce(source, simplified, inferFromTypes);
}
else if (target.flags & 8388608 /* IndexedAccess */) {
var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
@@ -45913,13 +46302,13 @@ var ts;
if (indexType.flags & 63176704 /* Instantiable */) {
var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
if (simplified_1 && simplified_1 !== target) {
- inferFromTypesOnce(source, simplified_1);
+ invokeOnce(source, simplified_1, inferFromTypes);
}
}
}
}
}
- if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {
+ if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
// If source and target are references to the same generic type, infer from type arguments
inferFromTypeArguments(source.typeArguments || ts.emptyArray, target.typeArguments || ts.emptyArray, getVariances(source.target));
}
@@ -45949,16 +46338,16 @@ var ts;
}
else if (target.flags & 16777216 /* Conditional */ && !contravariant) {
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
- inferToMultipleTypes(source, targetTypes, /*isIntersection*/ false);
+ inferToMultipleTypes(source, targetTypes, target.flags);
}
else if (target.flags & 3145728 /* UnionOrIntersection */) {
- inferToMultipleTypes(source, target.types, !!(target.flags & 2097152 /* Intersection */));
+ inferToMultipleTypes(source, target.types, target.flags);
}
else if (source.flags & 1048576 /* Union */) {
// Source is a union or intersection type, infer from each constituent type
var sourceTypes = source.types;
- for (var _d = 0, sourceTypes_3 = sourceTypes; _d < sourceTypes_3.length; _d++) {
- var sourceType = sourceTypes_3[_d];
+ for (var _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) {
+ var sourceType = sourceTypes_3[_e];
inferFromTypes(sourceType, target);
}
}
@@ -45982,38 +46371,59 @@ var ts;
source = apparentSource;
}
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
- var key = source.id + "," + target.id;
- if (visited && visited.get(key)) {
- return;
- }
- (visited || (visited = ts.createMap())).set(key, true);
- // If we are already processing another target type with the same associated symbol (such as
- // an instantiation of the same generic type), we do not explore this target as it would yield
- // no further inferences. We exclude the static side of classes from this check since it shares
- // its symbol with the instance side which would lead to false positives.
- var isNonConstructorObject = target.flags & 524288 /* Object */ &&
- !(ts.getObjectFlags(target) & 16 /* Anonymous */ && target.symbol && target.symbol.flags & 32 /* Class */);
- var symbol = isNonConstructorObject ? target.symbol : undefined;
- if (symbol) {
- if (ts.contains(symbolStack, symbol)) {
- return;
- }
- (symbolStack || (symbolStack = [])).push(symbol);
- inferFromObjectTypes(source, target);
- symbolStack.pop();
- }
- else {
- inferFromObjectTypes(source, target);
+ invokeOnce(source, target, inferFromObjectTypes);
+ }
+ }
+ }
+ function invokeOnce(source, target, action) {
+ var key = source.id + "," + target.id;
+ var status = visited && visited.get(key);
+ if (status !== undefined) {
+ if (status & 1)
+ inferenceMatch = true;
+ if (status & 2)
+ inferenceIncomplete = true;
+ return;
+ }
+ (visited || (visited = ts.createMap())).set(key, 0);
+ var saveInferenceMatch = inferenceMatch;
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceMatch = false;
+ inferenceIncomplete = false;
+ action(source, target);
+ visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0));
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ }
+ function inferFromMatchingType(source, targets, matches) {
+ var matched = false;
+ for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
+ var t = targets_1[_i];
+ if (matches(source, t)) {
+ inferFromTypes(source, t);
+ matched = true;
+ }
+ }
+ return matched;
+ }
+ function inferFromMatchingTypes(sources, targets, matches) {
+ var matchedSources;
+ var matchedTargets;
+ for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
+ var t = targets_2[_i];
+ for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
+ var s = sources_1[_a];
+ if (matches(s, t)) {
+ inferFromTypes(s, t);
+ matchedSources = ts.appendIfUnique(matchedSources, s);
+ matchedTargets = ts.appendIfUnique(matchedTargets, t);
}
}
}
- function inferFromTypesOnce(source, target) {
- var key = source.id + "," + target.id;
- if (!visited || !visited.get(key)) {
- (visited || (visited = ts.createMap())).set(key, true);
- inferFromTypes(source, target);
- }
- }
+ return [
+ matchedSources ? ts.filter(sources, function (t) { return !ts.contains(matchedSources, t); }) : sources,
+ matchedTargets ? ts.filter(targets, function (t) { return !ts.contains(matchedTargets, t); }) : targets,
+ ];
}
function inferFromTypeArguments(sourceTypes, targetTypes, variances) {
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
@@ -46047,29 +46457,69 @@ var ts;
}
return undefined;
}
- function inferToMultipleTypes(source, targets, isIntersection) {
- // We infer from types that are not naked type variables first so that inferences we
- // make from nested naked type variables and given slightly higher priority by virtue
- // of being first in the candidates array.
+ function inferToMultipleTypes(source, targets, targetFlags) {
var typeVariableCount = 0;
- for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
- var t = targets_1[_i];
- if (getInferenceInfoForType(t)) {
- typeVariableCount++;
+ if (targetFlags & 1048576 /* Union */) {
+ var nakedTypeVariable = void 0;
+ var sources = source.flags & 1048576 /* Union */ ? source.types : [source];
+ var matched_1 = new Array(sources.length);
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceIncomplete = false;
+ // First infer to types that are not naked type variables. For each source type we
+ // track whether inferences were made from that particular type to some target.
+ for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
+ var t = targets_3[_i];
+ if (getInferenceInfoForType(t)) {
+ nakedTypeVariable = t;
+ typeVariableCount++;
+ }
+ else {
+ for (var i = 0; i < sources.length; i++) {
+ var saveInferenceMatch = inferenceMatch;
+ inferenceMatch = false;
+ inferFromTypes(sources[i], t);
+ if (inferenceMatch)
+ matched_1[i] = true;
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ }
+ }
}
- else {
- inferFromTypes(source, t);
+ var inferenceComplete = !inferenceIncomplete;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ // If the target has a single naked type variable and inference completed (meaning we
+ // explored the types fully), create a union of the source types from which no inferences
+ // have been made so far and infer from that union to the naked type variable.
+ if (typeVariableCount === 1 && inferenceComplete) {
+ var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; });
+ if (unmatched.length) {
+ inferFromTypes(getUnionType(unmatched), nakedTypeVariable);
+ return;
+ }
+ }
+ }
+ else {
+ // We infer from types that are not naked type variables first so that inferences we
+ // make from nested naked type variables and given slightly higher priority by virtue
+ // of being first in the candidates array.
+ for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
+ var t = targets_4[_a];
+ if (getInferenceInfoForType(t)) {
+ typeVariableCount++;
+ }
+ else {
+ inferFromTypes(source, t);
+ }
}
}
// Inferences directly to naked type variables are given lower priority as they are
// less specific. For example, when inferring from Promise to T | Promise,
// we want to infer string for T, not Promise | string. For intersection types
// we only infer to single naked type variables.
- if (isIntersection ? typeVariableCount === 1 : typeVariableCount !== 0) {
+ if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) {
var savePriority = priority;
priority |= 1 /* NakedTypeVariable */;
- for (var _a = 0, targets_2 = targets; _a < targets_2.length; _a++) {
- var t = targets_2[_a];
+ for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
+ var t = targets_5[_b];
if (getInferenceInfoForType(t)) {
inferFromTypes(source, t);
}
@@ -46134,6 +46584,27 @@ var ts;
return false;
}
function inferFromObjectTypes(source, target) {
+ // If we are already processing another target type with the same associated symbol (such as
+ // an instantiation of the same generic type), we do not explore this target as it would yield
+ // no further inferences. We exclude the static side of classes from this check since it shares
+ // its symbol with the instance side which would lead to false positives.
+ var isNonConstructorObject = target.flags & 524288 /* Object */ &&
+ !(ts.getObjectFlags(target) & 16 /* Anonymous */ && target.symbol && target.symbol.flags & 32 /* Class */);
+ var symbol = isNonConstructorObject ? target.symbol : undefined;
+ if (symbol) {
+ if (ts.contains(symbolStack, symbol)) {
+ inferenceIncomplete = true;
+ return;
+ }
+ (symbolStack || (symbolStack = [])).push(symbol);
+ inferFromObjectTypesWorker(source, target);
+ symbolStack.pop();
+ }
+ else {
+ inferFromObjectTypesWorker(source, target);
+ }
+ }
+ function inferFromObjectTypesWorker(source, target) {
if (isGenericMappedType(source) && isGenericMappedType(target)) {
// The source and target types are generic types { [P in S]: X } and { [P in T]: Y }, so we infer
// from S to T and from X to Y.
@@ -46232,28 +46703,12 @@ var ts;
}
}
}
- function typeIdenticalToSomeType(type, types) {
- for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
- var t = types_11[_i];
- if (isTypeIdenticalTo(t, type)) {
- return true;
- }
- }
- return false;
+ function isTypeOrBaseIdenticalTo(s, t) {
+ return isTypeIdenticalTo(s, t) || !!(s.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t);
}
- /**
- * Return a new union or intersection type computed by removing a given set of types
- * from a given union or intersection type.
- */
- function removeTypesFromUnionOrIntersection(type, typesToRemove) {
- var reducedTypes = [];
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (!typeIdenticalToSomeType(t, typesToRemove)) {
- reducedTypes.push(t);
- }
- }
- return type.flags & 1048576 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);
+ function isTypeCloselyMatchedBy(s, t) {
+ return !!(s.flags & 524288 /* Object */ && t.flags & 524288 /* Object */ && s.symbol && s.symbol === t.symbol ||
+ s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol);
}
function hasPrimitiveConstraint(type) {
var constraint = getConstraintOfTypeParameter(type);
@@ -46404,7 +46859,7 @@ var ts;
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
+ resolveName(node, node.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
/*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
@@ -46601,8 +47056,8 @@ var ts;
}
function getTypeFactsOfTypes(types) {
var result = 0 /* None */;
- for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
- var t = types_12[_i];
+ for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
+ var t = types_11[_i];
result |= getTypeFacts(t);
}
return result;
@@ -46977,8 +47432,8 @@ var ts;
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var t = types_13[_i];
+ for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
+ var t = types_12[_i];
if (!(t.flags & 131072 /* Never */)) {
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
return false;
@@ -47930,8 +48385,11 @@ var ts;
}
return type;
}
+ function isExportOrExportExpression(location) {
+ return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); });
+ }
function markAliasReferenced(symbol, location) {
- if (isNonLocalAlias(symbol, /*excludes*/ 67220415 /* Value */) && !isInTypeQuery(location) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && ((compilerOptions.preserveConstEnums && isExportOrExportExpression(location)) || !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol)))) {
markAliasSymbolAsReferenced(symbol);
}
}
@@ -48824,6 +49282,15 @@ var ts;
}
return false;
}
+ function getContextualIterationType(kind, functionDecl) {
+ var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2 /* Async */);
+ var contextualReturnType = getContextualReturnType(functionDecl);
+ if (contextualReturnType) {
+ return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
+ || undefined;
+ }
+ return undefined;
+ }
function getContextualReturnType(functionDecl) {
// If the containing function has a return type annotation, is a constructor, or is a get accessor whose
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
@@ -48917,7 +49384,7 @@ var ts;
}
else if (ts.isIdentifier(lhs.expression)) {
var id = lhs.expression;
- var parentSymbol = resolveName(id, id.escapedText, 67220415 /* Value */, undefined, id.escapedText, /*isUse*/ true);
+ var parentSymbol = resolveName(id, id.escapedText, 111551 /* Value */, undefined, id.escapedText, /*isUse*/ true);
if (parentSymbol) {
var annotated = ts.getEffectiveTypeAnnotationNode(parentSymbol.valueDeclaration);
if (annotated) {
@@ -49105,9 +49572,12 @@ var ts;
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
// be "pushed" onto a node using the contextualType property.
function getApparentTypeOfContextualType(node, contextFlags) {
- var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
- if (contextualType) {
- var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true);
+ var contextualType = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, contextFlags) :
+ getContextualType(node, contextFlags);
+ var instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
+ if (instantiatedType) {
+ var apparentType = mapType(instantiatedType, getApparentType, /*noReductions*/ true);
if (apparentType.flags & 1048576 /* Union */) {
if (ts.isObjectLiteralExpression(node)) {
return discriminateContextualTypeByObjectMembers(node, apparentType);
@@ -49157,7 +49627,7 @@ var ts;
return type;
}
/**
- * Woah! Do you really want to use this function?
+ * Whoa! Do you really want to use this function?
*
* Unless you're trying to get the *non-apparent* type for a
* value-literal type or you're authoring relevant portions of this algorithm,
@@ -49408,9 +49878,7 @@ var ts;
if (typeTagSignature) {
return typeTagSignature;
}
- var type = ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) :
- getApparentTypeOfContextualType(node, 1 /* Signature */);
+ var type = getApparentTypeOfContextualType(node, 1 /* Signature */);
if (!type) {
return undefined;
}
@@ -49419,8 +49887,8 @@ var ts;
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var current = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var current = types_13[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -49971,7 +50439,7 @@ var ts;
function getJsxType(name, location) {
var namespace = getJsxNamespaceAt(location);
var exports = namespace && getExportsOfSymbol(namespace);
- var typeSymbol = exports && getSymbol(exports, name, 67897832 /* Type */);
+ var typeSymbol = exports && getSymbol(exports, name, 788968 /* Type */);
return typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType;
}
/**
@@ -50045,7 +50513,7 @@ var ts;
*/
function getNameFromJsxElementAttributesContainer(nameOfAttribPropContainer, jsxNamespace) {
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [symbol]
- var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 67897832 /* Type */);
+ var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 788968 /* Type */);
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [type]
var jsxElementAttribPropInterfaceType = jsxElementAttribPropInterfaceSym && getDeclaredTypeOfSymbol(jsxElementAttribPropInterfaceSym);
// The properties of JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute
@@ -50069,7 +50537,7 @@ var ts;
}
function getJsxLibraryManagedAttributes(jsxNamespace) {
// JSX.LibraryManagedAttributes [symbol]
- return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 67897832 /* Type */);
+ return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 788968 /* Type */);
}
/// e.g. "props" for React.d.ts,
/// or 'undefined' if ElementAttributesProperty doesn't exist (which means all
@@ -50221,13 +50689,13 @@ var ts;
var reactRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
var reactNamespace = getJsxNamespace(node);
var reactLocation = isNodeOpeningLikeElement ? node.tagName : node;
- var reactSym = resolveName(reactLocation, reactNamespace, 67220415 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true);
+ var reactSym = resolveName(reactLocation, reactNamespace, 111551 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true);
if (reactSym) {
// Mark local symbol as referenced here because it might not have been marked
// if jsx emit was not react as there wont be error being emitted
reactSym.isReferenced = 67108863 /* All */;
- // If react symbol is alias, mark it as referenced
- if (reactSym.flags & 2097152 /* Alias */ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) {
+ // If react symbol is alias, mark it as refereced
+ if (reactSym.flags & 2097152 /* Alias */) {
markAliasSymbolAsReferenced(reactSym);
}
}
@@ -50552,7 +51020,7 @@ var ts;
}
function checkPropertyNotUsedBeforeDeclaration(prop, node, right) {
var valueDeclaration = prop.valueDeclaration;
- if (!valueDeclaration) {
+ if (!valueDeclaration || ts.getSourceFileOfNode(node).isDeclarationFile) {
return;
}
var diagnosticMessage;
@@ -50668,7 +51136,7 @@ var ts;
return prop !== undefined && prop.valueDeclaration && ts.hasModifier(prop.valueDeclaration, 32 /* Static */);
}
function getSuggestedSymbolForNonexistentProperty(name, containingType) {
- return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 67220415 /* Value */);
+ return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 111551 /* Value */);
}
function getSuggestionForNonexistentProperty(name, containingType) {
var suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
@@ -52152,8 +52620,8 @@ var ts;
if (apparentType.flags & 1048576 /* Union */) {
var types = apparentType.types;
var hasSignatures = false;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var constituent = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var constituent = types_14[_i];
var signatures = getSignaturesOfType(constituent, kind);
if (signatures.length !== 0) {
hasSignatures = true;
@@ -52304,8 +52772,8 @@ var ts;
var exports = namespace && getExportsOfSymbol(namespace);
// We fake up a SFC signature for each intrinsic, however a more specific per-element signature drawn from the JSX declaration
// file would probably be preferable.
- var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */);
- var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node);
+ var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* Type */);
+ var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* Type */, node);
var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */));
var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
parameterSymbol.type = result;
@@ -52534,7 +53002,7 @@ var ts;
if (!globalESSymbol) {
return false;
}
- return globalESSymbol === resolveName(left, "Symbol", 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
+ return globalESSymbol === resolveName(left, "Symbol", 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
}
function checkImportCallExpression(node) {
// Check grammar of dynamic import
@@ -52594,7 +53062,7 @@ var ts;
// Make sure require is not a local function
if (!ts.isIdentifier(node.expression))
return ts.Debug.fail();
- var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); // TODO: GH#18217
+ var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); // TODO: GH#18217
if (resolvedRequire === requireSymbol) {
return true;
}
@@ -52703,8 +53171,8 @@ var ts;
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
- error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
+ error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system);
}
var file = ts.getSourceFileOfNode(node);
ts.Debug.assert(!!(file.flags & 1048576 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
@@ -52894,7 +53362,7 @@ var ts;
links.type = contextualType;
var decl = parameter.valueDeclaration;
if (decl.name.kind !== 73 /* Identifier */) {
- // if inference didn't come up with anything but {}, fall back to the binding pattern if present.
+ // if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
@@ -53002,7 +53470,7 @@ var ts;
nextType && isUnitType(nextType)) {
var contextualType = !contextualSignature ? undefined :
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
- getReturnTypeOfSignature(contextualSignature);
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
if (isGenerator) {
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0 /* Yield */, isAsync);
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1 /* Return */, isAsync);
@@ -53020,7 +53488,7 @@ var ts;
nextType = getWidenedType(nextType);
}
if (isGenerator) {
- return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || unknownType, isAsync);
+ return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || getContextualIterationType(2 /* Next */, func) || unknownType, isAsync);
}
else {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -53140,8 +53608,8 @@ var ts;
var witnesses = getSwitchClauseTypeOfWitnesses(node);
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
- var type_5 = getBaseConstraintOfType(operandType) || operandType;
- return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
+ var type_4 = getBaseConstraintOfType(operandType) || operandType;
+ return !!(filterType(type_4, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
}
var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
@@ -53514,7 +53982,11 @@ var ts;
}
}
var operandType = checkExpression(node.expression);
- return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ var awaitedType = checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ if (awaitedType === operandType && awaitedType !== errorType && !(operandType.flags & 3 /* AnyOrUnknown */)) {
+ addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(node, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
+ }
+ return awaitedType;
}
function checkPrefixUnaryExpression(node) {
var operandType = checkExpression(node.operand);
@@ -53599,8 +54071,8 @@ var ts;
}
if (type.flags & 3145728 /* UnionOrIntersection */) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -53709,7 +54181,7 @@ var ts;
error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
else {
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(property, 4 /* Rest */);
}
var nonRestNames = [];
@@ -54083,7 +54555,7 @@ var ts;
var propType = getTypeOfSymbol(prop);
if (propType.symbol && propType.symbol.flags & 32 /* Class */) {
var name = prop.escapedName;
- var symbol = resolveName(prop.valueDeclaration, name, 67897832 /* Type */, undefined, name, /*isUse*/ false);
+ var symbol = resolveName(prop.valueDeclaration, name, 788968 /* Type */, undefined, name, /*isUse*/ false);
if (symbol && symbol.declarations.some(ts.isJSDocTypedefTag)) {
grammarErrorOnNode(symbol.declarations[0], ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
return grammarErrorOnNode(prop.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
@@ -54232,7 +54704,7 @@ var ts;
if (node.asteriskToken) {
// Async generator functions prior to ESNext require the __await, __asyncDelegator,
// and __asyncValues helpers
- if (isAsync && languageVersion < 8 /* ESNext */) {
+ if (isAsync && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 53248 /* AsyncDelegatorIncludes */);
}
// Generator functions prior to ES2015 require the __values helper
@@ -54262,7 +54734,7 @@ var ts;
return getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, isAsync)
|| anyType;
}
- return anyType;
+ return getContextualIterationType(2 /* Next */, func) || anyType;
}
function checkConditionalExpression(node, checkMode) {
checkTruthinessExpression(node.condition);
@@ -54612,7 +55084,8 @@ var ts;
var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) ||
(node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) ||
((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node));
+ (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node)) ||
+ (node.parent.kind === 258 /* ExportSpecifier */ && (compilerOptions.preserveConstEnums || node.flags & 4194304 /* Ambient */)); // We allow reexporting const enums
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -54877,7 +55350,7 @@ var ts;
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4 /* Invalid */)) {
// Async generators prior to ESNext require the __await and __asyncGenerator helpers
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) {
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 12288 /* AsyncGeneratorIncludes */);
}
// Async functions prior to ES2017 require the __awaiter helper
@@ -54940,13 +55413,6 @@ var ts;
}
}
function checkClassForDuplicateDeclarations(node) {
- var Declaration;
- (function (Declaration) {
- Declaration[Declaration["Getter"] = 1] = "Getter";
- Declaration[Declaration["Setter"] = 2] = "Setter";
- Declaration[Declaration["Method"] = 4] = "Method";
- Declaration[Declaration["Property"] = 3] = "Property";
- })(Declaration || (Declaration = {}));
var instanceNames = ts.createUnderscoreEscapedMap();
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
@@ -54955,7 +55421,7 @@ var ts;
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
- addName(instanceNames, param.name, param.name.escapedText, 3 /* Property */);
+ addName(instanceNames, param.name, param.name.escapedText, 3 /* GetOrSetAccessor */);
}
}
}
@@ -54967,16 +55433,16 @@ var ts;
if (name && memberName) {
switch (member.kind) {
case 159 /* GetAccessor */:
- addName(names, name, memberName, 1 /* Getter */);
+ addName(names, name, memberName, 1 /* GetAccessor */);
break;
case 160 /* SetAccessor */:
- addName(names, name, memberName, 2 /* Setter */);
+ addName(names, name, memberName, 2 /* SetAccessor */);
break;
case 155 /* PropertyDeclaration */:
- addName(names, name, memberName, 3 /* Property */);
+ addName(names, name, memberName, 3 /* GetOrSetAccessor */);
break;
case 157 /* MethodDeclaration */:
- addName(names, name, memberName, 4 /* Method */);
+ addName(names, name, memberName, 8 /* Method */);
break;
}
}
@@ -54985,8 +55451,8 @@ var ts;
function addName(names, location, name, meaning) {
var prev = names.get(name);
if (prev) {
- if (prev & 4 /* Method */) {
- if (meaning !== 4 /* Method */) {
+ if (prev & 8 /* Method */) {
+ if (meaning !== 8 /* Method */) {
error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));
}
}
@@ -55554,6 +56020,7 @@ var ts;
}
var duplicateFunctionDeclaration = false;
var multipleConstructorImplementation = false;
+ var hasNonAmbientClass = false;
for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
var current = declarations_4[_i];
var node = current;
@@ -55569,6 +56036,9 @@ var ts;
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
+ if ((node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */) && !inAmbientContext) {
+ hasNonAmbientClass = true;
+ }
if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
@@ -55610,6 +56080,15 @@ var ts;
error(ts.getNameOfDeclaration(declaration), ts.Diagnostics.Duplicate_function_implementation);
});
}
+ if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */) {
+ // A non-ambient class cannot be an implementation for a non-constructor function/class merge
+ // TODO: The below just replicates our older error from when classes and functions were
+ // entirely unable to merge - a more helpful message like "Class declaration cannot implement overload list"
+ // might be warranted. :shrug:
+ ts.forEach(declarations, function (declaration) {
+ addDuplicateDeclarationError(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Duplicate_identifier_0, ts.symbolName(symbol), ts.filter(declarations, function (d) { return d !== declaration; }));
+ });
+ }
// Abstract methods can't have an implementation -- in particular, they don't need one.
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&
!ts.hasModifier(lastSeenNonAmbientDeclaration, 128 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) {
@@ -55631,13 +56110,6 @@ var ts;
}
}
}
- var DeclarationSpaces;
- (function (DeclarationSpaces) {
- DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None";
- DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue";
- DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType";
- DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace";
- })(DeclarationSpaces || (DeclarationSpaces = {}));
function checkExportsOnMergedDeclarations(node) {
if (!produceDiagnostics) {
return;
@@ -55701,8 +56173,9 @@ var ts;
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return 2 /* ExportType */;
case 245 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
@@ -55800,9 +56273,6 @@ var ts;
*/
function checkAwaitedType(type, errorNode, diagnosticMessage, arg0) {
var awaitedType = getAwaitedType(type, errorNode, diagnosticMessage, arg0);
- if (awaitedType === type && !(type.flags & 3 /* AnyOrUnknown */)) {
- addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(errorNode, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
- }
return awaitedType || errorType;
}
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -55961,7 +56431,7 @@ var ts;
error(returnTypeNode, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
return;
}
- var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true);
+ var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 111551 /* Value */, /*ignoreErrors*/ true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
@@ -55984,7 +56454,7 @@ var ts;
}
// Verify there is no local declaration that could collide with the promise constructor.
var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
- var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 67220415 /* Value */);
+ var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 111551 /* Value */);
if (collidingSymbol) {
error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, ts.idText(rootName), ts.entityNameToString(promiseConstructorName));
return;
@@ -56041,7 +56511,7 @@ var ts;
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
+ var meaning = (typeName.kind === 73 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true);
if (rootSymbol
&& rootSymbol.flags & 2097152 /* Alias */
@@ -56080,8 +56550,8 @@ var ts;
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
@@ -56809,7 +57279,7 @@ var ts;
}
}
if (node.kind === 187 /* BindingElement */) {
- if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) {
+ if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 4 /* Rest */);
}
// check computed properties inside property names of binding elements
@@ -57023,7 +57493,7 @@ var ts;
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) {
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 99 /* ESNext */) {
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
checkExternalEmitHelpers(node, 32768 /* ForAwaitOfIncludes */);
}
@@ -58300,7 +58770,7 @@ var ts;
// derived class instance member variables and accessors, but not by other kinds of members.
// NOTE: assignability is checked in checkClassDeclaration
var baseProperties = getPropertiesOfType(baseType);
- for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
+ basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304 /* Prototype */) {
@@ -58309,54 +58779,65 @@ var ts;
var derived = getTargetSymbol(getPropertyOfObjectType(type, base.escapedName)); // TODO: GH#18217
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration.");
- if (derived) {
- // In order to resolve whether the inherited method was overridden in the base class or not,
- // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
- // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
- if (derived === base) {
- // derived class inherits base without override/redeclaration
- var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
- // It is an error to inherit an abstract member without implementing it or being declared abstract.
- // If there is no declaration for the derived class (as in the case of class expressions),
- // then the class cannot be declared abstract.
- if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 210 /* ClassExpression */) {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
- }
- else {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
+ // In order to resolve whether the inherited method was overridden in the base class or not,
+ // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
+ // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
+ if (derived === base) {
+ // derived class inherits base without override/redeclaration
+ var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
+ // It is an error to inherit an abstract member without implementing it or being declared abstract.
+ // If there is no declaration for the derived class (as in the case of class expressions),
+ // then the class cannot be declared abstract.
+ if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
+ // Searches other base types for a declaration that would satisfy the inherited abstract member.
+ // (The class may have more than one base type via declaration merging with an interface with the
+ // same name.)
+ for (var _a = 0, _b = getBaseTypes(type); _a < _b.length; _a++) {
+ var otherBaseType = _b[_a];
+ if (otherBaseType === baseType)
+ continue;
+ var baseSymbol = getPropertyOfObjectType(otherBaseType, base.escapedName);
+ var derivedElsewhere = baseSymbol && getTargetSymbol(baseSymbol);
+ if (derivedElsewhere && derivedElsewhere !== base) {
+ continue basePropertyCheck;
}
}
- }
- else {
- // derived overrides base.
- var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
- if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
- // either base or derived property is private - not override, skip it
- continue;
- }
- if (isPrototypeProperty(base) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) {
- // method is overridden with method or property/accessor is overridden with property/accessor - correct case
- continue;
- }
- var errorMessage = void 0;
- if (isPrototypeProperty(base)) {
- if (derived.flags & 98304 /* Accessor */) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
- }
- else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
- }
- }
- else if (base.flags & 98304 /* Accessor */) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ if (derivedClassDecl.kind === 210 /* ClassExpression */) {
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
}
- error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
}
}
+ else {
+ // derived overrides base.
+ var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
+ if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
+ // either base or derived property is private - not override, skip it
+ continue;
+ }
+ if (isPrototypeProperty(base) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) {
+ // method is overridden with method or property/accessor is overridden with property/accessor - correct case
+ continue;
+ }
+ var errorMessage = void 0;
+ if (isPrototypeProperty(base)) {
+ if (derived.flags & 98304 /* Accessor */) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
+ }
+ }
+ else if (base.flags & 98304 /* Accessor */) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
+ }
}
}
function checkInheritedPropertiesAreIdentical(type, typeNode) {
@@ -58900,15 +59381,16 @@ var ts;
function checkAliasSymbol(node) {
var symbol = getSymbolOfNode(node);
var target = resolveAlias(symbol);
- if (target !== unknownSymbol) {
- // For external modules symbol represent local symbol for an alias.
+ var shouldSkipWithJSExpandoTargets = symbol.flags & 67108864 /* Assignment */;
+ if (!shouldSkipWithJSExpandoTargets && target !== unknownSymbol) {
+ // For external modules symbol represents local symbol for an alias.
// This local symbol will merge any other local declarations (excluding other aliases)
// and symbol.flags will contains combined representation for all merged declaration.
// Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,
// otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export*
// in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).
- var excludedMeanings = (symbol.flags & (67220415 /* Value */ | 1048576 /* ExportValue */) ? 67220415 /* Value */ : 0) |
- (symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) |
+ var excludedMeanings = (symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */) ? 111551 /* Value */ : 0) |
+ (symbol.flags & 788968 /* Type */ ? 788968 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
var message = node.kind === 258 /* ExportSpecifier */ ?
@@ -58919,7 +59401,7 @@ var ts;
// Don't allow to re-export something with no value side when `--isolatedModules` is set.
if (compilerOptions.isolatedModules
&& node.kind === 258 /* ExportSpecifier */
- && !(target.flags & 67220415 /* Value */)
+ && !(target.flags & 111551 /* Value */)
&& !(node.flags & 4194304 /* Ambient */)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
}
@@ -58972,14 +59454,14 @@ var ts;
if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
- if (target.flags & 67220415 /* Value */) {
+ if (target.flags & 111551 /* Value */) {
// Target is a value symbol, check that it is not hidden by a local declaration with the same name
var moduleName = getFirstIdentifier(node.moduleReference);
- if (!(resolveEntityName(moduleName, 67220415 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
+ if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
}
}
- if (target.flags & 67897832 /* Type */) {
+ if (target.flags & 788968 /* Type */) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
}
}
@@ -59039,13 +59521,17 @@ var ts;
if (!node.parent.parent.moduleSpecifier) {
var exportedName = node.propertyName || node.name;
// find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases)
- var symbol = resolveName(exportedName, exportedName.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
+ var symbol = resolveName(exportedName, exportedName.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
/*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
}
else {
markExportAsReferenced(node);
+ var target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
+ if (!target || target === unknownSymbol || target.flags & 111551 /* Value */) {
+ checkExpressionCached(node.propertyName || node.name);
+ }
}
}
}
@@ -59069,7 +59555,17 @@ var ts;
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
if (node.expression.kind === 73 /* Identifier */) {
- markExportAsReferenced(node);
+ var id = node.expression;
+ var sym = resolveEntityName(id, 67108863 /* All */, /*ignoreErrors*/ true, /*dontResolveAlias*/ true, node);
+ if (sym) {
+ markAliasReferenced(sym, id);
+ // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
+ var target = sym.flags & 2097152 /* Alias */ ? resolveAlias(sym) : sym;
+ if (target === unknownSymbol || target.flags & 111551 /* Value */) {
+ // However if it is a value, we need to check it's being used correctly
+ checkExpressionCached(node.expression);
+ }
+ }
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, /*setVisibility*/ true);
}
@@ -59138,14 +59634,6 @@ var ts;
links.exportsChecked = true;
}
}
- function isNotAccessor(declaration) {
- // Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
- return !ts.isAccessor(declaration);
- }
- function isNotOverload(declaration) {
- return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
- !!declaration.body;
- }
function checkSourceElement(node) {
if (node) {
var saveCurrentNode = currentNode;
@@ -59225,16 +59713,17 @@ var ts;
return checkInferType(node);
case 184 /* ImportType */:
return checkImportType(node);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return checkJSDocTypeAliasTag(node);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return checkJSDocTemplateTag(node);
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
return checkJSDocTypeTag(node);
- case 306 /* JSDocParameterTag */:
+ case 307 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
case 295 /* JSDocFunctionType */:
checkJSDocFunctionType(node);
@@ -59243,7 +59732,7 @@ var ts;
case 292 /* JSDocNullableType */:
case 290 /* JSDocAllType */:
case 291 /* JSDocUnknownType */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
@@ -59584,7 +60073,7 @@ var ts;
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
// Note: that the memberFlags come from previous iteration.
if (!isStatic) {
- copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */);
+ copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* Type */);
}
break;
case 197 /* FunctionExpression */:
@@ -59737,7 +60226,7 @@ var ts;
if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
// Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression
var success = resolveEntityName(entityName,
- /*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
+ /*all meanings*/ 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
if (success && success !== unknownSymbol) {
return success;
}
@@ -59763,10 +60252,10 @@ var ts;
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) {
- meaning = 67897832 /* Type */;
+ meaning = 788968 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
- meaning |= 67220415 /* Value */;
+ meaning |= 111551 /* Value */;
}
}
else {
@@ -59778,10 +60267,10 @@ var ts;
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 306 /* JSDocParameterTag */) {
+ if (entityName.parent.kind === 307 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 310 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 311 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -59796,7 +60285,7 @@ var ts;
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
- return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
+ return resolveEntityName(entityName, 111551 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) {
var links = getNodeLinks(entityName);
@@ -59813,7 +60302,7 @@ var ts;
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
+ var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
if (entityName.parent.kind === 164 /* TypePredicate */) {
@@ -59923,7 +60412,7 @@ var ts;
}
function getShorthandAssignmentValueSymbol(location) {
if (location && location.kind === 277 /* ShorthandPropertyAssignment */) {
- return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */);
+ return resolveEntityName(location.name, 111551 /* Value */ | 2097152 /* Alias */);
}
return undefined;
}
@@ -59931,7 +60420,7 @@ var ts;
function getExportSpecifierLocalTargetSymbol(node) {
return node.parent.parent.moduleSpecifier ?
getExternalModuleMember(node.parent.parent, node) :
- resolveEntityName(node.propertyName || node.name, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ resolveEntityName(node.propertyName || node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
function getTypeOfNode(node) {
if (node.flags & 8388608 /* InWithStatement */) {
@@ -60132,13 +60621,13 @@ var ts;
// for export assignments - check if resolved symbol for RHS is itself a value
// otherwise - check if at least one export is value
symbolLinks.exportsSomeValue = hasExportAssignment
- ? !!(moduleSymbol.flags & 67220415 /* Value */)
+ ? !!(moduleSymbol.flags & 111551 /* Value */)
: ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue);
}
return symbolLinks.exportsSomeValue;
function isValue(s) {
s = resolveSymbol(s);
- return s && !!(s.flags & 67220415 /* Value */);
+ return s && !!(s.flags & 111551 /* Value */);
}
}
function isNameOfModuleOrEnumDeclaration(node) {
@@ -60187,7 +60676,7 @@ var ts;
var symbol = getReferencedValueSymbol(node);
// We should only get the declaration of an alias if there isn't a local value
// declaration for the symbol
- if (isNonLocalAlias(symbol, /*excludes*/ 67220415 /* Value */)) {
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */)) {
return getDeclarationOfAliasSymbol(symbol);
}
}
@@ -60204,7 +60693,7 @@ var ts;
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
- if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
+ if (resolveName(container.parent, symbol.escapedName, 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
// redeclaration - always should be renamed
links.isDeclarationWithCollidingName = true;
}
@@ -60300,7 +60789,7 @@ var ts;
}
// const enums and modules that contain only const enums are not considered values from the emit perspective
// unless 'preserveConstEnums' option is set to true
- return !!(target.flags & 67220415 /* Value */) &&
+ return !!(target.flags & 111551 /* Value */) &&
(compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));
}
function isConstEnumOrConstEnumOnlyModule(s) {
@@ -60314,7 +60803,7 @@ var ts;
}
var target = getSymbolLinks(symbol).target; // TODO: GH#18217
if (target && ts.getModifierFlags(node) & 1 /* Export */ &&
- target.flags & 67220415 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
+ target.flags & 111551 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
// An `export import ... =` of a value symbol is always considered referenced
return true;
}
@@ -60368,7 +60857,7 @@ var ts;
if (!symbol || !(symbol.flags & 16 /* Function */)) {
return false;
}
- return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 67220415 /* Value */ && ts.isPropertyAccessExpression(p.valueDeclaration); });
+ return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 111551 /* Value */ && p.valueDeclaration && ts.isPropertyAccessExpression(p.valueDeclaration); });
}
function getPropertiesOfContainerFunction(node) {
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
@@ -60422,9 +60911,9 @@ var ts;
return ts.TypeReferenceSerializationKind.Unknown;
}
// Resolve the symbol as a value to ensure the type can be reached at runtime during emit.
- var valueSymbol = resolveEntityName(typeName, 67220415 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
+ var valueSymbol = resolveEntityName(typeName, 111551 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
// Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.
- var typeSymbol = resolveEntityName(typeName, 67897832 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
+ var typeSymbol = resolveEntityName(typeName, 788968 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
if (valueSymbol && valueSymbol === typeSymbol) {
var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(/*reportErrors*/ false);
if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) {
@@ -60529,7 +61018,7 @@ var ts;
location = getDeclarationContainer(parent);
}
}
- return resolveName(location, reference.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
+ return resolveName(location, reference.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
}
function getReferencedValueDeclaration(referenceIn) {
if (!ts.isGeneratedIdentifier(referenceIn)) {
@@ -60550,7 +61039,7 @@ var ts;
return false;
}
function literalTypeToNode(type, enclosing, tracker) {
- var enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(type.symbol, 67220415 /* Value */, enclosing, /*flags*/ undefined, tracker)
+ var enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(type.symbol, 111551 /* Value */, enclosing, /*flags*/ undefined, tracker)
: type === trueType ? ts.createTrue() : type === falseType && ts.createFalse();
return enumResult || ts.createLiteral(type.value);
}
@@ -60663,9 +61152,9 @@ var ts;
// property access can only be used as values, or types when within an expression with type arguments inside a heritage clause
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
- var meaning = 67897832 /* Type */ | 1920 /* Namespace */;
+ var meaning = 788968 /* Type */ | 1920 /* Namespace */;
if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
- meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
}
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
@@ -60888,7 +61377,7 @@ var ts;
for (var helper = 1 /* FirstEmitHelper */; helper <= 131072 /* LastEmitHelper */; helper <<= 1) {
if (uncheckedHelpers & helper) {
var name = getHelperName(helper);
- var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 67220415 /* Value */);
+ var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 111551 /* Value */);
if (!symbol) {
error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name);
}
@@ -61467,13 +61956,6 @@ var ts;
return !!exclamationToken && grammarErrorOnNode(exclamationToken, message);
}
function checkGrammarObjectLiteralExpression(node, inDestructuring) {
- var Flags;
- (function (Flags) {
- Flags[Flags["Property"] = 1] = "Property";
- Flags[Flags["GetAccessor"] = 2] = "GetAccessor";
- Flags[Flags["SetAccessor"] = 4] = "SetAccessor";
- Flags[Flags["GetOrSetAccessor"] = 6] = "GetOrSetAccessor";
- })(Flags || (Flags = {}));
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
@@ -61525,15 +62007,16 @@ var ts;
if (name.kind === 8 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
- // falls through
+ currentKind = 4 /* PropertyAssignment */;
+ break;
case 157 /* MethodDeclaration */:
- currentKind = 1 /* Property */;
+ currentKind = 8 /* Method */;
break;
case 159 /* GetAccessor */:
- currentKind = 2 /* GetAccessor */;
+ currentKind = 1 /* GetAccessor */;
break;
case 160 /* SetAccessor */:
- currentKind = 4 /* SetAccessor */;
+ currentKind = 2 /* SetAccessor */;
break;
default:
throw ts.Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
@@ -61547,11 +62030,11 @@ var ts;
seen.set(effectiveName, currentKind);
}
else {
- if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) {
+ if ((currentKind & 12 /* PropertyAssignmentOrMethod */) && (existingKind & 12 /* PropertyAssignmentOrMethod */)) {
grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name));
}
- else if ((currentKind & 6 /* GetOrSetAccessor */) && (existingKind & 6 /* GetOrSetAccessor */)) {
- if (existingKind !== 6 /* GetOrSetAccessor */ && currentKind !== existingKind) {
+ else if ((currentKind & 3 /* GetOrSetAccessor */) && (existingKind & 3 /* GetOrSetAccessor */)) {
+ if (existingKind !== 3 /* GetOrSetAccessor */ && currentKind !== existingKind) {
seen.set(effectiveName, currentKind | existingKind);
}
else {
@@ -61649,42 +62132,38 @@ var ts;
return false;
}
function checkGrammarAccessor(accessor) {
- var kind = accessor.kind;
- if (languageVersion < 1 /* ES5 */) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ if (!(accessor.flags & 4194304 /* Ambient */)) {
+ if (languageVersion < 1 /* ES5 */) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ }
+ if (accessor.body === undefined && !ts.hasModifier(accessor, 128 /* Abstract */)) {
+ return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
+ }
}
- else if (accessor.flags & 4194304 /* Ambient */) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);
- }
- else if (accessor.body === undefined && !ts.hasModifier(accessor, 128 /* Abstract */)) {
- return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
- }
- else if (accessor.body && ts.hasModifier(accessor, 128 /* Abstract */)) {
+ if (accessor.body && ts.hasModifier(accessor, 128 /* Abstract */)) {
return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
}
- else if (accessor.typeParameters) {
+ if (accessor.typeParameters) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
- else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ?
+ if (!doesAccessorHaveCorrectParameterCount(accessor)) {
+ return grammarErrorOnNode(accessor.name, accessor.kind === 159 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 160 /* SetAccessor */) {
+ if (accessor.kind === 160 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
- else {
- var parameter = accessor.parameters[0];
- if (parameter.dotDotDotToken) {
- return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
- }
- else if (parameter.questionToken) {
- return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
- }
- else if (parameter.initializer) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
- }
+ var parameter = ts.Debug.assertDefined(ts.getSetAccessorValueParameter(accessor), "Return value does not match parameter count assertion.");
+ if (parameter.dotDotDotToken) {
+ return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
+ }
+ if (parameter.questionToken) {
+ return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
+ }
+ if (parameter.initializer) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
}
}
return false;
@@ -62119,13 +62598,9 @@ var ts;
}
function checkGrammarStatementInAmbientContext(node) {
if (node.flags & 4194304 /* Ambient */) {
- // An accessors is already reported about the ambient context
- if (ts.isAccessor(node.parent)) {
- return getNodeLinks(node).hasReportedStatementInAmbientContext = true;
- }
// Find containing block which is either Block, ModuleBlock, SourceFile
var links = getNodeLinks(node);
- if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) {
+ if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
}
// We are either parented by another statement, or some sort of block.
@@ -62173,7 +62648,7 @@ var ts;
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -62223,6 +62698,14 @@ var ts;
}
}
ts.createTypeChecker = createTypeChecker;
+ function isNotAccessor(declaration) {
+ // Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
+ return !ts.isAccessor(declaration);
+ }
+ function isNotOverload(declaration) {
+ return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
+ !!declaration.body;
+ }
/** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
@@ -64201,7 +64684,7 @@ var ts;
ts.createJSDocTypeExpression = createJSDocTypeExpression;
/* @internal */
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(309 /* JSDocTypeTag */, "type");
+ var tag = createJSDocTag(310 /* JSDocTypeTag */, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -64209,7 +64692,7 @@ var ts;
ts.createJSDocTypeTag = createJSDocTypeTag;
/* @internal */
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(307 /* JSDocReturnTag */, "returns");
+ var tag = createJSDocTag(308 /* JSDocReturnTag */, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -64217,14 +64700,14 @@ var ts;
ts.createJSDocReturnTag = createJSDocReturnTag;
/** @internal */
function createJSDocThisTag(typeExpression) {
- var tag = createJSDocTag(308 /* JSDocThisTag */, "this");
+ var tag = createJSDocTag(309 /* JSDocThisTag */, "this");
tag.typeExpression = typeExpression;
return tag;
}
ts.createJSDocThisTag = createJSDocThisTag;
/* @internal */
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(306 /* JSDocParameterTag */, "param");
+ var tag = createJSDocTag(307 /* JSDocParameterTag */, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -64234,7 +64717,7 @@ var ts;
ts.createJSDocParamTag = createJSDocParamTag;
/* @internal */
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(297 /* JSDocComment */);
+ var node = createSynthesizedNode(298 /* JSDocComment */);
node.comment = comment;
node.tags = tags;
return node;
@@ -64599,7 +65082,7 @@ var ts;
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(314 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(315 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -64611,7 +65094,7 @@ var ts;
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(318 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(319 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -64623,7 +65106,7 @@ var ts;
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(317 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(318 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -64638,7 +65121,7 @@ var ts;
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(315 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(316 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -64654,7 +65137,7 @@ var ts;
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 316 /* CommaListExpression */) {
+ if (node.kind === 317 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) {
@@ -64664,7 +65147,7 @@ var ts;
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(316 /* CommaListExpression */);
+ var node = createSynthesizedNode(317 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -65512,29 +65995,34 @@ var ts;
}
ts.createExpressionForJsxFragment = createExpressionForJsxFragment;
// Helpers
- function getHelperName(name) {
+ /**
+ * Gets an identifier for the name of an *unscoped* emit helper.
+ */
+ function getUnscopedHelperName(name) {
return ts.setEmitFlags(ts.createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */);
}
- ts.getHelperName = getHelperName;
+ ts.getUnscopedHelperName = getUnscopedHelperName;
ts.valuesHelper = {
name: "typescript:values",
+ importName: "__values",
scoped: false,
- text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };"
+ text: "\n var __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n };"
};
function createValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.valuesHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__values"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__values"),
/*typeArguments*/ undefined, [expression]), location);
}
ts.createValuesHelper = createValuesHelper;
ts.readHelper = {
name: "typescript:read",
+ importName: "__read",
scoped: false,
text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };"
};
function createReadHelper(context, iteratorRecord, count, location) {
context.requestEmitHelper(ts.readHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__read"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__read"),
/*typeArguments*/ undefined, count !== undefined
? [iteratorRecord, ts.createLiteral(count)]
: [iteratorRecord]), location);
@@ -65542,24 +66030,26 @@ var ts;
ts.createReadHelper = createReadHelper;
ts.spreadHelper = {
name: "typescript:spread",
+ importName: "__spread",
scoped: false,
text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };"
};
function createSpreadHelper(context, argumentList, location) {
context.requestEmitHelper(ts.readHelper);
context.requestEmitHelper(ts.spreadHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spread"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spread"),
/*typeArguments*/ undefined, argumentList), location);
}
ts.createSpreadHelper = createSpreadHelper;
ts.spreadArraysHelper = {
name: "typescript:spreadArrays",
+ importName: "__spreadArrays",
scoped: false,
text: "\n var __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n };"
};
function createSpreadArraysHelper(context, argumentList, location) {
context.requestEmitHelper(ts.spreadArraysHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spreadArrays"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spreadArrays"),
/*typeArguments*/ undefined, argumentList), location);
}
ts.createSpreadArraysHelper = createSpreadArraysHelper;
@@ -66404,7 +66894,7 @@ var ts;
case 191 /* ElementAccessExpression */:
case 190 /* PropertyAccessExpression */:
case 214 /* NonNullExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -66421,7 +66911,7 @@ var ts;
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
- node.kind === 316 /* CommaListExpression */;
+ node.kind === 317 /* CommaListExpression */;
}
ts.isCommaSequence = isCommaSequence;
var OuterExpressionKinds;
@@ -66440,7 +66930,7 @@ var ts;
case 213 /* AsExpression */:
case 214 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -66477,7 +66967,7 @@ var ts;
case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 315 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 316 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -66520,6 +67010,60 @@ var ts;
return emitNode && emitNode.externalHelpersModuleName;
}
ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function hasRecordedExternalHelpers(sourceFile) {
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return !!emitNode && (!!emitNode.externalHelpersModuleName || !!emitNode.externalHelpers);
+ }
+ ts.hasRecordedExternalHelpers = hasRecordedExternalHelpers;
+ function createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) {
+ if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
+ var namedBindings = void 0;
+ var moduleKind = ts.getEmitModuleKind(compilerOptions);
+ if (moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) {
+ // use named imports
+ var helpers = ts.getEmitHelpers(sourceFile);
+ if (helpers) {
+ var helperNames = [];
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!helper.scoped) {
+ var importName = helper.importName;
+ if (importName) {
+ ts.pushIfUnique(helperNames, importName);
+ }
+ }
+ }
+ if (ts.some(helperNames)) {
+ helperNames.sort(ts.compareStringsCaseSensitive);
+ // Alias the imports if the names are used somewhere in the file.
+ // NOTE: We don't need to care about global import collisions as this is a module.
+ namedBindings = ts.createNamedImports(ts.map(helperNames, function (name) { return ts.isFileLevelUniqueName(sourceFile, name)
+ ? ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(name))
+ : ts.createImportSpecifier(ts.createIdentifier(name), getUnscopedHelperName(name)); }));
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = ts.getOrCreateEmitNode(parseNode);
+ emitNode.externalHelpers = true;
+ }
+ }
+ }
+ else {
+ // use a namespace import
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
+ if (externalHelpersModuleName) {
+ namedBindings = ts.createNamespaceImport(externalHelpersModuleName);
+ }
+ }
+ if (namedBindings) {
+ var externalHelpersImportDeclaration = ts.createImportDeclaration(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, namedBindings), ts.createLiteral(ts.externalHelpersModuleNameText));
+ ts.addEmitFlags(externalHelpersImportDeclaration, 67108864 /* NeverApplyImportHelper */);
+ return externalHelpersImportDeclaration;
+ }
+ }
+ }
+ ts.createExternalHelpersImportDeclarationIfNeeded = createExternalHelpersImportDeclarationIfNeeded;
function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(node, compilerOptions)) {
var externalHelpersModuleName = getExternalHelpersModuleName(node);
@@ -66534,8 +67078,8 @@ var ts;
if (!create) {
var helpers = ts.getEmitHelpers(node);
if (helpers) {
- for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
- var helper = helpers_2[_i];
+ for (var _i = 0, helpers_3 = helpers; _i < helpers_3.length; _i++) {
+ var helper = helpers_3[_i];
if (!helper.scoped) {
create = true;
break;
@@ -67274,9 +67818,9 @@ var ts;
case 285 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -67332,7 +67876,7 @@ var ts;
case 221 /* EmptyStatement */:
case 211 /* OmittedExpression */:
case 237 /* DebuggerStatement */:
- case 314 /* NotEmittedStatement */:
+ case 315 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
@@ -67713,10 +68257,10 @@ var ts;
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -68504,7 +69048,8 @@ var ts;
var hasExportDefault = false;
var exportEquals;
var hasExportStarsToExportValues = false;
- var hasImportStarOrImportDefault = false;
+ var hasImportStar = false;
+ var hasImportDefault = false;
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
@@ -68514,7 +69059,12 @@ var ts;
// import * as x from "mod"
// import { x, y } from "mod"
externalImports.push(node);
- hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
+ if (!hasImportStar && getImportNeedsImportStarHelper(node)) {
+ hasImportStar = true;
+ }
+ if (!hasImportDefault && getImportNeedsImportDefaultHelper(node)) {
+ hasImportDefault = true;
+ }
break;
case 249 /* ImportEqualsDeclaration */:
if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
@@ -68608,12 +69158,8 @@ var ts;
break;
}
}
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault);
- var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault);
if (externalHelpersImportDeclaration) {
- ts.addEmitFlags(externalHelpersImportDeclaration, 67108864 /* NeverApplyImportHelper */);
externalImports.unshift(externalHelpersImportDeclaration);
}
return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
@@ -69201,6 +69747,7 @@ var ts;
}
ts.restHelper = {
name: "typescript:rest",
+ importName: "__rest",
scoped: false,
text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
@@ -69225,7 +69772,7 @@ var ts;
}
}
}
- return ts.createCall(ts.getHelperName("__rest"),
+ return ts.createCall(ts.getUnscopedHelperName("__rest"),
/*typeArguments*/ undefined, [
value,
ts.setTextRange(ts.createArrayLiteral(propertyNames), location)
@@ -70590,8 +71137,8 @@ var ts;
// Note when updating logic here also update getEntityNameForDecoratorMetadata
// so that aliases can be marked as referenced
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
@@ -70733,7 +71280,7 @@ var ts;
* available.
*/
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 8 /* ESNext */
+ return languageVersion < 99 /* ESNext */
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -71871,18 +72418,19 @@ var ts;
}
}
context.requestEmitHelper(ts.decorateHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__decorate"),
/*typeArguments*/ undefined, argumentsArray), location);
}
ts.decorateHelper = {
name: "typescript:decorate",
+ importName: "__decorate",
scoped: false,
priority: 2,
text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
};
function createMetadataHelper(context, metadataKey, metadataValue) {
context.requestEmitHelper(ts.metadataHelper);
- return ts.createCall(ts.getHelperName("__metadata"),
+ return ts.createCall(ts.getUnscopedHelperName("__metadata"),
/*typeArguments*/ undefined, [
ts.createLiteral(metadataKey),
metadataValue
@@ -71890,13 +72438,14 @@ var ts;
}
ts.metadataHelper = {
name: "typescript:metadata",
+ importName: "__metadata",
scoped: false,
priority: 3,
text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
};
function createParamHelper(context, expression, parameterOffset, location) {
context.requestEmitHelper(ts.paramHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__param"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__param"),
/*typeArguments*/ undefined, [
ts.createLiteral(parameterOffset),
expression
@@ -71904,6 +72453,7 @@ var ts;
}
ts.paramHelper = {
name: "typescript:param",
+ importName: "__param",
scoped: false,
priority: 4,
text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
@@ -72348,6 +72898,7 @@ var ts;
var hasSuperElementAccess;
/** A set of node IDs for generated super accessors (variable statements). */
var substitutedSuperAccessors = [];
+ var topLevel;
// Save the previous transformation hooks.
var previousOnEmitNode = context.onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
@@ -72359,10 +72910,23 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitor(node) {
if ((node.transformFlags & 32 /* ContainsES2017 */) === 0) {
return node;
@@ -72374,11 +72938,11 @@ var ts;
case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
case 157 /* MethodDeclaration */:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 240 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197 /* FunctionExpression */:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198 /* ArrowFunction */:
return visitArrowFunction(node);
case 190 /* PropertyAccessExpression */:
@@ -72391,6 +72955,12 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -72642,7 +73212,7 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.body.statements, /*ensureUseStrict*/ false, visitor);
- statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
@@ -72669,7 +73239,7 @@ var ts;
result = block;
}
else {
- var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
+ var expression = createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
var declarations = endLexicalEnvironment();
if (ts.some(declarations)) {
var block = ts.convertToFunctionBody(expression);
@@ -72868,11 +73438,12 @@ var ts;
ts.createSuperAccessVariableStatement = createSuperAccessVariableStatement;
ts.awaiterHelper = {
name: "typescript:awaiter",
+ importName: "__awaiter",
scoped: false,
priority: 5,
- text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
};
- function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ function createAwaiterHelper(context, hasLexicalThis, hasLexicalArguments, promiseConstructor, body) {
context.requestEmitHelper(ts.awaiterHelper);
var generatorFunc = ts.createFunctionExpression(
/*modifiers*/ undefined, ts.createToken(40 /* AsteriskToken */),
@@ -72882,9 +73453,9 @@ var ts;
/*type*/ undefined, body);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */ | 524288 /* ReuseTempVariableScope */;
- return ts.createCall(ts.getHelperName("__awaiter"),
+ return ts.createCall(ts.getUnscopedHelperName("__awaiter"),
/*typeArguments*/ undefined, [
- ts.createThis(),
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
generatorFunc
@@ -72918,9 +73489,11 @@ var ts;
context.onEmitNode = onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
+ var exportedVariableStatement = false;
var enabledSubstitutions;
var enclosingFunctionFlags;
var enclosingSuperContainerFlags = 0;
+ var topLevel;
/** Keeps track of property names accessed on super (`super.x`) within async functions. */
var capturedSuperProperties;
/** Whether the async function contains an element access on super (`super[x]`). */
@@ -72932,6 +73505,8 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ exportedVariableStatement = false;
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
@@ -72948,6 +73523,18 @@ var ts;
}
return node;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitorWorker(node, noDestructuringValue) {
if ((node.transformFlags & 16 /* ContainsES2018 */) === 0) {
return node;
@@ -72967,6 +73554,8 @@ var ts;
return visitBinaryExpression(node, noDestructuringValue);
case 275 /* CatchClause */:
return visitCatchClause(node);
+ case 220 /* VariableStatement */:
+ return visitVariableStatement(node);
case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
case 228 /* ForOfStatement */:
@@ -72976,17 +73565,17 @@ var ts;
case 201 /* VoidExpression */:
return visitVoidExpression(node);
case 158 /* Constructor */:
- return visitConstructorDeclaration(node);
+ return doOutsideOfTopLevel(visitConstructorDeclaration, node);
case 157 /* MethodDeclaration */:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 159 /* GetAccessor */:
- return visitGetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitGetAccessorDeclaration, node);
case 160 /* SetAccessor */:
- return visitSetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitSetAccessorDeclaration, node);
case 240 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197 /* FunctionExpression */:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198 /* ArrowFunction */:
return visitArrowFunction(node);
case 152 /* Parameter */:
@@ -73005,6 +73594,9 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -73072,14 +73664,39 @@ var ts;
if (node.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
// spread elements emit like so:
// non-spread elements are chunked together into object literals, and then all are passed to __assign:
- // { a, ...o, b } => __assign({a}, o, {b});
+ // { a, ...o, b } => __assign(__assign({a}, o), {b});
// If the first element is a spread element, then the first argument to __assign is {}:
- // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
+ // { ...o, a, b, ...o2 } => __assign(__assign(__assign({}, o), {a, b}), o2)
+ //
+ // We cannot call __assign with more than two elements, since any element could cause side effects. For
+ // example:
+ // var k = { a: 1, b: 2 };
+ // var o = { a: 3, ...k, b: k.a++ };
+ // // expected: { a: 1, b: 1 }
+ // If we translate the above to `__assign({ a: 3 }, k, { b: k.a++ })`, the `k.a++` will evaluate before
+ // `k` is spread and we end up with `{ a: 2, b: 1 }`.
+ //
+ // This also occurs for spread elements, not just property assignments:
+ // var k = { a: 1, get b() { l = { z: 9 }; return 2; } };
+ // var l = { c: 3 };
+ // var o = { ...k, ...l };
+ // // expected: { a: 1, b: 2, z: 9 }
+ // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we
+ // end up with `{ a: 1, b: 2, c: 3 }`
var objects = chunkObjectLiteralElements(node.properties);
if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) {
objects.unshift(ts.createObjectLiteral());
}
- return createAssignHelper(context, objects);
+ var expression = objects[0];
+ if (objects.length > 1) {
+ for (var i = 1; i < objects.length; i++) {
+ expression = createAssignHelper(context, [expression, objects[i]]);
+ }
+ return expression;
+ }
+ else {
+ return createAssignHelper(context, objects);
+ }
}
return ts.visitEachChild(node, visitor, context);
}
@@ -73120,15 +73737,36 @@ var ts;
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitVariableStatement(node) {
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = true;
+ var visited = ts.visitEachChild(node, visitor, context);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
/**
* Visits a VariableDeclaration node with a binding pattern.
*
* @param node A VariableDeclaration node.
*/
function visitVariableDeclaration(node) {
+ if (exportedVariableStatement) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = false;
+ var visited = visitVariableDeclarationWorker(node, /*exportedVariableStatement*/ true);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return visitVariableDeclarationWorker(node, /*exportedVariableStatement*/ false);
+ }
+ function visitVariableDeclarationWorker(node, exportedVariableStatement) {
// If we are here it is because the name contains a binding pattern with a rest somewhere in it.
if (ts.isBindingPattern(node.name) && node.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
- return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */);
+ return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */,
+ /*rval*/ undefined, exportedVariableStatement);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -73346,7 +73984,7 @@ var ts;
/*modifiers*/ undefined, ts.createToken(40 /* AsteriskToken */), node.name && ts.getGeneratedNameForNode(node.name),
/*typeParameters*/ undefined,
/*parameters*/ [],
- /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))));
+ /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !topLevel));
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
var emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* AsyncMethodWithSuperBinding */ | 2048 /* AsyncMethodWithSuper */);
@@ -73526,6 +74164,7 @@ var ts;
ts.transformES2018 = transformES2018;
ts.assignHelper = {
name: "typescript:assign",
+ importName: "__assign",
scoped: false,
priority: 1,
text: "\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"
@@ -73536,55 +74175,59 @@ var ts;
/*typeArguments*/ undefined, attributesSegments);
}
context.requestEmitHelper(ts.assignHelper);
- return ts.createCall(ts.getHelperName("__assign"),
+ return ts.createCall(ts.getUnscopedHelperName("__assign"),
/*typeArguments*/ undefined, attributesSegments);
}
ts.createAssignHelper = createAssignHelper;
ts.awaitHelper = {
name: "typescript:await",
+ importName: "__await",
scoped: false,
text: "\n var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }"
};
function createAwaitHelper(context, expression) {
context.requestEmitHelper(ts.awaitHelper);
- return ts.createCall(ts.getHelperName("__await"), /*typeArguments*/ undefined, [expression]);
+ return ts.createCall(ts.getUnscopedHelperName("__await"), /*typeArguments*/ undefined, [expression]);
}
ts.asyncGeneratorHelper = {
name: "typescript:asyncGenerator",
+ importName: "__asyncGenerator",
scoped: false,
text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n };"
};
- function createAsyncGeneratorHelper(context, generatorFunc) {
+ function createAsyncGeneratorHelper(context, generatorFunc, hasLexicalThis) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncGeneratorHelper);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */;
- return ts.createCall(ts.getHelperName("__asyncGenerator"),
+ return ts.createCall(ts.getUnscopedHelperName("__asyncGenerator"),
/*typeArguments*/ undefined, [
- ts.createThis(),
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
ts.createIdentifier("arguments"),
generatorFunc
]);
}
ts.asyncDelegator = {
name: "typescript:asyncDelegator",
+ importName: "__asyncDelegator",
scoped: false,
text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n };"
};
function createAsyncDelegatorHelper(context, expression, location) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncDelegator);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncDelegator"),
/*typeArguments*/ undefined, [expression]), location);
}
ts.asyncValues = {
name: "typescript:asyncValues",
+ importName: "__asyncValues",
scoped: false,
text: "\n var __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n };"
};
function createAsyncValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.asyncValues);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncValues"),
/*typeArguments*/ undefined, [expression]), location);
}
})(ts || (ts = {}));
@@ -77396,7 +78039,7 @@ var ts;
ts.transformES2015 = transformES2015;
function createExtendsHelper(context, name) {
context.requestEmitHelper(ts.extendsHelper);
- return ts.createCall(ts.getHelperName("__extends"),
+ return ts.createCall(ts.getUnscopedHelperName("__extends"),
/*typeArguments*/ undefined, [
name,
ts.createFileLevelUniqueName("_super")
@@ -77404,7 +78047,7 @@ var ts;
}
function createTemplateObjectHelper(context, cooked, raw) {
context.requestEmitHelper(ts.templateObjectHelper);
- return ts.createCall(ts.getHelperName("__makeTemplateObject"),
+ return ts.createCall(ts.getUnscopedHelperName("__makeTemplateObject"),
/*typeArguments*/ undefined, [
cooked,
raw
@@ -77412,12 +78055,14 @@ var ts;
}
ts.extendsHelper = {
name: "typescript:extends",
+ importName: "__extends",
scoped: false,
priority: 0,
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
};
ts.templateObjectHelper = {
name: "typescript:makeTemplateObject",
+ importName: "__makeTemplateObject",
scoped: false,
priority: 0,
text: "\n var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n };"
@@ -80111,7 +80756,7 @@ var ts;
ts.transformGenerators = transformGenerators;
function createGeneratorHelper(context, body) {
context.requestEmitHelper(ts.generatorHelper);
- return ts.createCall(ts.getHelperName("__generator"),
+ return ts.createCall(ts.getUnscopedHelperName("__generator"),
/*typeArguments*/ undefined, [ts.createThis(), body]);
}
// The __generator helper is used by down-level transformations to emulate the runtime
@@ -80175,6 +80820,7 @@ var ts;
// For examples of how these are used, see the comments in ./transformers/generators.ts
ts.generatorHelper = {
name: "typescript:generator",
+ importName: "__generator",
scoped: false,
priority: 6,
text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
@@ -80548,9 +81194,9 @@ var ts;
return visitFunctionDeclaration(node);
case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 317 /* MergeDeclarationMarker */:
+ case 318 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 318 /* EndOfDeclarationMarker */:
+ case 319 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -80709,7 +81355,7 @@ var ts;
var promise = ts.createNew(ts.createIdentifier("Promise"), /*typeArguments*/ undefined, [func]);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), /*typeArguments*/ undefined, [ts.getHelperName("__importStar")]);
+ return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), /*typeArguments*/ undefined, [ts.getUnscopedHelperName("__importStar")]);
}
return promise;
}
@@ -80723,7 +81369,7 @@ var ts;
var requireCall = ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- requireCall = ts.createCall(ts.getHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
+ requireCall = ts.createCall(ts.getUnscopedHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
}
var func;
if (languageVersion >= 2 /* ES2015 */) {
@@ -80757,11 +81403,11 @@ var ts;
}
if (ts.getImportNeedsImportStarHelper(node)) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.getHelperName("__importStar"), /*typeArguments*/ undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importStar"), /*typeArguments*/ undefined, [innerExpr]);
}
if (ts.getImportNeedsImportDefaultHelper(node)) {
context.requestEmitHelper(ts.importDefaultHelper);
- return ts.createCall(ts.getHelperName("__importDefault"), /*typeArguments*/ undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importDefault"), /*typeArguments*/ undefined, [innerExpr]);
}
return innerExpr;
}
@@ -81533,7 +82179,7 @@ var ts;
function createExportStarHelper(context, module) {
var compilerOptions = context.getCompilerOptions();
return compilerOptions.importHelpers
- ? ts.createCall(ts.getHelperName("__exportStar"), /*typeArguments*/ undefined, [module, ts.createIdentifier("exports")])
+ ? ts.createCall(ts.getUnscopedHelperName("__exportStar"), /*typeArguments*/ undefined, [module, ts.createIdentifier("exports")])
: ts.createCall(ts.createIdentifier("__export"), /*typeArguments*/ undefined, [module]);
}
// emit helper for dynamic import
@@ -81545,12 +82191,14 @@ var ts;
// emit helper for `import * as Name from "foo"`
ts.importStarHelper = {
name: "typescript:commonjsimportstar",
+ importName: "__importStar",
scoped: false,
text: "\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};"
};
// emit helper for `import Name from "foo"`
ts.importDefaultHelper = {
name: "typescript:commonjsimportdefault",
+ importName: "__importDefault",
scoped: false,
text: "\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};"
};
@@ -81572,11 +82220,13 @@ var ts;
context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(215 /* MetaProperty */); // Substitutes 'import.meta'
context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var exportFunctionsMap = []; // The export function associated with a source file.
var noSubstitutionMap = []; // Set of nodes for which substitution rules should be ignored for each file.
+ var contextObjectMap = []; // The context object associated with a source file.
var currentSourceFile; // The current file.
var moduleInfo; // ExternalModuleInfo for the current file.
var exportFunction; // The export function for the current file.
@@ -81615,7 +82265,7 @@ var ts;
// existing identifiers.
exportFunction = ts.createUniqueName("exports");
exportFunctionsMap[id] = exportFunction;
- contextObject = ts.createUniqueName("context");
+ contextObject = contextObjectMap[id] = ts.createUniqueName("context");
// Add the body of the module.
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
@@ -82485,9 +83135,9 @@ var ts;
return visitCatchClause(node);
case 219 /* Block */:
return visitBlock(node);
- case 317 /* MergeDeclarationMarker */:
+ case 318 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 318 /* EndOfDeclarationMarker */:
+ case 319 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -82773,6 +83423,7 @@ var ts;
moduleInfo = moduleInfoMap[id];
exportFunction = exportFunctionsMap[id];
noSubstitution = noSubstitutionMap[id];
+ contextObject = contextObjectMap[id];
if (noSubstitution) {
delete noSubstitutionMap[id];
}
@@ -82780,6 +83431,7 @@ var ts;
currentSourceFile = undefined;
moduleInfo = undefined;
exportFunction = undefined;
+ contextObject = undefined;
noSubstitution = undefined;
}
else {
@@ -82856,6 +83508,8 @@ var ts;
case 203 /* PrefixUnaryExpression */:
case 204 /* PostfixUnaryExpression */:
return substituteUnaryExpression(node);
+ case 215 /* MetaProperty */:
+ return substituteMetaProperty(node);
}
return node;
}
@@ -82964,6 +83618,12 @@ var ts;
}
return node;
}
+ function substituteMetaProperty(node) {
+ if (ts.isImportMeta(node)) {
+ return ts.createPropertyAccess(contextObject, ts.createIdentifier("meta"));
+ }
+ return node;
+ }
/**
* Gets the exports of a name.
*
@@ -83017,22 +83677,18 @@ var ts;
context.onSubstituteNode = onSubstituteNode;
context.enableEmitNotification(285 /* SourceFile */);
context.enableSubstitution(73 /* Identifier */);
- var currentSourceFile;
+ var helperNameSubstitutions;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
if (node.isDeclarationFile) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
- if (externalHelpersModuleName) {
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(node, compilerOptions);
+ if (externalHelpersImportDeclaration) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.statements);
- var tslibImport = ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- ts.addEmitFlags(tslibImport, 67108864 /* NeverApplyImportHelper */);
- ts.append(statements, tslibImport);
+ ts.append(statements, externalHelpersImportDeclaration);
ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements));
}
@@ -83068,9 +83724,9 @@ var ts;
*/
function onEmitNode(hint, node, emitCallback) {
if (ts.isSourceFile(node)) {
- currentSourceFile = node;
+ helperNameSubstitutions = ts.createMap();
previousOnEmitNode(hint, node, emitCallback);
- currentSourceFile = undefined;
+ helperNameSubstitutions = undefined;
}
else {
previousOnEmitNode(hint, node, emitCallback);
@@ -83087,19 +83743,18 @@ var ts;
*/
function onSubstituteNode(hint, node) {
node = previousOnSubstituteNode(hint, node);
- if (ts.isIdentifier(node) && hint === 1 /* Expression */) {
- return substituteExpressionIdentifier(node);
+ if (helperNameSubstitutions && ts.isIdentifier(node) && ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ return substituteHelperName(node);
}
return node;
}
- function substituteExpressionIdentifier(node) {
- if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
- var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
- if (externalHelpersModuleName) {
- return ts.createPropertyAccess(externalHelpersModuleName, node);
- }
+ function substituteHelperName(node) {
+ var name = ts.idText(node);
+ var substitution = helperNameSubstitutions.get(name);
+ if (!substitution) {
+ helperNameSubstitutions.set(name, substitution = ts.createFileLevelUniqueName(name));
}
- return node;
+ return substitution;
}
}
ts.transformES2015Module = transformES2015Module;
@@ -83598,6 +84253,7 @@ var ts;
var currentSourceFile;
var refs;
var libs;
+ var emittedImports; // must be declared in container so it can be `undefined` while transformer's first pass
var resolver = context.getEmitResolver();
var options = context.getCompilerOptions();
var newLine = ts.getNewLineCharacter(options);
@@ -83760,7 +84416,7 @@ var ts;
var statements = ts.visitNodes(node.statements, visitDeclarationStatements);
var combinedStatements = ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
refs.forEach(referenceVisitor);
- var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
+ emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
if (ts.isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) {
combinedStatements = ts.setTextRange(ts.createNodeArray(__spreadArrays(combinedStatements, [createEmptyExports()])), combinedStatements);
}
@@ -83858,14 +84514,14 @@ var ts;
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
}
}
- function ensureParameter(p, modifierMask) {
+ function ensureParameter(p, modifierMask, type) {
var oldDiag;
if (!suppressNewDiagnosticContexts) {
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
}
var newParam = ts.updateParameter(p,
- /*decorators*/ undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56 /* QuestionToken */)) : undefined, ensureType(p, p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
+ /*decorators*/ undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56 /* QuestionToken */)) : undefined, ensureType(p, type || p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
ensureNoInitializer(p));
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
@@ -83972,6 +84628,33 @@ var ts;
}
return ts.createNodeArray(newParams, params.hasTrailingComma);
}
+ function updateAccessorParamsList(input, isPrivate) {
+ var newParams;
+ if (!isPrivate) {
+ var thisParameter = ts.getThisParameter(input);
+ if (thisParameter) {
+ newParams = [ensureParameter(thisParameter)];
+ }
+ }
+ if (ts.isSetAccessorDeclaration(input)) {
+ var newValueParameter = void 0;
+ if (!isPrivate) {
+ var valueParameter = ts.getSetAccessorValueParameter(input);
+ if (valueParameter) {
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ newValueParameter = ensureParameter(valueParameter, /*modifierMask*/ undefined, accessorType);
+ }
+ }
+ if (!newValueParameter) {
+ newValueParameter = ts.createParameter(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*dotDotDotToken*/ undefined, "value");
+ }
+ newParams = ts.append(newParams, newValueParameter);
+ }
+ return ts.createNodeArray(newParams || ts.emptyArray);
+ }
function ensureTypeParams(node, params) {
return ts.hasModifier(node, 8 /* Private */) ? undefined : ts.visitNodes(params, visitDeclarationSubtree);
}
@@ -84138,6 +84821,11 @@ var ts;
enclosingDeclaration = input;
}
var oldDiag = getSymbolAccessibilityDiagnostic;
+ // Setup diagnostic-related flags before first potential `cleanup` call, otherwise
+ // We'd see a TDZ violation at runtime
+ var canProduceDiagnostic = ts.canProduceDiagnostics(input);
+ var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
// Emit methods which are private as properties with no type information
if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) {
if (ts.hasModifier(input, 8 /* Private */)) {
@@ -84146,15 +84834,12 @@ var ts;
return cleanup(ts.createProperty(/*decorators*/ undefined, ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined));
}
}
- var canProdiceDiagnostic = ts.canProduceDiagnostics(input);
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input);
}
if (ts.isTypeQueryNode(input)) {
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
- var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
// We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
suppressNewDiagnosticContexts = true;
@@ -84193,10 +84878,24 @@ var ts;
return cleanup(sig);
}
case 159 /* GetAccessor */: {
+ // For now, only emit class accessors as accessors if they were already declared in an ambient context.
+ if (input.flags & 4194304 /* Ambient */) {
+ var isPrivate = ts.hasModifier(input, 8 /* Private */);
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ return cleanup(ts.updateGetAccessor(input,
+ /*decorators*/ undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, isPrivate), !isPrivate ? ensureType(input, accessorType) : undefined,
+ /*body*/ undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
case 160 /* SetAccessor */: {
+ // For now, only emit class accessors as accessors if they were already declared in an ambient context.
+ if (input.flags & 4194304 /* Ambient */) {
+ return cleanup(ts.updateSetAccessor(input,
+ /*decorators*/ undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasModifier(input, 8 /* Private */)),
+ /*body*/ undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
@@ -84257,13 +84956,13 @@ var ts;
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
function cleanup(returnValue) {
- if (returnValue && canProdiceDiagnostic && ts.hasDynamicName(input)) {
+ if (returnValue && canProduceDiagnostic && ts.hasDynamicName(input)) {
checkName(input);
}
if (isEnclosingDeclaration(input)) {
enclosingDeclaration = previousEnclosingDeclaration;
}
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
if (shouldEnterSuppressNewDiagnosticsContextContext) {
@@ -84632,17 +85331,26 @@ var ts;
}
return maskModifierFlags(node, mask, additions);
}
+ function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) {
+ var accessorType = getTypeAnnotationFromAccessor(node);
+ if (!accessorType && node !== accessors.firstAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.firstAccessor);
+ // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.firstAccessor);
+ }
+ if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
+ // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
+ }
+ return accessorType;
+ }
function ensureAccessor(node) {
var accessors = resolver.getAllAccessorDeclarations(node);
if (node.kind !== accessors.firstAccessor.kind) {
return;
}
- var accessorType = getTypeAnnotationFromAccessor(node);
- if (!accessorType && accessors.secondAccessor) {
- accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
- // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
- getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
- }
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessors);
var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
@@ -84805,7 +85513,7 @@ var ts;
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6 /* ES2019 */) {
@@ -84881,7 +85589,7 @@ var ts;
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(319 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(320 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -86406,30 +87114,30 @@ var ts;
case 279 /* EnumMember */:
return emitEnumMember(node);
// JSDoc nodes (only used in codefixes currently)
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return emitJSDocPropertyLikeTag(node);
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 308 /* JSDocThisTag */:
- case 305 /* JSDocEnumTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 309 /* JSDocThisTag */:
+ case 306 /* JSDocEnumTag */:
return emitJSDocSimpleTypedTag(node);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return emitJSDocAugmentsTag(node);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return emitJSDocTemplateTag(node);
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return emitJSDocTypedefTag(node);
- case 304 /* JSDocCallbackTag */:
+ case 305 /* JSDocCallbackTag */:
return emitJSDocCallbackTag(node);
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return emitJSDocSignature(node);
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
return emitJSDocTypeLiteral(node);
- case 303 /* JSDocClassTag */:
- case 300 /* JSDocTag */:
+ case 304 /* JSDocClassTag */:
+ case 301 /* JSDocTag */:
return emitJSDocSimpleTag(node);
- case 297 /* JSDocComment */:
+ case 298 /* JSDocComment */:
return emitJSDoc(node);
// Transformation nodes (ignored)
}
@@ -86528,9 +87236,9 @@ var ts;
case 265 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -86558,8 +87266,8 @@ var ts;
var helpers = getSortedEmitHelpers(sourceFile);
if (!helpers)
continue;
- for (var _c = 0, helpers_3 = helpers; _c < helpers_3.length; _c++) {
- var helper = helpers_3[_c];
+ for (var _c = 0, helpers_4 = helpers; _c < helpers_4.length; _c++) {
+ var helper = helpers_4[_c];
if (!helper.scoped && !shouldSkip && !bundledHelpers.get(helper.name)) {
bundledHelpers.set(helper.name, true);
(result || (result = [])).push(helper.name);
@@ -86579,12 +87287,12 @@ var ts;
for (var i = 0; i < numNodes; i++) {
var currentNode = bundle ? i < numPrepends ? bundle.prepends[i] : bundle.sourceFiles[i - numPrepends] : node;
var sourceFile = ts.isSourceFile(currentNode) ? currentNode : ts.isUnparsedSource(currentNode) ? undefined : currentSourceFile;
- var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.hasRecordedExternalHelpers(sourceFile));
var shouldBundle = (ts.isSourceFile(currentNode) || ts.isUnparsedSource(currentNode)) && !isOwnFileEmit;
var helpers = ts.isUnparsedSource(currentNode) ? currentNode.helpers : getSortedEmitHelpers(currentNode);
if (helpers) {
- for (var _a = 0, helpers_4 = helpers; _a < helpers_4.length; _a++) {
- var helper = helpers_4[_a];
+ for (var _a = 0, helpers_5 = helpers; _a < helpers_5.length; _a++) {
+ var helper = helpers_5[_a];
if (!helper.scoped) {
// Skip the helper if it can be skipped and the noEmitHelpers compiler
// option is set, or if it can be imported and the importHelpers compiler
@@ -88024,7 +88732,7 @@ var ts;
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 309 /* JSDocTypeTag */ && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 310 /* JSDocTypeTag */ && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -88077,7 +88785,7 @@ var ts;
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) {
+ if (tag.typeExpression && tag.typeExpression.kind === 299 /* JSDocTypeLiteral */) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -88211,8 +88919,8 @@ var ts;
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// ");
if (bundleFileInfo)
@@ -89066,7 +89774,7 @@ var ts;
if (node.locals) {
var local = node.locals.get(ts.escapeLeadingUnderscores(name));
// We conservatively include alias symbols to cover cases where they're emitted as locals
- if (local && local.flags & (67220415 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
+ if (local && local.flags & (111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
return false;
}
}
@@ -89253,7 +89961,7 @@ var ts;
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 314 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 315 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
@@ -89534,7 +90242,7 @@ var ts;
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 314 /* NotEmittedStatement */
+ if (node.kind !== 315 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -89547,7 +90255,7 @@ var ts;
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 314 /* NotEmittedStatement */
+ if (node.kind !== 315 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -89915,6 +90623,9 @@ var ts;
var createFileWatcher = getCreateFileWatcher(watchLogLevel, watchFile);
var createFilePathWatcher = watchLogLevel === WatchLogLevel.None ? watchFilePath : createFileWatcher;
var createDirectoryWatcher = getCreateFileWatcher(watchLogLevel, watchDirectory);
+ if (watchLogLevel === WatchLogLevel.Verbose && ts.sysLog === ts.noop) {
+ ts.sysLog = function (s) { return log(s); };
+ }
return {
watchFile: function (host, file, callback, pollingInterval, detailInfo1, detailInfo2) {
return createFileWatcher(host, file, callback, pollingInterval, /*passThrough*/ undefined, detailInfo1, detailInfo2, watchFile, log, "FileWatcher", getDetailWatchInfo);
@@ -90459,8 +91170,8 @@ var ts;
}
var resolutions = [];
var cache = ts.createMap();
- for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name = names_1[_i];
+ for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
+ var name = names_2[_i];
var result = void 0;
if (cache.has(name)) {
result = cache.get(name);
@@ -90621,7 +91332,7 @@ var ts;
var resolveModuleNamesWorker;
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
if (host.resolveModuleNames) {
- resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference).map(function (resolved) {
+ resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference, options).map(function (resolved) {
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
if (!resolved || resolved.extension !== undefined) {
return resolved;
@@ -90638,7 +91349,7 @@ var ts;
}
var resolveTypeReferenceDirectiveNamesWorker;
if (host.resolveTypeReferenceDirectives) {
- resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference); };
+ resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference, options); };
}
else {
var loader_2 = function (typesRef, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference).resolvedTypeReferenceDirective; }; // TODO: GH#18217
@@ -90668,7 +91379,10 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
- var structuralIsReused = tryReuseStructureFromOldProgram();
+ // We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks
+ // `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`.
+ var structuralIsReused;
+ structuralIsReused = tryReuseStructureFromOldProgram();
if (structuralIsReused !== 2 /* Completely */) {
processingDefaultLibFiles = [];
processingOtherFiles = [];
@@ -94337,8 +95051,8 @@ var ts;
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
!!redirectedReference;
var seenNamesInFile = ts.createMap();
- for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
- var name = names_2[_i];
+ for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
+ var name = names_3[_i];
var resolution = resolutionsInFile.get(name);
// Resolution is valid if it is present and not invalidated
if (!seenNamesInFile.has(name) &&
@@ -94844,7 +95558,7 @@ var ts;
return [ambient];
var info = getInfo(importingSourceFile.path, host);
var moduleSourceFile = ts.getSourceFileOfNode(moduleSymbol.valueDeclaration || ts.getNonAugmentationDeclaration(moduleSymbol));
- var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.fileName, info.getCanonicalFileName, host, redirectTargetsMap);
+ var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.originalFileName, info.getCanonicalFileName, host, redirectTargetsMap);
var preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
var global = ts.mapDefined(modulePaths, function (moduleFileName) { return tryGetModuleNameAsNodeModule(moduleFileName, info, host, compilerOptions); });
return global.length ? global : modulePaths.map(function (moduleFileName) { return getLocalModuleSpecifier(moduleFileName, info, compilerOptions, preferences); });
@@ -94860,7 +95574,7 @@ var ts;
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
var ending = _b.ending, relativePreference = _b.relativePreference;
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
- var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) ||
+ var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
if (!baseUrl || relativePreference === 0 /* Relative */) {
return relativePath;
@@ -94986,14 +95700,16 @@ var ts;
}
}
}
- function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) {
+ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
if (normalizedTargetPath === undefined) {
return undefined;
}
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
- return ts.removeFileExtension(relativePath);
+ return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
+ ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
+ : ts.removeFileExtension(relativePath);
}
function tryGetModuleNameAsNodeModule(moduleFileName, _a, host, options) {
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
@@ -95643,10 +96359,22 @@ var ts;
/*logChangesWhenResolvingModule*/ false);
// Resolve module using host module resolution strategy if provided otherwise use resolution cache to resolve module names
compilerHost.resolveModuleNames = host.resolveModuleNames ?
- (function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveModuleNames.apply(host, args);
+ }) :
(function (moduleNames, containingFile, reusedNames, redirectedReference) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); });
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
- (function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveTypeReferenceDirectives.apply(host, args);
+ }) :
(function (typeDirectiveNames, containingFile, redirectedReference) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); });
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
@@ -95872,13 +96600,19 @@ var ts;
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
switch (reloadLevel) {
case ts.ConfigFileProgramReloadLevel.Partial:
- return reloadFileNamesFromConfigFile();
+ ts.perfLogger.logStartUpdateProgram("PartialConfigReload");
+ reloadFileNamesFromConfigFile();
+ break;
case ts.ConfigFileProgramReloadLevel.Full:
- return reloadConfigFile();
+ ts.perfLogger.logStartUpdateProgram("FullConfigReload");
+ reloadConfigFile();
+ break;
default:
+ ts.perfLogger.logStartUpdateProgram("SynchronizeProgram");
synchronizeProgram();
- return;
+ break;
}
+ ts.perfLogger.logStopUpdateProgram("Done");
}
function reloadFileNamesFromConfigFile() {
writeLog("Reloading new file names and options");
@@ -96257,8 +96991,31 @@ var ts;
}
}
function getBuildOrder(state) {
- return state.buildOrder ||
- (state.buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); })));
+ return state.buildOrder || createStateBuildOrder(state);
+ }
+ function createStateBuildOrder(state) {
+ var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
+ if (ts.arrayIsEqualTo(state.buildOrder, buildOrder))
+ return state.buildOrder;
+ // Clear all to ResolvedConfigFilePaths cache to start fresh
+ state.resolvedConfigFilePaths.clear();
+ var currentProjects = ts.arrayToSet(buildOrder, function (resolved) { return toResolvedConfigFilePath(state, resolved); });
+ var noopOnDelete = { onDeleteValue: ts.noop };
+ // Config file cache
+ ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
+ // Remove watches for the program no longer in the solution
+ if (state.watch) {
+ ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
+ ts.mutateMapSkippingNewValues(state.allWatchedWildcardDirectories, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcherOf); } });
+ ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
+ }
+ return state.buildOrder = buildOrder;
}
function getBuildOrderFor(state, project, onlyReferences) {
var resolvedProject = project && resolveProjectName(state, project);
@@ -97715,66 +98472,82 @@ var ts;
}
}
JsTyping.discoverTypings = discoverTypings;
- var PackageNameValidationResult;
- (function (PackageNameValidationResult) {
- PackageNameValidationResult[PackageNameValidationResult["Ok"] = 0] = "Ok";
- PackageNameValidationResult[PackageNameValidationResult["ScopedPackagesNotSupported"] = 1] = "ScopedPackagesNotSupported";
- PackageNameValidationResult[PackageNameValidationResult["EmptyName"] = 2] = "EmptyName";
- PackageNameValidationResult[PackageNameValidationResult["NameTooLong"] = 3] = "NameTooLong";
- PackageNameValidationResult[PackageNameValidationResult["NameStartsWithDot"] = 4] = "NameStartsWithDot";
- PackageNameValidationResult[PackageNameValidationResult["NameStartsWithUnderscore"] = 5] = "NameStartsWithUnderscore";
- PackageNameValidationResult[PackageNameValidationResult["NameContainsNonURISafeCharacters"] = 6] = "NameContainsNonURISafeCharacters";
- })(PackageNameValidationResult = JsTyping.PackageNameValidationResult || (JsTyping.PackageNameValidationResult = {}));
+ var NameValidationResult;
+ (function (NameValidationResult) {
+ NameValidationResult[NameValidationResult["Ok"] = 0] = "Ok";
+ NameValidationResult[NameValidationResult["EmptyName"] = 1] = "EmptyName";
+ NameValidationResult[NameValidationResult["NameTooLong"] = 2] = "NameTooLong";
+ NameValidationResult[NameValidationResult["NameStartsWithDot"] = 3] = "NameStartsWithDot";
+ NameValidationResult[NameValidationResult["NameStartsWithUnderscore"] = 4] = "NameStartsWithUnderscore";
+ NameValidationResult[NameValidationResult["NameContainsNonURISafeCharacters"] = 5] = "NameContainsNonURISafeCharacters";
+ })(NameValidationResult = JsTyping.NameValidationResult || (JsTyping.NameValidationResult = {}));
var maxPackageNameLength = 214;
/**
* Validates package name using rules defined at https://docs.npmjs.com/files/package.json
*/
function validatePackageName(packageName) {
+ return validatePackageNameWorker(packageName, /*supportScopedPackage*/ true);
+ }
+ JsTyping.validatePackageName = validatePackageName;
+ function validatePackageNameWorker(packageName, supportScopedPackage) {
if (!packageName) {
- return 2 /* EmptyName */;
+ return 1 /* EmptyName */;
}
if (packageName.length > maxPackageNameLength) {
- return 3 /* NameTooLong */;
+ return 2 /* NameTooLong */;
}
if (packageName.charCodeAt(0) === 46 /* dot */) {
- return 4 /* NameStartsWithDot */;
+ return 3 /* NameStartsWithDot */;
}
if (packageName.charCodeAt(0) === 95 /* _ */) {
- return 5 /* NameStartsWithUnderscore */;
+ return 4 /* NameStartsWithUnderscore */;
}
// check if name is scope package like: starts with @ and has one '/' in the middle
// scoped packages are not currently supported
- // TODO: when support will be added we'll need to split and check both scope and package name
- if (/^@[^/]+\/[^/]+$/.test(packageName)) {
- return 1 /* ScopedPackagesNotSupported */;
+ if (supportScopedPackage) {
+ var matches = /^@([^/]+)\/([^/]+)$/.exec(packageName);
+ if (matches) {
+ var scopeResult = validatePackageNameWorker(matches[1], /*supportScopedPackage*/ false);
+ if (scopeResult !== 0 /* Ok */) {
+ return { name: matches[1], isScopeName: true, result: scopeResult };
+ }
+ var packageResult = validatePackageNameWorker(matches[2], /*supportScopedPackage*/ false);
+ if (packageResult !== 0 /* Ok */) {
+ return { name: matches[2], isScopeName: false, result: packageResult };
+ }
+ return 0 /* Ok */;
+ }
}
if (encodeURIComponent(packageName) !== packageName) {
- return 6 /* NameContainsNonURISafeCharacters */;
+ return 5 /* NameContainsNonURISafeCharacters */;
}
return 0 /* Ok */;
}
- JsTyping.validatePackageName = validatePackageName;
function renderPackageNameValidationFailure(result, typing) {
+ return typeof result === "object" ?
+ renderPackageNameValidationFailureWorker(typing, result.result, result.name, result.isScopeName) :
+ renderPackageNameValidationFailureWorker(typing, result, typing, /*isScopeName*/ false);
+ }
+ JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
+ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeName) {
+ var kind = isScopeName ? "Scope" : "Package";
switch (result) {
- case 2 /* EmptyName */:
- return "Package name '" + typing + "' cannot be empty";
- case 3 /* NameTooLong */:
- return "Package name '" + typing + "' should be less than " + maxPackageNameLength + " characters";
- case 4 /* NameStartsWithDot */:
- return "Package name '" + typing + "' cannot start with '.'";
- case 5 /* NameStartsWithUnderscore */:
- return "Package name '" + typing + "' cannot start with '_'";
- case 1 /* ScopedPackagesNotSupported */:
- return "Package '" + typing + "' is scoped and currently is not supported";
- case 6 /* NameContainsNonURISafeCharacters */:
- return "Package name '" + typing + "' contains non URI safe characters";
+ case 1 /* EmptyName */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot be empty";
+ case 2 /* NameTooLong */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' should be less than " + maxPackageNameLength + " characters";
+ case 3 /* NameStartsWithDot */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot start with '.'";
+ case 4 /* NameStartsWithUnderscore */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot start with '_'";
+ case 5 /* NameContainsNonURISafeCharacters */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' contains non URI safe characters";
case 0 /* Ok */:
return ts.Debug.fail(); // Shouldn't have called this.
default:
throw ts.Debug.assertNever(result);
}
}
- JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
})(JsTyping = ts.JsTyping || (ts.JsTyping = {}));
})(ts || (ts = {}));
var ts;
@@ -98059,7 +98832,7 @@ var ts;
/* @internal */
var ts;
(function (ts) {
- ts.scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
+ ts.scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ true);
var SemanticMeaning;
(function (SemanticMeaning) {
SemanticMeaning[SemanticMeaning["None"] = 0] = "None";
@@ -98094,7 +98867,7 @@ var ts;
case 243 /* TypeAliasDeclaration */:
case 169 /* TypeLiteral */:
return 2 /* Type */;
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
// If it has no name node, it shares the name with the value declaration below it.
return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */;
case 279 /* EnumMember */:
@@ -98359,8 +99132,8 @@ var ts;
return "class" /* classElement */;
case 242 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
case 243 /* TypeAliasDeclaration */:
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
return "type" /* typeElement */;
case 244 /* EnumDeclaration */: return "enum" /* enumElement */;
case 238 /* VariableDeclaration */:
@@ -99979,8 +100752,9 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ /** The classifier is used for syntactic highlighting in editors via the TSServer */
function createClassifier() {
- var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false);
+ var scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false);
function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {
return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
}
@@ -100534,8 +101308,8 @@ var ts;
var spanStart = span.start;
var spanLength = span.length;
// Make a scanner we can get trivia from.
- var triviaScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var triviaScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
var result = [];
processElement(sourceFile);
return { spans: result, endOfLineState: 0 /* None */ };
@@ -100607,6 +101381,11 @@ var ts;
return;
}
}
+ else if (kind === 2 /* SingleLineCommentTrivia */) {
+ if (tryClassifyTripleSlashComment(start, width)) {
+ return;
+ }
+ }
// Simple comment. Just add as is.
pushCommentRange(start, width);
}
@@ -100627,18 +101406,18 @@ var ts;
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param"
pos = tag.tagName.end;
switch (tag.kind) {
- case 306 /* JSDocParameterTag */:
+ case 307 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
pos = tag.end;
break;
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
- case 307 /* JSDocReturnTag */:
+ case 308 /* JSDocReturnTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
@@ -100667,6 +101446,65 @@ var ts;
}
}
}
+ function tryClassifyTripleSlashComment(start, width) {
+ var tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/im;
+ var attributeRegex = /(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/img;
+ var text = sourceFile.text.substr(start, width);
+ var match = tripleSlashXMLCommentRegEx.exec(text);
+ if (!match) {
+ return false;
+ }
+ var pos = start;
+ pushCommentRange(pos, match[1].length); // ///
+ pos += match[1].length;
+ pushClassification(pos, match[2].length, 10 /* punctuation */); // <
+ pos += match[2].length;
+ if (!match[3]) {
+ return true;
+ }
+ pushClassification(pos, match[3].length, 21 /* jsxSelfClosingTagName */); // element name
+ pos += match[3].length;
+ var attrText = match[4];
+ var attrPos = pos;
+ while (true) {
+ var attrMatch = attributeRegex.exec(attrText);
+ if (!attrMatch) {
+ break;
+ }
+ var newAttrPos = pos + attrMatch.index;
+ if (newAttrPos > attrPos) {
+ pushCommentRange(attrPos, newAttrPos - attrPos);
+ attrPos = newAttrPos;
+ }
+ pushClassification(attrPos, attrMatch[1].length, 22 /* jsxAttribute */); // attribute name
+ attrPos += attrMatch[1].length;
+ if (attrMatch[2].length) {
+ pushCommentRange(attrPos, attrMatch[2].length); // whitespace
+ attrPos += attrMatch[2].length;
+ }
+ pushClassification(attrPos, attrMatch[3].length, 5 /* operator */); // =
+ attrPos += attrMatch[3].length;
+ if (attrMatch[4].length) {
+ pushCommentRange(attrPos, attrMatch[4].length); // whitespace
+ attrPos += attrMatch[4].length;
+ }
+ pushClassification(attrPos, attrMatch[5].length, 24 /* jsxAttributeStringLiteralValue */); // attribute value
+ attrPos += attrMatch[5].length;
+ }
+ pos += match[4].length;
+ if (pos > attrPos) {
+ pushCommentRange(attrPos, pos - attrPos);
+ }
+ if (match[5]) {
+ pushClassification(pos, match[5].length, 10 /* punctuation */); // />
+ pos += match[5].length;
+ }
+ var end = start + width;
+ if (pos < end) {
+ pushCommentRange(pos, end - pos);
+ }
+ return true;
+ }
function processJSDocTemplateTag(tag) {
for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) {
var child = _a[_i];
@@ -100891,7 +101729,7 @@ var ts;
return convertPathCompletions(completion.paths);
case 1 /* Properties */: {
var entries = [];
- Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 8 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
+ Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 99 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, entries: entries };
}
case 2 /* Types */: {
@@ -101470,7 +102308,7 @@ var ts;
var offset = index !== -1 ? index + 1 : 0;
// If the range is an identifier, span is unnecessary.
var length = text.length - offset;
- return length === 0 || ts.isIdentifierText(text.substr(offset, length), 8 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
+ return length === 0 || ts.isIdentifierText(text.substr(offset, length), 99 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
}
// Returns true if the path is explicitly relative to the script (i.e. relative to . or ..)
function isPathRelativeToScript(path) {
@@ -102032,7 +102870,7 @@ var ts;
currentToken = ts.getTokenAtPosition(sourceFile, position);
if (!currentToken ||
(!ts.isDeclarationName(currentToken) &&
- (currentToken.parent.kind !== 312 /* JSDocPropertyTag */ ||
+ (currentToken.parent.kind !== 313 /* JSDocPropertyTag */ ||
currentToken.parent.name !== currentToken))) {
// Use as type location if inside tag's type expression
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
@@ -102228,11 +103066,11 @@ var ts;
};
function isTagWithTypeExpression(tag) {
switch (tag.kind) {
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 311 /* JSDocTypedefTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 312 /* JSDocTypedefTag */:
return true;
default:
return false;
@@ -102241,11 +103079,13 @@ var ts;
function getTypeScriptMemberSymbols() {
// Right of dot member completion list
completionKind = 2 /* PropertyAccess */;
- // Since this is qualified name check its a type node location
+ // Since this is qualified name check it's a type node location
var isImportType = ts.isLiteralImportTypeNode(node);
- var isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !node.isTypeOf) || ts.isPartOfTypeNode(node.parent);
+ var isTypeLocation = insideJsDocTagTypeExpression
+ || (isImportType && !node.isTypeOf)
+ || ts.isPartOfTypeNode(node.parent)
+ || ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
var isRhsOfImportDeclaration = ts.isInRightSideOfInternalImportEqualsDeclaration(node);
- var allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker));
if (ts.isEntityName(node) || isImportType) {
var isNamespaceName = ts.isModuleDeclaration(node.parent);
if (isNamespaceName)
@@ -102261,7 +103101,7 @@ var ts;
var isValidAccess = isNamespaceName
// At `namespace N.M/**/`, if this is the only declaration of `M`, don't include `M` as a completion.
? function (symbol) { return !!(symbol.flags & 1920 /* Namespace */) && !symbol.declarations.every(function (d) { return d.parent === node.parent; }); }
- : allowTypeOrValue ?
+ : isRhsOfImportDeclaration ?
// Any kind is allowed when dotting off namespace in internal import equals declaration
function (symbol) { return isValidTypeAccess_1(symbol) || isValidValueAccess_1(symbol); } :
isTypeLocation ? isValidTypeAccess_1 : isValidValueAccess_1;
@@ -102407,7 +103247,7 @@ var ts;
var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
isInSnippetScope = isSnippetScope(scopeNode);
var isTypeOnly = isTypeOnlyCompletion();
- var symbolMeanings = (isTypeOnly ? 0 /* None */ : 67220415 /* Value */) | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
+ var symbolMeanings = (isTypeOnly ? 0 /* None */ : 111551 /* Value */) | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined");
for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
var symbol = symbols_2[_i];
@@ -102462,7 +103302,6 @@ var ts;
}
function filterGlobalCompletion(symbols) {
var isTypeOnly = isTypeOnlyCompletion();
- var allowTypes = isTypeOnly || !isContextTokenValueLocation(contextToken) && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
if (isTypeOnly) {
keywordFilters = isTypeAssertion()
? 6 /* TypeAssertionKeywords */
@@ -102479,23 +103318,24 @@ var ts;
if (ts.isInRightSideOfInternalImportEqualsDeclaration(location)) {
return !!(symbol.flags & 1920 /* Namespace */);
}
- if (allowTypes) {
- // Its a type, but you can reach it by namespace.type as well
- var symbolAllowedAsType = symbolCanBeReferencedAtTypeLocation(symbol);
- if (symbolAllowedAsType || isTypeOnly) {
- return symbolAllowedAsType;
- }
+ if (isTypeOnly) {
+ // It's a type, but you can reach it by namespace.type as well
+ return symbolCanBeReferencedAtTypeLocation(symbol);
}
}
// expressions are value space (which includes the value namespaces)
- return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 67220415 /* Value */);
+ return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 111551 /* Value */);
});
}
function isTypeAssertion() {
return ts.isAssertionExpression(contextToken.parent);
}
function isTypeOnlyCompletion() {
- return insideJsDocTagTypeExpression || !isContextTokenValueLocation(contextToken) && (ts.isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
+ return insideJsDocTagTypeExpression
+ || !isContextTokenValueLocation(contextToken) &&
+ (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
+ || ts.isPartOfTypeNode(location)
+ || isContextTokenTypeLocation(contextToken));
}
function isContextTokenValueLocation(contextToken) {
return contextToken &&
@@ -102529,7 +103369,7 @@ var ts;
function symbolCanBeReferencedAtTypeLocation(symbol, seenModules) {
if (seenModules === void 0) { seenModules = ts.createMap(); }
var sym = ts.skipAlias(symbol.exportSymbol || symbol, typeChecker);
- return !!(sym.flags & 67897832 /* Type */) ||
+ return !!(sym.flags & 788968 /* Type */) ||
!!(sym.flags & 1536 /* Module */) &&
ts.addToSeen(seenModules, ts.getSymbolId(sym)) &&
typeChecker.getExportsOfModule(sym).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, seenModules); });
@@ -103234,16 +104074,18 @@ var ts;
case 0 /* None */:
return false;
case 1 /* All */:
- return kind === 122 /* AsyncKeyword */ || 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 126 /* DeclareKeyword */ || kind === 131 /* ModuleKeyword */
+ return isFunctionLikeBodyKeyword(kind)
+ || kind === 126 /* DeclareKeyword */
+ || kind === 131 /* ModuleKeyword */
|| ts.isTypeKeyword(kind) && kind !== 142 /* UndefinedKeyword */;
+ case 5 /* FunctionLikeBodyKeywords */:
+ return isFunctionLikeBodyKeyword(kind);
case 2 /* ClassElementKeywords */:
return isClassMemberCompletionKeyword(kind);
case 3 /* InterfaceElementKeywords */:
return isInterfaceOrTypeLiteralCompletionKeyword(kind);
case 4 /* ConstructorParameterKeywords */:
return ts.isParameterPropertyModifier(kind);
- case 5 /* FunctionLikeBodyKeywords */:
- return isFunctionLikeBodyKeyword(kind);
case 6 /* TypeAssertionKeywords */:
return ts.isTypeKeyword(kind) || kind === 78 /* ConstKeyword */;
case 7 /* TypeKeywords */:
@@ -103302,7 +104144,9 @@ var ts;
}
}
function isFunctionLikeBodyKeyword(kind) {
- return kind === 122 /* AsyncKeyword */ || kind === 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
+ return kind === 122 /* AsyncKeyword */
+ || kind === 123 /* AwaitKeyword */
+ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}
function keywordForNode(node) {
return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind;
@@ -103339,7 +104183,7 @@ var ts;
function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) {
// class c { method() { } | method2() { } }
switch (location.kind) {
- case 313 /* SyntaxList */:
+ case 314 /* SyntaxList */:
return ts.tryCast(location.parent, ts.isObjectTypeDeclaration);
case 1 /* EndOfFileToken */:
var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration);
@@ -103609,10 +104453,12 @@ var ts;
return __spreadArrays(container.parameters, (ts.isClassLike(container.parent) ? container.parent.members : []));
case 241 /* ClassDeclaration */:
case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 169 /* TypeLiteral */:
var nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
- if (modifierFlag & 28 /* AccessibilityModifier */) {
+ if (modifierFlag & (28 /* AccessibilityModifier */ | 64 /* Readonly */)) {
var constructor = ts.find(container.members, ts.isConstructorDeclaration);
if (constructor) {
return __spreadArrays(nodes, constructor.parameters);
@@ -104344,7 +105190,7 @@ var ts;
/**
* Given a local reference, we might notice that it's an import/export and recursively search for references of that.
* If at an import, look locally for the symbol it imports.
- * If an an export, look for all imports of it.
+ * If at an export, look for all imports of it.
* This doesn't handle export specifiers; that is done in `getReferencesAtExportSpecifier`.
* @param comingFromExport If we are doing a search for all exports, don't bother looking backwards for the imported symbol, since that's the reason we're here.
*/
@@ -104476,10 +105322,10 @@ var ts;
// If a reference is a class expression, the exported node would be its parent.
// If a reference is a variable declaration, the exported node would be the variable statement.
function getExportNode(parent, node) {
- if (parent.kind === 238 /* VariableDeclaration */) {
- var p = parent;
- return p.name !== node ? undefined :
- p.parent.kind === 275 /* CatchClause */ ? undefined : p.parent.parent.kind === 220 /* VariableStatement */ ? p.parent.parent : undefined;
+ var declaration = ts.isVariableDeclaration(parent) ? parent : ts.isBindingElement(parent) ? ts.walkUpBindingElementsAndPatterns(parent) : undefined;
+ if (declaration) {
+ return parent.name !== node ? undefined :
+ ts.isCatchClause(declaration.parent) ? undefined : ts.isVariableStatement(declaration.parent.parent) ? declaration.parent.parent : undefined;
}
else {
return parent;
@@ -104943,8 +105789,8 @@ var ts;
case 249 /* ImportEqualsDeclaration */:
case 254 /* ImportSpecifier */:
case 242 /* InterfaceDeclaration */:
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
case 268 /* JsxAttribute */:
case 245 /* ModuleDeclaration */:
case 248 /* NamespaceExportDeclaration */:
@@ -104969,8 +105815,8 @@ var ts;
return !!decl.initializer || ts.isCatchClause(decl.parent);
case 156 /* MethodSignature */:
case 154 /* PropertySignature */:
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
return false;
default:
return ts.Debug.failBadSyntaxKind(decl);
@@ -105161,10 +106007,23 @@ var ts;
}
return references.length ? [{ definition: { type: 0 /* Symbol */, symbol: symbol }, references: references }] : ts.emptyArray;
}
+ /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */
+ function isReadonlyTypeOperator(node) {
+ return node.kind === 134 /* ReadonlyKeyword */
+ && ts.isTypeOperatorNode(node.parent)
+ && node.parent.operator === 134 /* ReadonlyKeyword */;
+ }
/** getReferencedSymbols for special node kinds. */
function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) {
if (ts.isTypeKeyword(node.kind)) {
- return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken);
+ // A modifier readonly (like on a property declaration) is not special;
+ // a readonly type keyword (like `readonly string[]`) is.
+ if (node.kind === 134 /* ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) {
+ return undefined;
+ }
+ // Likewise, when we *are* looking for a special keyword, make sure we
+ // *don’t* include readonly member modifiers.
+ return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 134 /* ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined);
}
// Labels
if (ts.isJumpStatementTarget(node)) {
@@ -105589,8 +106448,8 @@ var ts;
// We found a match. Make sure it's not part of a larger word (i.e. the char
// before and after it have to be a non-identifier char).
var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 8 /* Latest */)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 8 /* Latest */))) {
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 99 /* Latest */)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 99 /* Latest */))) {
// Found a real match. Keep searching.
positions.push(position);
}
@@ -105625,11 +106484,13 @@ var ts;
return false;
}
}
- function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) {
+ function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken, filter) {
var references = ts.flatMap(sourceFiles, function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
return ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, ts.tokenToString(keywordKind), sourceFile), function (referenceLocation) {
- return referenceLocation.kind === keywordKind ? FindAllReferences.nodeEntry(referenceLocation) : undefined;
+ if (referenceLocation.kind === keywordKind && (!filter || filter(referenceLocation))) {
+ return FindAllReferences.nodeEntry(referenceLocation);
+ }
});
});
return references.length ? [{ definition: { type: 2 /* Keyword */, node: references[0].node }, references: references }] : undefined;
@@ -106771,18 +107632,21 @@ var ts;
}
}
function getDefinitionFromSymbol(typeChecker, symbol, node) {
- return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(symbol.declarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
+ // There are cases when you extend a function by adding properties to it afterwards,
+ // we want to strip those extra properties
+ var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return !ts.isAssignmentDeclaration(d) || d === symbol.valueDeclaration; }) || undefined;
+ return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(filteredDeclarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
function getConstructSignatureDefinition() {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 125 /* ConstructorKeyword */)) {
- var cls = ts.find(symbol.declarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
+ var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
return getSignatureDefinition(cls.members, /*selectConstructors*/ true);
}
}
function getCallSignatureDefinition() {
return ts.isCallOrNewExpressionTarget(node) || ts.isNameOfFunctionDeclaration(node)
- ? getSignatureDefinition(symbol.declarations, /*selectConstructors*/ false)
+ ? getSignatureDefinition(filteredDeclarations, /*selectConstructors*/ false)
: undefined;
}
function getSignatureDefinition(signatureDeclarations, selectConstructors) {
@@ -106964,11 +107828,11 @@ var ts;
JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
function getCommentHavingNodes(declaration) {
switch (declaration.kind) {
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return [declaration];
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
return [declaration, declaration.parent];
default:
return ts.getJSDocCommentsAndTags(declaration);
@@ -106989,16 +107853,16 @@ var ts;
function getCommentText(tag) {
var comment = tag.comment;
switch (tag.kind) {
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return withNode(tag.class);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return withList(tag.typeParameters);
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
return withNode(tag.typeExpression);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
var name = tag.name;
return name ? withNode(name) : comment;
default:
@@ -107823,8 +108687,8 @@ var ts;
case 245 /* ModuleDeclaration */:
case 285 /* SourceFile */:
case 243 /* TypeAliasDeclaration */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
return true;
case 158 /* Constructor */:
case 157 /* MethodDeclaration */:
@@ -108377,9 +109241,9 @@ var ts;
function addRegionOutliningSpans(sourceFile, out) {
var regions = [];
var lineStarts = sourceFile.getLineStarts();
- for (var i = 0; i < lineStarts.length; i++) {
- var currentLineStart = lineStarts[i];
- var lineEnd = i + 1 === lineStarts.length ? sourceFile.getEnd() : lineStarts[i + 1] - 1;
+ for (var _i = 0, lineStarts_1 = lineStarts; _i < lineStarts_1.length; _i++) {
+ var currentLineStart = lineStarts_1[_i];
+ var lineEnd = sourceFile.getLineEndOfPosition(currentLineStart);
var lineText = sourceFile.text.substring(currentLineStart, lineEnd);
var result = isRegionDelimiter(lineText);
if (!result || ts.isInComment(sourceFile, currentLineStart)) {
@@ -108814,7 +109678,7 @@ var ts;
if (ch >= 65 /* A */ && ch <= 90 /* Z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 99 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -108827,7 +109691,7 @@ var ts;
if (ch >= 97 /* a */ && ch <= 122 /* z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 99 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -109477,7 +110341,7 @@ var ts;
if (node.getStart(sourceFile) > pos) {
break outer;
}
- if (positionShouldSnapToNode(pos, node, nextNode)) {
+ if (positionShouldSnapToNode(sourceFile, pos, node)) {
// 1. Blocks are effectively redundant with SyntaxLists.
// 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
// of things that should be considered independently.
@@ -109520,6 +110384,12 @@ var ts;
parentNode = node;
break;
}
+ // If we made it to the end of the for loop, we’re done.
+ // In practice, I’ve only seen this happen at the very end
+ // of a SourceFile.
+ if (i === children.length - 1) {
+ break outer;
+ }
}
}
return selectionRange;
@@ -109543,12 +110413,11 @@ var ts;
* count too, unless that position belongs to the next node. In effect, makes
* selections able to snap to preceding tokens when the cursor is on the tail
* end of them with only whitespace ahead.
+ * @param sourceFile The source file containing the nodes.
* @param pos The position to check.
* @param node The candidate node to snap to.
- * @param nextNode The next sibling node in the tree.
- * @param sourceFile The source file containing the nodes.
*/
- function positionShouldSnapToNode(pos, node, nextNode) {
+ function positionShouldSnapToNode(sourceFile, pos, node) {
// Can’t use 'ts.positionBelongsToNode()' here because it cleverly accounts
// for missing nodes, which can’t really be considered when deciding what
// to select.
@@ -109557,9 +110426,8 @@ var ts;
return true;
}
var nodeEnd = node.getEnd();
- var nextNodeStart = nextNode && nextNode.getStart();
if (nodeEnd === pos) {
- return pos !== nextNodeStart;
+ return ts.getTouchingPropertyName(sourceFile, pos).pos < node.end;
}
return false;
}
@@ -109708,7 +110576,7 @@ var ts;
}
function createSyntaxList(children) {
ts.Debug.assertGreaterThanOrEqual(children.length, 1);
- var syntaxList = ts.createNode(313 /* SyntaxList */, children[0].pos, ts.last(children).end);
+ var syntaxList = ts.createNode(314 /* SyntaxList */, children[0].pos, ts.last(children).end);
syntaxList._children = children;
return syntaxList;
}
@@ -111217,7 +112085,14 @@ var ts;
*/
function transpileModule(input, transpileOptions) {
var diagnostics = [];
- var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : ts.getDefaultCompilerOptions();
+ var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
+ // mix in default options
+ var defaultOptions = ts.getDefaultCompilerOptions();
+ for (var key in defaultOptions) {
+ if (ts.hasProperty(defaultOptions, key) && options[key] === undefined) {
+ options[key] = defaultOptions[key];
+ }
+ }
options.isolatedModules = true;
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
options.suppressOutputPathCheck = true;
@@ -111423,8 +112298,8 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
- var standardScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
- var jsxScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
+ var standardScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
+ var jsxScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
var ScanAction;
(function (ScanAction) {
ScanAction[ScanAction["Scan"] = 0] = "Scan";
@@ -113759,7 +114634,7 @@ var ts;
case 210 /* ClassExpression */:
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return getList(node.typeParameters);
case 193 /* NewExpression */:
case 192 /* CallExpression */:
@@ -114652,7 +115527,7 @@ var ts;
function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) {
// TODO: this emits the file, parses it back, then formats it that -- may be a less roundabout way to do this
var nonFormattedText = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
- var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 8 /* ESNext */, /*setParentNodes*/ true, scriptKind);
+ var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 99 /* ESNext */, /*setParentNodes*/ true, scriptKind);
var changes = ts.formatting.formatDocument(sourceFile, formatContext);
return applyChanges(nonFormattedText, changes) + newLineCharacter;
}
@@ -116022,14 +116897,14 @@ var ts;
return undefined;
}
switch (oldTag.kind) {
- case 306 /* JSDocParameterTag */: {
+ case 307 /* JSDocParameterTag */: {
var oldParam = oldTag;
var newParam = newTag;
return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
? ts.createJSDocParamTag(newParam.name, newParam.isBracketed, newParam.typeExpression, oldParam.comment)
: undefined;
}
- case 307 /* JSDocReturnTag */:
+ case 308 /* JSDocReturnTag */:
return ts.createJSDocReturnTag(newTag.typeExpression, oldTag.comment);
}
}
@@ -117334,7 +118209,7 @@ var ts;
forEachExportReference(sourceFile, function (node) {
var _a = node.name, text = _a.text, originalKeywordKind = _a.originalKeywordKind;
if (!res.has(text) && (originalKeywordKind !== undefined && ts.isNonContextualKeyword(originalKeywordKind)
- || checker.resolveName(node.name.text, node, 67220415 /* Value */, /*excludeGlobals*/ true))) {
+ || checker.resolveName(node.name.text, node, 111551 /* Value */, /*excludeGlobals*/ true))) {
// Unconditionally add an underscore in case `text` is a keyword.
res.set(text, makeUniqueName("_" + text, identifiers));
}
@@ -117935,9 +118810,10 @@ var ts;
ImportKind[ImportKind["Default"] = 1] = "Default";
ImportKind[ImportKind["Namespace"] = 2] = "Namespace";
ImportKind[ImportKind["Equals"] = 3] = "Equals";
+ ImportKind[ImportKind["ConstEquals"] = 4] = "ConstEquals";
})(ImportKind || (ImportKind = {}));
function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
- var exportInfos = getAllReExportingModules(exportedSymbol, moduleSymbol, symbolName, sourceFile, program.getCompilerOptions(), program.getTypeChecker(), program.getSourceFiles());
+ var exportInfos = getAllReExportingModules(sourceFile, exportedSymbol, moduleSymbol, symbolName, sourceFile, program.getCompilerOptions(), program.getTypeChecker(), program.getSourceFiles());
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol; }));
// We sort the best codefixes first, so taking `first` is best for completions.
var moduleSpecifier = ts.first(getNewImportInfos(program, sourceFile, position, exportInfos, host, preferences)).moduleSpecifier;
@@ -117949,14 +118825,14 @@ var ts;
var description = _a.description, changes = _a.changes, commands = _a.commands;
return { description: description, changes: changes, commands: commands };
}
- function getAllReExportingModules(exportedSymbol, exportingModuleSymbol, symbolName, sourceFile, compilerOptions, checker, allSourceFiles) {
+ function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, sourceFile, compilerOptions, checker, allSourceFiles) {
var result = [];
forEachExternalModule(checker, allSourceFiles, function (moduleSymbol, moduleFile) {
// Don't import from a re-export when looking "up" like to `./index` or `../index`.
if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(sourceFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) {
return;
}
- var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
+ var defaultInfo = getDefaultLikeExportInfo(importingFile, moduleSymbol, checker, compilerOptions);
if (defaultInfo && defaultInfo.name === symbolName && ts.skipAlias(defaultInfo.symbol, checker) === exportedSymbol) {
result.push({ moduleSymbol: moduleSymbol, importKind: defaultInfo.kind, exportedSymbolIsTypeOnly: isTypeOnlySymbol(defaultInfo.symbol, checker) });
}
@@ -117970,7 +118846,7 @@ var ts;
return result;
}
function isTypeOnlySymbol(s, checker) {
- return !(ts.skipAlias(s, checker).flags & 67220415 /* Value */);
+ return !(ts.skipAlias(s, checker).flags & 111551 /* Value */);
}
function getFixForImport(exportInfos, symbolName, position, program, sourceFile, host, preferences) {
var checker = program.getTypeChecker();
@@ -118078,7 +118954,7 @@ var ts;
return undefined;
var symbol = checker.getAliasedSymbol(umdSymbol);
var symbolName = umdSymbol.name;
- var exportInfos = [{ moduleSymbol: symbol, importKind: getUmdImportKind(program.getCompilerOptions()), exportedSymbolIsTypeOnly: false }];
+ var exportInfos = [{ moduleSymbol: symbol, importKind: getUmdImportKind(sourceFile, program.getCompilerOptions()), exportedSymbolIsTypeOnly: false }];
var fixes = getFixForImport(exportInfos, symbolName, ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined, program, sourceFile, host, preferences);
return { fixes: fixes, symbolName: symbolName };
}
@@ -118090,10 +118966,10 @@ var ts;
// The error wasn't for the symbolAtLocation, it was for the JSX tag itself, which needs access to e.g. `React`.
var parent = token.parent;
return (ts.isJsxOpeningLikeElement(parent) && parent.tagName === token) || ts.isJsxOpeningFragment(parent)
- ? ts.tryCast(checker.resolveName(checker.getJsxNamespace(parent), ts.isJsxOpeningLikeElement(parent) ? token : parent, 67220415 /* Value */, /*excludeGlobals*/ false), ts.isUMDExportSymbol)
+ ? ts.tryCast(checker.resolveName(checker.getJsxNamespace(parent), ts.isJsxOpeningLikeElement(parent) ? token : parent, 111551 /* Value */, /*excludeGlobals*/ false), ts.isUMDExportSymbol)
: undefined;
}
- function getUmdImportKind(compilerOptions) {
+ function getUmdImportKind(importingFile, compilerOptions) {
// Import a synthetic `default` if enabled.
if (ts.getAllowSyntheticDefaultImports(compilerOptions)) {
return 1 /* Default */;
@@ -118104,6 +118980,9 @@ var ts;
case ts.ModuleKind.AMD:
case ts.ModuleKind.CommonJS:
case ts.ModuleKind.UMD:
+ if (ts.isInJSFile(importingFile)) {
+ return ts.isExternalModule(importingFile) ? 2 /* Namespace */ : 4 /* ConstEquals */;
+ }
return 3 /* Equals */;
case ts.ModuleKind.System:
case ts.ModuleKind.ES2015:
@@ -118142,7 +119021,7 @@ var ts;
}
forEachExternalModuleToImportFrom(checker, sourceFile, program.getSourceFiles(), function (moduleSymbol) {
cancellationToken.throwIfCancellationRequested();
- var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, program.getCompilerOptions());
+ var defaultInfo = getDefaultLikeExportInfo(sourceFile, moduleSymbol, checker, program.getCompilerOptions());
if (defaultInfo && defaultInfo.name === symbolName && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
addSymbol(moduleSymbol, defaultInfo.symbol, defaultInfo.kind);
}
@@ -118154,20 +119033,41 @@ var ts;
});
return originalSymbolToExportInfos;
}
- function getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions) {
- var exported = getDefaultLikeExportWorker(moduleSymbol, checker);
+ function getDefaultLikeExportInfo(importingFile, moduleSymbol, checker, compilerOptions) {
+ var exported = getDefaultLikeExportWorker(importingFile, moduleSymbol, checker, compilerOptions);
if (!exported)
return undefined;
var symbol = exported.symbol, kind = exported.kind;
var info = getDefaultExportInfoWorker(symbol, moduleSymbol, checker, compilerOptions);
return info && __assign({ symbol: symbol, kind: kind }, info);
}
- function getDefaultLikeExportWorker(moduleSymbol, checker) {
+ function getDefaultLikeExportWorker(importingFile, moduleSymbol, checker, compilerOptions) {
var defaultExport = checker.tryGetMemberInModuleExports("default" /* Default */, moduleSymbol);
if (defaultExport)
return { symbol: defaultExport, kind: 1 /* Default */ };
var exportEquals = checker.resolveExternalModuleSymbol(moduleSymbol);
- return exportEquals === moduleSymbol ? undefined : { symbol: exportEquals, kind: 3 /* Equals */ };
+ return exportEquals === moduleSymbol ? undefined : { symbol: exportEquals, kind: getExportEqualsImportKind(importingFile, compilerOptions, checker) };
+ }
+ function getExportEqualsImportKind(importingFile, compilerOptions, checker) {
+ if (ts.getAllowSyntheticDefaultImports(compilerOptions) && ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
+ return 1 /* Default */;
+ }
+ if (ts.isInJSFile(importingFile)) {
+ return ts.isExternalModule(importingFile) ? 1 /* Default */ : 4 /* ConstEquals */;
+ }
+ for (var _i = 0, _a = importingFile.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ if (ts.isImportEqualsDeclaration(statement)) {
+ return 3 /* Equals */;
+ }
+ if (ts.isImportDeclaration(statement) && statement.importClause && statement.importClause.name) {
+ var moduleSymbol = checker.getImmediateAliasedSymbol(statement.importClause.symbol);
+ if (moduleSymbol && moduleSymbol.name !== "default" /* Default */) {
+ return 1 /* Default */;
+ }
+ }
+ }
+ return 3 /* Equals */;
}
function getDefaultExportInfoWorker(defaultExport, moduleSymbol, checker, compilerOptions) {
var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport);
@@ -118180,9 +119080,11 @@ var ts;
var aliased = checker.getImmediateAliasedSymbol(defaultExport);
return aliased && getDefaultExportInfoWorker(aliased, ts.Debug.assertDefined(aliased.parent), checker, compilerOptions);
}
- else {
- return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) };
+ if (defaultExport.escapedName !== "default" /* Default */ &&
+ defaultExport.escapedName !== "export=" /* ExportEquals */) {
+ return { symbolForMeaning: defaultExport, name: defaultExport.getName() };
}
+ return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) };
}
function getNameForExportDefault(symbol) {
return symbol.declarations && ts.firstDefined(symbol.declarations, function (declaration) {
@@ -118274,11 +119176,17 @@ var ts;
ts.insertImport(changes, sourceFile, ts.makeImport(defaultImport === undefined ? undefined : ts.createIdentifier(defaultImport), namedImports.map(function (n) { return ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(n)); }), moduleSpecifier, quotePreference));
}
if (namespaceLikeImport) {
- ts.insertImport(changes, sourceFile, namespaceLikeImport.importKind === 3 /* Equals */
- ? ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createIdentifier(namespaceLikeImport.name), ts.createExternalModuleReference(quotedModuleSpecifier))
- : ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(ts.createIdentifier(namespaceLikeImport.name))), quotedModuleSpecifier));
+ ts.insertImport(changes, sourceFile, namespaceLikeImport.importKind === 3 /* Equals */ ? ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createIdentifier(namespaceLikeImport.name), ts.createExternalModuleReference(quotedModuleSpecifier)) :
+ namespaceLikeImport.importKind === 4 /* ConstEquals */ ? createConstEqualsRequireDeclaration(namespaceLikeImport.name, quotedModuleSpecifier) :
+ ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(ts.createIdentifier(namespaceLikeImport.name))), quotedModuleSpecifier));
}
}
+ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
+ return ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(ts.createIdentifier(name),
+ /*type*/ undefined, ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, [quotedModuleSpecifier]))
+ ], 2 /* Const */));
+ }
function symbolHasMeaning(_a, meaning) {
var declarations = _a.declarations;
return ts.some(declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); });
@@ -118420,10 +119328,10 @@ var ts;
flags |= 1920 /* Namespace */;
}
if (meaning & 2 /* Type */) {
- flags |= 67897832 /* Type */;
+ flags |= 788968 /* Type */;
}
if (meaning & 1 /* Value */) {
- flags |= 67220415 /* Value */;
+ flags |= 111551 /* Value */;
}
return flags;
}
@@ -119648,9 +120556,8 @@ var ts;
var modifiers = visibilityModifier ? ts.createNodeArray([visibilityModifier]) : undefined;
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
var optional = !!(symbol.flags & 16777216 /* Optional */);
+ var ambient = !!(enclosingDeclaration.flags & 4194304 /* Ambient */);
switch (declaration.kind) {
- case 159 /* GetAccessor */:
- case 160 /* SetAccessor */:
case 154 /* PropertySignature */:
case 155 /* PropertyDeclaration */:
var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
@@ -119658,6 +120565,29 @@ var ts;
/*decorators*/ undefined, modifiers, name, optional ? ts.createToken(56 /* QuestionToken */) : undefined, typeNode,
/*initializer*/ undefined));
break;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */: {
+ var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration);
+ var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
+ var orderedAccessors = allAccessors.secondAccessor
+ ? [allAccessors.firstAccessor, allAccessors.secondAccessor]
+ : [allAccessors.firstAccessor];
+ for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) {
+ var accessor = orderedAccessors_1[_i];
+ if (ts.isGetAccessorDeclaration(accessor)) {
+ out(ts.createGetAccessor(
+ /*decorators*/ undefined, modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : createStubbedMethodBody(preferences)));
+ }
+ else {
+ ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration);
+ var parameter = ts.getSetAccessorValueParameter(accessor);
+ var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined;
+ out(ts.createSetAccessor(
+ /*decorators*/ undefined, modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : createStubbedMethodBody(preferences)));
+ }
+ }
+ break;
+ }
case 156 /* MethodSignature */:
case 157 /* MethodDeclaration */:
// The signature for the implementation appears as an entry in `signatures` iff
@@ -119674,21 +120604,23 @@ var ts;
if (declarations.length === 1) {
ts.Debug.assert(signatures.length === 1);
var signature = signatures[0];
- outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
+ outputMethod(signature, modifiers, name, ambient ? undefined : createStubbedMethodBody(preferences));
break;
}
- for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
- var signature = signatures_1[_i];
+ for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) {
+ var signature = signatures_1[_a];
// Need to ensure nodes are fresh each time so they can have different positions.
outputMethod(signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
}
- if (declarations.length > signatures.length) {
- var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
- outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
- }
- else {
- ts.Debug.assert(declarations.length === signatures.length);
- out(createMethodImplementingSignatures(signatures, name, optional, modifiers, preferences));
+ if (!ambient) {
+ if (declarations.length > signatures.length) {
+ var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
+ outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
+ }
+ else {
+ ts.Debug.assert(declarations.length === signatures.length);
+ out(createMethodImplementingSignatures(signatures, name, optional, modifiers, preferences));
+ }
}
break;
}
@@ -120525,7 +121457,7 @@ var ts;
function doChangeNamedToNamespace(sourceFile, checker, changes, toConvert) {
var importDecl = toConvert.parent.parent;
var moduleSpecifier = importDecl.moduleSpecifier;
- var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 8 /* ESNext */) : "module";
+ var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 99 /* ESNext */) : "module";
var namespaceNameConflicts = toConvert.elements.some(function (element) {
return ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
return !!checker.resolveName(preferredName, id, 67108863 /* All */, /*excludeGlobals*/ true);
@@ -122154,7 +123086,7 @@ var ts;
}
else if (ts.isTypeQueryNode(node)) {
if (ts.isIdentifier(node.exprName)) {
- var symbol = checker.resolveName(node.exprName.text, node.exprName, 67220415 /* Value */, /* excludeGlobals */ false);
+ var symbol = checker.resolveName(node.exprName.text, node.exprName, 111551 /* Value */, /* excludeGlobals */ false);
if (symbol && rangeContainsSkipTrivia(statement, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) {
return true;
}
@@ -122176,7 +123108,7 @@ var ts;
changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
}
function doTypedefChange(changes, file, name, firstStatement, selection, typeParameters) {
- var node = ts.createNode(311 /* JSDocTypedefTag */);
+ var node = ts.createNode(312 /* JSDocTypedefTag */);
node.tagName = ts.createIdentifier("typedef"); // TODO: jsdoc factory https://github.com/Microsoft/TypeScript/pull/29539
node.fullName = ts.createIdentifier(name);
node.name = node.fullName;
@@ -122184,7 +123116,7 @@ var ts;
var templates = [];
ts.forEach(typeParameters, function (typeParameter) {
var constraint = ts.getEffectiveConstraintOfTypeParameter(typeParameter);
- var template = ts.createNode(310 /* JSDocTemplateTag */);
+ var template = ts.createNode(311 /* JSDocTemplateTag */);
template.tagName = ts.createIdentifier("template");
template.constraint = constraint && ts.cast(constraint, ts.isJSDocTypeExpression);
var parameter = ts.createNode(151 /* TypeParameter */);
@@ -122550,7 +123482,7 @@ var ts;
}
}
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) {
- var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 8 /* ESNext */);
+ var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 99 /* ESNext */);
var needUniqueName = false;
var toChange = [];
ts.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function (ref) {
@@ -122688,7 +123620,7 @@ var ts;
}
if (namedBindings) {
if (namedBindingsUnused) {
- changes.delete(sourceFile, namedBindings);
+ changes.replaceNode(sourceFile, importDecl.importClause, ts.updateImportClause(importDecl.importClause, name, /*namedBindings*/ undefined));
}
else if (namedBindings.kind === 253 /* NamedImports */) {
for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
@@ -123736,7 +124668,7 @@ var ts;
if (!children.length) {
return undefined;
}
- var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 312 /* LastJSDocNode */; });
+ var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 313 /* LastJSDocNode */; });
return child.kind < 149 /* FirstNode */ ?
child :
child.getFirstToken(sourceFile);
@@ -123806,7 +124738,7 @@ var ts;
}
}
function createSyntaxList(nodes, parent) {
- var list = createNode(313 /* SyntaxList */, nodes.pos, nodes.end, parent);
+ var list = createNode(314 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
@@ -124401,7 +125333,7 @@ var ts;
var sourceFile;
if (this.currentFileName !== fileName) {
// This is a new file, just parse it
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 8 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 99 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
}
else if (this.currentFileVersion !== version) {
// This is the same file, just a newer version. Incrementally parse the file.
@@ -124558,7 +125490,11 @@ var ts;
function getValidSourceFile(fileName) {
var sourceFile = program.getSourceFile(fileName);
if (!sourceFile) {
- throw new Error("Could not find sourceFile: '" + fileName + "' in " + (program && JSON.stringify(program.getSourceFiles().map(function (f) { return f.fileName; }))) + ".");
+ var error = new Error("Could not find source file: '" + fileName + "'.");
+ // We've been having trouble debugging this, so attach sidecar data for the tsserver log.
+ // See https://github.com/microsoft/TypeScript/issues/30180.
+ error.ProgramFiles = program.getSourceFiles().map(function (f) { return f.fileName; });
+ throw error;
}
return sourceFile;
}
@@ -124627,11 +125563,21 @@ var ts;
compilerHost.trace = function (message) { return host.trace(message); };
}
if (host.resolveModuleNames) {
- compilerHost.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); };
+ compilerHost.resolveModuleNames = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveModuleNames.apply(host, args);
+ };
}
if (host.resolveTypeReferenceDirectives) {
- compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference) {
- return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile, redirectedReference);
+ compilerHost.resolveTypeReferenceDirectives = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveTypeReferenceDirectives.apply(host, args);
};
}
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
@@ -124878,7 +125824,7 @@ var ts;
var normalizedFileName = ts.normalizePath(fileName);
ts.Debug.assert(filesToSearch.some(function (f) { return ts.normalizePath(f) === normalizedFileName; }));
synchronizeHostData();
- var sourceFilesToSearch = filesToSearch.map(getValidSourceFile);
+ var sourceFilesToSearch = ts.mapDefined(filesToSearch, function (fileName) { return program.getSourceFile(fileName); });
var sourceFile = getValidSourceFile(fileName);
return ts.DocumentHighlights.getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch);
}
diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts
index d64316d0e90..f4bee593953 100644
--- a/lib/typescriptServices.d.ts
+++ b/lib/typescriptServices.d.ts
@@ -374,29 +374,30 @@ declare namespace ts {
JSDocOptionalType = 294,
JSDocFunctionType = 295,
JSDocVariadicType = 296,
- JSDocComment = 297,
- JSDocTypeLiteral = 298,
- JSDocSignature = 299,
- JSDocTag = 300,
- JSDocAugmentsTag = 301,
- JSDocAuthorTag = 302,
- JSDocClassTag = 303,
- JSDocCallbackTag = 304,
- JSDocEnumTag = 305,
- JSDocParameterTag = 306,
- JSDocReturnTag = 307,
- JSDocThisTag = 308,
- JSDocTypeTag = 309,
- JSDocTemplateTag = 310,
- JSDocTypedefTag = 311,
- JSDocPropertyTag = 312,
- SyntaxList = 313,
- NotEmittedStatement = 314,
- PartiallyEmittedExpression = 315,
- CommaListExpression = 316,
- MergeDeclarationMarker = 317,
- EndOfDeclarationMarker = 318,
- Count = 319,
+ JSDocNamepathType = 297,
+ JSDocComment = 298,
+ JSDocTypeLiteral = 299,
+ JSDocSignature = 300,
+ JSDocTag = 301,
+ JSDocAugmentsTag = 302,
+ JSDocAuthorTag = 303,
+ JSDocClassTag = 304,
+ JSDocCallbackTag = 305,
+ JSDocEnumTag = 306,
+ JSDocParameterTag = 307,
+ JSDocReturnTag = 308,
+ JSDocThisTag = 309,
+ JSDocTypeTag = 310,
+ JSDocTemplateTag = 311,
+ JSDocTypedefTag = 312,
+ JSDocPropertyTag = 313,
+ SyntaxList = 314,
+ NotEmittedStatement = 315,
+ PartiallyEmittedExpression = 316,
+ CommaListExpression = 317,
+ MergeDeclarationMarker = 318,
+ EndOfDeclarationMarker = 319,
+ Count = 320,
FirstAssignment = 60,
LastAssignment = 72,
FirstCompoundAssignment = 61,
@@ -423,9 +424,9 @@ declare namespace ts {
LastBinaryOperator = 72,
FirstNode = 149,
FirstJSDocNode = 289,
- LastJSDocNode = 312,
- FirstJSDocTagNode = 300,
- LastJSDocTagNode = 312,
+ LastJSDocNode = 313,
+ FirstJSDocTagNode = 301,
+ LastJSDocTagNode = 313,
}
export enum NodeFlags {
None = 0,
@@ -1558,6 +1559,10 @@ declare namespace ts {
kind: SyntaxKind.JSDocVariadicType;
type: TypeNode;
}
+ export interface JSDocNamepathType extends JSDocType {
+ kind: SyntaxKind.JSDocNamepathType;
+ type: TypeNode;
+ }
export type JSDocTypeReferencingNode = JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
export interface JSDoc extends Node {
kind: SyntaxKind.JSDocComment;
@@ -1589,7 +1594,8 @@ declare namespace ts {
export interface JSDocClassTag extends JSDocTag {
kind: SyntaxKind.JSDocClassTag;
}
- export interface JSDocEnumTag extends JSDocTag {
+ export interface JSDocEnumTag extends JSDocTag, Declaration {
+ parent: JSDoc;
kind: SyntaxKind.JSDocEnumTag;
typeExpression?: JSDocTypeExpression;
}
@@ -2126,28 +2132,28 @@ declare namespace ts {
ModuleExports = 134217728,
Enum = 384,
Variable = 3,
- Value = 67220415,
- Type = 67897832,
+ Value = 111551,
+ Type = 788968,
Namespace = 1920,
Module = 1536,
Accessor = 98304,
- FunctionScopedVariableExcludes = 67220414,
- BlockScopedVariableExcludes = 67220415,
- ParameterExcludes = 67220415,
+ FunctionScopedVariableExcludes = 111550,
+ BlockScopedVariableExcludes = 111551,
+ ParameterExcludes = 111551,
PropertyExcludes = 0,
- EnumMemberExcludes = 68008959,
- FunctionExcludes = 67219887,
- ClassExcludes = 68008383,
- InterfaceExcludes = 67897736,
- RegularEnumExcludes = 68008191,
- ConstEnumExcludes = 68008831,
+ EnumMemberExcludes = 900095,
+ FunctionExcludes = 110991,
+ ClassExcludes = 899503,
+ InterfaceExcludes = 788872,
+ RegularEnumExcludes = 899327,
+ ConstEnumExcludes = 899967,
ValueModuleExcludes = 110735,
NamespaceModuleExcludes = 0,
- MethodExcludes = 67212223,
- GetAccessorExcludes = 67154879,
- SetAccessorExcludes = 67187647,
- TypeParameterExcludes = 67635688,
- TypeAliasExcludes = 67897832,
+ MethodExcludes = 103359,
+ GetAccessorExcludes = 46015,
+ SetAccessorExcludes = 78783,
+ TypeParameterExcludes = 526824,
+ TypeAliasExcludes = 788968,
AliasExcludes = 2097152,
ModuleMember = 2623475,
ExportHasLocal = 944,
@@ -2600,7 +2606,7 @@ declare namespace ts {
UMD = 3,
System = 4,
ES2015 = 5,
- ESNext = 6
+ ESNext = 99
}
export enum JsxEmit {
None = 0,
@@ -2640,9 +2646,9 @@ declare namespace ts {
ES2018 = 5,
ES2019 = 6,
ES2020 = 7,
- ESNext = 8,
+ ESNext = 99,
JSON = 100,
- Latest = 8
+ Latest = 99
}
export enum LanguageVariant {
Standard = 0,
@@ -2768,11 +2774,11 @@ declare namespace ts {
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
readDirectory?(rootDir: string, extensions: ReadonlyArray, excludes: ReadonlyArray | undefined, includes: ReadonlyArray, depth?: number): string[];
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
/**
* This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
*/
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
getEnvironmentVariable?(name: string): string | undefined;
createHash?(data: string): string;
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
@@ -3168,6 +3174,7 @@ declare namespace ts {
getTokenPos(): number;
getTokenText(): string;
getTokenValue(): string;
+ hasUnicodeEscape(): boolean;
hasExtendedUnicodeEscape(): boolean;
hasPrecedingLineBreak(): boolean;
isIdentifier(): boolean;
@@ -4528,9 +4535,9 @@ declare namespace ts {
/** If provided is used to get the environment variable */
getEnvironmentVariable?(name: string): string | undefined;
/** If provided, used to resolve the module names, otherwise typescript's default module resolution */
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
/** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
}
interface WatchCompilerHost extends ProgramHost, WatchHost {
/** If provided, callback to invoke after every new program creation */
@@ -4885,9 +4892,9 @@ declare namespace ts {
realpath?(path: string): string;
fileExists?(path: string): boolean;
getTypeRootsVersion?(): number;
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference): (ResolvedModule | undefined)[];
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined;
- resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
+ resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
getDirectories?(directoryName: string): string[];
/**
* Gets a set of custom transformers to use during emit.
@@ -5670,6 +5677,7 @@ declare namespace ts {
}
}
declare namespace ts {
+ /** The classifier is used for syntactic highlighting in editors via the TSServer */
function createClassifier(): Classifier;
}
declare namespace ts {
diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js
index 1bbc3239a18..26621550481 100644
--- a/lib/typescriptServices.js
+++ b/lib/typescriptServices.js
@@ -82,7 +82,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.6";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".0-beta";
+ ts.version = ts.versionMajorMinor + ".1-rc";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -1237,6 +1237,18 @@ var ts;
return keys;
}
ts.getOwnKeys = getOwnKeys;
+ function getAllKeys(obj) {
+ var result = [];
+ do {
+ var names = Object.getOwnPropertyNames(obj);
+ for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
+ var name = names_1[_i];
+ pushIfUnique(result, name);
+ }
+ } while (obj = Object.getPrototypeOf(obj));
+ return result;
+ }
+ ts.getAllKeys = getAllKeys;
function getOwnValues(sparseArray) {
var values = [];
for (var key in sparseArray) {
@@ -2376,6 +2388,46 @@ var ts;
})(ts || (ts = {}));
/* @internal */
var ts;
+(function (ts) {
+ var nullLogger = {
+ logEvent: ts.noop,
+ logErrEvent: ts.noop,
+ logPerfEvent: ts.noop,
+ logInfoEvent: ts.noop,
+ logStartCommand: ts.noop,
+ logStopCommand: ts.noop,
+ logStartUpdateProgram: ts.noop,
+ logStopUpdateProgram: ts.noop,
+ logStartUpdateGraph: ts.noop,
+ logStopUpdateGraph: ts.noop,
+ logStartResolveModule: ts.noop,
+ logStopResolveModule: ts.noop,
+ logStartParseSourceFile: ts.noop,
+ logStopParseSourceFile: ts.noop,
+ logStartReadFile: ts.noop,
+ logStopReadFile: ts.noop,
+ logStartBindFile: ts.noop,
+ logStopBindFile: ts.noop,
+ logStartScheduledOperation: ts.noop,
+ logStopScheduledOperation: ts.noop,
+ };
+ // Load optional module to enable Event Tracing for Windows
+ // See https://github.com/microsoft/typescript-etw for more information
+ var etwModule;
+ try {
+ // require() will throw an exception if the module is not installed
+ // It may also return undefined if not installed properly
+ etwModule = require("@microsoft/typescript-etw"); // tslint:disable-line:no-implicit-dependencies
+ }
+ catch (e) {
+ etwModule = undefined;
+ }
+ /** Performance logger that will generate ETW events if possible */
+ ts.perfLogger = etwModule ? etwModule : nullLogger;
+ ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
(function (ts) {
// https://semver.org/#spec-item-2
// > A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative
@@ -3068,32 +3120,34 @@ var ts;
SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType";
SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType";
SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature";
- SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag";
- SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 302] = "JSDocAuthorTag";
- SyntaxKind[SyntaxKind["JSDocClassTag"] = 303] = "JSDocClassTag";
- SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 304] = "JSDocCallbackTag";
- SyntaxKind[SyntaxKind["JSDocEnumTag"] = 305] = "JSDocEnumTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 306] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 307] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocThisTag"] = 308] = "JSDocThisTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 309] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 310] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 311] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 312] = "JSDocPropertyTag";
+ // https://jsdoc.app/about-namepaths.html
+ SyntaxKind[SyntaxKind["JSDocNamepathType"] = 297] = "JSDocNamepathType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 298] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 299] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocSignature"] = 300] = "JSDocSignature";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 301] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 302] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 303] = "JSDocAuthorTag";
+ SyntaxKind[SyntaxKind["JSDocClassTag"] = 304] = "JSDocClassTag";
+ SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 305] = "JSDocCallbackTag";
+ SyntaxKind[SyntaxKind["JSDocEnumTag"] = 306] = "JSDocEnumTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 307] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 308] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 309] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 310] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 311] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 312] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 313] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 313] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 314] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 314] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 315] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 316] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 317] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 318] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 315] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 316] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 317] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 318] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 319] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 319] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 320] = "Count";
// Markers
SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment";
@@ -3121,9 +3175,9 @@ var ts;
SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator";
SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode";
SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 312] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 312] = "LastJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 313] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 301] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 313] = "LastJSDocTagNode";
/* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword";
/* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
@@ -3249,6 +3303,8 @@ var ts;
/* @internal */
TokenFlags[TokenFlags["ContainsSeparator"] = 512] = "ContainsSeparator";
/* @internal */
+ TokenFlags[TokenFlags["UnicodeEscape"] = 1024] = "UnicodeEscape";
+ /* @internal */
TokenFlags[TokenFlags["BinaryOrOctalSpecifier"] = 384] = "BinaryOrOctalSpecifier";
/* @internal */
TokenFlags[TokenFlags["NumericLiteralFlags"] = 1008] = "NumericLiteralFlags";
@@ -3472,32 +3528,32 @@ var ts;
SymbolFlags[SymbolFlags["All"] = 67108863] = "All";
SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum";
SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable";
- SymbolFlags[SymbolFlags["Value"] = 67220415] = "Value";
- SymbolFlags[SymbolFlags["Type"] = 67897832] = "Type";
+ SymbolFlags[SymbolFlags["Value"] = 111551] = "Value";
+ SymbolFlags[SymbolFlags["Type"] = 788968] = "Type";
SymbolFlags[SymbolFlags["Namespace"] = 1920] = "Namespace";
SymbolFlags[SymbolFlags["Module"] = 1536] = "Module";
SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor";
// Variables can be redeclared, but can not redeclare a block-scoped declaration with the
// same name, or any other value that is not a variable, e.g. ValueModule or Class
- SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 67220414] = "FunctionScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 111550] = "FunctionScopedVariableExcludes";
// Block-scoped declarations are not allowed to be re-declared
// they can not merge with anything in the value space
- SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 67220415] = "BlockScopedVariableExcludes";
- SymbolFlags[SymbolFlags["ParameterExcludes"] = 67220415] = "ParameterExcludes";
+ SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 111551] = "BlockScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["ParameterExcludes"] = 111551] = "ParameterExcludes";
SymbolFlags[SymbolFlags["PropertyExcludes"] = 0] = "PropertyExcludes";
- SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 68008959] = "EnumMemberExcludes";
- SymbolFlags[SymbolFlags["FunctionExcludes"] = 67219887] = "FunctionExcludes";
- SymbolFlags[SymbolFlags["ClassExcludes"] = 68008383] = "ClassExcludes";
- SymbolFlags[SymbolFlags["InterfaceExcludes"] = 67897736] = "InterfaceExcludes";
- SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 68008191] = "RegularEnumExcludes";
- SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 68008831] = "ConstEnumExcludes";
+ SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes";
+ SymbolFlags[SymbolFlags["FunctionExcludes"] = 110991] = "FunctionExcludes";
+ SymbolFlags[SymbolFlags["ClassExcludes"] = 899503] = "ClassExcludes";
+ SymbolFlags[SymbolFlags["InterfaceExcludes"] = 788872] = "InterfaceExcludes";
+ SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes";
+ SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes";
SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 110735] = "ValueModuleExcludes";
SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes";
- SymbolFlags[SymbolFlags["MethodExcludes"] = 67212223] = "MethodExcludes";
- SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 67154879] = "GetAccessorExcludes";
- SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 67187647] = "SetAccessorExcludes";
- SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 67635688] = "TypeParameterExcludes";
- SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 67897832] = "TypeAliasExcludes";
+ SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes";
+ SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes";
+ SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes";
+ SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes";
+ SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes";
SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes";
SymbolFlags[SymbolFlags["ModuleMember"] = 2623475] = "ModuleMember";
SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal";
@@ -3825,8 +3881,11 @@ var ts;
ModuleKind[ModuleKind["AMD"] = 2] = "AMD";
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
ModuleKind[ModuleKind["System"] = 4] = "System";
+ // NOTE: ES module kinds should be contiguous to more easily check whether a module kind is *any* ES module kind.
+ // Non-ES module kinds should not come between ES2015 (the earliest ES module kind) and ESNext (the last ES
+ // module kind).
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
- ModuleKind[ModuleKind["ESNext"] = 6] = "ESNext";
+ ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
var JsxEmit;
(function (JsxEmit) {
@@ -3865,9 +3924,9 @@ var ts;
ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018";
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
- ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext";
+ ScriptTarget[ScriptTarget["ESNext"] = 99] = "ESNext";
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
- ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest";
+ ScriptTarget[ScriptTarget["Latest"] = 99] = "Latest";
})(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
var LanguageVariant;
(function (LanguageVariant) {
@@ -4563,6 +4622,38 @@ var ts;
}
}
ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
+ /* @internal */
+ function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
+ var cache = ts.createMap();
+ var callbacksCache = ts.createMultiMap();
+ var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
+ return function (fileName, callback, pollingInterval) {
+ var path = toCanonicalFileName(fileName);
+ var existing = cache.get(path);
+ if (existing) {
+ existing.refCount++;
+ }
+ else {
+ cache.set(path, {
+ watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval),
+ refCount: 1
+ });
+ }
+ callbacksCache.add(path, callback);
+ return {
+ close: function () {
+ var watcher = ts.Debug.assertDefined(cache.get(path));
+ callbacksCache.remove(path, callback);
+ watcher.refCount--;
+ if (watcher.refCount)
+ return;
+ cache.delete(path);
+ ts.closeFileWatcherOf(watcher);
+ }
+ };
+ };
+ }
+ ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
/**
* Returns true if file status changed
*/
@@ -4589,6 +4680,8 @@ var ts;
ts.getFileWatcherEventKind = getFileWatcherEventKind;
/*@internal*/
ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
+ /*@internal*/
+ ts.sysLog = ts.noop;
/**
* Watch the directory recursively using host provided method to watch child directories
* that means if this is recursive watcher, watch the children directories as well
@@ -4729,6 +4822,7 @@ var ts;
var Buffer = require("buffer").Buffer;
var nodeVersion = getNodeMajorVersion();
var isNode4OrLater = nodeVersion >= 4;
+ var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
var platform = _os.platform();
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
var FileSystemEntryKind;
@@ -4739,6 +4833,7 @@ var ts;
var useNonPollingWatchers = process.env.TSC_NONPOLLING_WATCHER;
var tscWatchFile = process.env.TSC_WATCHFILE;
var tscWatchDirectory = process.env.TSC_WATCHDIRECTORY;
+ var fsWatchFile = createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames);
var dynamicPollingWatchFile;
var nodeSystem = {
args: process.argv.slice(2),
@@ -4875,7 +4970,7 @@ var ts;
return useNonPollingWatchers ?
createNonPollingWatchFile() :
// Default to do not use polling interval as it is before this experiment branch
- function (fileName, callback) { return fsWatchFile(fileName, callback); };
+ function (fileName, callback) { return fsWatchFile(fileName, callback, /*pollingInterval*/ undefined); };
}
function getWatchDirectory() {
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
@@ -4949,7 +5044,7 @@ var ts;
return watcher;
}
}
- function fsWatchFile(fileName, callback, pollingInterval) {
+ function fsWatchFileWorker(fileName, callback, pollingInterval) {
_fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
var eventKind;
return {
@@ -5007,6 +5102,12 @@ var ts;
}
function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingWatchFile, pollingInterval) {
var options;
+ var lastDirectoryPartWithDirectorySeparator;
+ var lastDirectoryPart;
+ if (isLinuxOrMacOs) {
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
+ }
/** Watcher for the file system entry depending on whether it is missing or present */
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
watchMissingFileSystemEntry() :
@@ -5023,6 +5124,7 @@ var ts;
* @param createWatcher
*/
function invokeCallbackAndUpdateWatcher(createWatcher) {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
// Call the callback for current directory
callback("rename", "");
// If watcher is not closed, update it
@@ -5047,7 +5149,9 @@ var ts;
}
}
try {
- var presentWatcher = _fs.watch(fileOrDirectory, options, callback);
+ var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
+ callbackChangingToMissingFileSystemEntry :
+ callback);
// Watch the missing file or directory or error
presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
return presentWatcher;
@@ -5059,11 +5163,23 @@ var ts;
return watchPresentFileSystemEntryWithFsWatchFile();
}
}
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
+ return event === "rename" &&
+ (!relativeName ||
+ relativeName === lastDirectoryPart ||
+ relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length) &&
+ !fileSystemEntryExists(fileOrDirectory, entryKind) ?
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
+ callback(event, relativeName);
+ }
/**
* Watch the file or directory using fs.watchFile since fs.watch threw exception
* Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
*/
function watchPresentFileSystemEntryWithFsWatchFile() {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
return fallbackPollingWatchFile(fileOrDirectory, createFileWatcherCallback(callback), pollingInterval);
}
/**
@@ -5096,7 +5212,7 @@ var ts;
function createWatchDirectoryUsing(fsWatchFile) {
return function (directoryName, callback) { return fsWatchFile(directoryName, function () { return callback(directoryName); }, PollingInterval.Medium); };
}
- function readFile(fileName, _encoding) {
+ function readFileWorker(fileName, _encoding) {
if (!fileExists(fileName)) {
return undefined;
}
@@ -5124,7 +5240,14 @@ var ts;
// Default is UTF-8 with no byte order mark
return buffer.toString("utf8");
}
+ function readFile(fileName, _encoding) {
+ ts.perfLogger.logStartReadFile(fileName);
+ var file = readFileWorker(fileName, _encoding);
+ ts.perfLogger.logStopReadFile();
+ return file;
+ }
function writeFile(fileName, data, writeByteOrderMark) {
+ ts.perfLogger.logEvent("WriteFile: " + fileName);
// If a BOM is required, emit one
if (writeByteOrderMark) {
data = byteOrderMarkIndicator + data;
@@ -5141,6 +5264,7 @@ var ts;
}
}
function getAccessibleFileSystemEntries(path) {
+ ts.perfLogger.logEvent("ReadDir: " + (path || "."));
try {
var entries = _fs.readdirSync(path || ".").sort();
var files = [];
@@ -5196,6 +5320,7 @@ var ts;
return fileSystemEntryExists(path, 1 /* Directory */);
}
function getDirectories(path) {
+ ts.perfLogger.logEvent("ReadDir: " + path);
return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); });
}
function realpath(path) {
@@ -5386,7 +5511,6 @@ var ts;
A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."),
Invalid_reference_directive_syntax: diag(1084, ts.DiagnosticCategory.Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, ts.DiagnosticCategory.Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."),
- An_accessor_cannot_be_declared_in_an_ambient_context: diag(1086, ts.DiagnosticCategory.Error, "An_accessor_cannot_be_declared_in_an_ambient_context_1086", "An accessor cannot be declared in an ambient context."),
_0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."),
_0_modifier_cannot_appear_on_a_parameter: diag(1090, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."),
Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."),
@@ -5539,6 +5663,7 @@ var ts;
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
+ Keywords_cannot_contain_escape_characters: diag(1260, ts.DiagnosticCategory.Error, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -5571,7 +5696,7 @@ var ts;
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
- The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_option_1343", "The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options."),
+ The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system_1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'esnext' or 'system'."),
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness"),
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
@@ -6694,7 +6819,7 @@ var ts;
_a.of = 148 /* OfKeyword */,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */, "`": 59 /* BacktickToken */ }));
/*
As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
IdentifierStart ::
@@ -6741,6 +6866,14 @@ var ts;
*/
var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
+ /**
+ * Generated by scripts/regenerate-unicode-identifier-parts.js on node v12.4.0 with unicode 12.1
+ * based on http://www.unicode.org/reports/tr31/ and https://www.ecma-international.org/ecma-262/6.0/#sec-names-and-keywords
+ * unicodeESNextIdentifierStart corresponds to the ID_Start and Other_ID_Start property, and
+ * unicodeESNextIdentifierPart corresponds to ID_Continue, Other_ID_Continue, plus ID_Start and Other_ID_Start
+ */
+ var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3133, 3160, 3162, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101];
+ var unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3328, 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7673, 7675, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65071, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69376, 69404, 69415, 69415, 69424, 69456, 69600, 69622, 69632, 69702, 69734, 69743, 69759, 69818, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69958, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70096, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70206, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70751, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71680, 71738, 71840, 71913, 71935, 71935, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123584, 123641, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101, 917760, 917999];
function lookupInUnicodeMap(code, map) {
// Bail out quickly if it couldn't possibly be in the map.
if (code < map[0]) {
@@ -6767,15 +6900,17 @@ var ts;
return false;
}
/* @internal */ function isUnicodeIdentifierStart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
- lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierStart);
+ return languageVersion >= 2 /* ES2015 */ ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierStart) :
+ languageVersion === 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierStart);
}
ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;
function isUnicodeIdentifierPart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
- lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierPart);
+ return languageVersion >= 2 /* ES2015 */ ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierPart) :
+ languageVersion === 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierPart);
}
function makeReverseMap(source) {
var result = [];
@@ -7271,11 +7406,12 @@ var ts;
ts.isIdentifierPart = isIdentifierPart;
/* @internal */
function isIdentifierText(name, languageVersion) {
- if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {
+ var ch = codePointAt(name, 0);
+ if (!isIdentifierStart(ch, languageVersion)) {
return false;
}
- for (var i = 1; i < name.length; i++) {
- if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {
+ for (var i = charSize(ch); i < name.length; i += charSize(ch)) {
+ if (!isIdentifierPart(ch = codePointAt(name, i), languageVersion)) {
return false;
}
}
@@ -7306,6 +7442,7 @@ var ts;
getTokenPos: function () { return tokenPos; },
getTokenText: function () { return text.substring(tokenPos, pos); },
getTokenValue: function () { return tokenValue; },
+ hasUnicodeEscape: function () { return (tokenFlags & 1024 /* UnicodeEscape */) !== 0; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; },
@@ -7432,7 +7569,7 @@ var ts;
}
}
function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
- if (!isIdentifierStart(text.charCodeAt(pos), languageVersion)) {
+ if (!isIdentifierStart(codePointAt(text, pos), languageVersion)) {
return;
}
var identifierStart = pos;
@@ -7640,6 +7777,7 @@ var ts;
pos++;
return scanExtendedUnicodeEscape();
}
+ tokenFlags |= 1024 /* UnicodeEscape */;
// '\uDDDD'
return scanHexadecimalEscape(/*numDigits*/ 4);
case 120 /* x */:
@@ -7722,21 +7860,41 @@ var ts;
}
return -1;
}
+ function peekExtendedUnicodeEscape() {
+ if (languageVersion >= 2 /* ES2015 */ && codePointAt(text, pos + 1) === 117 /* u */ && codePointAt(text, pos + 2) === 123 /* openBrace */) {
+ var start_2 = pos;
+ pos += 3;
+ var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
+ var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
+ pos = start_2;
+ return escapedValue;
+ }
+ return -1;
+ }
function scanIdentifierParts() {
var result = "";
var start = pos;
while (pos < end) {
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
if (isIdentifierPart(ch, languageVersion)) {
- pos++;
+ pos += charSize(ch);
}
else if (ch === 92 /* backslash */) {
+ ch = peekExtendedUnicodeEscape();
+ if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ result += scanExtendedUnicodeEscape();
+ start = pos;
+ continue;
+ }
ch = peekUnicodeEscape();
if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
break;
}
+ tokenFlags |= 1024 /* UnicodeEscape */;
result += text.substring(start, pos);
- result += String.fromCharCode(ch);
+ result += utf16EncodeAsString(ch);
// Valid Unicode escape is always six characters
pos += 6;
start = pos;
@@ -7831,7 +7989,7 @@ var ts;
if (pos >= end) {
return token = 1 /* EndOfFileToken */;
}
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
// Special handling for shebang
if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) {
pos = scanShebangTrivia(text, pos);
@@ -8196,9 +8354,17 @@ var ts;
pos++;
return token = 58 /* AtToken */;
case 92 /* backslash */:
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
var cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
pos += 6;
+ tokenFlags |= 1024 /* UnicodeEscape */;
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
return token = getIdentifierToken();
}
@@ -8207,9 +8373,9 @@ var ts;
return token = 0 /* Unknown */;
default:
if (isIdentifierStart(ch, languageVersion)) {
- pos++;
- while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))
- pos++;
+ pos += charSize(ch);
+ while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion))
+ pos += charSize(ch);
tokenValue = text.substring(tokenPos, pos);
if (ch === 92 /* backslash */) {
tokenValue += scanIdentifierParts();
@@ -8217,16 +8383,16 @@ var ts;
return token = getIdentifierToken();
}
else if (isWhiteSpaceSingleLine(ch)) {
- pos++;
+ pos += charSize(ch);
continue;
}
else if (isLineBreak(ch)) {
tokenFlags |= 1 /* PrecedingLineBreak */;
- pos++;
+ pos += charSize(ch);
continue;
}
error(ts.Diagnostics.Invalid_character);
- pos++;
+ pos += charSize(ch);
return token = 0 /* Unknown */;
}
}
@@ -8343,7 +8509,7 @@ var ts;
// First non-whitespace character on this line.
var firstNonWhitespace = 0;
// These initial values are special because the first line is:
- // firstNonWhitespace = 0 to indicate that we want leading whitspace,
+ // firstNonWhitespace = 0 to indicate that we want leading whitespace,
while (pos < end) {
char = text.charCodeAt(pos);
if (char === 123 /* openBrace */) {
@@ -8377,17 +8543,22 @@ var ts;
// they allow dashes
function scanJsxIdentifier() {
if (tokenIsIdentifierOrKeyword(token)) {
- var firstCharPosition = pos;
+ // An identifier or keyword has already been parsed - check for a `-` and then append it and everything after it to the token
+ // Do note that this means that `scanJsxIdentifier` effectively _mutates_ the visible token without advancing to a new token
+ // Any caller should be expecting this behavior and should only read the pos or token value after calling it.
while (pos < end) {
var ch = text.charCodeAt(pos);
- if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
+ if (ch === 45 /* minus */) {
+ tokenValue += "-";
pos++;
+ continue;
}
- else {
+ var oldPos = pos;
+ tokenValue += scanIdentifierParts(); // reuse `scanIdentifierParts` so unicode escapes are handled
+ if (pos === oldPos) {
break;
}
}
- tokenValue += text.substring(firstCharPosition, pos);
}
return token;
}
@@ -8409,8 +8580,8 @@ var ts;
if (pos >= end) {
return token = 1 /* EndOfFileToken */;
}
- var ch = text.charCodeAt(pos);
- pos++;
+ var ch = codePointAt(text, pos);
+ pos += charSize(ch);
switch (ch) {
case 9 /* tab */:
case 11 /* verticalTab */:
@@ -8448,12 +8619,33 @@ var ts;
return token = 24 /* DotToken */;
case 96 /* backtick */:
return token = 59 /* BacktickToken */;
- }
- if (isIdentifierStart(ch, 8 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) {
+ case 92 /* backslash */:
+ pos--;
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
+ var cookedChar = peekUnicodeEscape();
+ if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
+ pos += 6;
+ tokenFlags |= 1024 /* UnicodeEscape */;
+ tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
pos++;
- }
+ return token = 0 /* Unknown */;
+ }
+ if (isIdentifierStart(ch, languageVersion)) {
+ var char = ch;
+ while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion))
+ pos += charSize(char);
tokenValue = text.substring(tokenPos, pos);
+ if (char === 92 /* backslash */) {
+ tokenValue += scanIdentifierParts();
+ }
return token = getIdentifierToken();
}
else {
@@ -8536,6 +8728,33 @@ var ts;
}
}
ts.createScanner = createScanner;
+ /* @internal */
+ var codePointAt = String.prototype.codePointAt ? function (s, i) { return s.codePointAt(i); } : function codePointAt(str, i) {
+ // from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt
+ var size = str.length;
+ // Account for out-of-bounds indices:
+ if (i < 0 || i >= size) {
+ return undefined; // String.codePointAt returns `undefined` for OOB indexes
+ }
+ // Get the first code unit
+ var first = str.charCodeAt(i);
+ // check if it’s the start of a surrogate pair
+ if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { // high surrogate and there is a next code unit
+ var second = str.charCodeAt(i + 1);
+ if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
+ // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
+ }
+ }
+ return first;
+ };
+ /* @internal */
+ function charSize(ch) {
+ if (ch >= 0x10000) {
+ return 2;
+ }
+ return 1;
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -8991,7 +9210,7 @@ var ts;
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 313 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 314 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -9049,6 +9268,8 @@ var ts;
return emitNode && emitNode.flags || 0;
}
ts.getEmitFlags = getEmitFlags;
+ var escapeNoSubstitutionTemplateLiteralText = ts.compose(escapeString, escapeTemplateSubstitution);
+ var escapeNonAsciiNoSubstitutionTemplateLiteralText = ts.compose(escapeNonAsciiString, escapeTemplateSubstitution);
function getLiteralText(node, sourceFile, neverAsciiEscape) {
// If we don't need to downlevel and we can reach the original source text using
// the node's parent reference, then simply get the text as it was originally written.
@@ -9056,7 +9277,11 @@ var ts;
ts.isBigIntLiteral(node))) {
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
}
- var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216 /* NoAsciiEscaping */) ? escapeString : escapeNonAsciiString;
+ // If a NoSubstitutionTemplateLiteral appears to have a substitution in it, the original text
+ // had to include a backslash: `not \${a} substitution`.
+ var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216 /* NoAsciiEscaping */) ?
+ node.kind === 14 /* NoSubstitutionTemplateLiteral */ ? escapeNoSubstitutionTemplateLiteralText : escapeString :
+ node.kind === 14 /* NoSubstitutionTemplateLiteral */ ? escapeNonAsciiNoSubstitutionTemplateLiteralText : escapeNonAsciiString;
// If we can't reach the original source text, use the canonical form if it's a number,
// or a (possibly escaped) quoted form of the original text if it's string-like.
switch (node.kind) {
@@ -9171,6 +9396,43 @@ var ts;
return ts.isExternalModule(node) || compilerOptions.isolatedModules || ((ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS) && !!node.commonJsModuleIndicator);
}
ts.isEffectiveExternalModule = isEffectiveExternalModule;
+ /**
+ * Returns whether the source file will be treated as if it were in strict mode at runtime.
+ */
+ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
+ // We can only verify strict mode for JS/TS files
+ switch (node.scriptKind) {
+ case 1 /* JS */:
+ case 3 /* TS */:
+ case 2 /* JSX */:
+ case 4 /* TSX */:
+ break;
+ default:
+ return false;
+ }
+ // Strict mode does not matter for declaration files.
+ if (node.isDeclarationFile) {
+ return false;
+ }
+ // If `alwaysStrict` is set, then treat the file as strict.
+ if (ts.getStrictOptionValue(compilerOptions, "alwaysStrict")) {
+ return true;
+ }
+ // Starting with a "use strict" directive indicates the file is strict.
+ if (ts.startsWithUseStrict(node.statements)) {
+ return true;
+ }
+ if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
+ // ECMAScript Modules are always strict.
+ if (ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
+ return true;
+ }
+ // Other modules are strict unless otherwise specified.
+ return !compilerOptions.noImplicitUseStrict;
+ }
+ return false;
+ }
+ ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile;
function isBlockScope(node, parentNode) {
switch (node.kind) {
case 285 /* SourceFile */:
@@ -9198,9 +9460,9 @@ var ts;
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
- case 299 /* JSDocSignature */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 300 /* JSDocSignature */:
return true;
default:
ts.assertType(node);
@@ -9221,7 +9483,7 @@ var ts;
case 210 /* ClassExpression */:
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
case 240 /* FunctionDeclaration */:
case 157 /* MethodDeclaration */:
case 158 /* Constructor */:
@@ -9449,6 +9711,12 @@ var ts;
return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */;
}
ts.isImportCall = isImportCall;
+ function isImportMeta(n) {
+ return ts.isMetaProperty(n)
+ && n.keywordToken === 93 /* ImportKeyword */
+ && n.name.escapedText === "meta";
+ }
+ ts.isImportMeta = isImportMeta;
function isLiteralImportTypeNode(n) {
return ts.isImportTypeNode(n) && ts.isLiteralTypeNode(n.argument) && ts.isStringLiteral(n.argument.literal);
}
@@ -9541,7 +9809,7 @@ var ts;
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
case 151 /* TypeParameter */:
return node === parent.constraint;
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return node === parent.constraint;
case 155 /* PropertyDeclaration */:
case 154 /* PropertySignature */:
@@ -10572,7 +10840,7 @@ var ts;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 311 /* JSDocTypedefTag */ || node.kind === 304 /* JSDocCallbackTag */;
+ return node.kind === 312 /* JSDocTypedefTag */ || node.kind === 305 /* JSDocCallbackTag */ || node.kind === 306 /* JSDocEnumTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -11022,6 +11290,10 @@ var ts;
return isKeyword(token) && !isContextualKeyword(token);
}
ts.isNonContextualKeyword = isNonContextualKeyword;
+ function isFutureReservedKeyword(token) {
+ return 110 /* FirstFutureReservedWord */ <= token && token <= 118 /* LastFutureReservedWord */;
+ }
+ ts.isFutureReservedKeyword = isFutureReservedKeyword;
function isStringANonContextualKeyword(name) {
var token = ts.stringToToken(name);
return token !== undefined && isNonContextualKeyword(token);
@@ -11281,7 +11553,7 @@ var ts;
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return 0;
case 209 /* SpreadElement */:
return 1;
@@ -11467,6 +11739,10 @@ var ts;
}
}
ts.createDiagnosticCollection = createDiagnosticCollection;
+ var templateSubstitutionRegExp = /\$\{/g;
+ function escapeTemplateSubstitution(str) {
+ return str.replace(templateSubstitutionRegExp, "\\${");
+ }
// This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator,
// paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in
// the language service. These characters should be escaped when printing, and if any characters are added,
@@ -11835,6 +12111,7 @@ var ts;
return accessor.parameters[hasThis ? 1 : 0];
}
}
+ ts.getSetAccessorValueParameter = getSetAccessorValueParameter;
/** Get the type annotation for the value parameter. */
function getSetAccessorTypeAnnotationNode(accessor) {
var parameter = getSetAccessorValueParameter(accessor);
@@ -11943,7 +12220,7 @@ var ts;
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
/** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 298 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
}
/**
* Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -12734,8 +13011,8 @@ var ts;
/**
* Mutates the map with newMap such that keys in map will be same as newMap.
*/
- function mutateMap(map, newMap, options) {
- var createNewValue = options.createNewValue, onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
+ function mutateMapSkippingNewValues(map, newMap, options) {
+ var onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
// Needs update
map.forEach(function (existingValue, key) {
var valueInNewMap = newMap.get(key);
@@ -12749,6 +13026,15 @@ var ts;
onExistingValue(existingValue, valueInNewMap, key);
}
});
+ }
+ ts.mutateMapSkippingNewValues = mutateMapSkippingNewValues;
+ /**
+ * Mutates the map with newMap such that keys in map will be same as newMap.
+ */
+ function mutateMap(map, newMap, options) {
+ // Needs update
+ mutateMapSkippingNewValues(map, newMap, options);
+ var createNewValue = options.createNewValue;
// Add new values that are not already present
newMap.forEach(function (valueInNewMap, key) {
if (!map.has(key)) {
@@ -12885,7 +13171,7 @@ var ts;
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 8 /* ESNext */:
+ case 99 /* ESNext */:
return "lib.esnext.full.d.ts";
case 7 /* ES2020 */:
return "lib.es2020.full.d.ts";
@@ -13305,6 +13591,9 @@ var ts;
break;
case 222 /* ExpressionStatement */:
var expr = hostNode.expression;
+ if (expr.kind === 205 /* BinaryExpression */ && expr.operatorToken.kind === 60 /* EqualsToken */) {
+ expr = expr.left;
+ }
switch (expr.kind) {
case 190 /* PropertyAccessExpression */:
return expr.name;
@@ -13344,8 +13633,8 @@ var ts;
switch (declaration.kind) {
case 73 /* Identifier */:
return declaration;
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */: {
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */: {
var name = declaration.name;
if (name.kind === 149 /* QualifiedName */) {
return name.right;
@@ -13369,8 +13658,10 @@ var ts;
return undefined;
}
}
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
+ case 306 /* JSDocEnumTag */:
+ return nameForNamelessJSDocTypedef(declaration);
case 255 /* ExportAssignment */: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
@@ -13576,7 +13867,7 @@ var ts;
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 298 /* JSDocComment */);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -13848,7 +14139,7 @@ var ts;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 315 /* PartiallyEmittedExpression */) {
+ while (node.kind === 316 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
@@ -14260,67 +14551,67 @@ var ts;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 297 /* JSDocComment */;
+ return node.kind === 298 /* JSDocComment */;
}
ts.isJSDoc = isJSDoc;
function isJSDocAuthorTag(node) {
- return node.kind === 302 /* JSDocAuthorTag */;
+ return node.kind === 303 /* JSDocAuthorTag */;
}
ts.isJSDocAuthorTag = isJSDocAuthorTag;
function isJSDocAugmentsTag(node) {
- return node.kind === 301 /* JSDocAugmentsTag */;
+ return node.kind === 302 /* JSDocAugmentsTag */;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 303 /* JSDocClassTag */;
+ return node.kind === 304 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 305 /* JSDocEnumTag */;
+ return node.kind === 306 /* JSDocEnumTag */;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 308 /* JSDocThisTag */;
+ return node.kind === 309 /* JSDocThisTag */;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 306 /* JSDocParameterTag */;
+ return node.kind === 307 /* JSDocParameterTag */;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 307 /* JSDocReturnTag */;
+ return node.kind === 308 /* JSDocReturnTag */;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 309 /* JSDocTypeTag */;
+ return node.kind === 310 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 310 /* JSDocTemplateTag */;
+ return node.kind === 311 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 311 /* JSDocTypedefTag */;
+ return node.kind === 312 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 312 /* JSDocPropertyTag */;
+ return node.kind === 313 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 312 /* JSDocPropertyTag */ || node.kind === 306 /* JSDocParameterTag */;
+ return node.kind === 313 /* JSDocPropertyTag */ || node.kind === 307 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 298 /* JSDocTypeLiteral */;
+ return node.kind === 299 /* JSDocTypeLiteral */;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 304 /* JSDocCallbackTag */;
+ return node.kind === 305 /* JSDocCallbackTag */;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 299 /* JSDocSignature */;
+ return node.kind === 300 /* JSDocSignature */;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
@@ -14331,7 +14622,7 @@ var ts;
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 313 /* SyntaxList */;
+ return n.kind === 314 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -14483,7 +14774,7 @@ var ts;
switch (kind) {
case 156 /* MethodSignature */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 162 /* ConstructSignature */:
case 163 /* IndexSignature */:
case 166 /* FunctionType */:
@@ -14778,8 +15069,8 @@ var ts;
case 209 /* SpreadElement */:
case 213 /* AsExpression */:
case 211 /* OmittedExpression */:
- case 316 /* CommaListExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 317 /* CommaListExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -14793,12 +15084,12 @@ var ts;
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 315 /* PartiallyEmittedExpression */;
+ return node.kind === 316 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 314 /* NotEmittedStatement */;
+ return node.kind === 315 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -14909,9 +15200,9 @@ var ts;
|| kind === 243 /* TypeAliasDeclaration */
|| kind === 151 /* TypeParameter */
|| kind === 238 /* VariableDeclaration */
- || kind === 311 /* JSDocTypedefTag */
- || kind === 304 /* JSDocCallbackTag */
- || kind === 312 /* JSDocPropertyTag */;
+ || kind === 312 /* JSDocTypedefTag */
+ || kind === 305 /* JSDocCallbackTag */
+ || kind === 313 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
return kind === 240 /* FunctionDeclaration */
@@ -14946,14 +15237,14 @@ var ts;
|| kind === 220 /* VariableStatement */
|| kind === 225 /* WhileStatement */
|| kind === 232 /* WithStatement */
- || kind === 314 /* NotEmittedStatement */
- || kind === 318 /* EndOfDeclarationMarker */
- || kind === 317 /* MergeDeclarationMarker */;
+ || kind === 315 /* NotEmittedStatement */
+ || kind === 319 /* EndOfDeclarationMarker */
+ || kind === 318 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
if (node.kind === 151 /* TypeParameter */) {
- return (node.parent && node.parent.kind !== 310 /* JSDocTemplateTag */) || ts.isInJSFile(node);
+ return (node.parent && node.parent.kind !== 311 /* JSDocTemplateTag */) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -15048,18 +15339,18 @@ var ts;
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 312 /* LastJSDocNode */;
+ return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 313 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 298 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 312 /* LastJSDocTagNode */;
+ return node.kind >= 301 /* FirstJSDocTagNode */ && node.kind <= 313 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
@@ -17090,7 +17381,7 @@ var ts;
return visitNode(cbNode, node.expression);
case 259 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
case 261 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
@@ -17128,26 +17419,26 @@ var ts;
case 295 /* JSDocFunctionType */:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 297 /* JSDocComment */:
+ case 298 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 302 /* JSDocAuthorTag */:
+ case 303 /* JSDocAuthorTag */:
return visitNode(cbNode, node.tagName);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
node.typeExpression.kind === 289 /* JSDocTypeExpression */
@@ -17155,26 +17446,26 @@ var ts;
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 304 /* JSDocCallbackTag */:
+ case 305 /* JSDocCallbackTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 308 /* JSDocThisTag */:
- case 305 /* JSDocEnumTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 309 /* JSDocThisTag */:
+ case 306 /* JSDocEnumTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 300 /* JSDocTag */:
- case 303 /* JSDocClassTag */:
+ case 301 /* JSDocTag */:
+ case 304 /* JSDocClassTag */:
return visitNode(cbNode, node.tagName);
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -17183,12 +17474,14 @@ var ts;
if (setParentNodes === void 0) { setParentNodes = false; }
ts.performance.mark("beforeParse");
var result;
+ ts.perfLogger.logStartParseSourceFile(fileName);
if (languageVersion === 100 /* JSON */) {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, 6 /* JSON */);
}
else {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
}
+ ts.perfLogger.logStopParseSourceFile();
ts.performance.mark("afterParse");
ts.performance.measure("Parse", "beforeParse", "afterParse");
return result;
@@ -17254,7 +17547,7 @@ var ts;
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
+ var scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ true);
var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
@@ -17272,6 +17565,7 @@ var ts;
var identifiers;
var identifierCount;
var parsingContext;
+ var notParenthesizedArrow;
// Flags that dictate what parsing context we're in. For example:
// Whether or not we are in strict parsing mode. All that changes in strict parsing mode is
// that some tokens that would be considered identifiers may be considered keywords.
@@ -17479,6 +17773,7 @@ var ts;
identifiers = undefined;
syntaxCursor = undefined;
sourceText = undefined;
+ notParenthesizedArrow = undefined;
}
function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {
var isDeclarationFile = isDeclarationFileName(fileName);
@@ -17688,9 +17983,17 @@ var ts;
function token() {
return currentToken;
}
- function nextToken() {
+ function nextTokenWithoutCheck() {
return currentToken = scanner.scan();
}
+ function nextToken() {
+ // if the keyword had an escape
+ if (ts.isKeyword(currentToken) && (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape())) {
+ // issue a parse error for the escape
+ parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), ts.Diagnostics.Keywords_cannot_contain_escape_characters);
+ }
+ return nextTokenWithoutCheck();
+ }
function nextTokenJSDoc() {
return currentToken = scanner.scanJsDocToken();
}
@@ -17929,7 +18232,7 @@ var ts;
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
- nextToken();
+ nextTokenWithoutCheck();
return finishNode(node);
}
// Only for end of file because the error gets reported incorrectly on embedded script tags.
@@ -18839,6 +19142,23 @@ var ts;
}
function parseJSDocType() {
scanner.setInJSDocType(true);
+ var moduleSpecifier = parseOptionalToken(131 /* ModuleKeyword */);
+ if (moduleSpecifier) {
+ var moduleTag = createNode(297 /* JSDocNamepathType */, moduleSpecifier.pos);
+ terminate: while (true) {
+ switch (token()) {
+ case 19 /* CloseBraceToken */:
+ case 1 /* EndOfFileToken */:
+ case 27 /* CommaToken */:
+ case 5 /* WhitespaceTrivia */:
+ break terminate;
+ default:
+ nextTokenJSDoc();
+ }
+ }
+ scanner.setInJSDocType(false);
+ return finishNode(moduleTag);
+ }
var dotdotdot = parseOptionalToken(25 /* DotDotDotToken */);
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
@@ -19962,7 +20282,15 @@ var ts;
}
}
function parsePossibleParenthesizedArrowFunctionExpressionHead() {
- return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ var tokenPos = scanner.getTokenPos();
+ if (notParenthesizedArrow && notParenthesizedArrow.has(tokenPos.toString())) {
+ return undefined;
+ }
+ var result = parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ if (!result) {
+ (notParenthesizedArrow || (notParenthesizedArrow = ts.createMap())).set(tokenPos.toString(), true);
+ }
+ return result;
}
function tryParseAsyncSimpleArrowFunctionExpression() {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
@@ -22373,8 +22701,8 @@ var ts;
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
+ initializeState(content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 99 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -22396,9 +22724,9 @@ var ts;
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion
- var jsDoc = parseJSDocCommentWorker(start, length);
+ var jsDoc = doInsideOfContext(2097152 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
var diagnostics = parseDiagnostics;
clearState();
return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined;
@@ -22409,7 +22737,7 @@ var ts;
var saveToken = currentToken;
var saveParseDiagnosticsLength = parseDiagnostics.length;
var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
- var comment = parseJSDocCommentWorker(start, length);
+ var comment = doInsideOfContext(2097152 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
if (comment) {
comment.parent = parent;
}
@@ -22548,7 +22876,7 @@ var ts;
}
}
function createJSDocComment() {
- var result = createNode(297 /* JSDocComment */, start);
+ var result = createNode(298 /* JSDocComment */, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -22748,7 +23076,7 @@ var ts;
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(300 /* JSDocTag */, start);
+ var result = createNode(301 /* JSDocTag */, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -22811,8 +23139,8 @@ var ts;
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(312 /* JSDocPropertyTag */, start) :
- createNode(306 /* JSDocParameterTag */, start);
+ createNode(313 /* JSDocPropertyTag */, start) :
+ createNode(307 /* JSDocParameterTag */, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -22832,15 +23160,15 @@ var ts;
var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
- var start_2 = scanner.getStartPos();
+ var start_3 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 306 /* JSDocParameterTag */ || child.kind === 312 /* JSDocPropertyTag */) {
+ if (child.kind === 307 /* JSDocParameterTag */ || child.kind === 313 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2);
+ jsdocTypeLiteral = createNode(299 /* JSDocTypeLiteral */, start_3);
jsdocTypeLiteral.jsDocPropertyTags = children;
if (typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
@@ -22854,7 +23182,7 @@ var ts;
if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307 /* JSDocReturnTag */, start);
+ var result = createNode(308 /* JSDocReturnTag */, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
@@ -22863,13 +23191,13 @@ var ts;
if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(309 /* JSDocTypeTag */, start);
+ var result = createNode(310 /* JSDocTypeTag */, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
return finishNode(result);
}
function parseAuthorTag(start, tagName, indent) {
- var result = createNode(302 /* JSDocAuthorTag */, start);
+ var result = createNode(303 /* JSDocAuthorTag */, start);
result.tagName = tagName;
var authorInfoWithEmail = tryParse(function () { return tryParseAuthorNameAndEmail(); });
if (!authorInfoWithEmail) {
@@ -22923,7 +23251,7 @@ var ts;
}
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(301 /* JSDocAugmentsTag */, start);
+ var result = createNode(302 /* JSDocAugmentsTag */, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
@@ -22950,19 +23278,19 @@ var ts;
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(303 /* JSDocClassTag */, start);
+ var tag = createNode(304 /* JSDocClassTag */, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(308 /* JSDocThisTag */, start);
+ var tag = createNode(309 /* JSDocThisTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(305 /* JSDocEnumTag */, start);
+ var tag = createNode(306 /* JSDocEnumTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
@@ -22971,7 +23299,7 @@ var ts;
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(311 /* JSDocTypedefTag */, start);
+ var typedefTag = createNode(312 /* JSDocTypedefTag */, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -22985,9 +23313,9 @@ var ts;
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start);
+ jsdocTypeLiteral = createNode(299 /* JSDocTypeLiteral */, start);
}
- if (child.kind === 309 /* JSDocTypeTag */) {
+ if (child.kind === 310 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -23033,14 +23361,14 @@ var ts;
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(304 /* JSDocCallbackTag */, start);
+ var callbackTag = createNode(305 /* JSDocCallbackTag */, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(299 /* JSDocSignature */, start);
+ var jsdocSignature = createNode(300 /* JSDocSignature */, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -23048,7 +23376,7 @@ var ts;
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58 /* AtToken */)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 307 /* JSDocReturnTag */) {
+ if (tag && tag.kind === 308 /* JSDocReturnTag */) {
return tag;
}
}
@@ -23093,7 +23421,7 @@ var ts;
case 58 /* AtToken */:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 306 /* JSDocParameterTag */ || child.kind === 312 /* JSDocPropertyTag */) &&
+ if (child && (child.kind === 307 /* JSDocParameterTag */ || child.kind === 313 /* JSDocPropertyTag */) &&
target !== 4 /* CallbackParameter */ &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -23163,7 +23491,7 @@ var ts;
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27 /* CommaToken */));
- var result = createNode(310 /* JSDocTemplateTag */, start);
+ var result = createNode(311 /* JSDocTemplateTag */, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
@@ -23198,16 +23526,19 @@ var ts;
if (!ts.tokenIsIdentifierOrKeyword(token())) {
return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
}
+ identifierCount++;
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
var result = createNode(73 /* Identifier */, pos);
- result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
+ if (token() !== 73 /* Identifier */) {
+ result.originalKeywordKind = token();
+ }
+ result.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
finishNode(result, end);
nextTokenJSDoc();
return result;
}
}
- JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker;
})(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {}));
})(Parser || (Parser = {}));
var IncrementalParser;
@@ -24124,7 +24455,7 @@ var ts;
es2018: 5 /* ES2018 */,
es2019: 6 /* ES2019 */,
es2020: 7 /* ES2020 */,
- esnext: 8 /* ESNext */,
+ esnext: 99 /* ESNext */,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
@@ -25492,10 +25823,10 @@ var ts;
var config = __assign({ compilerOptions: __assign({}, ts.arrayFrom(optionMap.entries()).reduce(function (prev, cur) {
var _a;
return (__assign({}, prev, (_a = {}, _a[cur[0]] = cur[1], _a)));
- }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath, originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
+ }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath ? r.originalPath : "", originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
include: filterSameAsDefaultInclude(configParseResult.configFileSpecs.validatedIncludeSpecs),
exclude: configParseResult.configFileSpecs.validatedExcludeSpecs
- } : {}), { compilerOnSave: !!configParseResult.compileOnSave ? true : undefined });
+ } : {}), { compileOnSave: !!configParseResult.compileOnSave ? true : undefined });
return config;
}
ts.convertToTSConfig = convertToTSConfig;
@@ -27020,6 +27351,7 @@ var ts;
trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
}
}
+ ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
switch (moduleResolution) {
case ts.ModuleResolutionKind.NodeJs:
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
@@ -27030,6 +27362,9 @@ var ts;
default:
return ts.Debug.fail("Unexpected moduleResolution: " + moduleResolution);
}
+ if (result && result.resolvedModule)
+ ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
+ ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
if (perFolderCache) {
perFolderCache.set(moduleName, result);
if (!ts.isExternalModuleNameRelative(moduleName)) {
@@ -27862,7 +28197,9 @@ var ts;
var binder = createBinder();
function bindSourceFile(file, options) {
ts.performance.mark("beforeBind");
+ ts.perfLogger.logStartBindFile("" + file.fileName);
binder(file, options);
+ ts.perfLogger.logStopBindFile();
ts.performance.mark("afterBind");
ts.performance.measure("Bind", "beforeBind", "afterBind");
}
@@ -27975,7 +28312,7 @@ var ts;
if (symbol.constEnumOnlyModule && (symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */))) {
symbol.constEnumOnlyModule = false;
}
- if (symbolFlags & 67220415 /* Value */) {
+ if (symbolFlags & 111551 /* Value */) {
setValueDeclaration(symbol, node);
}
}
@@ -28019,7 +28356,7 @@ var ts;
return "__constructor" /* Constructor */;
case 166 /* FunctionType */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return "__call" /* Call */;
case 167 /* ConstructorType */:
case 162 /* ConstructSignature */:
@@ -28204,10 +28541,10 @@ var ts;
if (ts.isJSDocTypeAlias(node))
ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file.
if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32 /* ExportContext */)) || ts.isJSDocTypeAlias(node)) {
- if (ts.hasModifier(node, 512 /* Default */) && !getDeclarationName(node)) {
+ if (!container.locals || (ts.hasModifier(node, 512 /* Default */) && !getDeclarationName(node))) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default!
}
- var exportKind = symbolFlags & 67220415 /* Value */ ? 1048576 /* ExportValue */ : 0;
+ var exportKind = symbolFlags & 111551 /* Value */ ? 1048576 /* ExportValue */ : 0;
var local = declareSymbol(container.locals, /*parent*/ undefined, node, exportKind, symbolExcludes);
local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
node.localSymbol = local;
@@ -28437,8 +28774,9 @@ var ts;
case 192 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
bindJSDocTypeAlias(node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
@@ -29095,7 +29433,7 @@ var ts;
}
function bindJSDocTypeAlias(node) {
node.tagName.parent = node;
- if (node.fullName) {
+ if (node.kind !== 306 /* JSDocEnumTag */ && node.fullName) {
setParentPointers(node, node.fullName);
}
}
@@ -29129,7 +29467,7 @@ var ts;
case 244 /* EnumDeclaration */:
case 189 /* ObjectLiteralExpression */:
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 269 /* JsxAttributes */:
return 1 /* IsContainer */;
case 242 /* InterfaceDeclaration */:
@@ -29151,7 +29489,7 @@ var ts;
case 159 /* GetAccessor */:
case 160 /* SetAccessor */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 295 /* JSDocFunctionType */:
case 166 /* FunctionType */:
case 162 /* ConstructSignature */:
@@ -29214,7 +29552,7 @@ var ts;
case 244 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 189 /* ObjectLiteralExpression */:
case 242 /* InterfaceDeclaration */:
case 269 /* JsxAttributes */:
@@ -29228,7 +29566,7 @@ var ts;
case 167 /* ConstructorType */:
case 161 /* CallSignature */:
case 162 /* ConstructSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 163 /* IndexSignature */:
case 157 /* MethodDeclaration */:
case 156 /* MethodSignature */:
@@ -29239,8 +29577,8 @@ var ts;
case 197 /* FunctionExpression */:
case 198 /* ArrowFunction */:
case 295 /* JSDocFunctionType */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
case 243 /* TypeAliasDeclaration */:
case 182 /* MappedType */:
// All the children of these container types are never visible through another
@@ -29421,9 +29759,21 @@ var ts;
currentFlow = { flags: 2 /* Start */ };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
+ var declName = ts.getNameOfDeclaration(typeAlias);
+ if ((ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName) && declName && ts.isPropertyAccessEntityNameExpression(declName.parent)) {
+ // typedef anchored to an A.B.C assignment - we need to bind into B's namespace under name C
+ var isTopLevel = isTopLevelNamespaceAssignment(declName.parent);
+ if (isTopLevel) {
+ bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
+ var oldContainer = container;
+ container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
+ declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
+ container = oldContainer;
+ }
+ }
+ else if (ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
parent = typeAlias.parent;
- bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
}
else {
bind(typeAlias.fullName);
@@ -29442,7 +29792,8 @@ var ts;
node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ &&
node.originalKeywordKind <= 118 /* LastFutureReservedWord */ &&
!ts.isIdentifierName(node) &&
- !(node.flags & 4194304 /* Ambient */)) {
+ !(node.flags & 4194304 /* Ambient */) &&
+ !(node.flags & 2097152 /* JSDoc */)) {
// Report error only if there are no parse errors in file
if (!file.parseDiagnostics.length) {
file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));
@@ -29695,7 +30046,7 @@ var ts;
while (parentNode && !ts.isJSDocTypeAlias(parentNode)) {
parentNode = parentNode.parent;
}
- bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
break;
}
// falls through
@@ -29716,7 +30067,7 @@ var ts;
file.commonJsModuleIndicator &&
ts.isModuleExportsPropertyAccessExpression(node) &&
!lookupSymbolForNameWorker(blockScopeContainer, "module")) {
- declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */);
+ declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 111550 /* FunctionScopedVariableExcludes */);
}
break;
case 205 /* BinaryExpression */:
@@ -29782,7 +30133,7 @@ var ts;
case 277 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
case 279 /* EnumMember */:
- return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */);
case 161 /* CallSignature */:
case 162 /* ConstructSignature */:
case 163 /* IndexSignature */:
@@ -29793,22 +30144,22 @@ var ts;
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
- return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */);
case 240 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
case 158 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
case 159 /* GetAccessor */:
- return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */);
case 160 /* SetAccessor */:
- return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 78783 /* SetAccessorExcludes */);
case 166 /* FunctionType */:
case 295 /* JSDocFunctionType */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 167 /* ConstructorType */:
return bindFunctionOrConstructorType(node);
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 182 /* MappedType */:
return bindAnonymousTypeWorker(node);
case 189 /* ObjectLiteralExpression */:
@@ -29841,9 +30192,9 @@ var ts;
inStrictMode = true;
return bindClassLikeDeclaration(node);
case 242 /* InterfaceDeclaration */:
- return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */);
+ return bindBlockScopedDeclaration(node, 64 /* Interface */, 788872 /* InterfaceExcludes */);
case 243 /* TypeAliasDeclaration */:
- return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
case 244 /* EnumDeclaration */:
return bindEnumDeclaration(node);
case 245 /* ModuleDeclaration */:
@@ -29877,22 +30228,23 @@ var ts;
// falls through
case 246 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
- case 306 /* JSDocParameterTag */:
- if (node.parent.kind === 299 /* JSDocSignature */) {
+ case 307 /* JSDocParameterTag */:
+ if (node.parent.kind === 300 /* JSDocSignature */) {
return bindParameter(node);
}
- if (node.parent.kind !== 298 /* JSDocTypeLiteral */) {
+ if (node.parent.kind !== 299 /* JSDocTypeLiteral */) {
break;
}
// falls through
- case 312 /* JSDocPropertyTag */:
+ case 313 /* JSDocPropertyTag */:
var propTag = node;
var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -30070,7 +30422,7 @@ var ts;
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220414 /* FunctionScopedVariableExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
}
break;
default:
@@ -30151,7 +30503,7 @@ var ts;
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false);
}
function bindPotentiallyMissingNamespaces(namespaceSymbol, entityName, isToplevel, isPrototypeProperty) {
- if (isToplevel && !isPrototypeProperty && (!namespaceSymbol || !(namespaceSymbol.flags & 1920 /* Namespace */))) {
+ if (isToplevel && !isPrototypeProperty) {
// make symbols or add declarations for intermediate containers
var flags_1 = 1536 /* Module */ | 67108864 /* Assignment */;
var excludeFlags_1 = 110735 /* ValueModuleExcludes */ & ~67108864 /* Assignment */;
@@ -30179,14 +30531,17 @@ var ts;
(namespaceSymbol.exports || (namespaceSymbol.exports = ts.createSymbolTable()));
var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedExpandoInitializer(declaration));
var includes = isMethod ? 8192 /* Method */ : 4 /* Property */;
- var excludes = isMethod ? 67212223 /* MethodExcludes */ : 0 /* PropertyExcludes */;
+ var excludes = isMethod ? 103359 /* MethodExcludes */ : 0 /* PropertyExcludes */;
declareSymbol(symbolTable, namespaceSymbol, declaration, includes | 67108864 /* Assignment */, excludes & ~67108864 /* Assignment */);
}
+ function isTopLevelNamespaceAssignment(propertyAccess) {
+ return ts.isBinaryExpression(propertyAccess.parent)
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
+ : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
+ }
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
- var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
- : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
+ var isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -30257,7 +30612,7 @@ var ts;
}
function bindClassLikeDeclaration(node) {
if (node.kind === 241 /* ClassDeclaration */) {
- bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */);
+ bindBlockScopedDeclaration(node, 32 /* Class */, 899503 /* ClassExcludes */);
}
else {
var bindingName = node.name ? node.name.escapedText : "__class" /* Class */;
@@ -30290,19 +30645,16 @@ var ts;
}
function bindEnumDeclaration(node) {
return ts.isEnumConst(node)
- ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 68008831 /* ConstEnumExcludes */)
- : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 68008191 /* RegularEnumExcludes */);
+ ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */)
+ : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */);
}
function bindVariableDeclarationOrBindingElement(node) {
if (inStrictMode) {
checkStrictModeEvalOrArguments(node, node.name);
}
if (!ts.isBindingPattern(node.name)) {
- var isEnum = ts.isInJSFile(node) && !!ts.getJSDocEnumTag(node);
- var enumFlags = (isEnum ? 256 /* RegularEnum */ : 0 /* None */);
- var enumExcludes = (isEnum ? 68008191 /* RegularEnumExcludes */ : 0 /* None */);
if (ts.isBlockOrCatchScoped(node)) {
- bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */ | enumFlags, 67220415 /* BlockScopedVariableExcludes */ | enumExcludes);
+ bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
}
else if (ts.isParameterDeclaration(node)) {
// It is safe to walk up parent chain to find whether the node is a destructuring parameter declaration
@@ -30314,15 +30666,15 @@ var ts;
// function foo([a,a]) {} // Duplicate Identifier error
// function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter
// // which correctly set excluded symbols
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220415 /* ParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */ | enumFlags, 67220414 /* FunctionScopedVariableExcludes */ | enumExcludes);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
}
}
}
function bindParameter(node) {
- if (node.kind === 306 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) {
+ if (node.kind === 307 /* JSDocParameterTag */ && container.kind !== 300 /* JSDocSignature */) {
return;
}
if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) {
@@ -30334,7 +30686,7 @@ var ts;
bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, "__" + node.parent.parameters.indexOf(node));
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220415 /* ParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
}
// If this is a property-parameter, then also declare the property symbol into the
// containing class.
@@ -30352,10 +30704,10 @@ var ts;
checkStrictModeFunctionName(node);
if (inStrictMode) {
checkStrictModeFunctionDeclaration(node);
- bindBlockScopedDeclaration(node, 16 /* Function */, 67219887 /* FunctionExcludes */);
+ bindBlockScopedDeclaration(node, 16 /* Function */, 110991 /* FunctionExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 67219887 /* FunctionExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 110991 /* FunctionExcludes */);
}
}
function bindFunctionExpression(node) {
@@ -30393,10 +30745,10 @@ var ts;
if (!container_1.locals) {
container_1.locals = ts.createSymbolTable();
}
- declareSymbol(container_1.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbol(container_1.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
}
else if (node.parent.kind === 177 /* InferType */) {
@@ -30405,14 +30757,14 @@ var ts;
if (!container_2.locals) {
container_2.locals = ts.createSymbolTable();
}
- declareSymbol(container_2.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbol(container_2.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
else {
bindAnonymousDeclaration(node, 262144 /* TypeParameter */, getDeclarationName(node)); // TODO: GH#18217
}
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
}
// reachability checks
@@ -31023,7 +31375,7 @@ var ts;
break;
case 195 /* TypeAssertionExpression */:
case 213 /* AsExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
excludeFlags = 536870912 /* OuterExpressionExcludes */;
@@ -31282,7 +31634,7 @@ var ts;
return 536875008 /* BindingPatternExcludes */;
case 195 /* TypeAssertionExpression */:
case 213 /* AsExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
case 196 /* ParenthesizedExpression */:
case 99 /* SuperKeyword */:
return 536870912 /* OuterExpressionExcludes */;
@@ -31513,6 +31865,179 @@ var ts;
WideningKind[WideningKind["Normal"] = 0] = "Normal";
WideningKind[WideningKind["GeneratorYield"] = 1] = "GeneratorYield";
})(WideningKind || (WideningKind = {}));
+ var TypeFacts;
+ (function (TypeFacts) {
+ TypeFacts[TypeFacts["None"] = 0] = "None";
+ TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
+ TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
+ TypeFacts[TypeFacts["TypeofEQBigInt"] = 4] = "TypeofEQBigInt";
+ TypeFacts[TypeFacts["TypeofEQBoolean"] = 8] = "TypeofEQBoolean";
+ TypeFacts[TypeFacts["TypeofEQSymbol"] = 16] = "TypeofEQSymbol";
+ TypeFacts[TypeFacts["TypeofEQObject"] = 32] = "TypeofEQObject";
+ TypeFacts[TypeFacts["TypeofEQFunction"] = 64] = "TypeofEQFunction";
+ TypeFacts[TypeFacts["TypeofEQHostObject"] = 128] = "TypeofEQHostObject";
+ TypeFacts[TypeFacts["TypeofNEString"] = 256] = "TypeofNEString";
+ TypeFacts[TypeFacts["TypeofNENumber"] = 512] = "TypeofNENumber";
+ TypeFacts[TypeFacts["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt";
+ TypeFacts[TypeFacts["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean";
+ TypeFacts[TypeFacts["TypeofNESymbol"] = 4096] = "TypeofNESymbol";
+ TypeFacts[TypeFacts["TypeofNEObject"] = 8192] = "TypeofNEObject";
+ TypeFacts[TypeFacts["TypeofNEFunction"] = 16384] = "TypeofNEFunction";
+ TypeFacts[TypeFacts["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject";
+ TypeFacts[TypeFacts["EQUndefined"] = 65536] = "EQUndefined";
+ TypeFacts[TypeFacts["EQNull"] = 131072] = "EQNull";
+ TypeFacts[TypeFacts["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull";
+ TypeFacts[TypeFacts["NEUndefined"] = 524288] = "NEUndefined";
+ TypeFacts[TypeFacts["NENull"] = 1048576] = "NENull";
+ TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
+ TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
+ TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
+ TypeFacts[TypeFacts["All"] = 16777215] = "All";
+ // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
+ // The presence of a particular fact means that the given test is true for some (and possibly all) values
+ // of that kind of type.
+ TypeFacts[TypeFacts["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts";
+ TypeFacts[TypeFacts["BaseStringFacts"] = 12582401] = "BaseStringFacts";
+ TypeFacts[TypeFacts["StringStrictFacts"] = 16317953] = "StringStrictFacts";
+ TypeFacts[TypeFacts["StringFacts"] = 16776705] = "StringFacts";
+ TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts";
+ TypeFacts[TypeFacts["EmptyStringFacts"] = 12582401] = "EmptyStringFacts";
+ TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts";
+ TypeFacts[TypeFacts["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts";
+ TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts";
+ TypeFacts[TypeFacts["BaseNumberFacts"] = 12582146] = "BaseNumberFacts";
+ TypeFacts[TypeFacts["NumberStrictFacts"] = 16317698] = "NumberStrictFacts";
+ TypeFacts[TypeFacts["NumberFacts"] = 16776450] = "NumberFacts";
+ TypeFacts[TypeFacts["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts";
+ TypeFacts[TypeFacts["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts";
+ TypeFacts[TypeFacts["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts";
+ TypeFacts[TypeFacts["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts";
+ TypeFacts[TypeFacts["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts";
+ TypeFacts[TypeFacts["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts";
+ TypeFacts[TypeFacts["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts";
+ TypeFacts[TypeFacts["BigIntFacts"] = 16775940] = "BigIntFacts";
+ TypeFacts[TypeFacts["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts";
+ TypeFacts[TypeFacts["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts";
+ TypeFacts[TypeFacts["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts";
+ TypeFacts[TypeFacts["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts";
+ TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts";
+ TypeFacts[TypeFacts["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts";
+ TypeFacts[TypeFacts["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts";
+ TypeFacts[TypeFacts["BooleanFacts"] = 16774920] = "BooleanFacts";
+ TypeFacts[TypeFacts["FalseStrictFacts"] = 12121864] = "FalseStrictFacts";
+ TypeFacts[TypeFacts["FalseFacts"] = 12580616] = "FalseFacts";
+ TypeFacts[TypeFacts["TrueStrictFacts"] = 7927560] = "TrueStrictFacts";
+ TypeFacts[TypeFacts["TrueFacts"] = 16774920] = "TrueFacts";
+ TypeFacts[TypeFacts["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts";
+ TypeFacts[TypeFacts["SymbolFacts"] = 16772880] = "SymbolFacts";
+ TypeFacts[TypeFacts["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts";
+ TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
+ TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
+ TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
+ TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
+ TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
+ TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
+ TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
+ })(TypeFacts || (TypeFacts = {}));
+ var typeofEQFacts = ts.createMapFromTemplate({
+ string: 1 /* TypeofEQString */,
+ number: 2 /* TypeofEQNumber */,
+ bigint: 4 /* TypeofEQBigInt */,
+ boolean: 8 /* TypeofEQBoolean */,
+ symbol: 16 /* TypeofEQSymbol */,
+ undefined: 65536 /* EQUndefined */,
+ object: 32 /* TypeofEQObject */,
+ function: 64 /* TypeofEQFunction */
+ });
+ var typeofNEFacts = ts.createMapFromTemplate({
+ string: 256 /* TypeofNEString */,
+ number: 512 /* TypeofNENumber */,
+ bigint: 1024 /* TypeofNEBigInt */,
+ boolean: 2048 /* TypeofNEBoolean */,
+ symbol: 4096 /* TypeofNESymbol */,
+ undefined: 524288 /* NEUndefined */,
+ object: 8192 /* TypeofNEObject */,
+ function: 16384 /* TypeofNEFunction */
+ });
+ var TypeSystemPropertyName;
+ (function (TypeSystemPropertyName) {
+ TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
+ TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
+ TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
+ TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
+ })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
+ var CheckMode;
+ (function (CheckMode) {
+ CheckMode[CheckMode["Normal"] = 0] = "Normal";
+ CheckMode[CheckMode["Contextual"] = 1] = "Contextual";
+ CheckMode[CheckMode["Inferential"] = 2] = "Inferential";
+ CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
+ CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
+ CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
+ })(CheckMode || (CheckMode = {}));
+ var ContextFlags;
+ (function (ContextFlags) {
+ ContextFlags[ContextFlags["None"] = 0] = "None";
+ ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
+ })(ContextFlags || (ContextFlags = {}));
+ var AccessFlags;
+ (function (AccessFlags) {
+ AccessFlags[AccessFlags["None"] = 0] = "None";
+ AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
+ AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
+ AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
+ AccessFlags[AccessFlags["NoTupleBoundsCheck"] = 8] = "NoTupleBoundsCheck";
+ })(AccessFlags || (AccessFlags = {}));
+ var CallbackCheck;
+ (function (CallbackCheck) {
+ CallbackCheck[CallbackCheck["None"] = 0] = "None";
+ CallbackCheck[CallbackCheck["Bivariant"] = 1] = "Bivariant";
+ CallbackCheck[CallbackCheck["Strict"] = 2] = "Strict";
+ })(CallbackCheck || (CallbackCheck = {}));
+ var MappedTypeModifiers;
+ (function (MappedTypeModifiers) {
+ MappedTypeModifiers[MappedTypeModifiers["IncludeReadonly"] = 1] = "IncludeReadonly";
+ MappedTypeModifiers[MappedTypeModifiers["ExcludeReadonly"] = 2] = "ExcludeReadonly";
+ MappedTypeModifiers[MappedTypeModifiers["IncludeOptional"] = 4] = "IncludeOptional";
+ MappedTypeModifiers[MappedTypeModifiers["ExcludeOptional"] = 8] = "ExcludeOptional";
+ })(MappedTypeModifiers || (MappedTypeModifiers = {}));
+ var ExpandingFlags;
+ (function (ExpandingFlags) {
+ ExpandingFlags[ExpandingFlags["None"] = 0] = "None";
+ ExpandingFlags[ExpandingFlags["Source"] = 1] = "Source";
+ ExpandingFlags[ExpandingFlags["Target"] = 2] = "Target";
+ ExpandingFlags[ExpandingFlags["Both"] = 3] = "Both";
+ })(ExpandingFlags || (ExpandingFlags = {}));
+ var MembersOrExportsResolutionKind;
+ (function (MembersOrExportsResolutionKind) {
+ MembersOrExportsResolutionKind["resolvedExports"] = "resolvedExports";
+ MembersOrExportsResolutionKind["resolvedMembers"] = "resolvedMembers";
+ })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {}));
+ var UnusedKind;
+ (function (UnusedKind) {
+ UnusedKind[UnusedKind["Local"] = 0] = "Local";
+ UnusedKind[UnusedKind["Parameter"] = 1] = "Parameter";
+ })(UnusedKind || (UnusedKind = {}));
+ var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
+ var DeclarationMeaning;
+ (function (DeclarationMeaning) {
+ DeclarationMeaning[DeclarationMeaning["GetAccessor"] = 1] = "GetAccessor";
+ DeclarationMeaning[DeclarationMeaning["SetAccessor"] = 2] = "SetAccessor";
+ DeclarationMeaning[DeclarationMeaning["PropertyAssignment"] = 4] = "PropertyAssignment";
+ DeclarationMeaning[DeclarationMeaning["Method"] = 8] = "Method";
+ DeclarationMeaning[DeclarationMeaning["GetOrSetAccessor"] = 3] = "GetOrSetAccessor";
+ DeclarationMeaning[DeclarationMeaning["PropertyAssignmentOrMethod"] = 12] = "PropertyAssignmentOrMethod";
+ })(DeclarationMeaning || (DeclarationMeaning = {}));
+ var DeclarationSpaces;
+ (function (DeclarationSpaces) {
+ DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None";
+ DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue";
+ DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType";
+ DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace";
+ })(DeclarationSpaces || (DeclarationSpaces = {}));
function getNodeId(node) {
if (!node.id) {
node.id = nextNodeId;
@@ -31838,7 +32363,7 @@ var ts;
// Ensure file is type checked
checkSourceFile(file);
ts.Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
- diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.get(file.fileName));
+ diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
if (!file.isDeclarationFile && (!unusedIsError(0 /* Local */) || !unusedIsError(1 /* Parameter */))) {
addUnusedDiagnostics();
}
@@ -32062,102 +32587,7 @@ var ts;
var potentialNewTargetCollisions = [];
var awaitedTypeStack = [];
var diagnostics = ts.createDiagnosticCollection();
- // Suggestion diagnostics must have a file. Keyed by source file name.
- var suggestionDiagnostics = ts.createMultiMap();
- var TypeFacts;
- (function (TypeFacts) {
- TypeFacts[TypeFacts["None"] = 0] = "None";
- TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
- TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
- TypeFacts[TypeFacts["TypeofEQBigInt"] = 4] = "TypeofEQBigInt";
- TypeFacts[TypeFacts["TypeofEQBoolean"] = 8] = "TypeofEQBoolean";
- TypeFacts[TypeFacts["TypeofEQSymbol"] = 16] = "TypeofEQSymbol";
- TypeFacts[TypeFacts["TypeofEQObject"] = 32] = "TypeofEQObject";
- TypeFacts[TypeFacts["TypeofEQFunction"] = 64] = "TypeofEQFunction";
- TypeFacts[TypeFacts["TypeofEQHostObject"] = 128] = "TypeofEQHostObject";
- TypeFacts[TypeFacts["TypeofNEString"] = 256] = "TypeofNEString";
- TypeFacts[TypeFacts["TypeofNENumber"] = 512] = "TypeofNENumber";
- TypeFacts[TypeFacts["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt";
- TypeFacts[TypeFacts["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean";
- TypeFacts[TypeFacts["TypeofNESymbol"] = 4096] = "TypeofNESymbol";
- TypeFacts[TypeFacts["TypeofNEObject"] = 8192] = "TypeofNEObject";
- TypeFacts[TypeFacts["TypeofNEFunction"] = 16384] = "TypeofNEFunction";
- TypeFacts[TypeFacts["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject";
- TypeFacts[TypeFacts["EQUndefined"] = 65536] = "EQUndefined";
- TypeFacts[TypeFacts["EQNull"] = 131072] = "EQNull";
- TypeFacts[TypeFacts["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull";
- TypeFacts[TypeFacts["NEUndefined"] = 524288] = "NEUndefined";
- TypeFacts[TypeFacts["NENull"] = 1048576] = "NENull";
- TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
- TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
- TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
- TypeFacts[TypeFacts["All"] = 16777215] = "All";
- // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
- // The presence of a particular fact means that the given test is true for some (and possibly all) values
- // of that kind of type.
- TypeFacts[TypeFacts["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts";
- TypeFacts[TypeFacts["BaseStringFacts"] = 12582401] = "BaseStringFacts";
- TypeFacts[TypeFacts["StringStrictFacts"] = 16317953] = "StringStrictFacts";
- TypeFacts[TypeFacts["StringFacts"] = 16776705] = "StringFacts";
- TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts";
- TypeFacts[TypeFacts["EmptyStringFacts"] = 12582401] = "EmptyStringFacts";
- TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts";
- TypeFacts[TypeFacts["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts";
- TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts";
- TypeFacts[TypeFacts["BaseNumberFacts"] = 12582146] = "BaseNumberFacts";
- TypeFacts[TypeFacts["NumberStrictFacts"] = 16317698] = "NumberStrictFacts";
- TypeFacts[TypeFacts["NumberFacts"] = 16776450] = "NumberFacts";
- TypeFacts[TypeFacts["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts";
- TypeFacts[TypeFacts["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts";
- TypeFacts[TypeFacts["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts";
- TypeFacts[TypeFacts["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts";
- TypeFacts[TypeFacts["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts";
- TypeFacts[TypeFacts["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts";
- TypeFacts[TypeFacts["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts";
- TypeFacts[TypeFacts["BigIntFacts"] = 16775940] = "BigIntFacts";
- TypeFacts[TypeFacts["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts";
- TypeFacts[TypeFacts["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts";
- TypeFacts[TypeFacts["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts";
- TypeFacts[TypeFacts["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts";
- TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts";
- TypeFacts[TypeFacts["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts";
- TypeFacts[TypeFacts["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts";
- TypeFacts[TypeFacts["BooleanFacts"] = 16774920] = "BooleanFacts";
- TypeFacts[TypeFacts["FalseStrictFacts"] = 12121864] = "FalseStrictFacts";
- TypeFacts[TypeFacts["FalseFacts"] = 12580616] = "FalseFacts";
- TypeFacts[TypeFacts["TrueStrictFacts"] = 7927560] = "TrueStrictFacts";
- TypeFacts[TypeFacts["TrueFacts"] = 16774920] = "TrueFacts";
- TypeFacts[TypeFacts["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts";
- TypeFacts[TypeFacts["SymbolFacts"] = 16772880] = "SymbolFacts";
- TypeFacts[TypeFacts["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts";
- TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
- TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
- TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
- TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
- TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
- TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
- TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
- })(TypeFacts || (TypeFacts = {}));
- var typeofEQFacts = ts.createMapFromTemplate({
- string: 1 /* TypeofEQString */,
- number: 2 /* TypeofEQNumber */,
- bigint: 4 /* TypeofEQBigInt */,
- boolean: 8 /* TypeofEQBoolean */,
- symbol: 16 /* TypeofEQSymbol */,
- undefined: 65536 /* EQUndefined */,
- object: 32 /* TypeofEQObject */,
- function: 64 /* TypeofEQFunction */
- });
- var typeofNEFacts = ts.createMapFromTemplate({
- string: 256 /* TypeofNEString */,
- number: 512 /* TypeofNENumber */,
- bigint: 1024 /* TypeofNEBigInt */,
- boolean: 2048 /* TypeofNEBoolean */,
- symbol: 4096 /* TypeofNESymbol */,
- undefined: 524288 /* NEUndefined */,
- object: 8192 /* TypeofNEObject */,
- function: 16384 /* TypeofNEFunction */
- });
+ var suggestionDiagnostics = ts.createDiagnosticCollection();
var typeofTypesByName = ts.createMapFromTemplate({
string: stringType,
number: numberType,
@@ -32175,71 +32605,8 @@ var ts;
var comparableRelation = ts.createMap();
var identityRelation = ts.createMap();
var enumRelation = ts.createMap();
- var TypeSystemPropertyName;
- (function (TypeSystemPropertyName) {
- TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
- TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
- TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
- TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
- TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
- TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
- TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
- })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
- var CheckMode;
- (function (CheckMode) {
- CheckMode[CheckMode["Normal"] = 0] = "Normal";
- CheckMode[CheckMode["Contextual"] = 1] = "Contextual";
- CheckMode[CheckMode["Inferential"] = 2] = "Inferential";
- CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
- CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
- CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
- })(CheckMode || (CheckMode = {}));
- var ContextFlags;
- (function (ContextFlags) {
- ContextFlags[ContextFlags["None"] = 0] = "None";
- ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
- })(ContextFlags || (ContextFlags = {}));
- var AccessFlags;
- (function (AccessFlags) {
- AccessFlags[AccessFlags["None"] = 0] = "None";
- AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
- AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
- AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
- AccessFlags[AccessFlags["NoTupleBoundsCheck"] = 8] = "NoTupleBoundsCheck";
- })(AccessFlags || (AccessFlags = {}));
- var CallbackCheck;
- (function (CallbackCheck) {
- CallbackCheck[CallbackCheck["None"] = 0] = "None";
- CallbackCheck[CallbackCheck["Bivariant"] = 1] = "Bivariant";
- CallbackCheck[CallbackCheck["Strict"] = 2] = "Strict";
- })(CallbackCheck || (CallbackCheck = {}));
- var MappedTypeModifiers;
- (function (MappedTypeModifiers) {
- MappedTypeModifiers[MappedTypeModifiers["IncludeReadonly"] = 1] = "IncludeReadonly";
- MappedTypeModifiers[MappedTypeModifiers["ExcludeReadonly"] = 2] = "ExcludeReadonly";
- MappedTypeModifiers[MappedTypeModifiers["IncludeOptional"] = 4] = "IncludeOptional";
- MappedTypeModifiers[MappedTypeModifiers["ExcludeOptional"] = 8] = "ExcludeOptional";
- })(MappedTypeModifiers || (MappedTypeModifiers = {}));
- var ExpandingFlags;
- (function (ExpandingFlags) {
- ExpandingFlags[ExpandingFlags["None"] = 0] = "None";
- ExpandingFlags[ExpandingFlags["Source"] = 1] = "Source";
- ExpandingFlags[ExpandingFlags["Target"] = 2] = "Target";
- ExpandingFlags[ExpandingFlags["Both"] = 3] = "Both";
- })(ExpandingFlags || (ExpandingFlags = {}));
- var MembersOrExportsResolutionKind;
- (function (MembersOrExportsResolutionKind) {
- MembersOrExportsResolutionKind["resolvedExports"] = "resolvedExports";
- MembersOrExportsResolutionKind["resolvedMembers"] = "resolvedMembers";
- })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {}));
- var UnusedKind;
- (function (UnusedKind) {
- UnusedKind[UnusedKind["Local"] = 0] = "Local";
- UnusedKind[UnusedKind["Parameter"] = 1] = "Parameter";
- })(UnusedKind || (UnusedKind = {}));
var builtinGlobals = ts.createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
- var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
initializeTypeChecker();
return checker;
function getJsxNamespace(location) {
@@ -32304,7 +32671,7 @@ var ts;
diagnostics.add(diagnostic);
}
else {
- suggestionDiagnostics.add(diagnostic.file.fileName, __assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
+ suggestionDiagnostics.add(__assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
}
}
function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
@@ -32330,35 +32697,35 @@ var ts;
function getExcludedSymbolFlags(flags) {
var result = 0;
if (flags & 2 /* BlockScopedVariable */)
- result |= 67220415 /* BlockScopedVariableExcludes */;
+ result |= 111551 /* BlockScopedVariableExcludes */;
if (flags & 1 /* FunctionScopedVariable */)
- result |= 67220414 /* FunctionScopedVariableExcludes */;
+ result |= 111550 /* FunctionScopedVariableExcludes */;
if (flags & 4 /* Property */)
result |= 0 /* PropertyExcludes */;
if (flags & 8 /* EnumMember */)
- result |= 68008959 /* EnumMemberExcludes */;
+ result |= 900095 /* EnumMemberExcludes */;
if (flags & 16 /* Function */)
- result |= 67219887 /* FunctionExcludes */;
+ result |= 110991 /* FunctionExcludes */;
if (flags & 32 /* Class */)
- result |= 68008383 /* ClassExcludes */;
+ result |= 899503 /* ClassExcludes */;
if (flags & 64 /* Interface */)
- result |= 67897736 /* InterfaceExcludes */;
+ result |= 788872 /* InterfaceExcludes */;
if (flags & 256 /* RegularEnum */)
- result |= 68008191 /* RegularEnumExcludes */;
+ result |= 899327 /* RegularEnumExcludes */;
if (flags & 128 /* ConstEnum */)
- result |= 68008831 /* ConstEnumExcludes */;
+ result |= 899967 /* ConstEnumExcludes */;
if (flags & 512 /* ValueModule */)
result |= 110735 /* ValueModuleExcludes */;
if (flags & 8192 /* Method */)
- result |= 67212223 /* MethodExcludes */;
+ result |= 103359 /* MethodExcludes */;
if (flags & 32768 /* GetAccessor */)
- result |= 67154879 /* GetAccessorExcludes */;
+ result |= 46015 /* GetAccessorExcludes */;
if (flags & 65536 /* SetAccessor */)
- result |= 67187647 /* SetAccessorExcludes */;
+ result |= 78783 /* SetAccessorExcludes */;
if (flags & 262144 /* TypeParameter */)
- result |= 67635688 /* TypeParameterExcludes */;
+ result |= 526824 /* TypeParameterExcludes */;
if (flags & 524288 /* TypeAlias */)
- result |= 67897832 /* TypeAliasExcludes */;
+ result |= 788968 /* TypeAliasExcludes */;
if (flags & 2097152 /* Alias */)
result |= 2097152 /* AliasExcludes */;
return result;
@@ -32611,8 +32978,8 @@ var ts;
function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) {
var constructorDeclaration = parameter.parent;
var classDeclaration = parameter.parent.parent;
- var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 67220415 /* Value */);
- var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 67220415 /* Value */);
+ var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 111551 /* Value */);
+ var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 111551 /* Value */);
if (parameterSymbol && propertySymbol) {
return [parameterSymbol, propertySymbol];
}
@@ -32791,7 +33158,7 @@ var ts;
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) {
+ if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 298 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
// type parameters are visible in parameter list, return type and type parameter list
? lastLocation === location.type ||
@@ -32894,7 +33261,7 @@ var ts;
if (!ts.hasModifier(location, 32 /* Static */)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
- if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) {
+ if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
// Remember the property node, it will be used later to report appropriate error
propertyWithInvalidInitializer = location;
}
@@ -32907,7 +33274,7 @@ var ts;
// The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals
// These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would
// trigger resolving late-bound names, which we may already be in the process of doing while we're here!
- if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 67897832 /* Type */)) {
+ if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
// ignore type parameters not declared in this container
result = undefined;
@@ -32934,7 +33301,7 @@ var ts;
// The type parameters of a class are not in scope in the base class expression.
if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) {
var container = location.parent.parent;
- if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) {
+ if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 788968 /* Type */))) {
if (nameNotFoundMessage) {
error(errorLocation, ts.Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
}
@@ -32954,7 +33321,7 @@ var ts;
grandparent = location.parent.parent;
if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
- if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) {
+ if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
return undefined;
}
@@ -33018,8 +33385,9 @@ var ts;
location = location.parent;
}
break;
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
break;
@@ -33117,21 +33485,21 @@ var ts;
// we want to check for block-scoped
if (errorLocation &&
(meaning & 2 /* BlockScopedVariable */ ||
- ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 67220415 /* Value */) === 67220415 /* Value */))) {
+ ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */))) {
var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
}
}
// If we're in an external module, we can't reference value symbols created from UMD export declarations
- if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
+ if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
}
}
// If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
- if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) {
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
var candidate = getMergedSymbol(getLateBoundSymbol(result));
var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
// A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
@@ -33248,9 +33616,9 @@ var ts;
}
}
function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
- var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(errorLocation) ? 67220415 /* Value */ : 0);
+ var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(errorLocation) ? 111551 /* Value */ : 0);
if (meaning === namespaceMeaning) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 /* Type */ & ~namespaceMeaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~namespaceMeaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
var parent = errorLocation.parent;
if (symbol) {
if (ts.isQualifiedName(parent)) {
@@ -33269,8 +33637,8 @@ var ts;
return false;
}
function checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning) {
- if (meaning & (67897832 /* Type */ & ~1920 /* Namespace */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, ~67897832 /* Type */ & 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ if (meaning & (788968 /* Type */ & ~1920 /* Namespace */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, ~788968 /* Type */ & 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol && !(symbol.flags & 1920 /* Namespace */)) {
error(errorLocation, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here, ts.unescapeLeadingUnderscores(name));
return true;
@@ -33279,12 +33647,12 @@ var ts;
return false;
}
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 /* Value */ & ~1024 /* NamespaceModule */)) {
+ if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
if (name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never") {
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
return true;
}
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 /* Type */ & ~67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol && !(symbol.flags & 1024 /* NamespaceModule */)) {
var message = isES2015OrLaterConstructorName(name)
? ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later
@@ -33308,15 +33676,15 @@ var ts;
return false;
}
function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 /* Value */ & ~1024 /* NamespaceModule */ & ~67897832 /* Type */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */ & ~788968 /* Type */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
return true;
}
}
- else if (meaning & (67897832 /* Type */ & ~1024 /* NamespaceModule */ & ~67220415 /* Value */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* ValueModule */ | 1024 /* NamespaceModule */) & ~67897832 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ else if (meaning & (788968 /* Type */ & ~1024 /* NamespaceModule */ & ~111551 /* Value */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* ValueModule */ | 1024 /* NamespaceModule */) & ~788968 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
return true;
@@ -33327,7 +33695,7 @@ var ts;
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
// Block-scoped variables cannot be used before their definition
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -33479,7 +33847,7 @@ var ts;
if (valueSymbol === unknownSymbol && typeSymbol === unknownSymbol) {
return unknownSymbol;
}
- if (valueSymbol.flags & (67897832 /* Type */ | 1920 /* Namespace */)) {
+ if (valueSymbol.flags & (788968 /* Type */ | 1920 /* Namespace */)) {
return valueSymbol;
}
var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName);
@@ -33569,7 +33937,7 @@ var ts;
if (ts.isClassExpression(expression)) {
return checkExpression(expression).symbol;
}
- var aliasLike = resolveEntityName(expression, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias);
+ var aliasLike = resolveEntityName(expression, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias);
if (aliasLike) {
return aliasLike;
}
@@ -33588,7 +33956,7 @@ var ts;
case 254 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
case 258 /* ExportSpecifier */:
- return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
+ return getTargetOfExportSpecifier(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
case 255 /* ExportAssignment */:
case 205 /* BinaryExpression */:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
@@ -33603,7 +33971,7 @@ var ts;
* OR Is a JSContainer which may merge an alias with a local declaration
*/
function isNonLocalAlias(symbol, excludes) {
- if (excludes === void 0) { excludes = 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */; }
+ if (excludes === void 0) { excludes = 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */; }
if (!symbol)
return false;
return (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */ || !!(symbol.flags & 2097152 /* Alias */ && symbol.flags & 67108864 /* Assignment */);
@@ -33637,7 +34005,7 @@ var ts;
var target = resolveAlias(symbol);
if (target) {
var markAlias = target === unknownSymbol ||
- ((target.flags & 67220415 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));
+ ((target.flags & 111551 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));
if (markAlias) {
markAliasSymbolAsReferenced(symbol);
}
@@ -33653,17 +34021,15 @@ var ts;
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 255 /* ExportAssignment */) {
- // export default
- checkExpressionCached(node.expression);
- }
- else if (node.kind === 258 /* ExportSpecifier */) {
- // export { } or export { as foo }
- checkExpressionCached(node.propertyName || node.name);
- }
- else if (ts.isInternalModuleImportEqualsDeclaration(node)) {
- // import foo =
- checkExpressionCached(node.moduleReference);
+ // We defer checking of the reference of an `import =` until the import itself is referenced,
+ // This way a chain of imports can be elided if ultimately the final input is only used in a type
+ // position.
+ if (ts.isInternalModuleImportEqualsDeclaration(node)) {
+ var target = resolveSymbol(symbol);
+ if (target === unknownSymbol || target.flags & 111551 /* Value */) {
+ // import foo =
+ checkExpressionCached(node.moduleReference);
+ }
}
}
}
@@ -33686,7 +34052,7 @@ var ts;
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */);
- return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
+ return resolveEntityName(entityName, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
function getFullyQualifiedName(symbol, containingLocation) {
@@ -33699,7 +34065,7 @@ var ts;
if (ts.nodeIsMissing(name)) {
return undefined;
}
- var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0);
+ var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 111551 /* Value */ : 0);
var symbol;
if (name.kind === 73 /* Identifier */) {
var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
@@ -34200,7 +34566,7 @@ var ts;
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 ? symbol.exportSymbol : symbol);
}
function symbolIsValue(symbol) {
- return !!(symbol.flags & 67220415 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 67220415 /* Value */);
+ return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */);
}
function findConstructorDeclaration(node) {
var members = node.members;
@@ -34308,7 +34674,7 @@ var ts;
}
function getQualifiedLeftMeaning(rightMeaning) {
// If we are looking in value space, the parent meaning is value, other wise it is namespace
- return rightMeaning === 67220415 /* Value */ ? 67220415 /* Value */ : 1920 /* Namespace */;
+ return rightMeaning === 111551 /* Value */ ? 111551 /* Value */ : 1920 /* Namespace */;
}
function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) {
if (visitedSymbolTablesMap === void 0) { visitedSymbolTablesMap = ts.createMap(); }
@@ -34426,11 +34792,11 @@ var ts;
return false;
}
function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67897832 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 788968 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false);
return access.accessibility === 0 /* Accessible */;
}
function isValueSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67220415 /* Value */, /*shouldComputeAliasesToMakeVisible*/ false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 111551 /* Value */, /*shouldComputeAliasesToMakeVisible*/ false);
return access.accessibility === 0 /* Accessible */;
}
function isAnySymbolAccessible(symbols, enclosingDeclaration, initialSymbol, meaning, shouldComputeAliasesToMakeVisible) {
@@ -34473,7 +34839,7 @@ var ts;
// from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however,
// we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal.
var firstDecl = ts.first(symbol.declarations);
- if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
+ if (!ts.length(containers) && meaning & 111551 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
containers = [getSymbolOfNode(firstDecl.parent)];
}
@@ -34586,7 +34952,7 @@ var ts;
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
entityName.parent.kind === 150 /* ComputedPropertyName */) {
// Typeof value
- meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
}
else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ ||
entityName.parent.kind === 249 /* ImportEqualsDeclaration */) {
@@ -34596,7 +34962,7 @@ var ts;
}
else {
// Type Reference or TypeAlias entity = Identifier
- meaning = 67897832 /* Type */;
+ meaning = 788968 /* Type */;
}
var firstIdentifier = getFirstIdentifier(entityName);
var symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
@@ -34768,14 +35134,14 @@ var ts;
}
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
var parentSymbol = getParentOfSymbol(type.symbol);
- var parentName = symbolToTypeNode(parentSymbol, context, 67897832 /* Type */);
+ var parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
var enumLiteralName = getDeclaredTypeOfSymbol(parentSymbol) === type
? parentName
: appendReferenceToType(parentName, ts.createTypeReferenceNode(ts.symbolName(type.symbol), /*typeArguments*/ undefined));
return enumLiteralName;
}
if (type.flags & 1056 /* EnumLike */) {
- return symbolToTypeNode(type.symbol, context, 67897832 /* Type */);
+ return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
}
if (type.flags & 128 /* StringLiteral */) {
context.approximateLength += (type.value.length + 2);
@@ -34798,7 +35164,7 @@ var ts;
if (!(context.flags & 1048576 /* AllowUniqueESSymbolType */)) {
if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
context.approximateLength += 6;
- return symbolToTypeNode(type.symbol, context, 67220415 /* Value */);
+ return symbolToTypeNode(type.symbol, context, 111551 /* Value */);
}
if (context.tracker.reportInaccessibleUniqueSymbolError) {
context.tracker.reportInaccessibleUniqueSymbolError();
@@ -34861,14 +35227,14 @@ var ts;
}
// Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter.
return type.symbol
- ? symbolToTypeNode(type.symbol, context, 67897832 /* Type */)
+ ? symbolToTypeNode(type.symbol, context, 788968 /* Type */)
: ts.createTypeReferenceNode(ts.createIdentifier("?"), /*typeArguments*/ undefined);
}
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */))
return ts.createTypeReferenceNode(ts.createIdentifier(""), typeArgumentNodes);
- return symbolToTypeNode(type.aliasSymbol, context, 67897832 /* Type */, typeArgumentNodes);
+ return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
}
if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) {
var types = type.flags & 1048576 /* Union */ ? formatUnionTypes(type.types) : type.types;
@@ -34947,21 +35313,21 @@ var ts;
id = (isConstructorObject ? "+" : "") + getSymbolId(symbol);
if (isJSConstructor(symbol.valueDeclaration)) {
// Instance and static types share the same symbol; only add 'typeof' for the static side.
- var isInstanceType = type === getInferredClassType(symbol) ? 67897832 /* Type */ : 67220415 /* Value */;
+ var isInstanceType = type === getInferredClassType(symbol) ? 788968 /* Type */ : 111551 /* Value */;
return symbolToTypeNode(symbol, context, isInstanceType);
}
// Always use 'typeof T' for type of class, enum, and module objects
else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) ||
shouldWriteTypeOfFunctionSymbol()) {
- return symbolToTypeNode(symbol, context, 67220415 /* Value */);
+ return symbolToTypeNode(symbol, context, 111551 /* Value */);
}
else if (context.visitedTypes && context.visitedTypes.has(typeId)) {
// If type is an anonymous type literal in a type alias declaration, use type alias name
var typeAlias = getTypeAliasForTypeLiteral(type);
if (typeAlias) {
// The specified symbol flags need to be reinterpreted as type flags
- return symbolToTypeNode(typeAlias, context, 67897832 /* Type */);
+ return symbolToTypeNode(typeAlias, context, 788968 /* Type */);
}
else {
return createElidedInformationPlaceholder(context);
@@ -35094,7 +35460,7 @@ var ts;
var typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
var flags_2 = context.flags;
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
- var ref = symbolToTypeNode(parent, context, 67897832 /* Type */, typeArgumentSlice);
+ var ref = symbolToTypeNode(parent, context, 788968 /* Type */, typeArgumentSlice);
context.flags = flags_2;
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
}
@@ -35107,7 +35473,7 @@ var ts;
}
var flags = context.flags;
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
- var finalRef = symbolToTypeNode(type.symbol, context, 67897832 /* Type */, typeArgumentNodes);
+ var finalRef = symbolToTypeNode(type.symbol, context, 788968 /* Type */, typeArgumentNodes);
context.flags = flags;
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
}
@@ -35224,7 +35590,7 @@ var ts;
trackComputedName(decl.name, saveEnclosingDeclaration, context);
}
}
- var propertyName = symbolToName(propertySymbol, context, 67220415 /* Value */, /*expectsIdentifier*/ true);
+ var propertyName = symbolToName(propertySymbol, context, 111551 /* Value */, /*expectsIdentifier*/ true);
context.approximateLength += (ts.symbolName(propertySymbol).length + 1);
context.enclosingDeclaration = saveEnclosingDeclaration;
var optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? ts.createToken(56 /* QuestionToken */) : undefined;
@@ -35374,7 +35740,7 @@ var ts;
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 306 /* JSDocParameterTag */);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 307 /* JSDocParameterTag */);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -35418,9 +35784,9 @@ var ts;
return;
// get symbol of the first identifier of the entityName
var firstIdentifier = getFirstIdentifier(node.expression);
- var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
+ var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (name) {
- context.tracker.trackSymbol(name, enclosingDeclaration, 67220415 /* Value */);
+ context.tracker.trackSymbol(name, enclosingDeclaration, 111551 /* Value */);
}
}
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
@@ -35582,7 +35948,7 @@ var ts;
}
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
- var isTypeOf = meaning === 67220415 /* Value */;
+ var isTypeOf = meaning === 111551 /* Value */;
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
// module is root, must use `ImportTypeNode`
var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
@@ -35661,7 +36027,7 @@ var ts;
}
}
function typeParameterShadowsNameInScope(escapedName, context) {
- return !!resolveName(context.enclosingDeclaration, escapedName, 67897832 /* Type */, /*nameNotFoundArg*/ undefined, escapedName, /*isUse*/ false);
+ return !!resolveName(context.enclosingDeclaration, escapedName, 788968 /* Type */, /*nameNotFoundArg*/ undefined, escapedName, /*isUse*/ false);
}
function typeParameterToName(type, context) {
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
@@ -35670,7 +36036,7 @@ var ts;
return cached;
}
}
- var result = symbolToName(type.symbol, context, 67897832 /* Type */, /*expectsIdentifier*/ true);
+ var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
var rawtext = result.escapedText;
var i = 0;
@@ -35897,8 +36263,9 @@ var ts;
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 306 /* JSDocEnumTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
@@ -35981,10 +36348,10 @@ var ts;
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
if (node.parent && node.parent.kind === 255 /* ExportAssignment */) {
- exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
+ exportSymbol = resolveName(node, node.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
}
else if (node.parent.kind === 258 /* ExportSpecifier */) {
- exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
var result;
if (exportSymbol) {
@@ -36005,7 +36372,7 @@ var ts;
// Add the referenced top container visible
var internalModuleReference = declaration.moduleReference;
var firstIdentifier = getFirstIdentifier(internalModuleReference);
- var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, undefined, undefined, /*isUse*/ false);
+ var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, undefined, undefined, /*isUse*/ false);
if (importSymbol) {
buildVisibleNodeList(importSymbol.declarations);
}
@@ -36069,8 +36436,10 @@ var ts;
}
return ts.Debug.assertNever(propertyName);
}
- // Pop an entry from the type resolution stack and return its associated result value. The result value will
- // be true if no circularities were detected, or false if a circularity was found.
+ /**
+ * Pop an entry from the type resolution stack and return its associated result value. The result value will
+ * be true if no circularities were detected, or false if a circularity was found.
+ */
function popTypeResolution() {
resolutionTargets.pop();
resolutionPropertyNames.pop();
@@ -36399,7 +36768,7 @@ var ts;
// No type specified and nothing can be inferred
return undefined;
}
- function getWidenedTypeFromAssignmentDeclaration(symbol, resolvedSymbol) {
+ function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
// function/class/{} initializers are themselves containers, so they won't merge in the same way as other initializers
var container = ts.getAssignedExpandoInitializer(symbol.valueDeclaration);
if (container) {
@@ -36432,7 +36801,7 @@ var ts;
}
}
if (!ts.isCallExpression(expression)) {
- jsdocType = getJSDocTypeFromAssignmentDeclaration(jsdocType, expression, symbol, declaration);
+ jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
}
if (!jsdocType) {
(types || (types = [])).push((ts.isBinaryExpression(expression) || ts.isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
@@ -36479,8 +36848,8 @@ var ts;
type.objectFlags |= 16384 /* JSLiteral */;
return type;
}
- function getJSDocTypeFromAssignmentDeclaration(declaredType, expression, _symbol, declaration) {
- var typeNode = ts.getJSDocType(expression.parent);
+ function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) {
+ var typeNode = ts.getEffectiveTypeAnnotationNode(expression.parent);
if (typeNode) {
var type = getWidenedType(getTypeFromTypeNode(typeNode));
if (!declaredType) {
@@ -36490,6 +36859,12 @@ var ts;
errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
}
}
+ if (symbol.parent) {
+ var typeNode_2 = ts.getEffectiveTypeAnnotationNode(symbol.parent.valueDeclaration);
+ if (typeNode_2) {
+ return getTypeOfPropertyOfType(getTypeFromTypeNode(typeNode_2), symbol.escapedName);
+ }
+ }
return declaredType;
}
/** If we don't have an explicit JSDoc type, get the type from the initializer. */
@@ -36760,7 +37135,7 @@ var ts;
}
else if (ts.isInJSFile(declaration) &&
(ts.isCallExpression(declaration) || ts.isBinaryExpression(declaration) || ts.isPropertyAccessExpression(declaration) && ts.isBinaryExpression(declaration.parent))) {
- type = getWidenedTypeFromAssignmentDeclaration(symbol);
+ type = getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (ts.isJSDocPropertyLikeTag(declaration)
|| ts.isPropertyAccessExpression(declaration)
@@ -36775,7 +37150,7 @@ var ts;
return getTypeOfFuncClassEnumModule(symbol);
}
type = ts.isBinaryExpression(declaration.parent) ?
- getWidenedTypeFromAssignmentDeclaration(symbol) :
+ getWidenedTypeForAssignmentDeclaration(symbol) :
tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
}
else if (ts.isPropertyAssignment(declaration)) {
@@ -36877,7 +37252,9 @@ var ts;
// Otherwise, fall back to 'any'.
else {
if (setter) {
- errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ if (!isPrivateWithinAmbient(setter)) {
+ errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ }
}
else {
ts.Debug.assert(!!getter, "there must existed getter as we are current checking either setter or getter in this function");
@@ -36932,7 +37309,7 @@ var ts;
}
else if (declaration.kind === 205 /* BinaryExpression */ ||
declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) {
- return getWidenedTypeFromAssignmentDeclaration(symbol);
+ return getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
var resolvedModule = resolveExternalModuleSymbol(symbol);
@@ -36941,7 +37318,7 @@ var ts;
return errorType;
}
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
- var type_2 = getWidenedTypeFromAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
+ var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
if (!popTypeResolution()) {
return reportCircularityError(symbol);
}
@@ -36970,7 +37347,7 @@ var ts;
// type symbol, call getDeclaredTypeOfSymbol.
// This check is important because without it, a call to getTypeOfSymbol could end
// up recursively calling getTypeOfAlias, causing a stack overflow.
- links.type = targetSymbol.flags & 67220415 /* Value */
+ links.type = targetSymbol.flags & 111551 /* Value */
? getTypeOfSymbol(targetSymbol)
: errorType;
}
@@ -37097,9 +37474,10 @@ var ts;
case 197 /* FunctionExpression */:
case 198 /* ArrowFunction */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 311 /* JSDocTemplateTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 306 /* JSDocEnumTag */:
+ case 305 /* JSDocCallbackTag */:
case 182 /* MappedType */:
case 176 /* ConditionalType */:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
@@ -37369,7 +37747,7 @@ var ts;
for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {
var node = baseTypeNodes_1[_b];
if (ts.isEntityNameExpression(node.expression)) {
- var baseSymbol = resolveEntityName(node.expression, 67897832 /* Type */, /*ignoreErrors*/ true);
+ var baseSymbol = resolveEntityName(node.expression, 788968 /* Type */, /*ignoreErrors*/ true);
if (!baseSymbol || !(baseSymbol.flags & 64 /* Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {
return false;
}
@@ -37416,9 +37794,10 @@ var ts;
if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {
return errorType;
}
- var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */;
- });
+ var declaration = ts.find(symbol.declarations, ts.isTypeAlias);
+ if (!declaration) {
+ return ts.Debug.fail("Type alias symbol with no valid declaration found");
+ }
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
// If typeNode is missing, we will error in checkJSDocTypedefTag.
var type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
@@ -37434,7 +37813,7 @@ var ts;
}
else {
type = errorType;
- error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
+ error(ts.isJSDocEnumTag(declaration) ? declaration : declaration.name || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
links.declaredType = type;
}
@@ -37751,7 +38130,7 @@ var ts;
else {
symbol.declarations.push(member);
}
- if (symbolFlags & 67220415 /* Value */) {
+ if (symbolFlags & 111551 /* Value */) {
if (!symbol.valueDeclaration || symbol.valueDeclaration.kind !== member.kind) {
symbol.valueDeclaration = member;
}
@@ -38057,8 +38436,9 @@ var ts;
}
var result;
for (var i = 0; i < signatureLists.length; i++) {
- // Allow matching non-generic signatures to have excess parameters and different return types
- var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true);
+ // Allow matching non-generic signatures to have excess parameters and different return types.
+ // Prefer matching this types if possible.
+ var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true);
if (!match) {
return undefined;
}
@@ -38082,7 +38462,7 @@ var ts;
for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {
var signature = _a[_i];
// Only process signatures with parameter lists that aren't already in the result list
- if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) {
+ if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true)) {
var unionSignatures = findMatchingSignatures(signatureLists, signature, i);
if (unionSignatures) {
var s = signature;
@@ -38091,7 +38471,7 @@ var ts;
var thisParameter = signature.thisParameter;
var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
if (firstThisParameterOfUnionSignatures) {
- var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */);
+ var thisType = getIntersectionType(ts.mapDefined(unionSignatures, function (sig) { return sig.thisParameter && getTypeOfSymbol(sig.thisParameter); }));
thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
@@ -38135,8 +38515,8 @@ var ts;
}
// A signature `this` type might be a read or a write position... It's very possible that it should be invariant
// and we should refuse to merge signatures if there are `this` types and they do not match. However, so as to be
- // permissive when calling, for now, we'll union the `this` types just like the overlapping-union-signature check does
- var thisType = getUnionType([getTypeOfSymbol(left), getTypeOfSymbol(right)], 2 /* Subtype */);
+ // permissive when calling, for now, we'll intersect the `this` types just like we do for param types in union signatures.
+ var thisType = getIntersectionType([getTypeOfSymbol(left), getTypeOfSymbol(right)]);
return createSymbolWithType(left, thisType);
}
function combineUnionParameters(left, right) {
@@ -38510,7 +38890,7 @@ var ts;
else {
// Otherwise, get the declared constraint type, and if the constraint type is a type parameter,
// get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T',
- // the modifiers type is T. Otherwise, the modifiers type is {}.
+ // the modifiers type is T. Otherwise, the modifiers type is unknown.
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint;
@@ -38955,7 +39335,7 @@ var ts;
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 /* StringLike */ ? globalStringType :
t.flags & 296 /* NumberLike */ ? globalNumberType :
- t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) :
+ t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 99 /* ESNext */) :
t.flags & 528 /* BooleanLike */ ? globalBooleanType :
t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) :
t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType :
@@ -39309,7 +39689,7 @@ var ts;
var type = ts.isJSDocParameterTag(param) ? (param.typeExpression && param.typeExpression.type) : param.type;
// Include parameter symbol instead of property symbol in the signature
if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !ts.isBindingPattern(param.name)) {
- var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 67220415 /* Value */, undefined, undefined, /*isUse*/ false);
+ var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 111551 /* Value */, undefined, undefined, /*isUse*/ false);
paramSymbol = resolvedSymbol;
}
if (i === 0 && paramSymbol.escapedName === "this" /* This */) {
@@ -39892,20 +40272,6 @@ var ts;
if (type) {
return type;
}
- // JS enums are 'string' or 'number', not an enum type.
- var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
- if (enumTag) {
- var links = getNodeLinks(enumTag);
- if (!pushTypeResolution(enumTag, 5 /* EnumTagType */)) {
- return errorType;
- }
- var type_4 = enumTag.typeExpression ? getTypeFromTypeNode(enumTag.typeExpression) : errorType;
- if (!popTypeResolution()) {
- type_4 = errorType;
- error(node, ts.Diagnostics.Enum_type_0_circularly_references_itself, symbolToString(symbol));
- }
- return (links.resolvedEnumType = type_4);
- }
// Get type from reference to named type that cannot be generic (enum or type parameter)
var res = tryGetDeclaredTypeOfSymbol(symbol);
if (res) {
@@ -39913,7 +40279,7 @@ var ts;
res.flags & 262144 /* TypeParameter */ ? getConstrainedTypeVariable(res, node) : getRegularTypeOfLiteralType(res) :
errorType;
}
- if (!(symbol.flags & 67220415 /* Value */ && isJSDocTypeReference(node))) {
+ if (!(symbol.flags & 111551 /* Value */ && isJSDocTypeReference(node))) {
return errorType;
}
var jsdocType = getJSDocTypeReference(node, symbol, typeArguments);
@@ -39921,7 +40287,7 @@ var ts;
return jsdocType;
}
// Resolve the type reference as a Type for the purpose of reporting errors.
- resolveTypeReferenceName(getTypeReferenceName(node), 67897832 /* Type */);
+ resolveTypeReferenceName(getTypeReferenceName(node), 788968 /* Type */);
return getTypeOfSymbol(symbol);
}
/**
@@ -39989,7 +40355,7 @@ var ts;
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) {
+ while (node && !ts.isStatement(node) && node.kind !== 298 /* JSDocComment */) {
var parent = node.parent;
if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
@@ -40067,10 +40433,10 @@ var ts;
if (!links.resolvedType) {
var symbol = void 0;
var type = void 0;
- var meaning = 67897832 /* Type */;
+ var meaning = 788968 /* Type */;
if (isJSDocTypeReference(node)) {
type = getIntendedTypeFromJSDocTypeReference(node);
- meaning |= 67220415 /* Value */;
+ meaning |= 111551 /* Value */;
}
if (!type) {
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
@@ -40125,10 +40491,10 @@ var ts;
return type;
}
function getGlobalValueSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67220415 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
+ return getGlobalSymbol(name, 111551 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
}
function getGlobalTypeSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67897832 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
+ return getGlobalSymbol(name, 788968 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
}
function getGlobalSymbol(name, meaning, diagnostic) {
// Don't track references for global symbols anyway, so value if `isReference` is arbitrary
@@ -40197,7 +40563,7 @@ var ts;
}
function getGlobalTypeOrUndefined(name, arity) {
if (arity === void 0) { arity = 0; }
- var symbol = getGlobalSymbol(name, 67897832 /* Type */, /*diagnostic*/ undefined);
+ var symbol = getGlobalSymbol(name, 788968 /* Type */, /*diagnostic*/ undefined);
return symbol && getTypeOfGlobalSymbol(symbol, arity);
}
function getGlobalExtractSymbol() {
@@ -40561,7 +40927,7 @@ var ts;
if (isEmptyAnonymousObjectType(type)) {
if (!(includes & 8388608 /* IncludesEmptyObject */)) {
includes |= 8388608 /* IncludesEmptyObject */;
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
}
else {
@@ -40569,13 +40935,13 @@ var ts;
if (type === wildcardType)
includes |= 4194304 /* IncludesWildcard */;
}
- else if ((strictNullChecks || !(flags & 98304 /* Nullable */)) && !ts.contains(typeSet, type)) {
+ else if ((strictNullChecks || !(flags & 98304 /* Nullable */)) && !typeSet.has(type.id.toString())) {
if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
// We have seen two distinct unit types which means we should reduce to an
// empty intersection. Adding TypeFlags.NonPrimitive causes that to happen.
includes |= 67108864 /* NonPrimitive */;
}
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
includes |= flags & 68943871 /* IncludesMask */;
}
@@ -40688,8 +41054,9 @@ var ts;
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
// for intersections of types with signatures can be deterministic.
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
- var typeSet = [];
- var includes = addTypesToIntersection(typeSet, 0, types);
+ var typeMembershipMap = ts.createMap();
+ var includes = addTypesToIntersection(typeMembershipMap, 0, types);
+ var typeSet = ts.arrayFrom(typeMembershipMap.values());
// An intersection type is considered empty if it contains
// the type never, or
// more than one unit type or,
@@ -41384,7 +41751,7 @@ var ts;
links.resolvedSymbol = unknownSymbol;
return links.resolvedType = errorType;
}
- var targetMeaning = node.isTypeOf ? 67220415 /* Value */ : node.flags & 2097152 /* JSDoc */ ? 67220415 /* Value */ | 67897832 /* Type */ : 67897832 /* Type */;
+ var targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 2097152 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */;
// TODO: Future work: support unions/generics/whatever via a deferred import-type
var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
if (!innerModuleSymbol) {
@@ -41414,7 +41781,7 @@ var ts;
resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
}
else {
- var errorMessage = targetMeaning === 67220415 /* Value */
+ var errorMessage = targetMeaning === 111551 /* Value */
? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here
: ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
error(node, errorMessage, node.argument.literal.text);
@@ -41428,7 +41795,7 @@ var ts;
function resolveImportSymbolType(node, links, symbol, meaning) {
var resolvedSymbol = resolveSymbol(symbol);
links.resolvedSymbol = resolvedSymbol;
- if (meaning === 67220415 /* Value */) {
+ if (meaning === 111551 /* Value */) {
return links.resolvedType = getTypeOfSymbol(symbol); // intentionally doesn't use resolved symbol so type is cached as expected on the alias
}
else {
@@ -41726,9 +42093,9 @@ var ts;
case 166 /* FunctionType */:
case 167 /* ConstructorType */:
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 295 /* JSDocFunctionType */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 180 /* TypeOperator */:
return getTypeFromTypeOperatorNode(node);
@@ -41955,7 +42322,8 @@ var ts;
}
function maybeTypeParameterReference(node) {
return !(node.kind === 149 /* QualifiedName */ ||
- node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
+ node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName ||
+ node.parent.kind === 184 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier);
}
function isTypeParameterPossiblyReferenced(tp, node) {
// If the type parameter doesn't have exactly one declaration, if there are invening statement blocks
@@ -43223,7 +43591,7 @@ var ts;
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */);
- var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
+ var isPerformingExcessPropertyChecks = !isApparentIntersectionConstituent && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
@@ -43233,11 +43601,11 @@ var ts;
return 0 /* False */;
}
}
- if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
+ var isPerformingCommonPropertyChecks = relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
target.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target) &&
- (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)) &&
- !hasCommonProperties(source, target, isComparingJsxAttributes)) {
+ (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
+ if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
if (reportErrors) {
var calls = getSignaturesOfType(source, 0 /* Call */);
var constructs = getSignaturesOfType(source, 1 /* Construct */);
@@ -43265,10 +43633,10 @@ var ts;
else {
if (target.flags & 1048576 /* Union */) {
result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
// Validate against excess props using the original `source`
var discriminantType = findMatchingDiscriminantType(source, target) || filterPrimitivesIfContainsNonPrimitive(target);
- if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined)) {
+ if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined, isIntersectionConstituent)) {
return 0 /* False */;
}
}
@@ -43276,9 +43644,9 @@ var ts;
else if (target.flags & 2097152 /* Intersection */) {
isIntersectionConstituent = true; // set here to affect the following trio of checks
result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
// Validate against excess props using the original `source`
- if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) {
+ if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, /*isIntersectionConstituent*/ false)) {
return 0 /* False */;
}
}
@@ -43593,7 +43961,7 @@ var ts;
}
return result;
}
- function typeArgumentsRelatedTo(sources, targets, variances, reportErrors) {
+ function typeArgumentsRelatedTo(sources, targets, variances, reportErrors, isIntersectionConstituent) {
if (sources === void 0) { sources = ts.emptyArray; }
if (targets === void 0) { targets = ts.emptyArray; }
if (variances === void 0) { variances = ts.emptyArray; }
@@ -43620,10 +43988,10 @@ var ts;
related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t);
}
else if (variance === 1 /* Covariant */) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
else if (variance === 2 /* Contravariant */) {
- related = isRelatedTo(t, s, reportErrors);
+ related = isRelatedTo(t, s, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
else if (variance === 3 /* Bivariant */) {
// In the bivariant case we first compare contravariantly without reporting
@@ -43632,16 +44000,16 @@ var ts;
// which is generally easier to reason about.
related = isRelatedTo(t, s, /*reportErrors*/ false);
if (!related) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
else {
// In the invariant case we first compare covariantly, and only when that
// succeeds do we proceed to compare contravariantly. Thus, error elaboration
// will typically be based on the covariant check.
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
if (related) {
- related &= isRelatedTo(t, s, reportErrors);
+ related &= isRelatedTo(t, s, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
if (!related) {
@@ -43784,7 +44152,7 @@ var ts;
source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
!(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
var variances = getAliasVariances(source.aliasSymbol);
- var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances);
+ var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -43959,13 +44327,16 @@ var ts;
if (relation !== identityRelation) {
source = getApparentType(source);
}
+ else if (isGenericMappedType(source)) {
+ return 0 /* False */;
+ }
if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target &&
!(ts.getObjectFlags(source) & 8192 /* MarkerType */ || ts.getObjectFlags(target) & 8192 /* MarkerType */)) {
// We have type references to the same generic type, and the type references are not marker
// type references (which are intended by be compared structurally). Obtain the variance
// information for the type parameters and relate the type arguments accordingly.
var variances = getVariances(source.target);
- var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances);
+ var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -43993,7 +44364,7 @@ var ts;
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) {
// Report structural errors only if we haven't reported any errors yet
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined, isIntersectionConstituent);
if (result) {
result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors);
if (result) {
@@ -44028,8 +44399,8 @@ var ts;
}
}
return 0 /* False */;
- function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
- if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
+ function relateVariances(sourceTypeArguments, targetTypeArguments, variances, isIntersectionConstituent) {
+ if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors, isIntersectionConstituent)) {
return result;
}
if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) {
@@ -44154,7 +44525,7 @@ var ts;
if (sourceProperty === targetProperty)
return "continue";
// We compare the source property to the target in the context of a single discriminant type.
- var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false);
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false, /*isIntersectionConstituent*/ false);
// If the target property could not be found, or if the properties were not related,
// then this constituent is not a match.
if (!related) {
@@ -44184,7 +44555,7 @@ var ts;
var result = -1 /* True */;
for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
var type = matchingTypes_1[_b];
- result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties);
+ result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties, /*isIntersectionConstituent*/ false);
if (result) {
result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false);
if (result) {
@@ -44219,7 +44590,7 @@ var ts;
}
return result || properties;
}
- function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */);
var source = getTypeOfSourceProperty(sourceProp);
if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) {
@@ -44259,10 +44630,10 @@ var ts;
return result_7;
}
else {
- return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
- function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {
@@ -44300,7 +44671,7 @@ var ts;
return 0 /* False */;
}
// If the target comes from a partial union prop, allow `undefined` in the target type
- var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
@@ -44323,7 +44694,7 @@ var ts;
}
return related;
}
- function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties, isIntersectionConstituent) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target, excludedProperties);
}
@@ -44412,7 +44783,7 @@ var ts;
if (!(targetProp.flags & 4194304 /* Prototype */)) {
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp && sourceProp !== targetProp) {
- var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, isIntersectionConstituent);
if (!related) {
return 0 /* False */;
}
@@ -44647,23 +45018,27 @@ var ts;
}
}
function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue) {
- var match;
+ // undefined=unknown, true=discriminated, false=not discriminated
+ // The state of each type progresses from left to right. Discriminated types stop at 'true'.
+ var discriminable = target.types.map(function (_) { return undefined; });
for (var _i = 0, discriminators_1 = discriminators; _i < discriminators_1.length; _i++) {
var _a = discriminators_1[_i], getDiscriminatingType = _a[0], propertyName = _a[1];
+ var i = 0;
for (var _b = 0, _c = target.types; _b < _c.length; _b++) {
var type = _c[_b];
var targetType = getTypeOfPropertyOfType(type, propertyName);
if (targetType && related(getDiscriminatingType(), targetType)) {
- if (match) {
- if (type === match)
- continue; // Finding multiple fields which discriminate to the same type is fine
- return defaultValue;
- }
- match = type;
+ discriminable[i] = discriminable[i] === undefined ? true : discriminable[i];
}
+ else {
+ discriminable[i] = false;
+ }
+ i++;
}
}
- return match || defaultValue;
+ var match = discriminable.indexOf(/*searchElement*/ true);
+ // make sure exactly 1 matches before returning it
+ return match === -1 || discriminable.indexOf(/*searchElement*/ true, match + 1) !== -1 ? defaultValue : target.types[match];
}
/**
* A type is 'weak' if it is an object type with at least one optional property
@@ -45475,7 +45850,7 @@ var ts;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
param.parent.parameters.indexOf(param) > -1 &&
- (resolveName(param, param.name.escapedText, 67897832 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
+ (resolveName(param, param.name.escapedText, 788968 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
param.name.originalKeywordKind && ts.isTypeNodeKind(param.name.originalKeywordKind))) {
var newName = "arg" + param.parent.parameters.indexOf(param);
errorOrSuggestion(noImplicitAny, declaration, ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, ts.declarationNameToString(param.name));
@@ -45639,7 +46014,7 @@ var ts;
objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
objectFlags & 32 /* Mapped */ ||
- type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));
+ type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && couldUnionOrIntersectionContainTypeVariables(type));
}
function couldUnionOrIntersectionContainTypeVariables(type) {
if (type.couldContainTypeVariables === undefined) {
@@ -45794,6 +46169,8 @@ var ts;
var visited;
var bivariant = false;
var propagationType;
+ var inferenceMatch = false;
+ var inferenceIncomplete = false;
var allowComplexConstraintInference = true;
inferFromTypes(originalSource, originalTarget);
function inferFromTypes(source, target) {
@@ -45816,43 +46193,54 @@ var ts;
inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
return;
}
- if (source.flags & 1048576 /* Union */ && target.flags & 1048576 /* Union */ && !(source.flags & 1024 /* EnumLiteral */ && target.flags & 1024 /* EnumLiteral */) ||
- source.flags & 2097152 /* Intersection */ && target.flags & 2097152 /* Intersection */) {
- // Source and target are both unions or both intersections. If source and target
- // are the same type, just relate each constituent type to itself.
- if (source === target) {
- for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
- var t = _a[_i];
- inferFromTypes(t, t);
- }
- return;
+ if (source === target && source.flags & 3145728 /* UnionOrIntersection */) {
+ // When source and target are the same union or intersection type, just relate each constituent
+ // type to itself.
+ for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ inferFromTypes(t, t);
}
- // Find each source constituent type that has an identically matching target constituent
- // type, and for each such type infer from the type to itself. When inferring from a
- // type to itself we effectively find all type parameter occurrences within that type
- // and infer themselves as their type arguments. We have special handling for numeric
- // and string literals because the number and string types are not represented as unions
- // of all their possible values.
- var matchingTypes = void 0;
- for (var _b = 0, _c = source.types; _b < _c.length; _b++) {
- var t = _c[_b];
- if (typeIdenticalToSomeType(t, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t);
- inferFromTypes(t, t);
- }
- else if (t.flags & (256 /* NumberLiteral */ | 128 /* StringLiteral */)) {
- var b = getBaseTypeOfLiteralType(t);
- if (typeIdenticalToSomeType(b, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t, b);
- }
+ return;
+ }
+ if (target.flags & 1048576 /* Union */) {
+ if (source.flags & 1048576 /* Union */) {
+ // First, infer between identically matching source and target constituents and remove the
+ // matching types.
+ var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
+ // Next, infer between closely matching source and target constituents and remove
+ // the matching types. Types closely match when they are instantiations of the same
+ // object type or instantiations of the same type alias.
+ var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
}
+ source = getUnionType(sources);
+ target = getUnionType(targets);
}
- // Next, to improve the quality of inferences, reduce the source and target types by
- // removing the identically matched constituents. For example, when inferring from
- // 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'.
- if (matchingTypes) {
- source = removeTypesFromUnionOrIntersection(source, matchingTypes);
- target = removeTypesFromUnionOrIntersection(target, matchingTypes);
+ else {
+ if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
+ return;
+ if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
+ return;
+ }
+ }
+ else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
+ // We reduce intersection types only when they contain naked type parameters. For example, when
+ // inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
+ // infer { extra: any } for T. But when inferring to 'string[] & Iterable' we want to keep the
+ // string[] on the source side and infer string for T.
+ if (source.flags & 2097152 /* Intersection */) {
+ // Infer between identically matching source and target constituents and remove the matching types.
+ var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
+ }
+ source = getIntersectionType(sources);
+ target = getIntersectionType(targets);
+ }
+ else if (!(source.flags & 1048576 /* Union */)) {
+ if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
+ return;
}
}
else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
@@ -45898,13 +46286,14 @@ var ts;
clearCachedInferences(inferences);
}
}
+ inferenceMatch = true;
return;
}
else {
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
var simplified = getSimplifiedType(target, /*writing*/ false);
if (simplified !== target) {
- inferFromTypesOnce(source, simplified);
+ invokeOnce(source, simplified, inferFromTypes);
}
else if (target.flags & 8388608 /* IndexedAccess */) {
var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
@@ -45913,13 +46302,13 @@ var ts;
if (indexType.flags & 63176704 /* Instantiable */) {
var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
if (simplified_1 && simplified_1 !== target) {
- inferFromTypesOnce(source, simplified_1);
+ invokeOnce(source, simplified_1, inferFromTypes);
}
}
}
}
}
- if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {
+ if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
// If source and target are references to the same generic type, infer from type arguments
inferFromTypeArguments(source.typeArguments || ts.emptyArray, target.typeArguments || ts.emptyArray, getVariances(source.target));
}
@@ -45949,16 +46338,16 @@ var ts;
}
else if (target.flags & 16777216 /* Conditional */ && !contravariant) {
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
- inferToMultipleTypes(source, targetTypes, /*isIntersection*/ false);
+ inferToMultipleTypes(source, targetTypes, target.flags);
}
else if (target.flags & 3145728 /* UnionOrIntersection */) {
- inferToMultipleTypes(source, target.types, !!(target.flags & 2097152 /* Intersection */));
+ inferToMultipleTypes(source, target.types, target.flags);
}
else if (source.flags & 1048576 /* Union */) {
// Source is a union or intersection type, infer from each constituent type
var sourceTypes = source.types;
- for (var _d = 0, sourceTypes_3 = sourceTypes; _d < sourceTypes_3.length; _d++) {
- var sourceType = sourceTypes_3[_d];
+ for (var _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) {
+ var sourceType = sourceTypes_3[_e];
inferFromTypes(sourceType, target);
}
}
@@ -45982,38 +46371,59 @@ var ts;
source = apparentSource;
}
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
- var key = source.id + "," + target.id;
- if (visited && visited.get(key)) {
- return;
- }
- (visited || (visited = ts.createMap())).set(key, true);
- // If we are already processing another target type with the same associated symbol (such as
- // an instantiation of the same generic type), we do not explore this target as it would yield
- // no further inferences. We exclude the static side of classes from this check since it shares
- // its symbol with the instance side which would lead to false positives.
- var isNonConstructorObject = target.flags & 524288 /* Object */ &&
- !(ts.getObjectFlags(target) & 16 /* Anonymous */ && target.symbol && target.symbol.flags & 32 /* Class */);
- var symbol = isNonConstructorObject ? target.symbol : undefined;
- if (symbol) {
- if (ts.contains(symbolStack, symbol)) {
- return;
- }
- (symbolStack || (symbolStack = [])).push(symbol);
- inferFromObjectTypes(source, target);
- symbolStack.pop();
- }
- else {
- inferFromObjectTypes(source, target);
+ invokeOnce(source, target, inferFromObjectTypes);
+ }
+ }
+ }
+ function invokeOnce(source, target, action) {
+ var key = source.id + "," + target.id;
+ var status = visited && visited.get(key);
+ if (status !== undefined) {
+ if (status & 1)
+ inferenceMatch = true;
+ if (status & 2)
+ inferenceIncomplete = true;
+ return;
+ }
+ (visited || (visited = ts.createMap())).set(key, 0);
+ var saveInferenceMatch = inferenceMatch;
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceMatch = false;
+ inferenceIncomplete = false;
+ action(source, target);
+ visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0));
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ }
+ function inferFromMatchingType(source, targets, matches) {
+ var matched = false;
+ for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
+ var t = targets_1[_i];
+ if (matches(source, t)) {
+ inferFromTypes(source, t);
+ matched = true;
+ }
+ }
+ return matched;
+ }
+ function inferFromMatchingTypes(sources, targets, matches) {
+ var matchedSources;
+ var matchedTargets;
+ for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
+ var t = targets_2[_i];
+ for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
+ var s = sources_1[_a];
+ if (matches(s, t)) {
+ inferFromTypes(s, t);
+ matchedSources = ts.appendIfUnique(matchedSources, s);
+ matchedTargets = ts.appendIfUnique(matchedTargets, t);
}
}
}
- function inferFromTypesOnce(source, target) {
- var key = source.id + "," + target.id;
- if (!visited || !visited.get(key)) {
- (visited || (visited = ts.createMap())).set(key, true);
- inferFromTypes(source, target);
- }
- }
+ return [
+ matchedSources ? ts.filter(sources, function (t) { return !ts.contains(matchedSources, t); }) : sources,
+ matchedTargets ? ts.filter(targets, function (t) { return !ts.contains(matchedTargets, t); }) : targets,
+ ];
}
function inferFromTypeArguments(sourceTypes, targetTypes, variances) {
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
@@ -46047,29 +46457,69 @@ var ts;
}
return undefined;
}
- function inferToMultipleTypes(source, targets, isIntersection) {
- // We infer from types that are not naked type variables first so that inferences we
- // make from nested naked type variables and given slightly higher priority by virtue
- // of being first in the candidates array.
+ function inferToMultipleTypes(source, targets, targetFlags) {
var typeVariableCount = 0;
- for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
- var t = targets_1[_i];
- if (getInferenceInfoForType(t)) {
- typeVariableCount++;
+ if (targetFlags & 1048576 /* Union */) {
+ var nakedTypeVariable = void 0;
+ var sources = source.flags & 1048576 /* Union */ ? source.types : [source];
+ var matched_1 = new Array(sources.length);
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceIncomplete = false;
+ // First infer to types that are not naked type variables. For each source type we
+ // track whether inferences were made from that particular type to some target.
+ for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
+ var t = targets_3[_i];
+ if (getInferenceInfoForType(t)) {
+ nakedTypeVariable = t;
+ typeVariableCount++;
+ }
+ else {
+ for (var i = 0; i < sources.length; i++) {
+ var saveInferenceMatch = inferenceMatch;
+ inferenceMatch = false;
+ inferFromTypes(sources[i], t);
+ if (inferenceMatch)
+ matched_1[i] = true;
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ }
+ }
}
- else {
- inferFromTypes(source, t);
+ var inferenceComplete = !inferenceIncomplete;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ // If the target has a single naked type variable and inference completed (meaning we
+ // explored the types fully), create a union of the source types from which no inferences
+ // have been made so far and infer from that union to the naked type variable.
+ if (typeVariableCount === 1 && inferenceComplete) {
+ var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; });
+ if (unmatched.length) {
+ inferFromTypes(getUnionType(unmatched), nakedTypeVariable);
+ return;
+ }
+ }
+ }
+ else {
+ // We infer from types that are not naked type variables first so that inferences we
+ // make from nested naked type variables and given slightly higher priority by virtue
+ // of being first in the candidates array.
+ for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
+ var t = targets_4[_a];
+ if (getInferenceInfoForType(t)) {
+ typeVariableCount++;
+ }
+ else {
+ inferFromTypes(source, t);
+ }
}
}
// Inferences directly to naked type variables are given lower priority as they are
// less specific. For example, when inferring from Promise to T | Promise,
// we want to infer string for T, not Promise | string. For intersection types
// we only infer to single naked type variables.
- if (isIntersection ? typeVariableCount === 1 : typeVariableCount !== 0) {
+ if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) {
var savePriority = priority;
priority |= 1 /* NakedTypeVariable */;
- for (var _a = 0, targets_2 = targets; _a < targets_2.length; _a++) {
- var t = targets_2[_a];
+ for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
+ var t = targets_5[_b];
if (getInferenceInfoForType(t)) {
inferFromTypes(source, t);
}
@@ -46134,6 +46584,27 @@ var ts;
return false;
}
function inferFromObjectTypes(source, target) {
+ // If we are already processing another target type with the same associated symbol (such as
+ // an instantiation of the same generic type), we do not explore this target as it would yield
+ // no further inferences. We exclude the static side of classes from this check since it shares
+ // its symbol with the instance side which would lead to false positives.
+ var isNonConstructorObject = target.flags & 524288 /* Object */ &&
+ !(ts.getObjectFlags(target) & 16 /* Anonymous */ && target.symbol && target.symbol.flags & 32 /* Class */);
+ var symbol = isNonConstructorObject ? target.symbol : undefined;
+ if (symbol) {
+ if (ts.contains(symbolStack, symbol)) {
+ inferenceIncomplete = true;
+ return;
+ }
+ (symbolStack || (symbolStack = [])).push(symbol);
+ inferFromObjectTypesWorker(source, target);
+ symbolStack.pop();
+ }
+ else {
+ inferFromObjectTypesWorker(source, target);
+ }
+ }
+ function inferFromObjectTypesWorker(source, target) {
if (isGenericMappedType(source) && isGenericMappedType(target)) {
// The source and target types are generic types { [P in S]: X } and { [P in T]: Y }, so we infer
// from S to T and from X to Y.
@@ -46232,28 +46703,12 @@ var ts;
}
}
}
- function typeIdenticalToSomeType(type, types) {
- for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
- var t = types_11[_i];
- if (isTypeIdenticalTo(t, type)) {
- return true;
- }
- }
- return false;
+ function isTypeOrBaseIdenticalTo(s, t) {
+ return isTypeIdenticalTo(s, t) || !!(s.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t);
}
- /**
- * Return a new union or intersection type computed by removing a given set of types
- * from a given union or intersection type.
- */
- function removeTypesFromUnionOrIntersection(type, typesToRemove) {
- var reducedTypes = [];
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (!typeIdenticalToSomeType(t, typesToRemove)) {
- reducedTypes.push(t);
- }
- }
- return type.flags & 1048576 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);
+ function isTypeCloselyMatchedBy(s, t) {
+ return !!(s.flags & 524288 /* Object */ && t.flags & 524288 /* Object */ && s.symbol && s.symbol === t.symbol ||
+ s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol);
}
function hasPrimitiveConstraint(type) {
var constraint = getConstraintOfTypeParameter(type);
@@ -46404,7 +46859,7 @@ var ts;
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
+ resolveName(node, node.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
/*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
@@ -46601,8 +47056,8 @@ var ts;
}
function getTypeFactsOfTypes(types) {
var result = 0 /* None */;
- for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
- var t = types_12[_i];
+ for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
+ var t = types_11[_i];
result |= getTypeFacts(t);
}
return result;
@@ -46977,8 +47432,8 @@ var ts;
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var t = types_13[_i];
+ for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
+ var t = types_12[_i];
if (!(t.flags & 131072 /* Never */)) {
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
return false;
@@ -47930,8 +48385,11 @@ var ts;
}
return type;
}
+ function isExportOrExportExpression(location) {
+ return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); });
+ }
function markAliasReferenced(symbol, location) {
- if (isNonLocalAlias(symbol, /*excludes*/ 67220415 /* Value */) && !isInTypeQuery(location) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && ((compilerOptions.preserveConstEnums && isExportOrExportExpression(location)) || !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol)))) {
markAliasSymbolAsReferenced(symbol);
}
}
@@ -48824,6 +49282,15 @@ var ts;
}
return false;
}
+ function getContextualIterationType(kind, functionDecl) {
+ var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2 /* Async */);
+ var contextualReturnType = getContextualReturnType(functionDecl);
+ if (contextualReturnType) {
+ return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
+ || undefined;
+ }
+ return undefined;
+ }
function getContextualReturnType(functionDecl) {
// If the containing function has a return type annotation, is a constructor, or is a get accessor whose
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
@@ -48917,7 +49384,7 @@ var ts;
}
else if (ts.isIdentifier(lhs.expression)) {
var id = lhs.expression;
- var parentSymbol = resolveName(id, id.escapedText, 67220415 /* Value */, undefined, id.escapedText, /*isUse*/ true);
+ var parentSymbol = resolveName(id, id.escapedText, 111551 /* Value */, undefined, id.escapedText, /*isUse*/ true);
if (parentSymbol) {
var annotated = ts.getEffectiveTypeAnnotationNode(parentSymbol.valueDeclaration);
if (annotated) {
@@ -49105,9 +49572,12 @@ var ts;
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
// be "pushed" onto a node using the contextualType property.
function getApparentTypeOfContextualType(node, contextFlags) {
- var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
- if (contextualType) {
- var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true);
+ var contextualType = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, contextFlags) :
+ getContextualType(node, contextFlags);
+ var instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
+ if (instantiatedType) {
+ var apparentType = mapType(instantiatedType, getApparentType, /*noReductions*/ true);
if (apparentType.flags & 1048576 /* Union */) {
if (ts.isObjectLiteralExpression(node)) {
return discriminateContextualTypeByObjectMembers(node, apparentType);
@@ -49157,7 +49627,7 @@ var ts;
return type;
}
/**
- * Woah! Do you really want to use this function?
+ * Whoa! Do you really want to use this function?
*
* Unless you're trying to get the *non-apparent* type for a
* value-literal type or you're authoring relevant portions of this algorithm,
@@ -49408,9 +49878,7 @@ var ts;
if (typeTagSignature) {
return typeTagSignature;
}
- var type = ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) :
- getApparentTypeOfContextualType(node, 1 /* Signature */);
+ var type = getApparentTypeOfContextualType(node, 1 /* Signature */);
if (!type) {
return undefined;
}
@@ -49419,8 +49887,8 @@ var ts;
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var current = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var current = types_13[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -49971,7 +50439,7 @@ var ts;
function getJsxType(name, location) {
var namespace = getJsxNamespaceAt(location);
var exports = namespace && getExportsOfSymbol(namespace);
- var typeSymbol = exports && getSymbol(exports, name, 67897832 /* Type */);
+ var typeSymbol = exports && getSymbol(exports, name, 788968 /* Type */);
return typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType;
}
/**
@@ -50045,7 +50513,7 @@ var ts;
*/
function getNameFromJsxElementAttributesContainer(nameOfAttribPropContainer, jsxNamespace) {
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [symbol]
- var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 67897832 /* Type */);
+ var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 788968 /* Type */);
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [type]
var jsxElementAttribPropInterfaceType = jsxElementAttribPropInterfaceSym && getDeclaredTypeOfSymbol(jsxElementAttribPropInterfaceSym);
// The properties of JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute
@@ -50069,7 +50537,7 @@ var ts;
}
function getJsxLibraryManagedAttributes(jsxNamespace) {
// JSX.LibraryManagedAttributes [symbol]
- return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 67897832 /* Type */);
+ return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 788968 /* Type */);
}
/// e.g. "props" for React.d.ts,
/// or 'undefined' if ElementAttributesProperty doesn't exist (which means all
@@ -50221,13 +50689,13 @@ var ts;
var reactRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
var reactNamespace = getJsxNamespace(node);
var reactLocation = isNodeOpeningLikeElement ? node.tagName : node;
- var reactSym = resolveName(reactLocation, reactNamespace, 67220415 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true);
+ var reactSym = resolveName(reactLocation, reactNamespace, 111551 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true);
if (reactSym) {
// Mark local symbol as referenced here because it might not have been marked
// if jsx emit was not react as there wont be error being emitted
reactSym.isReferenced = 67108863 /* All */;
- // If react symbol is alias, mark it as referenced
- if (reactSym.flags & 2097152 /* Alias */ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) {
+ // If react symbol is alias, mark it as refereced
+ if (reactSym.flags & 2097152 /* Alias */) {
markAliasSymbolAsReferenced(reactSym);
}
}
@@ -50552,7 +51020,7 @@ var ts;
}
function checkPropertyNotUsedBeforeDeclaration(prop, node, right) {
var valueDeclaration = prop.valueDeclaration;
- if (!valueDeclaration) {
+ if (!valueDeclaration || ts.getSourceFileOfNode(node).isDeclarationFile) {
return;
}
var diagnosticMessage;
@@ -50668,7 +51136,7 @@ var ts;
return prop !== undefined && prop.valueDeclaration && ts.hasModifier(prop.valueDeclaration, 32 /* Static */);
}
function getSuggestedSymbolForNonexistentProperty(name, containingType) {
- return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 67220415 /* Value */);
+ return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 111551 /* Value */);
}
function getSuggestionForNonexistentProperty(name, containingType) {
var suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
@@ -52152,8 +52620,8 @@ var ts;
if (apparentType.flags & 1048576 /* Union */) {
var types = apparentType.types;
var hasSignatures = false;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var constituent = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var constituent = types_14[_i];
var signatures = getSignaturesOfType(constituent, kind);
if (signatures.length !== 0) {
hasSignatures = true;
@@ -52304,8 +52772,8 @@ var ts;
var exports = namespace && getExportsOfSymbol(namespace);
// We fake up a SFC signature for each intrinsic, however a more specific per-element signature drawn from the JSX declaration
// file would probably be preferable.
- var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */);
- var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node);
+ var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* Type */);
+ var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* Type */, node);
var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */));
var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
parameterSymbol.type = result;
@@ -52534,7 +53002,7 @@ var ts;
if (!globalESSymbol) {
return false;
}
- return globalESSymbol === resolveName(left, "Symbol", 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
+ return globalESSymbol === resolveName(left, "Symbol", 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
}
function checkImportCallExpression(node) {
// Check grammar of dynamic import
@@ -52594,7 +53062,7 @@ var ts;
// Make sure require is not a local function
if (!ts.isIdentifier(node.expression))
return ts.Debug.fail();
- var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); // TODO: GH#18217
+ var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); // TODO: GH#18217
if (resolvedRequire === requireSymbol) {
return true;
}
@@ -52703,8 +53171,8 @@ var ts;
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
- error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
+ error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system);
}
var file = ts.getSourceFileOfNode(node);
ts.Debug.assert(!!(file.flags & 1048576 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
@@ -52894,7 +53362,7 @@ var ts;
links.type = contextualType;
var decl = parameter.valueDeclaration;
if (decl.name.kind !== 73 /* Identifier */) {
- // if inference didn't come up with anything but {}, fall back to the binding pattern if present.
+ // if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
@@ -53002,7 +53470,7 @@ var ts;
nextType && isUnitType(nextType)) {
var contextualType = !contextualSignature ? undefined :
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
- getReturnTypeOfSignature(contextualSignature);
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
if (isGenerator) {
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0 /* Yield */, isAsync);
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1 /* Return */, isAsync);
@@ -53020,7 +53488,7 @@ var ts;
nextType = getWidenedType(nextType);
}
if (isGenerator) {
- return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || unknownType, isAsync);
+ return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || getContextualIterationType(2 /* Next */, func) || unknownType, isAsync);
}
else {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -53140,8 +53608,8 @@ var ts;
var witnesses = getSwitchClauseTypeOfWitnesses(node);
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
- var type_5 = getBaseConstraintOfType(operandType) || operandType;
- return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
+ var type_4 = getBaseConstraintOfType(operandType) || operandType;
+ return !!(filterType(type_4, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
}
var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
@@ -53514,7 +53982,11 @@ var ts;
}
}
var operandType = checkExpression(node.expression);
- return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ var awaitedType = checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ if (awaitedType === operandType && awaitedType !== errorType && !(operandType.flags & 3 /* AnyOrUnknown */)) {
+ addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(node, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
+ }
+ return awaitedType;
}
function checkPrefixUnaryExpression(node) {
var operandType = checkExpression(node.operand);
@@ -53599,8 +54071,8 @@ var ts;
}
if (type.flags & 3145728 /* UnionOrIntersection */) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -53709,7 +54181,7 @@ var ts;
error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
else {
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(property, 4 /* Rest */);
}
var nonRestNames = [];
@@ -54083,7 +54555,7 @@ var ts;
var propType = getTypeOfSymbol(prop);
if (propType.symbol && propType.symbol.flags & 32 /* Class */) {
var name = prop.escapedName;
- var symbol = resolveName(prop.valueDeclaration, name, 67897832 /* Type */, undefined, name, /*isUse*/ false);
+ var symbol = resolveName(prop.valueDeclaration, name, 788968 /* Type */, undefined, name, /*isUse*/ false);
if (symbol && symbol.declarations.some(ts.isJSDocTypedefTag)) {
grammarErrorOnNode(symbol.declarations[0], ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
return grammarErrorOnNode(prop.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
@@ -54232,7 +54704,7 @@ var ts;
if (node.asteriskToken) {
// Async generator functions prior to ESNext require the __await, __asyncDelegator,
// and __asyncValues helpers
- if (isAsync && languageVersion < 8 /* ESNext */) {
+ if (isAsync && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 53248 /* AsyncDelegatorIncludes */);
}
// Generator functions prior to ES2015 require the __values helper
@@ -54262,7 +54734,7 @@ var ts;
return getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, isAsync)
|| anyType;
}
- return anyType;
+ return getContextualIterationType(2 /* Next */, func) || anyType;
}
function checkConditionalExpression(node, checkMode) {
checkTruthinessExpression(node.condition);
@@ -54612,7 +55084,8 @@ var ts;
var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) ||
(node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) ||
((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node));
+ (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node)) ||
+ (node.parent.kind === 258 /* ExportSpecifier */ && (compilerOptions.preserveConstEnums || node.flags & 4194304 /* Ambient */)); // We allow reexporting const enums
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -54877,7 +55350,7 @@ var ts;
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4 /* Invalid */)) {
// Async generators prior to ESNext require the __await and __asyncGenerator helpers
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) {
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 12288 /* AsyncGeneratorIncludes */);
}
// Async functions prior to ES2017 require the __awaiter helper
@@ -54940,13 +55413,6 @@ var ts;
}
}
function checkClassForDuplicateDeclarations(node) {
- var Declaration;
- (function (Declaration) {
- Declaration[Declaration["Getter"] = 1] = "Getter";
- Declaration[Declaration["Setter"] = 2] = "Setter";
- Declaration[Declaration["Method"] = 4] = "Method";
- Declaration[Declaration["Property"] = 3] = "Property";
- })(Declaration || (Declaration = {}));
var instanceNames = ts.createUnderscoreEscapedMap();
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
@@ -54955,7 +55421,7 @@ var ts;
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
- addName(instanceNames, param.name, param.name.escapedText, 3 /* Property */);
+ addName(instanceNames, param.name, param.name.escapedText, 3 /* GetOrSetAccessor */);
}
}
}
@@ -54967,16 +55433,16 @@ var ts;
if (name && memberName) {
switch (member.kind) {
case 159 /* GetAccessor */:
- addName(names, name, memberName, 1 /* Getter */);
+ addName(names, name, memberName, 1 /* GetAccessor */);
break;
case 160 /* SetAccessor */:
- addName(names, name, memberName, 2 /* Setter */);
+ addName(names, name, memberName, 2 /* SetAccessor */);
break;
case 155 /* PropertyDeclaration */:
- addName(names, name, memberName, 3 /* Property */);
+ addName(names, name, memberName, 3 /* GetOrSetAccessor */);
break;
case 157 /* MethodDeclaration */:
- addName(names, name, memberName, 4 /* Method */);
+ addName(names, name, memberName, 8 /* Method */);
break;
}
}
@@ -54985,8 +55451,8 @@ var ts;
function addName(names, location, name, meaning) {
var prev = names.get(name);
if (prev) {
- if (prev & 4 /* Method */) {
- if (meaning !== 4 /* Method */) {
+ if (prev & 8 /* Method */) {
+ if (meaning !== 8 /* Method */) {
error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));
}
}
@@ -55554,6 +56020,7 @@ var ts;
}
var duplicateFunctionDeclaration = false;
var multipleConstructorImplementation = false;
+ var hasNonAmbientClass = false;
for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
var current = declarations_4[_i];
var node = current;
@@ -55569,6 +56036,9 @@ var ts;
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
+ if ((node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */) && !inAmbientContext) {
+ hasNonAmbientClass = true;
+ }
if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
@@ -55610,6 +56080,15 @@ var ts;
error(ts.getNameOfDeclaration(declaration), ts.Diagnostics.Duplicate_function_implementation);
});
}
+ if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */) {
+ // A non-ambient class cannot be an implementation for a non-constructor function/class merge
+ // TODO: The below just replicates our older error from when classes and functions were
+ // entirely unable to merge - a more helpful message like "Class declaration cannot implement overload list"
+ // might be warranted. :shrug:
+ ts.forEach(declarations, function (declaration) {
+ addDuplicateDeclarationError(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Duplicate_identifier_0, ts.symbolName(symbol), ts.filter(declarations, function (d) { return d !== declaration; }));
+ });
+ }
// Abstract methods can't have an implementation -- in particular, they don't need one.
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&
!ts.hasModifier(lastSeenNonAmbientDeclaration, 128 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) {
@@ -55631,13 +56110,6 @@ var ts;
}
}
}
- var DeclarationSpaces;
- (function (DeclarationSpaces) {
- DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None";
- DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue";
- DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType";
- DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace";
- })(DeclarationSpaces || (DeclarationSpaces = {}));
function checkExportsOnMergedDeclarations(node) {
if (!produceDiagnostics) {
return;
@@ -55701,8 +56173,9 @@ var ts;
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return 2 /* ExportType */;
case 245 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
@@ -55800,9 +56273,6 @@ var ts;
*/
function checkAwaitedType(type, errorNode, diagnosticMessage, arg0) {
var awaitedType = getAwaitedType(type, errorNode, diagnosticMessage, arg0);
- if (awaitedType === type && !(type.flags & 3 /* AnyOrUnknown */)) {
- addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(errorNode, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
- }
return awaitedType || errorType;
}
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -55961,7 +56431,7 @@ var ts;
error(returnTypeNode, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
return;
}
- var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true);
+ var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 111551 /* Value */, /*ignoreErrors*/ true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
@@ -55984,7 +56454,7 @@ var ts;
}
// Verify there is no local declaration that could collide with the promise constructor.
var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
- var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 67220415 /* Value */);
+ var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 111551 /* Value */);
if (collidingSymbol) {
error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, ts.idText(rootName), ts.entityNameToString(promiseConstructorName));
return;
@@ -56041,7 +56511,7 @@ var ts;
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
+ var meaning = (typeName.kind === 73 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true);
if (rootSymbol
&& rootSymbol.flags & 2097152 /* Alias */
@@ -56080,8 +56550,8 @@ var ts;
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
@@ -56809,7 +57279,7 @@ var ts;
}
}
if (node.kind === 187 /* BindingElement */) {
- if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) {
+ if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 4 /* Rest */);
}
// check computed properties inside property names of binding elements
@@ -57023,7 +57493,7 @@ var ts;
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) {
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 99 /* ESNext */) {
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
checkExternalEmitHelpers(node, 32768 /* ForAwaitOfIncludes */);
}
@@ -58300,7 +58770,7 @@ var ts;
// derived class instance member variables and accessors, but not by other kinds of members.
// NOTE: assignability is checked in checkClassDeclaration
var baseProperties = getPropertiesOfType(baseType);
- for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
+ basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304 /* Prototype */) {
@@ -58309,54 +58779,65 @@ var ts;
var derived = getTargetSymbol(getPropertyOfObjectType(type, base.escapedName)); // TODO: GH#18217
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration.");
- if (derived) {
- // In order to resolve whether the inherited method was overridden in the base class or not,
- // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
- // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
- if (derived === base) {
- // derived class inherits base without override/redeclaration
- var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
- // It is an error to inherit an abstract member without implementing it or being declared abstract.
- // If there is no declaration for the derived class (as in the case of class expressions),
- // then the class cannot be declared abstract.
- if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 210 /* ClassExpression */) {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
- }
- else {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
+ // In order to resolve whether the inherited method was overridden in the base class or not,
+ // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
+ // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
+ if (derived === base) {
+ // derived class inherits base without override/redeclaration
+ var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
+ // It is an error to inherit an abstract member without implementing it or being declared abstract.
+ // If there is no declaration for the derived class (as in the case of class expressions),
+ // then the class cannot be declared abstract.
+ if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
+ // Searches other base types for a declaration that would satisfy the inherited abstract member.
+ // (The class may have more than one base type via declaration merging with an interface with the
+ // same name.)
+ for (var _a = 0, _b = getBaseTypes(type); _a < _b.length; _a++) {
+ var otherBaseType = _b[_a];
+ if (otherBaseType === baseType)
+ continue;
+ var baseSymbol = getPropertyOfObjectType(otherBaseType, base.escapedName);
+ var derivedElsewhere = baseSymbol && getTargetSymbol(baseSymbol);
+ if (derivedElsewhere && derivedElsewhere !== base) {
+ continue basePropertyCheck;
}
}
- }
- else {
- // derived overrides base.
- var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
- if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
- // either base or derived property is private - not override, skip it
- continue;
- }
- if (isPrototypeProperty(base) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) {
- // method is overridden with method or property/accessor is overridden with property/accessor - correct case
- continue;
- }
- var errorMessage = void 0;
- if (isPrototypeProperty(base)) {
- if (derived.flags & 98304 /* Accessor */) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
- }
- else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
- }
- }
- else if (base.flags & 98304 /* Accessor */) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ if (derivedClassDecl.kind === 210 /* ClassExpression */) {
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
}
- error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
}
}
+ else {
+ // derived overrides base.
+ var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
+ if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
+ // either base or derived property is private - not override, skip it
+ continue;
+ }
+ if (isPrototypeProperty(base) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) {
+ // method is overridden with method or property/accessor is overridden with property/accessor - correct case
+ continue;
+ }
+ var errorMessage = void 0;
+ if (isPrototypeProperty(base)) {
+ if (derived.flags & 98304 /* Accessor */) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
+ }
+ }
+ else if (base.flags & 98304 /* Accessor */) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
+ }
}
}
function checkInheritedPropertiesAreIdentical(type, typeNode) {
@@ -58900,15 +59381,16 @@ var ts;
function checkAliasSymbol(node) {
var symbol = getSymbolOfNode(node);
var target = resolveAlias(symbol);
- if (target !== unknownSymbol) {
- // For external modules symbol represent local symbol for an alias.
+ var shouldSkipWithJSExpandoTargets = symbol.flags & 67108864 /* Assignment */;
+ if (!shouldSkipWithJSExpandoTargets && target !== unknownSymbol) {
+ // For external modules symbol represents local symbol for an alias.
// This local symbol will merge any other local declarations (excluding other aliases)
// and symbol.flags will contains combined representation for all merged declaration.
// Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,
// otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export*
// in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).
- var excludedMeanings = (symbol.flags & (67220415 /* Value */ | 1048576 /* ExportValue */) ? 67220415 /* Value */ : 0) |
- (symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) |
+ var excludedMeanings = (symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */) ? 111551 /* Value */ : 0) |
+ (symbol.flags & 788968 /* Type */ ? 788968 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
var message = node.kind === 258 /* ExportSpecifier */ ?
@@ -58919,7 +59401,7 @@ var ts;
// Don't allow to re-export something with no value side when `--isolatedModules` is set.
if (compilerOptions.isolatedModules
&& node.kind === 258 /* ExportSpecifier */
- && !(target.flags & 67220415 /* Value */)
+ && !(target.flags & 111551 /* Value */)
&& !(node.flags & 4194304 /* Ambient */)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
}
@@ -58972,14 +59454,14 @@ var ts;
if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
- if (target.flags & 67220415 /* Value */) {
+ if (target.flags & 111551 /* Value */) {
// Target is a value symbol, check that it is not hidden by a local declaration with the same name
var moduleName = getFirstIdentifier(node.moduleReference);
- if (!(resolveEntityName(moduleName, 67220415 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
+ if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
}
}
- if (target.flags & 67897832 /* Type */) {
+ if (target.flags & 788968 /* Type */) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
}
}
@@ -59039,13 +59521,17 @@ var ts;
if (!node.parent.parent.moduleSpecifier) {
var exportedName = node.propertyName || node.name;
// find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases)
- var symbol = resolveName(exportedName, exportedName.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
+ var symbol = resolveName(exportedName, exportedName.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
/*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
}
else {
markExportAsReferenced(node);
+ var target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
+ if (!target || target === unknownSymbol || target.flags & 111551 /* Value */) {
+ checkExpressionCached(node.propertyName || node.name);
+ }
}
}
}
@@ -59069,7 +59555,17 @@ var ts;
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
if (node.expression.kind === 73 /* Identifier */) {
- markExportAsReferenced(node);
+ var id = node.expression;
+ var sym = resolveEntityName(id, 67108863 /* All */, /*ignoreErrors*/ true, /*dontResolveAlias*/ true, node);
+ if (sym) {
+ markAliasReferenced(sym, id);
+ // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
+ var target = sym.flags & 2097152 /* Alias */ ? resolveAlias(sym) : sym;
+ if (target === unknownSymbol || target.flags & 111551 /* Value */) {
+ // However if it is a value, we need to check it's being used correctly
+ checkExpressionCached(node.expression);
+ }
+ }
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, /*setVisibility*/ true);
}
@@ -59138,14 +59634,6 @@ var ts;
links.exportsChecked = true;
}
}
- function isNotAccessor(declaration) {
- // Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
- return !ts.isAccessor(declaration);
- }
- function isNotOverload(declaration) {
- return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
- !!declaration.body;
- }
function checkSourceElement(node) {
if (node) {
var saveCurrentNode = currentNode;
@@ -59225,16 +59713,17 @@ var ts;
return checkInferType(node);
case 184 /* ImportType */:
return checkImportType(node);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return checkJSDocTypeAliasTag(node);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return checkJSDocTemplateTag(node);
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
return checkJSDocTypeTag(node);
- case 306 /* JSDocParameterTag */:
+ case 307 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
case 295 /* JSDocFunctionType */:
checkJSDocFunctionType(node);
@@ -59243,7 +59732,7 @@ var ts;
case 292 /* JSDocNullableType */:
case 290 /* JSDocAllType */:
case 291 /* JSDocUnknownType */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
@@ -59584,7 +60073,7 @@ var ts;
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
// Note: that the memberFlags come from previous iteration.
if (!isStatic) {
- copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */);
+ copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* Type */);
}
break;
case 197 /* FunctionExpression */:
@@ -59737,7 +60226,7 @@ var ts;
if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
// Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression
var success = resolveEntityName(entityName,
- /*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
+ /*all meanings*/ 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
if (success && success !== unknownSymbol) {
return success;
}
@@ -59763,10 +60252,10 @@ var ts;
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) {
- meaning = 67897832 /* Type */;
+ meaning = 788968 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
- meaning |= 67220415 /* Value */;
+ meaning |= 111551 /* Value */;
}
}
else {
@@ -59778,10 +60267,10 @@ var ts;
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 306 /* JSDocParameterTag */) {
+ if (entityName.parent.kind === 307 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 310 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 311 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -59796,7 +60285,7 @@ var ts;
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
- return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
+ return resolveEntityName(entityName, 111551 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) {
var links = getNodeLinks(entityName);
@@ -59813,7 +60302,7 @@ var ts;
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
+ var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
if (entityName.parent.kind === 164 /* TypePredicate */) {
@@ -59923,7 +60412,7 @@ var ts;
}
function getShorthandAssignmentValueSymbol(location) {
if (location && location.kind === 277 /* ShorthandPropertyAssignment */) {
- return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */);
+ return resolveEntityName(location.name, 111551 /* Value */ | 2097152 /* Alias */);
}
return undefined;
}
@@ -59931,7 +60420,7 @@ var ts;
function getExportSpecifierLocalTargetSymbol(node) {
return node.parent.parent.moduleSpecifier ?
getExternalModuleMember(node.parent.parent, node) :
- resolveEntityName(node.propertyName || node.name, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ resolveEntityName(node.propertyName || node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
function getTypeOfNode(node) {
if (node.flags & 8388608 /* InWithStatement */) {
@@ -60132,13 +60621,13 @@ var ts;
// for export assignments - check if resolved symbol for RHS is itself a value
// otherwise - check if at least one export is value
symbolLinks.exportsSomeValue = hasExportAssignment
- ? !!(moduleSymbol.flags & 67220415 /* Value */)
+ ? !!(moduleSymbol.flags & 111551 /* Value */)
: ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue);
}
return symbolLinks.exportsSomeValue;
function isValue(s) {
s = resolveSymbol(s);
- return s && !!(s.flags & 67220415 /* Value */);
+ return s && !!(s.flags & 111551 /* Value */);
}
}
function isNameOfModuleOrEnumDeclaration(node) {
@@ -60187,7 +60676,7 @@ var ts;
var symbol = getReferencedValueSymbol(node);
// We should only get the declaration of an alias if there isn't a local value
// declaration for the symbol
- if (isNonLocalAlias(symbol, /*excludes*/ 67220415 /* Value */)) {
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */)) {
return getDeclarationOfAliasSymbol(symbol);
}
}
@@ -60204,7 +60693,7 @@ var ts;
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
- if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
+ if (resolveName(container.parent, symbol.escapedName, 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
// redeclaration - always should be renamed
links.isDeclarationWithCollidingName = true;
}
@@ -60300,7 +60789,7 @@ var ts;
}
// const enums and modules that contain only const enums are not considered values from the emit perspective
// unless 'preserveConstEnums' option is set to true
- return !!(target.flags & 67220415 /* Value */) &&
+ return !!(target.flags & 111551 /* Value */) &&
(compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));
}
function isConstEnumOrConstEnumOnlyModule(s) {
@@ -60314,7 +60803,7 @@ var ts;
}
var target = getSymbolLinks(symbol).target; // TODO: GH#18217
if (target && ts.getModifierFlags(node) & 1 /* Export */ &&
- target.flags & 67220415 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
+ target.flags & 111551 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
// An `export import ... =` of a value symbol is always considered referenced
return true;
}
@@ -60368,7 +60857,7 @@ var ts;
if (!symbol || !(symbol.flags & 16 /* Function */)) {
return false;
}
- return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 67220415 /* Value */ && ts.isPropertyAccessExpression(p.valueDeclaration); });
+ return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 111551 /* Value */ && p.valueDeclaration && ts.isPropertyAccessExpression(p.valueDeclaration); });
}
function getPropertiesOfContainerFunction(node) {
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
@@ -60422,9 +60911,9 @@ var ts;
return ts.TypeReferenceSerializationKind.Unknown;
}
// Resolve the symbol as a value to ensure the type can be reached at runtime during emit.
- var valueSymbol = resolveEntityName(typeName, 67220415 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
+ var valueSymbol = resolveEntityName(typeName, 111551 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
// Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.
- var typeSymbol = resolveEntityName(typeName, 67897832 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
+ var typeSymbol = resolveEntityName(typeName, 788968 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
if (valueSymbol && valueSymbol === typeSymbol) {
var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(/*reportErrors*/ false);
if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) {
@@ -60529,7 +61018,7 @@ var ts;
location = getDeclarationContainer(parent);
}
}
- return resolveName(location, reference.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
+ return resolveName(location, reference.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
}
function getReferencedValueDeclaration(referenceIn) {
if (!ts.isGeneratedIdentifier(referenceIn)) {
@@ -60550,7 +61039,7 @@ var ts;
return false;
}
function literalTypeToNode(type, enclosing, tracker) {
- var enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(type.symbol, 67220415 /* Value */, enclosing, /*flags*/ undefined, tracker)
+ var enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(type.symbol, 111551 /* Value */, enclosing, /*flags*/ undefined, tracker)
: type === trueType ? ts.createTrue() : type === falseType && ts.createFalse();
return enumResult || ts.createLiteral(type.value);
}
@@ -60663,9 +61152,9 @@ var ts;
// property access can only be used as values, or types when within an expression with type arguments inside a heritage clause
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
- var meaning = 67897832 /* Type */ | 1920 /* Namespace */;
+ var meaning = 788968 /* Type */ | 1920 /* Namespace */;
if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
- meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
}
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
@@ -60888,7 +61377,7 @@ var ts;
for (var helper = 1 /* FirstEmitHelper */; helper <= 131072 /* LastEmitHelper */; helper <<= 1) {
if (uncheckedHelpers & helper) {
var name = getHelperName(helper);
- var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 67220415 /* Value */);
+ var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 111551 /* Value */);
if (!symbol) {
error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name);
}
@@ -61467,13 +61956,6 @@ var ts;
return !!exclamationToken && grammarErrorOnNode(exclamationToken, message);
}
function checkGrammarObjectLiteralExpression(node, inDestructuring) {
- var Flags;
- (function (Flags) {
- Flags[Flags["Property"] = 1] = "Property";
- Flags[Flags["GetAccessor"] = 2] = "GetAccessor";
- Flags[Flags["SetAccessor"] = 4] = "SetAccessor";
- Flags[Flags["GetOrSetAccessor"] = 6] = "GetOrSetAccessor";
- })(Flags || (Flags = {}));
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
@@ -61525,15 +62007,16 @@ var ts;
if (name.kind === 8 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
- // falls through
+ currentKind = 4 /* PropertyAssignment */;
+ break;
case 157 /* MethodDeclaration */:
- currentKind = 1 /* Property */;
+ currentKind = 8 /* Method */;
break;
case 159 /* GetAccessor */:
- currentKind = 2 /* GetAccessor */;
+ currentKind = 1 /* GetAccessor */;
break;
case 160 /* SetAccessor */:
- currentKind = 4 /* SetAccessor */;
+ currentKind = 2 /* SetAccessor */;
break;
default:
throw ts.Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
@@ -61547,11 +62030,11 @@ var ts;
seen.set(effectiveName, currentKind);
}
else {
- if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) {
+ if ((currentKind & 12 /* PropertyAssignmentOrMethod */) && (existingKind & 12 /* PropertyAssignmentOrMethod */)) {
grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name));
}
- else if ((currentKind & 6 /* GetOrSetAccessor */) && (existingKind & 6 /* GetOrSetAccessor */)) {
- if (existingKind !== 6 /* GetOrSetAccessor */ && currentKind !== existingKind) {
+ else if ((currentKind & 3 /* GetOrSetAccessor */) && (existingKind & 3 /* GetOrSetAccessor */)) {
+ if (existingKind !== 3 /* GetOrSetAccessor */ && currentKind !== existingKind) {
seen.set(effectiveName, currentKind | existingKind);
}
else {
@@ -61649,42 +62132,38 @@ var ts;
return false;
}
function checkGrammarAccessor(accessor) {
- var kind = accessor.kind;
- if (languageVersion < 1 /* ES5 */) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ if (!(accessor.flags & 4194304 /* Ambient */)) {
+ if (languageVersion < 1 /* ES5 */) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ }
+ if (accessor.body === undefined && !ts.hasModifier(accessor, 128 /* Abstract */)) {
+ return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
+ }
}
- else if (accessor.flags & 4194304 /* Ambient */) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);
- }
- else if (accessor.body === undefined && !ts.hasModifier(accessor, 128 /* Abstract */)) {
- return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
- }
- else if (accessor.body && ts.hasModifier(accessor, 128 /* Abstract */)) {
+ if (accessor.body && ts.hasModifier(accessor, 128 /* Abstract */)) {
return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
}
- else if (accessor.typeParameters) {
+ if (accessor.typeParameters) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
- else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ?
+ if (!doesAccessorHaveCorrectParameterCount(accessor)) {
+ return grammarErrorOnNode(accessor.name, accessor.kind === 159 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 160 /* SetAccessor */) {
+ if (accessor.kind === 160 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
- else {
- var parameter = accessor.parameters[0];
- if (parameter.dotDotDotToken) {
- return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
- }
- else if (parameter.questionToken) {
- return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
- }
- else if (parameter.initializer) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
- }
+ var parameter = ts.Debug.assertDefined(ts.getSetAccessorValueParameter(accessor), "Return value does not match parameter count assertion.");
+ if (parameter.dotDotDotToken) {
+ return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
+ }
+ if (parameter.questionToken) {
+ return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
+ }
+ if (parameter.initializer) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
}
}
return false;
@@ -62119,13 +62598,9 @@ var ts;
}
function checkGrammarStatementInAmbientContext(node) {
if (node.flags & 4194304 /* Ambient */) {
- // An accessors is already reported about the ambient context
- if (ts.isAccessor(node.parent)) {
- return getNodeLinks(node).hasReportedStatementInAmbientContext = true;
- }
// Find containing block which is either Block, ModuleBlock, SourceFile
var links = getNodeLinks(node);
- if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) {
+ if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
}
// We are either parented by another statement, or some sort of block.
@@ -62173,7 +62648,7 @@ var ts;
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -62223,6 +62698,14 @@ var ts;
}
}
ts.createTypeChecker = createTypeChecker;
+ function isNotAccessor(declaration) {
+ // Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
+ return !ts.isAccessor(declaration);
+ }
+ function isNotOverload(declaration) {
+ return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
+ !!declaration.body;
+ }
/** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
@@ -64201,7 +64684,7 @@ var ts;
ts.createJSDocTypeExpression = createJSDocTypeExpression;
/* @internal */
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(309 /* JSDocTypeTag */, "type");
+ var tag = createJSDocTag(310 /* JSDocTypeTag */, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -64209,7 +64692,7 @@ var ts;
ts.createJSDocTypeTag = createJSDocTypeTag;
/* @internal */
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(307 /* JSDocReturnTag */, "returns");
+ var tag = createJSDocTag(308 /* JSDocReturnTag */, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -64217,14 +64700,14 @@ var ts;
ts.createJSDocReturnTag = createJSDocReturnTag;
/** @internal */
function createJSDocThisTag(typeExpression) {
- var tag = createJSDocTag(308 /* JSDocThisTag */, "this");
+ var tag = createJSDocTag(309 /* JSDocThisTag */, "this");
tag.typeExpression = typeExpression;
return tag;
}
ts.createJSDocThisTag = createJSDocThisTag;
/* @internal */
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(306 /* JSDocParameterTag */, "param");
+ var tag = createJSDocTag(307 /* JSDocParameterTag */, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -64234,7 +64717,7 @@ var ts;
ts.createJSDocParamTag = createJSDocParamTag;
/* @internal */
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(297 /* JSDocComment */);
+ var node = createSynthesizedNode(298 /* JSDocComment */);
node.comment = comment;
node.tags = tags;
return node;
@@ -64599,7 +65082,7 @@ var ts;
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(314 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(315 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -64611,7 +65094,7 @@ var ts;
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(318 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(319 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -64623,7 +65106,7 @@ var ts;
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(317 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(318 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -64638,7 +65121,7 @@ var ts;
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(315 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(316 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -64654,7 +65137,7 @@ var ts;
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 316 /* CommaListExpression */) {
+ if (node.kind === 317 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) {
@@ -64664,7 +65147,7 @@ var ts;
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(316 /* CommaListExpression */);
+ var node = createSynthesizedNode(317 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -65512,29 +65995,34 @@ var ts;
}
ts.createExpressionForJsxFragment = createExpressionForJsxFragment;
// Helpers
- function getHelperName(name) {
+ /**
+ * Gets an identifier for the name of an *unscoped* emit helper.
+ */
+ function getUnscopedHelperName(name) {
return ts.setEmitFlags(ts.createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */);
}
- ts.getHelperName = getHelperName;
+ ts.getUnscopedHelperName = getUnscopedHelperName;
ts.valuesHelper = {
name: "typescript:values",
+ importName: "__values",
scoped: false,
- text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };"
+ text: "\n var __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n };"
};
function createValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.valuesHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__values"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__values"),
/*typeArguments*/ undefined, [expression]), location);
}
ts.createValuesHelper = createValuesHelper;
ts.readHelper = {
name: "typescript:read",
+ importName: "__read",
scoped: false,
text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };"
};
function createReadHelper(context, iteratorRecord, count, location) {
context.requestEmitHelper(ts.readHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__read"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__read"),
/*typeArguments*/ undefined, count !== undefined
? [iteratorRecord, ts.createLiteral(count)]
: [iteratorRecord]), location);
@@ -65542,24 +66030,26 @@ var ts;
ts.createReadHelper = createReadHelper;
ts.spreadHelper = {
name: "typescript:spread",
+ importName: "__spread",
scoped: false,
text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };"
};
function createSpreadHelper(context, argumentList, location) {
context.requestEmitHelper(ts.readHelper);
context.requestEmitHelper(ts.spreadHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spread"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spread"),
/*typeArguments*/ undefined, argumentList), location);
}
ts.createSpreadHelper = createSpreadHelper;
ts.spreadArraysHelper = {
name: "typescript:spreadArrays",
+ importName: "__spreadArrays",
scoped: false,
text: "\n var __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n };"
};
function createSpreadArraysHelper(context, argumentList, location) {
context.requestEmitHelper(ts.spreadArraysHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spreadArrays"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spreadArrays"),
/*typeArguments*/ undefined, argumentList), location);
}
ts.createSpreadArraysHelper = createSpreadArraysHelper;
@@ -66404,7 +66894,7 @@ var ts;
case 191 /* ElementAccessExpression */:
case 190 /* PropertyAccessExpression */:
case 214 /* NonNullExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -66421,7 +66911,7 @@ var ts;
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
- node.kind === 316 /* CommaListExpression */;
+ node.kind === 317 /* CommaListExpression */;
}
ts.isCommaSequence = isCommaSequence;
var OuterExpressionKinds;
@@ -66440,7 +66930,7 @@ var ts;
case 213 /* AsExpression */:
case 214 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -66477,7 +66967,7 @@ var ts;
case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 315 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 316 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -66520,6 +67010,60 @@ var ts;
return emitNode && emitNode.externalHelpersModuleName;
}
ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function hasRecordedExternalHelpers(sourceFile) {
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return !!emitNode && (!!emitNode.externalHelpersModuleName || !!emitNode.externalHelpers);
+ }
+ ts.hasRecordedExternalHelpers = hasRecordedExternalHelpers;
+ function createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) {
+ if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
+ var namedBindings = void 0;
+ var moduleKind = ts.getEmitModuleKind(compilerOptions);
+ if (moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) {
+ // use named imports
+ var helpers = ts.getEmitHelpers(sourceFile);
+ if (helpers) {
+ var helperNames = [];
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!helper.scoped) {
+ var importName = helper.importName;
+ if (importName) {
+ ts.pushIfUnique(helperNames, importName);
+ }
+ }
+ }
+ if (ts.some(helperNames)) {
+ helperNames.sort(ts.compareStringsCaseSensitive);
+ // Alias the imports if the names are used somewhere in the file.
+ // NOTE: We don't need to care about global import collisions as this is a module.
+ namedBindings = ts.createNamedImports(ts.map(helperNames, function (name) { return ts.isFileLevelUniqueName(sourceFile, name)
+ ? ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(name))
+ : ts.createImportSpecifier(ts.createIdentifier(name), getUnscopedHelperName(name)); }));
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = ts.getOrCreateEmitNode(parseNode);
+ emitNode.externalHelpers = true;
+ }
+ }
+ }
+ else {
+ // use a namespace import
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
+ if (externalHelpersModuleName) {
+ namedBindings = ts.createNamespaceImport(externalHelpersModuleName);
+ }
+ }
+ if (namedBindings) {
+ var externalHelpersImportDeclaration = ts.createImportDeclaration(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, namedBindings), ts.createLiteral(ts.externalHelpersModuleNameText));
+ ts.addEmitFlags(externalHelpersImportDeclaration, 67108864 /* NeverApplyImportHelper */);
+ return externalHelpersImportDeclaration;
+ }
+ }
+ }
+ ts.createExternalHelpersImportDeclarationIfNeeded = createExternalHelpersImportDeclarationIfNeeded;
function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(node, compilerOptions)) {
var externalHelpersModuleName = getExternalHelpersModuleName(node);
@@ -66534,8 +67078,8 @@ var ts;
if (!create) {
var helpers = ts.getEmitHelpers(node);
if (helpers) {
- for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
- var helper = helpers_2[_i];
+ for (var _i = 0, helpers_3 = helpers; _i < helpers_3.length; _i++) {
+ var helper = helpers_3[_i];
if (!helper.scoped) {
create = true;
break;
@@ -67274,9 +67818,9 @@ var ts;
case 285 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -67332,7 +67876,7 @@ var ts;
case 221 /* EmptyStatement */:
case 211 /* OmittedExpression */:
case 237 /* DebuggerStatement */:
- case 314 /* NotEmittedStatement */:
+ case 315 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
@@ -67713,10 +68257,10 @@ var ts;
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -68504,7 +69048,8 @@ var ts;
var hasExportDefault = false;
var exportEquals;
var hasExportStarsToExportValues = false;
- var hasImportStarOrImportDefault = false;
+ var hasImportStar = false;
+ var hasImportDefault = false;
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
@@ -68514,7 +69059,12 @@ var ts;
// import * as x from "mod"
// import { x, y } from "mod"
externalImports.push(node);
- hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
+ if (!hasImportStar && getImportNeedsImportStarHelper(node)) {
+ hasImportStar = true;
+ }
+ if (!hasImportDefault && getImportNeedsImportDefaultHelper(node)) {
+ hasImportDefault = true;
+ }
break;
case 249 /* ImportEqualsDeclaration */:
if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
@@ -68608,12 +69158,8 @@ var ts;
break;
}
}
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault);
- var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault);
if (externalHelpersImportDeclaration) {
- ts.addEmitFlags(externalHelpersImportDeclaration, 67108864 /* NeverApplyImportHelper */);
externalImports.unshift(externalHelpersImportDeclaration);
}
return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
@@ -69201,6 +69747,7 @@ var ts;
}
ts.restHelper = {
name: "typescript:rest",
+ importName: "__rest",
scoped: false,
text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
@@ -69225,7 +69772,7 @@ var ts;
}
}
}
- return ts.createCall(ts.getHelperName("__rest"),
+ return ts.createCall(ts.getUnscopedHelperName("__rest"),
/*typeArguments*/ undefined, [
value,
ts.setTextRange(ts.createArrayLiteral(propertyNames), location)
@@ -70590,8 +71137,8 @@ var ts;
// Note when updating logic here also update getEntityNameForDecoratorMetadata
// so that aliases can be marked as referenced
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
@@ -70733,7 +71280,7 @@ var ts;
* available.
*/
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 8 /* ESNext */
+ return languageVersion < 99 /* ESNext */
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -71871,18 +72418,19 @@ var ts;
}
}
context.requestEmitHelper(ts.decorateHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__decorate"),
/*typeArguments*/ undefined, argumentsArray), location);
}
ts.decorateHelper = {
name: "typescript:decorate",
+ importName: "__decorate",
scoped: false,
priority: 2,
text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
};
function createMetadataHelper(context, metadataKey, metadataValue) {
context.requestEmitHelper(ts.metadataHelper);
- return ts.createCall(ts.getHelperName("__metadata"),
+ return ts.createCall(ts.getUnscopedHelperName("__metadata"),
/*typeArguments*/ undefined, [
ts.createLiteral(metadataKey),
metadataValue
@@ -71890,13 +72438,14 @@ var ts;
}
ts.metadataHelper = {
name: "typescript:metadata",
+ importName: "__metadata",
scoped: false,
priority: 3,
text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
};
function createParamHelper(context, expression, parameterOffset, location) {
context.requestEmitHelper(ts.paramHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__param"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__param"),
/*typeArguments*/ undefined, [
ts.createLiteral(parameterOffset),
expression
@@ -71904,6 +72453,7 @@ var ts;
}
ts.paramHelper = {
name: "typescript:param",
+ importName: "__param",
scoped: false,
priority: 4,
text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
@@ -72348,6 +72898,7 @@ var ts;
var hasSuperElementAccess;
/** A set of node IDs for generated super accessors (variable statements). */
var substitutedSuperAccessors = [];
+ var topLevel;
// Save the previous transformation hooks.
var previousOnEmitNode = context.onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
@@ -72359,10 +72910,23 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitor(node) {
if ((node.transformFlags & 32 /* ContainsES2017 */) === 0) {
return node;
@@ -72374,11 +72938,11 @@ var ts;
case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
case 157 /* MethodDeclaration */:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 240 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197 /* FunctionExpression */:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198 /* ArrowFunction */:
return visitArrowFunction(node);
case 190 /* PropertyAccessExpression */:
@@ -72391,6 +72955,12 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -72642,7 +73212,7 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.body.statements, /*ensureUseStrict*/ false, visitor);
- statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
@@ -72669,7 +73239,7 @@ var ts;
result = block;
}
else {
- var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
+ var expression = createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
var declarations = endLexicalEnvironment();
if (ts.some(declarations)) {
var block = ts.convertToFunctionBody(expression);
@@ -72868,11 +73438,12 @@ var ts;
ts.createSuperAccessVariableStatement = createSuperAccessVariableStatement;
ts.awaiterHelper = {
name: "typescript:awaiter",
+ importName: "__awaiter",
scoped: false,
priority: 5,
- text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
};
- function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ function createAwaiterHelper(context, hasLexicalThis, hasLexicalArguments, promiseConstructor, body) {
context.requestEmitHelper(ts.awaiterHelper);
var generatorFunc = ts.createFunctionExpression(
/*modifiers*/ undefined, ts.createToken(40 /* AsteriskToken */),
@@ -72882,9 +73453,9 @@ var ts;
/*type*/ undefined, body);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */ | 524288 /* ReuseTempVariableScope */;
- return ts.createCall(ts.getHelperName("__awaiter"),
+ return ts.createCall(ts.getUnscopedHelperName("__awaiter"),
/*typeArguments*/ undefined, [
- ts.createThis(),
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
generatorFunc
@@ -72918,9 +73489,11 @@ var ts;
context.onEmitNode = onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
+ var exportedVariableStatement = false;
var enabledSubstitutions;
var enclosingFunctionFlags;
var enclosingSuperContainerFlags = 0;
+ var topLevel;
/** Keeps track of property names accessed on super (`super.x`) within async functions. */
var capturedSuperProperties;
/** Whether the async function contains an element access on super (`super[x]`). */
@@ -72932,6 +73505,8 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ exportedVariableStatement = false;
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
@@ -72948,6 +73523,18 @@ var ts;
}
return node;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitorWorker(node, noDestructuringValue) {
if ((node.transformFlags & 16 /* ContainsES2018 */) === 0) {
return node;
@@ -72967,6 +73554,8 @@ var ts;
return visitBinaryExpression(node, noDestructuringValue);
case 275 /* CatchClause */:
return visitCatchClause(node);
+ case 220 /* VariableStatement */:
+ return visitVariableStatement(node);
case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
case 228 /* ForOfStatement */:
@@ -72976,17 +73565,17 @@ var ts;
case 201 /* VoidExpression */:
return visitVoidExpression(node);
case 158 /* Constructor */:
- return visitConstructorDeclaration(node);
+ return doOutsideOfTopLevel(visitConstructorDeclaration, node);
case 157 /* MethodDeclaration */:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 159 /* GetAccessor */:
- return visitGetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitGetAccessorDeclaration, node);
case 160 /* SetAccessor */:
- return visitSetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitSetAccessorDeclaration, node);
case 240 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197 /* FunctionExpression */:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198 /* ArrowFunction */:
return visitArrowFunction(node);
case 152 /* Parameter */:
@@ -73005,6 +73594,9 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -73072,14 +73664,39 @@ var ts;
if (node.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
// spread elements emit like so:
// non-spread elements are chunked together into object literals, and then all are passed to __assign:
- // { a, ...o, b } => __assign({a}, o, {b});
+ // { a, ...o, b } => __assign(__assign({a}, o), {b});
// If the first element is a spread element, then the first argument to __assign is {}:
- // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
+ // { ...o, a, b, ...o2 } => __assign(__assign(__assign({}, o), {a, b}), o2)
+ //
+ // We cannot call __assign with more than two elements, since any element could cause side effects. For
+ // example:
+ // var k = { a: 1, b: 2 };
+ // var o = { a: 3, ...k, b: k.a++ };
+ // // expected: { a: 1, b: 1 }
+ // If we translate the above to `__assign({ a: 3 }, k, { b: k.a++ })`, the `k.a++` will evaluate before
+ // `k` is spread and we end up with `{ a: 2, b: 1 }`.
+ //
+ // This also occurs for spread elements, not just property assignments:
+ // var k = { a: 1, get b() { l = { z: 9 }; return 2; } };
+ // var l = { c: 3 };
+ // var o = { ...k, ...l };
+ // // expected: { a: 1, b: 2, z: 9 }
+ // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we
+ // end up with `{ a: 1, b: 2, c: 3 }`
var objects = chunkObjectLiteralElements(node.properties);
if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) {
objects.unshift(ts.createObjectLiteral());
}
- return createAssignHelper(context, objects);
+ var expression = objects[0];
+ if (objects.length > 1) {
+ for (var i = 1; i < objects.length; i++) {
+ expression = createAssignHelper(context, [expression, objects[i]]);
+ }
+ return expression;
+ }
+ else {
+ return createAssignHelper(context, objects);
+ }
}
return ts.visitEachChild(node, visitor, context);
}
@@ -73120,15 +73737,36 @@ var ts;
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitVariableStatement(node) {
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = true;
+ var visited = ts.visitEachChild(node, visitor, context);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
/**
* Visits a VariableDeclaration node with a binding pattern.
*
* @param node A VariableDeclaration node.
*/
function visitVariableDeclaration(node) {
+ if (exportedVariableStatement) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = false;
+ var visited = visitVariableDeclarationWorker(node, /*exportedVariableStatement*/ true);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return visitVariableDeclarationWorker(node, /*exportedVariableStatement*/ false);
+ }
+ function visitVariableDeclarationWorker(node, exportedVariableStatement) {
// If we are here it is because the name contains a binding pattern with a rest somewhere in it.
if (ts.isBindingPattern(node.name) && node.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
- return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */);
+ return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */,
+ /*rval*/ undefined, exportedVariableStatement);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -73346,7 +73984,7 @@ var ts;
/*modifiers*/ undefined, ts.createToken(40 /* AsteriskToken */), node.name && ts.getGeneratedNameForNode(node.name),
/*typeParameters*/ undefined,
/*parameters*/ [],
- /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))));
+ /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !topLevel));
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
var emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* AsyncMethodWithSuperBinding */ | 2048 /* AsyncMethodWithSuper */);
@@ -73526,6 +74164,7 @@ var ts;
ts.transformES2018 = transformES2018;
ts.assignHelper = {
name: "typescript:assign",
+ importName: "__assign",
scoped: false,
priority: 1,
text: "\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"
@@ -73536,55 +74175,59 @@ var ts;
/*typeArguments*/ undefined, attributesSegments);
}
context.requestEmitHelper(ts.assignHelper);
- return ts.createCall(ts.getHelperName("__assign"),
+ return ts.createCall(ts.getUnscopedHelperName("__assign"),
/*typeArguments*/ undefined, attributesSegments);
}
ts.createAssignHelper = createAssignHelper;
ts.awaitHelper = {
name: "typescript:await",
+ importName: "__await",
scoped: false,
text: "\n var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }"
};
function createAwaitHelper(context, expression) {
context.requestEmitHelper(ts.awaitHelper);
- return ts.createCall(ts.getHelperName("__await"), /*typeArguments*/ undefined, [expression]);
+ return ts.createCall(ts.getUnscopedHelperName("__await"), /*typeArguments*/ undefined, [expression]);
}
ts.asyncGeneratorHelper = {
name: "typescript:asyncGenerator",
+ importName: "__asyncGenerator",
scoped: false,
text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n };"
};
- function createAsyncGeneratorHelper(context, generatorFunc) {
+ function createAsyncGeneratorHelper(context, generatorFunc, hasLexicalThis) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncGeneratorHelper);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */;
- return ts.createCall(ts.getHelperName("__asyncGenerator"),
+ return ts.createCall(ts.getUnscopedHelperName("__asyncGenerator"),
/*typeArguments*/ undefined, [
- ts.createThis(),
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
ts.createIdentifier("arguments"),
generatorFunc
]);
}
ts.asyncDelegator = {
name: "typescript:asyncDelegator",
+ importName: "__asyncDelegator",
scoped: false,
text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n };"
};
function createAsyncDelegatorHelper(context, expression, location) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncDelegator);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncDelegator"),
/*typeArguments*/ undefined, [expression]), location);
}
ts.asyncValues = {
name: "typescript:asyncValues",
+ importName: "__asyncValues",
scoped: false,
text: "\n var __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n };"
};
function createAsyncValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.asyncValues);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncValues"),
/*typeArguments*/ undefined, [expression]), location);
}
})(ts || (ts = {}));
@@ -77396,7 +78039,7 @@ var ts;
ts.transformES2015 = transformES2015;
function createExtendsHelper(context, name) {
context.requestEmitHelper(ts.extendsHelper);
- return ts.createCall(ts.getHelperName("__extends"),
+ return ts.createCall(ts.getUnscopedHelperName("__extends"),
/*typeArguments*/ undefined, [
name,
ts.createFileLevelUniqueName("_super")
@@ -77404,7 +78047,7 @@ var ts;
}
function createTemplateObjectHelper(context, cooked, raw) {
context.requestEmitHelper(ts.templateObjectHelper);
- return ts.createCall(ts.getHelperName("__makeTemplateObject"),
+ return ts.createCall(ts.getUnscopedHelperName("__makeTemplateObject"),
/*typeArguments*/ undefined, [
cooked,
raw
@@ -77412,12 +78055,14 @@ var ts;
}
ts.extendsHelper = {
name: "typescript:extends",
+ importName: "__extends",
scoped: false,
priority: 0,
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
};
ts.templateObjectHelper = {
name: "typescript:makeTemplateObject",
+ importName: "__makeTemplateObject",
scoped: false,
priority: 0,
text: "\n var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n };"
@@ -80111,7 +80756,7 @@ var ts;
ts.transformGenerators = transformGenerators;
function createGeneratorHelper(context, body) {
context.requestEmitHelper(ts.generatorHelper);
- return ts.createCall(ts.getHelperName("__generator"),
+ return ts.createCall(ts.getUnscopedHelperName("__generator"),
/*typeArguments*/ undefined, [ts.createThis(), body]);
}
// The __generator helper is used by down-level transformations to emulate the runtime
@@ -80175,6 +80820,7 @@ var ts;
// For examples of how these are used, see the comments in ./transformers/generators.ts
ts.generatorHelper = {
name: "typescript:generator",
+ importName: "__generator",
scoped: false,
priority: 6,
text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
@@ -80548,9 +81194,9 @@ var ts;
return visitFunctionDeclaration(node);
case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 317 /* MergeDeclarationMarker */:
+ case 318 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 318 /* EndOfDeclarationMarker */:
+ case 319 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -80709,7 +81355,7 @@ var ts;
var promise = ts.createNew(ts.createIdentifier("Promise"), /*typeArguments*/ undefined, [func]);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), /*typeArguments*/ undefined, [ts.getHelperName("__importStar")]);
+ return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), /*typeArguments*/ undefined, [ts.getUnscopedHelperName("__importStar")]);
}
return promise;
}
@@ -80723,7 +81369,7 @@ var ts;
var requireCall = ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- requireCall = ts.createCall(ts.getHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
+ requireCall = ts.createCall(ts.getUnscopedHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
}
var func;
if (languageVersion >= 2 /* ES2015 */) {
@@ -80757,11 +81403,11 @@ var ts;
}
if (ts.getImportNeedsImportStarHelper(node)) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.getHelperName("__importStar"), /*typeArguments*/ undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importStar"), /*typeArguments*/ undefined, [innerExpr]);
}
if (ts.getImportNeedsImportDefaultHelper(node)) {
context.requestEmitHelper(ts.importDefaultHelper);
- return ts.createCall(ts.getHelperName("__importDefault"), /*typeArguments*/ undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importDefault"), /*typeArguments*/ undefined, [innerExpr]);
}
return innerExpr;
}
@@ -81533,7 +82179,7 @@ var ts;
function createExportStarHelper(context, module) {
var compilerOptions = context.getCompilerOptions();
return compilerOptions.importHelpers
- ? ts.createCall(ts.getHelperName("__exportStar"), /*typeArguments*/ undefined, [module, ts.createIdentifier("exports")])
+ ? ts.createCall(ts.getUnscopedHelperName("__exportStar"), /*typeArguments*/ undefined, [module, ts.createIdentifier("exports")])
: ts.createCall(ts.createIdentifier("__export"), /*typeArguments*/ undefined, [module]);
}
// emit helper for dynamic import
@@ -81545,12 +82191,14 @@ var ts;
// emit helper for `import * as Name from "foo"`
ts.importStarHelper = {
name: "typescript:commonjsimportstar",
+ importName: "__importStar",
scoped: false,
text: "\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};"
};
// emit helper for `import Name from "foo"`
ts.importDefaultHelper = {
name: "typescript:commonjsimportdefault",
+ importName: "__importDefault",
scoped: false,
text: "\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};"
};
@@ -81572,11 +82220,13 @@ var ts;
context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(215 /* MetaProperty */); // Substitutes 'import.meta'
context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var exportFunctionsMap = []; // The export function associated with a source file.
var noSubstitutionMap = []; // Set of nodes for which substitution rules should be ignored for each file.
+ var contextObjectMap = []; // The context object associated with a source file.
var currentSourceFile; // The current file.
var moduleInfo; // ExternalModuleInfo for the current file.
var exportFunction; // The export function for the current file.
@@ -81615,7 +82265,7 @@ var ts;
// existing identifiers.
exportFunction = ts.createUniqueName("exports");
exportFunctionsMap[id] = exportFunction;
- contextObject = ts.createUniqueName("context");
+ contextObject = contextObjectMap[id] = ts.createUniqueName("context");
// Add the body of the module.
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
@@ -82485,9 +83135,9 @@ var ts;
return visitCatchClause(node);
case 219 /* Block */:
return visitBlock(node);
- case 317 /* MergeDeclarationMarker */:
+ case 318 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 318 /* EndOfDeclarationMarker */:
+ case 319 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -82773,6 +83423,7 @@ var ts;
moduleInfo = moduleInfoMap[id];
exportFunction = exportFunctionsMap[id];
noSubstitution = noSubstitutionMap[id];
+ contextObject = contextObjectMap[id];
if (noSubstitution) {
delete noSubstitutionMap[id];
}
@@ -82780,6 +83431,7 @@ var ts;
currentSourceFile = undefined;
moduleInfo = undefined;
exportFunction = undefined;
+ contextObject = undefined;
noSubstitution = undefined;
}
else {
@@ -82856,6 +83508,8 @@ var ts;
case 203 /* PrefixUnaryExpression */:
case 204 /* PostfixUnaryExpression */:
return substituteUnaryExpression(node);
+ case 215 /* MetaProperty */:
+ return substituteMetaProperty(node);
}
return node;
}
@@ -82964,6 +83618,12 @@ var ts;
}
return node;
}
+ function substituteMetaProperty(node) {
+ if (ts.isImportMeta(node)) {
+ return ts.createPropertyAccess(contextObject, ts.createIdentifier("meta"));
+ }
+ return node;
+ }
/**
* Gets the exports of a name.
*
@@ -83017,22 +83677,18 @@ var ts;
context.onSubstituteNode = onSubstituteNode;
context.enableEmitNotification(285 /* SourceFile */);
context.enableSubstitution(73 /* Identifier */);
- var currentSourceFile;
+ var helperNameSubstitutions;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
if (node.isDeclarationFile) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
- if (externalHelpersModuleName) {
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(node, compilerOptions);
+ if (externalHelpersImportDeclaration) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.statements);
- var tslibImport = ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- ts.addEmitFlags(tslibImport, 67108864 /* NeverApplyImportHelper */);
- ts.append(statements, tslibImport);
+ ts.append(statements, externalHelpersImportDeclaration);
ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements));
}
@@ -83068,9 +83724,9 @@ var ts;
*/
function onEmitNode(hint, node, emitCallback) {
if (ts.isSourceFile(node)) {
- currentSourceFile = node;
+ helperNameSubstitutions = ts.createMap();
previousOnEmitNode(hint, node, emitCallback);
- currentSourceFile = undefined;
+ helperNameSubstitutions = undefined;
}
else {
previousOnEmitNode(hint, node, emitCallback);
@@ -83087,19 +83743,18 @@ var ts;
*/
function onSubstituteNode(hint, node) {
node = previousOnSubstituteNode(hint, node);
- if (ts.isIdentifier(node) && hint === 1 /* Expression */) {
- return substituteExpressionIdentifier(node);
+ if (helperNameSubstitutions && ts.isIdentifier(node) && ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ return substituteHelperName(node);
}
return node;
}
- function substituteExpressionIdentifier(node) {
- if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
- var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
- if (externalHelpersModuleName) {
- return ts.createPropertyAccess(externalHelpersModuleName, node);
- }
+ function substituteHelperName(node) {
+ var name = ts.idText(node);
+ var substitution = helperNameSubstitutions.get(name);
+ if (!substitution) {
+ helperNameSubstitutions.set(name, substitution = ts.createFileLevelUniqueName(name));
}
- return node;
+ return substitution;
}
}
ts.transformES2015Module = transformES2015Module;
@@ -83598,6 +84253,7 @@ var ts;
var currentSourceFile;
var refs;
var libs;
+ var emittedImports; // must be declared in container so it can be `undefined` while transformer's first pass
var resolver = context.getEmitResolver();
var options = context.getCompilerOptions();
var newLine = ts.getNewLineCharacter(options);
@@ -83760,7 +84416,7 @@ var ts;
var statements = ts.visitNodes(node.statements, visitDeclarationStatements);
var combinedStatements = ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
refs.forEach(referenceVisitor);
- var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
+ emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
if (ts.isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) {
combinedStatements = ts.setTextRange(ts.createNodeArray(__spreadArrays(combinedStatements, [createEmptyExports()])), combinedStatements);
}
@@ -83858,14 +84514,14 @@ var ts;
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
}
}
- function ensureParameter(p, modifierMask) {
+ function ensureParameter(p, modifierMask, type) {
var oldDiag;
if (!suppressNewDiagnosticContexts) {
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
}
var newParam = ts.updateParameter(p,
- /*decorators*/ undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56 /* QuestionToken */)) : undefined, ensureType(p, p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
+ /*decorators*/ undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56 /* QuestionToken */)) : undefined, ensureType(p, type || p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
ensureNoInitializer(p));
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
@@ -83972,6 +84628,33 @@ var ts;
}
return ts.createNodeArray(newParams, params.hasTrailingComma);
}
+ function updateAccessorParamsList(input, isPrivate) {
+ var newParams;
+ if (!isPrivate) {
+ var thisParameter = ts.getThisParameter(input);
+ if (thisParameter) {
+ newParams = [ensureParameter(thisParameter)];
+ }
+ }
+ if (ts.isSetAccessorDeclaration(input)) {
+ var newValueParameter = void 0;
+ if (!isPrivate) {
+ var valueParameter = ts.getSetAccessorValueParameter(input);
+ if (valueParameter) {
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ newValueParameter = ensureParameter(valueParameter, /*modifierMask*/ undefined, accessorType);
+ }
+ }
+ if (!newValueParameter) {
+ newValueParameter = ts.createParameter(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*dotDotDotToken*/ undefined, "value");
+ }
+ newParams = ts.append(newParams, newValueParameter);
+ }
+ return ts.createNodeArray(newParams || ts.emptyArray);
+ }
function ensureTypeParams(node, params) {
return ts.hasModifier(node, 8 /* Private */) ? undefined : ts.visitNodes(params, visitDeclarationSubtree);
}
@@ -84138,6 +84821,11 @@ var ts;
enclosingDeclaration = input;
}
var oldDiag = getSymbolAccessibilityDiagnostic;
+ // Setup diagnostic-related flags before first potential `cleanup` call, otherwise
+ // We'd see a TDZ violation at runtime
+ var canProduceDiagnostic = ts.canProduceDiagnostics(input);
+ var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
// Emit methods which are private as properties with no type information
if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) {
if (ts.hasModifier(input, 8 /* Private */)) {
@@ -84146,15 +84834,12 @@ var ts;
return cleanup(ts.createProperty(/*decorators*/ undefined, ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined));
}
}
- var canProdiceDiagnostic = ts.canProduceDiagnostics(input);
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input);
}
if (ts.isTypeQueryNode(input)) {
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
- var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
// We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
suppressNewDiagnosticContexts = true;
@@ -84193,10 +84878,24 @@ var ts;
return cleanup(sig);
}
case 159 /* GetAccessor */: {
+ // For now, only emit class accessors as accessors if they were already declared in an ambient context.
+ if (input.flags & 4194304 /* Ambient */) {
+ var isPrivate = ts.hasModifier(input, 8 /* Private */);
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ return cleanup(ts.updateGetAccessor(input,
+ /*decorators*/ undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, isPrivate), !isPrivate ? ensureType(input, accessorType) : undefined,
+ /*body*/ undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
case 160 /* SetAccessor */: {
+ // For now, only emit class accessors as accessors if they were already declared in an ambient context.
+ if (input.flags & 4194304 /* Ambient */) {
+ return cleanup(ts.updateSetAccessor(input,
+ /*decorators*/ undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasModifier(input, 8 /* Private */)),
+ /*body*/ undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
@@ -84257,13 +84956,13 @@ var ts;
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
function cleanup(returnValue) {
- if (returnValue && canProdiceDiagnostic && ts.hasDynamicName(input)) {
+ if (returnValue && canProduceDiagnostic && ts.hasDynamicName(input)) {
checkName(input);
}
if (isEnclosingDeclaration(input)) {
enclosingDeclaration = previousEnclosingDeclaration;
}
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
if (shouldEnterSuppressNewDiagnosticsContextContext) {
@@ -84632,17 +85331,26 @@ var ts;
}
return maskModifierFlags(node, mask, additions);
}
+ function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) {
+ var accessorType = getTypeAnnotationFromAccessor(node);
+ if (!accessorType && node !== accessors.firstAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.firstAccessor);
+ // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.firstAccessor);
+ }
+ if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
+ // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
+ }
+ return accessorType;
+ }
function ensureAccessor(node) {
var accessors = resolver.getAllAccessorDeclarations(node);
if (node.kind !== accessors.firstAccessor.kind) {
return;
}
- var accessorType = getTypeAnnotationFromAccessor(node);
- if (!accessorType && accessors.secondAccessor) {
- accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
- // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
- getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
- }
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessors);
var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
@@ -84805,7 +85513,7 @@ var ts;
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6 /* ES2019 */) {
@@ -84881,7 +85589,7 @@ var ts;
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(319 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(320 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -86406,30 +87114,30 @@ var ts;
case 279 /* EnumMember */:
return emitEnumMember(node);
// JSDoc nodes (only used in codefixes currently)
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return emitJSDocPropertyLikeTag(node);
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 308 /* JSDocThisTag */:
- case 305 /* JSDocEnumTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 309 /* JSDocThisTag */:
+ case 306 /* JSDocEnumTag */:
return emitJSDocSimpleTypedTag(node);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return emitJSDocAugmentsTag(node);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return emitJSDocTemplateTag(node);
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return emitJSDocTypedefTag(node);
- case 304 /* JSDocCallbackTag */:
+ case 305 /* JSDocCallbackTag */:
return emitJSDocCallbackTag(node);
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return emitJSDocSignature(node);
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
return emitJSDocTypeLiteral(node);
- case 303 /* JSDocClassTag */:
- case 300 /* JSDocTag */:
+ case 304 /* JSDocClassTag */:
+ case 301 /* JSDocTag */:
return emitJSDocSimpleTag(node);
- case 297 /* JSDocComment */:
+ case 298 /* JSDocComment */:
return emitJSDoc(node);
// Transformation nodes (ignored)
}
@@ -86528,9 +87236,9 @@ var ts;
case 265 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -86558,8 +87266,8 @@ var ts;
var helpers = getSortedEmitHelpers(sourceFile);
if (!helpers)
continue;
- for (var _c = 0, helpers_3 = helpers; _c < helpers_3.length; _c++) {
- var helper = helpers_3[_c];
+ for (var _c = 0, helpers_4 = helpers; _c < helpers_4.length; _c++) {
+ var helper = helpers_4[_c];
if (!helper.scoped && !shouldSkip && !bundledHelpers.get(helper.name)) {
bundledHelpers.set(helper.name, true);
(result || (result = [])).push(helper.name);
@@ -86579,12 +87287,12 @@ var ts;
for (var i = 0; i < numNodes; i++) {
var currentNode = bundle ? i < numPrepends ? bundle.prepends[i] : bundle.sourceFiles[i - numPrepends] : node;
var sourceFile = ts.isSourceFile(currentNode) ? currentNode : ts.isUnparsedSource(currentNode) ? undefined : currentSourceFile;
- var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.hasRecordedExternalHelpers(sourceFile));
var shouldBundle = (ts.isSourceFile(currentNode) || ts.isUnparsedSource(currentNode)) && !isOwnFileEmit;
var helpers = ts.isUnparsedSource(currentNode) ? currentNode.helpers : getSortedEmitHelpers(currentNode);
if (helpers) {
- for (var _a = 0, helpers_4 = helpers; _a < helpers_4.length; _a++) {
- var helper = helpers_4[_a];
+ for (var _a = 0, helpers_5 = helpers; _a < helpers_5.length; _a++) {
+ var helper = helpers_5[_a];
if (!helper.scoped) {
// Skip the helper if it can be skipped and the noEmitHelpers compiler
// option is set, or if it can be imported and the importHelpers compiler
@@ -88024,7 +88732,7 @@ var ts;
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 309 /* JSDocTypeTag */ && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 310 /* JSDocTypeTag */ && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -88077,7 +88785,7 @@ var ts;
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) {
+ if (tag.typeExpression && tag.typeExpression.kind === 299 /* JSDocTypeLiteral */) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -88211,8 +88919,8 @@ var ts;
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// ");
if (bundleFileInfo)
@@ -89066,7 +89774,7 @@ var ts;
if (node.locals) {
var local = node.locals.get(ts.escapeLeadingUnderscores(name));
// We conservatively include alias symbols to cover cases where they're emitted as locals
- if (local && local.flags & (67220415 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
+ if (local && local.flags & (111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
return false;
}
}
@@ -89253,7 +89961,7 @@ var ts;
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 314 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 315 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
@@ -89534,7 +90242,7 @@ var ts;
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 314 /* NotEmittedStatement */
+ if (node.kind !== 315 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -89547,7 +90255,7 @@ var ts;
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 314 /* NotEmittedStatement */
+ if (node.kind !== 315 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -89915,6 +90623,9 @@ var ts;
var createFileWatcher = getCreateFileWatcher(watchLogLevel, watchFile);
var createFilePathWatcher = watchLogLevel === WatchLogLevel.None ? watchFilePath : createFileWatcher;
var createDirectoryWatcher = getCreateFileWatcher(watchLogLevel, watchDirectory);
+ if (watchLogLevel === WatchLogLevel.Verbose && ts.sysLog === ts.noop) {
+ ts.sysLog = function (s) { return log(s); };
+ }
return {
watchFile: function (host, file, callback, pollingInterval, detailInfo1, detailInfo2) {
return createFileWatcher(host, file, callback, pollingInterval, /*passThrough*/ undefined, detailInfo1, detailInfo2, watchFile, log, "FileWatcher", getDetailWatchInfo);
@@ -90459,8 +91170,8 @@ var ts;
}
var resolutions = [];
var cache = ts.createMap();
- for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name = names_1[_i];
+ for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
+ var name = names_2[_i];
var result = void 0;
if (cache.has(name)) {
result = cache.get(name);
@@ -90621,7 +91332,7 @@ var ts;
var resolveModuleNamesWorker;
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
if (host.resolveModuleNames) {
- resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference).map(function (resolved) {
+ resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference, options).map(function (resolved) {
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
if (!resolved || resolved.extension !== undefined) {
return resolved;
@@ -90638,7 +91349,7 @@ var ts;
}
var resolveTypeReferenceDirectiveNamesWorker;
if (host.resolveTypeReferenceDirectives) {
- resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference); };
+ resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference, options); };
}
else {
var loader_2 = function (typesRef, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference).resolvedTypeReferenceDirective; }; // TODO: GH#18217
@@ -90668,7 +91379,10 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
- var structuralIsReused = tryReuseStructureFromOldProgram();
+ // We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks
+ // `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`.
+ var structuralIsReused;
+ structuralIsReused = tryReuseStructureFromOldProgram();
if (structuralIsReused !== 2 /* Completely */) {
processingDefaultLibFiles = [];
processingOtherFiles = [];
@@ -94337,8 +95051,8 @@ var ts;
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
!!redirectedReference;
var seenNamesInFile = ts.createMap();
- for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
- var name = names_2[_i];
+ for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
+ var name = names_3[_i];
var resolution = resolutionsInFile.get(name);
// Resolution is valid if it is present and not invalidated
if (!seenNamesInFile.has(name) &&
@@ -94844,7 +95558,7 @@ var ts;
return [ambient];
var info = getInfo(importingSourceFile.path, host);
var moduleSourceFile = ts.getSourceFileOfNode(moduleSymbol.valueDeclaration || ts.getNonAugmentationDeclaration(moduleSymbol));
- var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.fileName, info.getCanonicalFileName, host, redirectTargetsMap);
+ var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.originalFileName, info.getCanonicalFileName, host, redirectTargetsMap);
var preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
var global = ts.mapDefined(modulePaths, function (moduleFileName) { return tryGetModuleNameAsNodeModule(moduleFileName, info, host, compilerOptions); });
return global.length ? global : modulePaths.map(function (moduleFileName) { return getLocalModuleSpecifier(moduleFileName, info, compilerOptions, preferences); });
@@ -94860,7 +95574,7 @@ var ts;
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
var ending = _b.ending, relativePreference = _b.relativePreference;
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
- var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) ||
+ var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
if (!baseUrl || relativePreference === 0 /* Relative */) {
return relativePath;
@@ -94986,14 +95700,16 @@ var ts;
}
}
}
- function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) {
+ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
if (normalizedTargetPath === undefined) {
return undefined;
}
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
- return ts.removeFileExtension(relativePath);
+ return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
+ ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
+ : ts.removeFileExtension(relativePath);
}
function tryGetModuleNameAsNodeModule(moduleFileName, _a, host, options) {
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
@@ -95643,10 +96359,22 @@ var ts;
/*logChangesWhenResolvingModule*/ false);
// Resolve module using host module resolution strategy if provided otherwise use resolution cache to resolve module names
compilerHost.resolveModuleNames = host.resolveModuleNames ?
- (function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveModuleNames.apply(host, args);
+ }) :
(function (moduleNames, containingFile, reusedNames, redirectedReference) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); });
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
- (function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveTypeReferenceDirectives.apply(host, args);
+ }) :
(function (typeDirectiveNames, containingFile, redirectedReference) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); });
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
@@ -95872,13 +96600,19 @@ var ts;
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
switch (reloadLevel) {
case ts.ConfigFileProgramReloadLevel.Partial:
- return reloadFileNamesFromConfigFile();
+ ts.perfLogger.logStartUpdateProgram("PartialConfigReload");
+ reloadFileNamesFromConfigFile();
+ break;
case ts.ConfigFileProgramReloadLevel.Full:
- return reloadConfigFile();
+ ts.perfLogger.logStartUpdateProgram("FullConfigReload");
+ reloadConfigFile();
+ break;
default:
+ ts.perfLogger.logStartUpdateProgram("SynchronizeProgram");
synchronizeProgram();
- return;
+ break;
}
+ ts.perfLogger.logStopUpdateProgram("Done");
}
function reloadFileNamesFromConfigFile() {
writeLog("Reloading new file names and options");
@@ -96257,8 +96991,31 @@ var ts;
}
}
function getBuildOrder(state) {
- return state.buildOrder ||
- (state.buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); })));
+ return state.buildOrder || createStateBuildOrder(state);
+ }
+ function createStateBuildOrder(state) {
+ var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
+ if (ts.arrayIsEqualTo(state.buildOrder, buildOrder))
+ return state.buildOrder;
+ // Clear all to ResolvedConfigFilePaths cache to start fresh
+ state.resolvedConfigFilePaths.clear();
+ var currentProjects = ts.arrayToSet(buildOrder, function (resolved) { return toResolvedConfigFilePath(state, resolved); });
+ var noopOnDelete = { onDeleteValue: ts.noop };
+ // Config file cache
+ ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
+ // Remove watches for the program no longer in the solution
+ if (state.watch) {
+ ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
+ ts.mutateMapSkippingNewValues(state.allWatchedWildcardDirectories, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcherOf); } });
+ ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
+ }
+ return state.buildOrder = buildOrder;
}
function getBuildOrderFor(state, project, onlyReferences) {
var resolvedProject = project && resolveProjectName(state, project);
@@ -97715,66 +98472,82 @@ var ts;
}
}
JsTyping.discoverTypings = discoverTypings;
- var PackageNameValidationResult;
- (function (PackageNameValidationResult) {
- PackageNameValidationResult[PackageNameValidationResult["Ok"] = 0] = "Ok";
- PackageNameValidationResult[PackageNameValidationResult["ScopedPackagesNotSupported"] = 1] = "ScopedPackagesNotSupported";
- PackageNameValidationResult[PackageNameValidationResult["EmptyName"] = 2] = "EmptyName";
- PackageNameValidationResult[PackageNameValidationResult["NameTooLong"] = 3] = "NameTooLong";
- PackageNameValidationResult[PackageNameValidationResult["NameStartsWithDot"] = 4] = "NameStartsWithDot";
- PackageNameValidationResult[PackageNameValidationResult["NameStartsWithUnderscore"] = 5] = "NameStartsWithUnderscore";
- PackageNameValidationResult[PackageNameValidationResult["NameContainsNonURISafeCharacters"] = 6] = "NameContainsNonURISafeCharacters";
- })(PackageNameValidationResult = JsTyping.PackageNameValidationResult || (JsTyping.PackageNameValidationResult = {}));
+ var NameValidationResult;
+ (function (NameValidationResult) {
+ NameValidationResult[NameValidationResult["Ok"] = 0] = "Ok";
+ NameValidationResult[NameValidationResult["EmptyName"] = 1] = "EmptyName";
+ NameValidationResult[NameValidationResult["NameTooLong"] = 2] = "NameTooLong";
+ NameValidationResult[NameValidationResult["NameStartsWithDot"] = 3] = "NameStartsWithDot";
+ NameValidationResult[NameValidationResult["NameStartsWithUnderscore"] = 4] = "NameStartsWithUnderscore";
+ NameValidationResult[NameValidationResult["NameContainsNonURISafeCharacters"] = 5] = "NameContainsNonURISafeCharacters";
+ })(NameValidationResult = JsTyping.NameValidationResult || (JsTyping.NameValidationResult = {}));
var maxPackageNameLength = 214;
/**
* Validates package name using rules defined at https://docs.npmjs.com/files/package.json
*/
function validatePackageName(packageName) {
+ return validatePackageNameWorker(packageName, /*supportScopedPackage*/ true);
+ }
+ JsTyping.validatePackageName = validatePackageName;
+ function validatePackageNameWorker(packageName, supportScopedPackage) {
if (!packageName) {
- return 2 /* EmptyName */;
+ return 1 /* EmptyName */;
}
if (packageName.length > maxPackageNameLength) {
- return 3 /* NameTooLong */;
+ return 2 /* NameTooLong */;
}
if (packageName.charCodeAt(0) === 46 /* dot */) {
- return 4 /* NameStartsWithDot */;
+ return 3 /* NameStartsWithDot */;
}
if (packageName.charCodeAt(0) === 95 /* _ */) {
- return 5 /* NameStartsWithUnderscore */;
+ return 4 /* NameStartsWithUnderscore */;
}
// check if name is scope package like: starts with @ and has one '/' in the middle
// scoped packages are not currently supported
- // TODO: when support will be added we'll need to split and check both scope and package name
- if (/^@[^/]+\/[^/]+$/.test(packageName)) {
- return 1 /* ScopedPackagesNotSupported */;
+ if (supportScopedPackage) {
+ var matches = /^@([^/]+)\/([^/]+)$/.exec(packageName);
+ if (matches) {
+ var scopeResult = validatePackageNameWorker(matches[1], /*supportScopedPackage*/ false);
+ if (scopeResult !== 0 /* Ok */) {
+ return { name: matches[1], isScopeName: true, result: scopeResult };
+ }
+ var packageResult = validatePackageNameWorker(matches[2], /*supportScopedPackage*/ false);
+ if (packageResult !== 0 /* Ok */) {
+ return { name: matches[2], isScopeName: false, result: packageResult };
+ }
+ return 0 /* Ok */;
+ }
}
if (encodeURIComponent(packageName) !== packageName) {
- return 6 /* NameContainsNonURISafeCharacters */;
+ return 5 /* NameContainsNonURISafeCharacters */;
}
return 0 /* Ok */;
}
- JsTyping.validatePackageName = validatePackageName;
function renderPackageNameValidationFailure(result, typing) {
+ return typeof result === "object" ?
+ renderPackageNameValidationFailureWorker(typing, result.result, result.name, result.isScopeName) :
+ renderPackageNameValidationFailureWorker(typing, result, typing, /*isScopeName*/ false);
+ }
+ JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
+ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeName) {
+ var kind = isScopeName ? "Scope" : "Package";
switch (result) {
- case 2 /* EmptyName */:
- return "Package name '" + typing + "' cannot be empty";
- case 3 /* NameTooLong */:
- return "Package name '" + typing + "' should be less than " + maxPackageNameLength + " characters";
- case 4 /* NameStartsWithDot */:
- return "Package name '" + typing + "' cannot start with '.'";
- case 5 /* NameStartsWithUnderscore */:
- return "Package name '" + typing + "' cannot start with '_'";
- case 1 /* ScopedPackagesNotSupported */:
- return "Package '" + typing + "' is scoped and currently is not supported";
- case 6 /* NameContainsNonURISafeCharacters */:
- return "Package name '" + typing + "' contains non URI safe characters";
+ case 1 /* EmptyName */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot be empty";
+ case 2 /* NameTooLong */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' should be less than " + maxPackageNameLength + " characters";
+ case 3 /* NameStartsWithDot */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot start with '.'";
+ case 4 /* NameStartsWithUnderscore */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot start with '_'";
+ case 5 /* NameContainsNonURISafeCharacters */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' contains non URI safe characters";
case 0 /* Ok */:
return ts.Debug.fail(); // Shouldn't have called this.
default:
throw ts.Debug.assertNever(result);
}
}
- JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
})(JsTyping = ts.JsTyping || (ts.JsTyping = {}));
})(ts || (ts = {}));
var ts;
@@ -98059,7 +98832,7 @@ var ts;
/* @internal */
var ts;
(function (ts) {
- ts.scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
+ ts.scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ true);
var SemanticMeaning;
(function (SemanticMeaning) {
SemanticMeaning[SemanticMeaning["None"] = 0] = "None";
@@ -98094,7 +98867,7 @@ var ts;
case 243 /* TypeAliasDeclaration */:
case 169 /* TypeLiteral */:
return 2 /* Type */;
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
// If it has no name node, it shares the name with the value declaration below it.
return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */;
case 279 /* EnumMember */:
@@ -98359,8 +99132,8 @@ var ts;
return "class" /* classElement */;
case 242 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
case 243 /* TypeAliasDeclaration */:
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
return "type" /* typeElement */;
case 244 /* EnumDeclaration */: return "enum" /* enumElement */;
case 238 /* VariableDeclaration */:
@@ -99979,8 +100752,9 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ /** The classifier is used for syntactic highlighting in editors via the TSServer */
function createClassifier() {
- var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false);
+ var scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false);
function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {
return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
}
@@ -100534,8 +101308,8 @@ var ts;
var spanStart = span.start;
var spanLength = span.length;
// Make a scanner we can get trivia from.
- var triviaScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var triviaScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
var result = [];
processElement(sourceFile);
return { spans: result, endOfLineState: 0 /* None */ };
@@ -100607,6 +101381,11 @@ var ts;
return;
}
}
+ else if (kind === 2 /* SingleLineCommentTrivia */) {
+ if (tryClassifyTripleSlashComment(start, width)) {
+ return;
+ }
+ }
// Simple comment. Just add as is.
pushCommentRange(start, width);
}
@@ -100627,18 +101406,18 @@ var ts;
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param"
pos = tag.tagName.end;
switch (tag.kind) {
- case 306 /* JSDocParameterTag */:
+ case 307 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
pos = tag.end;
break;
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
- case 307 /* JSDocReturnTag */:
+ case 308 /* JSDocReturnTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
@@ -100667,6 +101446,65 @@ var ts;
}
}
}
+ function tryClassifyTripleSlashComment(start, width) {
+ var tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/im;
+ var attributeRegex = /(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/img;
+ var text = sourceFile.text.substr(start, width);
+ var match = tripleSlashXMLCommentRegEx.exec(text);
+ if (!match) {
+ return false;
+ }
+ var pos = start;
+ pushCommentRange(pos, match[1].length); // ///
+ pos += match[1].length;
+ pushClassification(pos, match[2].length, 10 /* punctuation */); // <
+ pos += match[2].length;
+ if (!match[3]) {
+ return true;
+ }
+ pushClassification(pos, match[3].length, 21 /* jsxSelfClosingTagName */); // element name
+ pos += match[3].length;
+ var attrText = match[4];
+ var attrPos = pos;
+ while (true) {
+ var attrMatch = attributeRegex.exec(attrText);
+ if (!attrMatch) {
+ break;
+ }
+ var newAttrPos = pos + attrMatch.index;
+ if (newAttrPos > attrPos) {
+ pushCommentRange(attrPos, newAttrPos - attrPos);
+ attrPos = newAttrPos;
+ }
+ pushClassification(attrPos, attrMatch[1].length, 22 /* jsxAttribute */); // attribute name
+ attrPos += attrMatch[1].length;
+ if (attrMatch[2].length) {
+ pushCommentRange(attrPos, attrMatch[2].length); // whitespace
+ attrPos += attrMatch[2].length;
+ }
+ pushClassification(attrPos, attrMatch[3].length, 5 /* operator */); // =
+ attrPos += attrMatch[3].length;
+ if (attrMatch[4].length) {
+ pushCommentRange(attrPos, attrMatch[4].length); // whitespace
+ attrPos += attrMatch[4].length;
+ }
+ pushClassification(attrPos, attrMatch[5].length, 24 /* jsxAttributeStringLiteralValue */); // attribute value
+ attrPos += attrMatch[5].length;
+ }
+ pos += match[4].length;
+ if (pos > attrPos) {
+ pushCommentRange(attrPos, pos - attrPos);
+ }
+ if (match[5]) {
+ pushClassification(pos, match[5].length, 10 /* punctuation */); // />
+ pos += match[5].length;
+ }
+ var end = start + width;
+ if (pos < end) {
+ pushCommentRange(pos, end - pos);
+ }
+ return true;
+ }
function processJSDocTemplateTag(tag) {
for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) {
var child = _a[_i];
@@ -100891,7 +101729,7 @@ var ts;
return convertPathCompletions(completion.paths);
case 1 /* Properties */: {
var entries = [];
- Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 8 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
+ Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 99 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, entries: entries };
}
case 2 /* Types */: {
@@ -101470,7 +102308,7 @@ var ts;
var offset = index !== -1 ? index + 1 : 0;
// If the range is an identifier, span is unnecessary.
var length = text.length - offset;
- return length === 0 || ts.isIdentifierText(text.substr(offset, length), 8 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
+ return length === 0 || ts.isIdentifierText(text.substr(offset, length), 99 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
}
// Returns true if the path is explicitly relative to the script (i.e. relative to . or ..)
function isPathRelativeToScript(path) {
@@ -102032,7 +102870,7 @@ var ts;
currentToken = ts.getTokenAtPosition(sourceFile, position);
if (!currentToken ||
(!ts.isDeclarationName(currentToken) &&
- (currentToken.parent.kind !== 312 /* JSDocPropertyTag */ ||
+ (currentToken.parent.kind !== 313 /* JSDocPropertyTag */ ||
currentToken.parent.name !== currentToken))) {
// Use as type location if inside tag's type expression
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
@@ -102228,11 +103066,11 @@ var ts;
};
function isTagWithTypeExpression(tag) {
switch (tag.kind) {
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 311 /* JSDocTypedefTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 312 /* JSDocTypedefTag */:
return true;
default:
return false;
@@ -102241,11 +103079,13 @@ var ts;
function getTypeScriptMemberSymbols() {
// Right of dot member completion list
completionKind = 2 /* PropertyAccess */;
- // Since this is qualified name check its a type node location
+ // Since this is qualified name check it's a type node location
var isImportType = ts.isLiteralImportTypeNode(node);
- var isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !node.isTypeOf) || ts.isPartOfTypeNode(node.parent);
+ var isTypeLocation = insideJsDocTagTypeExpression
+ || (isImportType && !node.isTypeOf)
+ || ts.isPartOfTypeNode(node.parent)
+ || ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
var isRhsOfImportDeclaration = ts.isInRightSideOfInternalImportEqualsDeclaration(node);
- var allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker));
if (ts.isEntityName(node) || isImportType) {
var isNamespaceName = ts.isModuleDeclaration(node.parent);
if (isNamespaceName)
@@ -102261,7 +103101,7 @@ var ts;
var isValidAccess = isNamespaceName
// At `namespace N.M/**/`, if this is the only declaration of `M`, don't include `M` as a completion.
? function (symbol) { return !!(symbol.flags & 1920 /* Namespace */) && !symbol.declarations.every(function (d) { return d.parent === node.parent; }); }
- : allowTypeOrValue ?
+ : isRhsOfImportDeclaration ?
// Any kind is allowed when dotting off namespace in internal import equals declaration
function (symbol) { return isValidTypeAccess_1(symbol) || isValidValueAccess_1(symbol); } :
isTypeLocation ? isValidTypeAccess_1 : isValidValueAccess_1;
@@ -102407,7 +103247,7 @@ var ts;
var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
isInSnippetScope = isSnippetScope(scopeNode);
var isTypeOnly = isTypeOnlyCompletion();
- var symbolMeanings = (isTypeOnly ? 0 /* None */ : 67220415 /* Value */) | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
+ var symbolMeanings = (isTypeOnly ? 0 /* None */ : 111551 /* Value */) | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined");
for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
var symbol = symbols_2[_i];
@@ -102462,7 +103302,6 @@ var ts;
}
function filterGlobalCompletion(symbols) {
var isTypeOnly = isTypeOnlyCompletion();
- var allowTypes = isTypeOnly || !isContextTokenValueLocation(contextToken) && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
if (isTypeOnly) {
keywordFilters = isTypeAssertion()
? 6 /* TypeAssertionKeywords */
@@ -102479,23 +103318,24 @@ var ts;
if (ts.isInRightSideOfInternalImportEqualsDeclaration(location)) {
return !!(symbol.flags & 1920 /* Namespace */);
}
- if (allowTypes) {
- // Its a type, but you can reach it by namespace.type as well
- var symbolAllowedAsType = symbolCanBeReferencedAtTypeLocation(symbol);
- if (symbolAllowedAsType || isTypeOnly) {
- return symbolAllowedAsType;
- }
+ if (isTypeOnly) {
+ // It's a type, but you can reach it by namespace.type as well
+ return symbolCanBeReferencedAtTypeLocation(symbol);
}
}
// expressions are value space (which includes the value namespaces)
- return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 67220415 /* Value */);
+ return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 111551 /* Value */);
});
}
function isTypeAssertion() {
return ts.isAssertionExpression(contextToken.parent);
}
function isTypeOnlyCompletion() {
- return insideJsDocTagTypeExpression || !isContextTokenValueLocation(contextToken) && (ts.isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
+ return insideJsDocTagTypeExpression
+ || !isContextTokenValueLocation(contextToken) &&
+ (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
+ || ts.isPartOfTypeNode(location)
+ || isContextTokenTypeLocation(contextToken));
}
function isContextTokenValueLocation(contextToken) {
return contextToken &&
@@ -102529,7 +103369,7 @@ var ts;
function symbolCanBeReferencedAtTypeLocation(symbol, seenModules) {
if (seenModules === void 0) { seenModules = ts.createMap(); }
var sym = ts.skipAlias(symbol.exportSymbol || symbol, typeChecker);
- return !!(sym.flags & 67897832 /* Type */) ||
+ return !!(sym.flags & 788968 /* Type */) ||
!!(sym.flags & 1536 /* Module */) &&
ts.addToSeen(seenModules, ts.getSymbolId(sym)) &&
typeChecker.getExportsOfModule(sym).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, seenModules); });
@@ -103234,16 +104074,18 @@ var ts;
case 0 /* None */:
return false;
case 1 /* All */:
- return kind === 122 /* AsyncKeyword */ || 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 126 /* DeclareKeyword */ || kind === 131 /* ModuleKeyword */
+ return isFunctionLikeBodyKeyword(kind)
+ || kind === 126 /* DeclareKeyword */
+ || kind === 131 /* ModuleKeyword */
|| ts.isTypeKeyword(kind) && kind !== 142 /* UndefinedKeyword */;
+ case 5 /* FunctionLikeBodyKeywords */:
+ return isFunctionLikeBodyKeyword(kind);
case 2 /* ClassElementKeywords */:
return isClassMemberCompletionKeyword(kind);
case 3 /* InterfaceElementKeywords */:
return isInterfaceOrTypeLiteralCompletionKeyword(kind);
case 4 /* ConstructorParameterKeywords */:
return ts.isParameterPropertyModifier(kind);
- case 5 /* FunctionLikeBodyKeywords */:
- return isFunctionLikeBodyKeyword(kind);
case 6 /* TypeAssertionKeywords */:
return ts.isTypeKeyword(kind) || kind === 78 /* ConstKeyword */;
case 7 /* TypeKeywords */:
@@ -103302,7 +104144,9 @@ var ts;
}
}
function isFunctionLikeBodyKeyword(kind) {
- return kind === 122 /* AsyncKeyword */ || kind === 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
+ return kind === 122 /* AsyncKeyword */
+ || kind === 123 /* AwaitKeyword */
+ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}
function keywordForNode(node) {
return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind;
@@ -103339,7 +104183,7 @@ var ts;
function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) {
// class c { method() { } | method2() { } }
switch (location.kind) {
- case 313 /* SyntaxList */:
+ case 314 /* SyntaxList */:
return ts.tryCast(location.parent, ts.isObjectTypeDeclaration);
case 1 /* EndOfFileToken */:
var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration);
@@ -103609,10 +104453,12 @@ var ts;
return __spreadArrays(container.parameters, (ts.isClassLike(container.parent) ? container.parent.members : []));
case 241 /* ClassDeclaration */:
case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 169 /* TypeLiteral */:
var nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
- if (modifierFlag & 28 /* AccessibilityModifier */) {
+ if (modifierFlag & (28 /* AccessibilityModifier */ | 64 /* Readonly */)) {
var constructor = ts.find(container.members, ts.isConstructorDeclaration);
if (constructor) {
return __spreadArrays(nodes, constructor.parameters);
@@ -104344,7 +105190,7 @@ var ts;
/**
* Given a local reference, we might notice that it's an import/export and recursively search for references of that.
* If at an import, look locally for the symbol it imports.
- * If an an export, look for all imports of it.
+ * If at an export, look for all imports of it.
* This doesn't handle export specifiers; that is done in `getReferencesAtExportSpecifier`.
* @param comingFromExport If we are doing a search for all exports, don't bother looking backwards for the imported symbol, since that's the reason we're here.
*/
@@ -104476,10 +105322,10 @@ var ts;
// If a reference is a class expression, the exported node would be its parent.
// If a reference is a variable declaration, the exported node would be the variable statement.
function getExportNode(parent, node) {
- if (parent.kind === 238 /* VariableDeclaration */) {
- var p = parent;
- return p.name !== node ? undefined :
- p.parent.kind === 275 /* CatchClause */ ? undefined : p.parent.parent.kind === 220 /* VariableStatement */ ? p.parent.parent : undefined;
+ var declaration = ts.isVariableDeclaration(parent) ? parent : ts.isBindingElement(parent) ? ts.walkUpBindingElementsAndPatterns(parent) : undefined;
+ if (declaration) {
+ return parent.name !== node ? undefined :
+ ts.isCatchClause(declaration.parent) ? undefined : ts.isVariableStatement(declaration.parent.parent) ? declaration.parent.parent : undefined;
}
else {
return parent;
@@ -104943,8 +105789,8 @@ var ts;
case 249 /* ImportEqualsDeclaration */:
case 254 /* ImportSpecifier */:
case 242 /* InterfaceDeclaration */:
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
case 268 /* JsxAttribute */:
case 245 /* ModuleDeclaration */:
case 248 /* NamespaceExportDeclaration */:
@@ -104969,8 +105815,8 @@ var ts;
return !!decl.initializer || ts.isCatchClause(decl.parent);
case 156 /* MethodSignature */:
case 154 /* PropertySignature */:
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
return false;
default:
return ts.Debug.failBadSyntaxKind(decl);
@@ -105161,10 +106007,23 @@ var ts;
}
return references.length ? [{ definition: { type: 0 /* Symbol */, symbol: symbol }, references: references }] : ts.emptyArray;
}
+ /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */
+ function isReadonlyTypeOperator(node) {
+ return node.kind === 134 /* ReadonlyKeyword */
+ && ts.isTypeOperatorNode(node.parent)
+ && node.parent.operator === 134 /* ReadonlyKeyword */;
+ }
/** getReferencedSymbols for special node kinds. */
function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) {
if (ts.isTypeKeyword(node.kind)) {
- return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken);
+ // A modifier readonly (like on a property declaration) is not special;
+ // a readonly type keyword (like `readonly string[]`) is.
+ if (node.kind === 134 /* ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) {
+ return undefined;
+ }
+ // Likewise, when we *are* looking for a special keyword, make sure we
+ // *don’t* include readonly member modifiers.
+ return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 134 /* ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined);
}
// Labels
if (ts.isJumpStatementTarget(node)) {
@@ -105589,8 +106448,8 @@ var ts;
// We found a match. Make sure it's not part of a larger word (i.e. the char
// before and after it have to be a non-identifier char).
var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 8 /* Latest */)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 8 /* Latest */))) {
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 99 /* Latest */)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 99 /* Latest */))) {
// Found a real match. Keep searching.
positions.push(position);
}
@@ -105625,11 +106484,13 @@ var ts;
return false;
}
}
- function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) {
+ function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken, filter) {
var references = ts.flatMap(sourceFiles, function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
return ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, ts.tokenToString(keywordKind), sourceFile), function (referenceLocation) {
- return referenceLocation.kind === keywordKind ? FindAllReferences.nodeEntry(referenceLocation) : undefined;
+ if (referenceLocation.kind === keywordKind && (!filter || filter(referenceLocation))) {
+ return FindAllReferences.nodeEntry(referenceLocation);
+ }
});
});
return references.length ? [{ definition: { type: 2 /* Keyword */, node: references[0].node }, references: references }] : undefined;
@@ -106771,18 +107632,21 @@ var ts;
}
}
function getDefinitionFromSymbol(typeChecker, symbol, node) {
- return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(symbol.declarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
+ // There are cases when you extend a function by adding properties to it afterwards,
+ // we want to strip those extra properties
+ var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return !ts.isAssignmentDeclaration(d) || d === symbol.valueDeclaration; }) || undefined;
+ return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(filteredDeclarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
function getConstructSignatureDefinition() {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 125 /* ConstructorKeyword */)) {
- var cls = ts.find(symbol.declarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
+ var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
return getSignatureDefinition(cls.members, /*selectConstructors*/ true);
}
}
function getCallSignatureDefinition() {
return ts.isCallOrNewExpressionTarget(node) || ts.isNameOfFunctionDeclaration(node)
- ? getSignatureDefinition(symbol.declarations, /*selectConstructors*/ false)
+ ? getSignatureDefinition(filteredDeclarations, /*selectConstructors*/ false)
: undefined;
}
function getSignatureDefinition(signatureDeclarations, selectConstructors) {
@@ -106964,11 +107828,11 @@ var ts;
JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
function getCommentHavingNodes(declaration) {
switch (declaration.kind) {
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return [declaration];
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
return [declaration, declaration.parent];
default:
return ts.getJSDocCommentsAndTags(declaration);
@@ -106989,16 +107853,16 @@ var ts;
function getCommentText(tag) {
var comment = tag.comment;
switch (tag.kind) {
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return withNode(tag.class);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return withList(tag.typeParameters);
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
return withNode(tag.typeExpression);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
var name = tag.name;
return name ? withNode(name) : comment;
default:
@@ -107823,8 +108687,8 @@ var ts;
case 245 /* ModuleDeclaration */:
case 285 /* SourceFile */:
case 243 /* TypeAliasDeclaration */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
return true;
case 158 /* Constructor */:
case 157 /* MethodDeclaration */:
@@ -108377,9 +109241,9 @@ var ts;
function addRegionOutliningSpans(sourceFile, out) {
var regions = [];
var lineStarts = sourceFile.getLineStarts();
- for (var i = 0; i < lineStarts.length; i++) {
- var currentLineStart = lineStarts[i];
- var lineEnd = i + 1 === lineStarts.length ? sourceFile.getEnd() : lineStarts[i + 1] - 1;
+ for (var _i = 0, lineStarts_1 = lineStarts; _i < lineStarts_1.length; _i++) {
+ var currentLineStart = lineStarts_1[_i];
+ var lineEnd = sourceFile.getLineEndOfPosition(currentLineStart);
var lineText = sourceFile.text.substring(currentLineStart, lineEnd);
var result = isRegionDelimiter(lineText);
if (!result || ts.isInComment(sourceFile, currentLineStart)) {
@@ -108814,7 +109678,7 @@ var ts;
if (ch >= 65 /* A */ && ch <= 90 /* Z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 99 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -108827,7 +109691,7 @@ var ts;
if (ch >= 97 /* a */ && ch <= 122 /* z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 99 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -109477,7 +110341,7 @@ var ts;
if (node.getStart(sourceFile) > pos) {
break outer;
}
- if (positionShouldSnapToNode(pos, node, nextNode)) {
+ if (positionShouldSnapToNode(sourceFile, pos, node)) {
// 1. Blocks are effectively redundant with SyntaxLists.
// 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
// of things that should be considered independently.
@@ -109520,6 +110384,12 @@ var ts;
parentNode = node;
break;
}
+ // If we made it to the end of the for loop, we’re done.
+ // In practice, I’ve only seen this happen at the very end
+ // of a SourceFile.
+ if (i === children.length - 1) {
+ break outer;
+ }
}
}
return selectionRange;
@@ -109543,12 +110413,11 @@ var ts;
* count too, unless that position belongs to the next node. In effect, makes
* selections able to snap to preceding tokens when the cursor is on the tail
* end of them with only whitespace ahead.
+ * @param sourceFile The source file containing the nodes.
* @param pos The position to check.
* @param node The candidate node to snap to.
- * @param nextNode The next sibling node in the tree.
- * @param sourceFile The source file containing the nodes.
*/
- function positionShouldSnapToNode(pos, node, nextNode) {
+ function positionShouldSnapToNode(sourceFile, pos, node) {
// Can’t use 'ts.positionBelongsToNode()' here because it cleverly accounts
// for missing nodes, which can’t really be considered when deciding what
// to select.
@@ -109557,9 +110426,8 @@ var ts;
return true;
}
var nodeEnd = node.getEnd();
- var nextNodeStart = nextNode && nextNode.getStart();
if (nodeEnd === pos) {
- return pos !== nextNodeStart;
+ return ts.getTouchingPropertyName(sourceFile, pos).pos < node.end;
}
return false;
}
@@ -109708,7 +110576,7 @@ var ts;
}
function createSyntaxList(children) {
ts.Debug.assertGreaterThanOrEqual(children.length, 1);
- var syntaxList = ts.createNode(313 /* SyntaxList */, children[0].pos, ts.last(children).end);
+ var syntaxList = ts.createNode(314 /* SyntaxList */, children[0].pos, ts.last(children).end);
syntaxList._children = children;
return syntaxList;
}
@@ -111217,7 +112085,14 @@ var ts;
*/
function transpileModule(input, transpileOptions) {
var diagnostics = [];
- var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : ts.getDefaultCompilerOptions();
+ var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
+ // mix in default options
+ var defaultOptions = ts.getDefaultCompilerOptions();
+ for (var key in defaultOptions) {
+ if (ts.hasProperty(defaultOptions, key) && options[key] === undefined) {
+ options[key] = defaultOptions[key];
+ }
+ }
options.isolatedModules = true;
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
options.suppressOutputPathCheck = true;
@@ -111423,8 +112298,8 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
- var standardScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
- var jsxScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
+ var standardScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
+ var jsxScanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
var ScanAction;
(function (ScanAction) {
ScanAction[ScanAction["Scan"] = 0] = "Scan";
@@ -113759,7 +114634,7 @@ var ts;
case 210 /* ClassExpression */:
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return getList(node.typeParameters);
case 193 /* NewExpression */:
case 192 /* CallExpression */:
@@ -114652,7 +115527,7 @@ var ts;
function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) {
// TODO: this emits the file, parses it back, then formats it that -- may be a less roundabout way to do this
var nonFormattedText = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
- var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 8 /* ESNext */, /*setParentNodes*/ true, scriptKind);
+ var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 99 /* ESNext */, /*setParentNodes*/ true, scriptKind);
var changes = ts.formatting.formatDocument(sourceFile, formatContext);
return applyChanges(nonFormattedText, changes) + newLineCharacter;
}
@@ -116022,14 +116897,14 @@ var ts;
return undefined;
}
switch (oldTag.kind) {
- case 306 /* JSDocParameterTag */: {
+ case 307 /* JSDocParameterTag */: {
var oldParam = oldTag;
var newParam = newTag;
return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
? ts.createJSDocParamTag(newParam.name, newParam.isBracketed, newParam.typeExpression, oldParam.comment)
: undefined;
}
- case 307 /* JSDocReturnTag */:
+ case 308 /* JSDocReturnTag */:
return ts.createJSDocReturnTag(newTag.typeExpression, oldTag.comment);
}
}
@@ -117334,7 +118209,7 @@ var ts;
forEachExportReference(sourceFile, function (node) {
var _a = node.name, text = _a.text, originalKeywordKind = _a.originalKeywordKind;
if (!res.has(text) && (originalKeywordKind !== undefined && ts.isNonContextualKeyword(originalKeywordKind)
- || checker.resolveName(node.name.text, node, 67220415 /* Value */, /*excludeGlobals*/ true))) {
+ || checker.resolveName(node.name.text, node, 111551 /* Value */, /*excludeGlobals*/ true))) {
// Unconditionally add an underscore in case `text` is a keyword.
res.set(text, makeUniqueName("_" + text, identifiers));
}
@@ -117935,9 +118810,10 @@ var ts;
ImportKind[ImportKind["Default"] = 1] = "Default";
ImportKind[ImportKind["Namespace"] = 2] = "Namespace";
ImportKind[ImportKind["Equals"] = 3] = "Equals";
+ ImportKind[ImportKind["ConstEquals"] = 4] = "ConstEquals";
})(ImportKind || (ImportKind = {}));
function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
- var exportInfos = getAllReExportingModules(exportedSymbol, moduleSymbol, symbolName, sourceFile, program.getCompilerOptions(), program.getTypeChecker(), program.getSourceFiles());
+ var exportInfos = getAllReExportingModules(sourceFile, exportedSymbol, moduleSymbol, symbolName, sourceFile, program.getCompilerOptions(), program.getTypeChecker(), program.getSourceFiles());
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol; }));
// We sort the best codefixes first, so taking `first` is best for completions.
var moduleSpecifier = ts.first(getNewImportInfos(program, sourceFile, position, exportInfos, host, preferences)).moduleSpecifier;
@@ -117949,14 +118825,14 @@ var ts;
var description = _a.description, changes = _a.changes, commands = _a.commands;
return { description: description, changes: changes, commands: commands };
}
- function getAllReExportingModules(exportedSymbol, exportingModuleSymbol, symbolName, sourceFile, compilerOptions, checker, allSourceFiles) {
+ function getAllReExportingModules(importingFile, exportedSymbol, exportingModuleSymbol, symbolName, sourceFile, compilerOptions, checker, allSourceFiles) {
var result = [];
forEachExternalModule(checker, allSourceFiles, function (moduleSymbol, moduleFile) {
// Don't import from a re-export when looking "up" like to `./index` or `../index`.
if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(sourceFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) {
return;
}
- var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
+ var defaultInfo = getDefaultLikeExportInfo(importingFile, moduleSymbol, checker, compilerOptions);
if (defaultInfo && defaultInfo.name === symbolName && ts.skipAlias(defaultInfo.symbol, checker) === exportedSymbol) {
result.push({ moduleSymbol: moduleSymbol, importKind: defaultInfo.kind, exportedSymbolIsTypeOnly: isTypeOnlySymbol(defaultInfo.symbol, checker) });
}
@@ -117970,7 +118846,7 @@ var ts;
return result;
}
function isTypeOnlySymbol(s, checker) {
- return !(ts.skipAlias(s, checker).flags & 67220415 /* Value */);
+ return !(ts.skipAlias(s, checker).flags & 111551 /* Value */);
}
function getFixForImport(exportInfos, symbolName, position, program, sourceFile, host, preferences) {
var checker = program.getTypeChecker();
@@ -118078,7 +118954,7 @@ var ts;
return undefined;
var symbol = checker.getAliasedSymbol(umdSymbol);
var symbolName = umdSymbol.name;
- var exportInfos = [{ moduleSymbol: symbol, importKind: getUmdImportKind(program.getCompilerOptions()), exportedSymbolIsTypeOnly: false }];
+ var exportInfos = [{ moduleSymbol: symbol, importKind: getUmdImportKind(sourceFile, program.getCompilerOptions()), exportedSymbolIsTypeOnly: false }];
var fixes = getFixForImport(exportInfos, symbolName, ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined, program, sourceFile, host, preferences);
return { fixes: fixes, symbolName: symbolName };
}
@@ -118090,10 +118966,10 @@ var ts;
// The error wasn't for the symbolAtLocation, it was for the JSX tag itself, which needs access to e.g. `React`.
var parent = token.parent;
return (ts.isJsxOpeningLikeElement(parent) && parent.tagName === token) || ts.isJsxOpeningFragment(parent)
- ? ts.tryCast(checker.resolveName(checker.getJsxNamespace(parent), ts.isJsxOpeningLikeElement(parent) ? token : parent, 67220415 /* Value */, /*excludeGlobals*/ false), ts.isUMDExportSymbol)
+ ? ts.tryCast(checker.resolveName(checker.getJsxNamespace(parent), ts.isJsxOpeningLikeElement(parent) ? token : parent, 111551 /* Value */, /*excludeGlobals*/ false), ts.isUMDExportSymbol)
: undefined;
}
- function getUmdImportKind(compilerOptions) {
+ function getUmdImportKind(importingFile, compilerOptions) {
// Import a synthetic `default` if enabled.
if (ts.getAllowSyntheticDefaultImports(compilerOptions)) {
return 1 /* Default */;
@@ -118104,6 +118980,9 @@ var ts;
case ts.ModuleKind.AMD:
case ts.ModuleKind.CommonJS:
case ts.ModuleKind.UMD:
+ if (ts.isInJSFile(importingFile)) {
+ return ts.isExternalModule(importingFile) ? 2 /* Namespace */ : 4 /* ConstEquals */;
+ }
return 3 /* Equals */;
case ts.ModuleKind.System:
case ts.ModuleKind.ES2015:
@@ -118142,7 +119021,7 @@ var ts;
}
forEachExternalModuleToImportFrom(checker, sourceFile, program.getSourceFiles(), function (moduleSymbol) {
cancellationToken.throwIfCancellationRequested();
- var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, program.getCompilerOptions());
+ var defaultInfo = getDefaultLikeExportInfo(sourceFile, moduleSymbol, checker, program.getCompilerOptions());
if (defaultInfo && defaultInfo.name === symbolName && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
addSymbol(moduleSymbol, defaultInfo.symbol, defaultInfo.kind);
}
@@ -118154,20 +119033,41 @@ var ts;
});
return originalSymbolToExportInfos;
}
- function getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions) {
- var exported = getDefaultLikeExportWorker(moduleSymbol, checker);
+ function getDefaultLikeExportInfo(importingFile, moduleSymbol, checker, compilerOptions) {
+ var exported = getDefaultLikeExportWorker(importingFile, moduleSymbol, checker, compilerOptions);
if (!exported)
return undefined;
var symbol = exported.symbol, kind = exported.kind;
var info = getDefaultExportInfoWorker(symbol, moduleSymbol, checker, compilerOptions);
return info && __assign({ symbol: symbol, kind: kind }, info);
}
- function getDefaultLikeExportWorker(moduleSymbol, checker) {
+ function getDefaultLikeExportWorker(importingFile, moduleSymbol, checker, compilerOptions) {
var defaultExport = checker.tryGetMemberInModuleExports("default" /* Default */, moduleSymbol);
if (defaultExport)
return { symbol: defaultExport, kind: 1 /* Default */ };
var exportEquals = checker.resolveExternalModuleSymbol(moduleSymbol);
- return exportEquals === moduleSymbol ? undefined : { symbol: exportEquals, kind: 3 /* Equals */ };
+ return exportEquals === moduleSymbol ? undefined : { symbol: exportEquals, kind: getExportEqualsImportKind(importingFile, compilerOptions, checker) };
+ }
+ function getExportEqualsImportKind(importingFile, compilerOptions, checker) {
+ if (ts.getAllowSyntheticDefaultImports(compilerOptions) && ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
+ return 1 /* Default */;
+ }
+ if (ts.isInJSFile(importingFile)) {
+ return ts.isExternalModule(importingFile) ? 1 /* Default */ : 4 /* ConstEquals */;
+ }
+ for (var _i = 0, _a = importingFile.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ if (ts.isImportEqualsDeclaration(statement)) {
+ return 3 /* Equals */;
+ }
+ if (ts.isImportDeclaration(statement) && statement.importClause && statement.importClause.name) {
+ var moduleSymbol = checker.getImmediateAliasedSymbol(statement.importClause.symbol);
+ if (moduleSymbol && moduleSymbol.name !== "default" /* Default */) {
+ return 1 /* Default */;
+ }
+ }
+ }
+ return 3 /* Equals */;
}
function getDefaultExportInfoWorker(defaultExport, moduleSymbol, checker, compilerOptions) {
var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport);
@@ -118180,9 +119080,11 @@ var ts;
var aliased = checker.getImmediateAliasedSymbol(defaultExport);
return aliased && getDefaultExportInfoWorker(aliased, ts.Debug.assertDefined(aliased.parent), checker, compilerOptions);
}
- else {
- return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) };
+ if (defaultExport.escapedName !== "default" /* Default */ &&
+ defaultExport.escapedName !== "export=" /* ExportEquals */) {
+ return { symbolForMeaning: defaultExport, name: defaultExport.getName() };
}
+ return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) };
}
function getNameForExportDefault(symbol) {
return symbol.declarations && ts.firstDefined(symbol.declarations, function (declaration) {
@@ -118274,11 +119176,17 @@ var ts;
ts.insertImport(changes, sourceFile, ts.makeImport(defaultImport === undefined ? undefined : ts.createIdentifier(defaultImport), namedImports.map(function (n) { return ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(n)); }), moduleSpecifier, quotePreference));
}
if (namespaceLikeImport) {
- ts.insertImport(changes, sourceFile, namespaceLikeImport.importKind === 3 /* Equals */
- ? ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createIdentifier(namespaceLikeImport.name), ts.createExternalModuleReference(quotedModuleSpecifier))
- : ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(ts.createIdentifier(namespaceLikeImport.name))), quotedModuleSpecifier));
+ ts.insertImport(changes, sourceFile, namespaceLikeImport.importKind === 3 /* Equals */ ? ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createIdentifier(namespaceLikeImport.name), ts.createExternalModuleReference(quotedModuleSpecifier)) :
+ namespaceLikeImport.importKind === 4 /* ConstEquals */ ? createConstEqualsRequireDeclaration(namespaceLikeImport.name, quotedModuleSpecifier) :
+ ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(ts.createIdentifier(namespaceLikeImport.name))), quotedModuleSpecifier));
}
}
+ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
+ return ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(ts.createIdentifier(name),
+ /*type*/ undefined, ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, [quotedModuleSpecifier]))
+ ], 2 /* Const */));
+ }
function symbolHasMeaning(_a, meaning) {
var declarations = _a.declarations;
return ts.some(declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); });
@@ -118420,10 +119328,10 @@ var ts;
flags |= 1920 /* Namespace */;
}
if (meaning & 2 /* Type */) {
- flags |= 67897832 /* Type */;
+ flags |= 788968 /* Type */;
}
if (meaning & 1 /* Value */) {
- flags |= 67220415 /* Value */;
+ flags |= 111551 /* Value */;
}
return flags;
}
@@ -119648,9 +120556,8 @@ var ts;
var modifiers = visibilityModifier ? ts.createNodeArray([visibilityModifier]) : undefined;
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
var optional = !!(symbol.flags & 16777216 /* Optional */);
+ var ambient = !!(enclosingDeclaration.flags & 4194304 /* Ambient */);
switch (declaration.kind) {
- case 159 /* GetAccessor */:
- case 160 /* SetAccessor */:
case 154 /* PropertySignature */:
case 155 /* PropertyDeclaration */:
var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
@@ -119658,6 +120565,29 @@ var ts;
/*decorators*/ undefined, modifiers, name, optional ? ts.createToken(56 /* QuestionToken */) : undefined, typeNode,
/*initializer*/ undefined));
break;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */: {
+ var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration);
+ var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
+ var orderedAccessors = allAccessors.secondAccessor
+ ? [allAccessors.firstAccessor, allAccessors.secondAccessor]
+ : [allAccessors.firstAccessor];
+ for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) {
+ var accessor = orderedAccessors_1[_i];
+ if (ts.isGetAccessorDeclaration(accessor)) {
+ out(ts.createGetAccessor(
+ /*decorators*/ undefined, modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : createStubbedMethodBody(preferences)));
+ }
+ else {
+ ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration);
+ var parameter = ts.getSetAccessorValueParameter(accessor);
+ var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined;
+ out(ts.createSetAccessor(
+ /*decorators*/ undefined, modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : createStubbedMethodBody(preferences)));
+ }
+ }
+ break;
+ }
case 156 /* MethodSignature */:
case 157 /* MethodDeclaration */:
// The signature for the implementation appears as an entry in `signatures` iff
@@ -119674,21 +120604,23 @@ var ts;
if (declarations.length === 1) {
ts.Debug.assert(signatures.length === 1);
var signature = signatures[0];
- outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
+ outputMethod(signature, modifiers, name, ambient ? undefined : createStubbedMethodBody(preferences));
break;
}
- for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
- var signature = signatures_1[_i];
+ for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) {
+ var signature = signatures_1[_a];
// Need to ensure nodes are fresh each time so they can have different positions.
outputMethod(signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
}
- if (declarations.length > signatures.length) {
- var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
- outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
- }
- else {
- ts.Debug.assert(declarations.length === signatures.length);
- out(createMethodImplementingSignatures(signatures, name, optional, modifiers, preferences));
+ if (!ambient) {
+ if (declarations.length > signatures.length) {
+ var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
+ outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
+ }
+ else {
+ ts.Debug.assert(declarations.length === signatures.length);
+ out(createMethodImplementingSignatures(signatures, name, optional, modifiers, preferences));
+ }
}
break;
}
@@ -120525,7 +121457,7 @@ var ts;
function doChangeNamedToNamespace(sourceFile, checker, changes, toConvert) {
var importDecl = toConvert.parent.parent;
var moduleSpecifier = importDecl.moduleSpecifier;
- var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 8 /* ESNext */) : "module";
+ var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 99 /* ESNext */) : "module";
var namespaceNameConflicts = toConvert.elements.some(function (element) {
return ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
return !!checker.resolveName(preferredName, id, 67108863 /* All */, /*excludeGlobals*/ true);
@@ -122154,7 +123086,7 @@ var ts;
}
else if (ts.isTypeQueryNode(node)) {
if (ts.isIdentifier(node.exprName)) {
- var symbol = checker.resolveName(node.exprName.text, node.exprName, 67220415 /* Value */, /* excludeGlobals */ false);
+ var symbol = checker.resolveName(node.exprName.text, node.exprName, 111551 /* Value */, /* excludeGlobals */ false);
if (symbol && rangeContainsSkipTrivia(statement, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) {
return true;
}
@@ -122176,7 +123108,7 @@ var ts;
changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
}
function doTypedefChange(changes, file, name, firstStatement, selection, typeParameters) {
- var node = ts.createNode(311 /* JSDocTypedefTag */);
+ var node = ts.createNode(312 /* JSDocTypedefTag */);
node.tagName = ts.createIdentifier("typedef"); // TODO: jsdoc factory https://github.com/Microsoft/TypeScript/pull/29539
node.fullName = ts.createIdentifier(name);
node.name = node.fullName;
@@ -122184,7 +123116,7 @@ var ts;
var templates = [];
ts.forEach(typeParameters, function (typeParameter) {
var constraint = ts.getEffectiveConstraintOfTypeParameter(typeParameter);
- var template = ts.createNode(310 /* JSDocTemplateTag */);
+ var template = ts.createNode(311 /* JSDocTemplateTag */);
template.tagName = ts.createIdentifier("template");
template.constraint = constraint && ts.cast(constraint, ts.isJSDocTypeExpression);
var parameter = ts.createNode(151 /* TypeParameter */);
@@ -122550,7 +123482,7 @@ var ts;
}
}
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) {
- var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 8 /* ESNext */);
+ var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 99 /* ESNext */);
var needUniqueName = false;
var toChange = [];
ts.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function (ref) {
@@ -122688,7 +123620,7 @@ var ts;
}
if (namedBindings) {
if (namedBindingsUnused) {
- changes.delete(sourceFile, namedBindings);
+ changes.replaceNode(sourceFile, importDecl.importClause, ts.updateImportClause(importDecl.importClause, name, /*namedBindings*/ undefined));
}
else if (namedBindings.kind === 253 /* NamedImports */) {
for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
@@ -123736,7 +124668,7 @@ var ts;
if (!children.length) {
return undefined;
}
- var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 312 /* LastJSDocNode */; });
+ var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 313 /* LastJSDocNode */; });
return child.kind < 149 /* FirstNode */ ?
child :
child.getFirstToken(sourceFile);
@@ -123806,7 +124738,7 @@ var ts;
}
}
function createSyntaxList(nodes, parent) {
- var list = createNode(313 /* SyntaxList */, nodes.pos, nodes.end, parent);
+ var list = createNode(314 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
@@ -124401,7 +125333,7 @@ var ts;
var sourceFile;
if (this.currentFileName !== fileName) {
// This is a new file, just parse it
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 8 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 99 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
}
else if (this.currentFileVersion !== version) {
// This is the same file, just a newer version. Incrementally parse the file.
@@ -124558,7 +125490,11 @@ var ts;
function getValidSourceFile(fileName) {
var sourceFile = program.getSourceFile(fileName);
if (!sourceFile) {
- throw new Error("Could not find sourceFile: '" + fileName + "' in " + (program && JSON.stringify(program.getSourceFiles().map(function (f) { return f.fileName; }))) + ".");
+ var error = new Error("Could not find source file: '" + fileName + "'.");
+ // We've been having trouble debugging this, so attach sidecar data for the tsserver log.
+ // See https://github.com/microsoft/TypeScript/issues/30180.
+ error.ProgramFiles = program.getSourceFiles().map(function (f) { return f.fileName; });
+ throw error;
}
return sourceFile;
}
@@ -124627,11 +125563,21 @@ var ts;
compilerHost.trace = function (message) { return host.trace(message); };
}
if (host.resolveModuleNames) {
- compilerHost.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); };
+ compilerHost.resolveModuleNames = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveModuleNames.apply(host, args);
+ };
}
if (host.resolveTypeReferenceDirectives) {
- compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference) {
- return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile, redirectedReference);
+ compilerHost.resolveTypeReferenceDirectives = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveTypeReferenceDirectives.apply(host, args);
};
}
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
@@ -124878,7 +125824,7 @@ var ts;
var normalizedFileName = ts.normalizePath(fileName);
ts.Debug.assert(filesToSearch.some(function (f) { return ts.normalizePath(f) === normalizedFileName; }));
synchronizeHostData();
- var sourceFilesToSearch = filesToSearch.map(getValidSourceFile);
+ var sourceFilesToSearch = ts.mapDefined(filesToSearch, function (fileName) { return program.getSourceFile(fileName); });
var sourceFile = getValidSourceFile(fileName);
return ts.DocumentHighlights.getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch);
}
diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js
index 49916a66d34..8210e042df6 100644
--- a/lib/typingsInstaller.js
+++ b/lib/typingsInstaller.js
@@ -83,7 +83,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.6";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".0-beta";
+ ts.version = ts.versionMajorMinor + ".1-rc";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -1238,6 +1238,18 @@ var ts;
return keys;
}
ts.getOwnKeys = getOwnKeys;
+ function getAllKeys(obj) {
+ var result = [];
+ do {
+ var names = Object.getOwnPropertyNames(obj);
+ for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
+ var name = names_1[_i];
+ pushIfUnique(result, name);
+ }
+ } while (obj = Object.getPrototypeOf(obj));
+ return result;
+ }
+ ts.getAllKeys = getAllKeys;
function getOwnValues(sparseArray) {
var values = [];
for (var key in sparseArray) {
@@ -2377,6 +2389,46 @@ var ts;
})(ts || (ts = {}));
/* @internal */
var ts;
+(function (ts) {
+ var nullLogger = {
+ logEvent: ts.noop,
+ logErrEvent: ts.noop,
+ logPerfEvent: ts.noop,
+ logInfoEvent: ts.noop,
+ logStartCommand: ts.noop,
+ logStopCommand: ts.noop,
+ logStartUpdateProgram: ts.noop,
+ logStopUpdateProgram: ts.noop,
+ logStartUpdateGraph: ts.noop,
+ logStopUpdateGraph: ts.noop,
+ logStartResolveModule: ts.noop,
+ logStopResolveModule: ts.noop,
+ logStartParseSourceFile: ts.noop,
+ logStopParseSourceFile: ts.noop,
+ logStartReadFile: ts.noop,
+ logStopReadFile: ts.noop,
+ logStartBindFile: ts.noop,
+ logStopBindFile: ts.noop,
+ logStartScheduledOperation: ts.noop,
+ logStopScheduledOperation: ts.noop,
+ };
+ // Load optional module to enable Event Tracing for Windows
+ // See https://github.com/microsoft/typescript-etw for more information
+ var etwModule;
+ try {
+ // require() will throw an exception if the module is not installed
+ // It may also return undefined if not installed properly
+ etwModule = require("@microsoft/typescript-etw"); // tslint:disable-line:no-implicit-dependencies
+ }
+ catch (e) {
+ etwModule = undefined;
+ }
+ /** Performance logger that will generate ETW events if possible */
+ ts.perfLogger = etwModule ? etwModule : nullLogger;
+ ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
(function (ts) {
// https://semver.org/#spec-item-2
// > A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative
@@ -3069,32 +3121,34 @@ var ts;
SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType";
SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType";
SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature";
- SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag";
- SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 302] = "JSDocAuthorTag";
- SyntaxKind[SyntaxKind["JSDocClassTag"] = 303] = "JSDocClassTag";
- SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 304] = "JSDocCallbackTag";
- SyntaxKind[SyntaxKind["JSDocEnumTag"] = 305] = "JSDocEnumTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 306] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 307] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocThisTag"] = 308] = "JSDocThisTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 309] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 310] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 311] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 312] = "JSDocPropertyTag";
+ // https://jsdoc.app/about-namepaths.html
+ SyntaxKind[SyntaxKind["JSDocNamepathType"] = 297] = "JSDocNamepathType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 298] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 299] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocSignature"] = 300] = "JSDocSignature";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 301] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 302] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 303] = "JSDocAuthorTag";
+ SyntaxKind[SyntaxKind["JSDocClassTag"] = 304] = "JSDocClassTag";
+ SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 305] = "JSDocCallbackTag";
+ SyntaxKind[SyntaxKind["JSDocEnumTag"] = 306] = "JSDocEnumTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 307] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 308] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 309] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 310] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 311] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 312] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 313] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 313] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 314] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 314] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 315] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 316] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 317] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 318] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 315] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 316] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 317] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 318] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 319] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 319] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 320] = "Count";
// Markers
SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment";
@@ -3122,9 +3176,9 @@ var ts;
SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator";
SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode";
SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 312] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 312] = "LastJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 313] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 301] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 313] = "LastJSDocTagNode";
/* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword";
/* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
@@ -3250,6 +3304,8 @@ var ts;
/* @internal */
TokenFlags[TokenFlags["ContainsSeparator"] = 512] = "ContainsSeparator";
/* @internal */
+ TokenFlags[TokenFlags["UnicodeEscape"] = 1024] = "UnicodeEscape";
+ /* @internal */
TokenFlags[TokenFlags["BinaryOrOctalSpecifier"] = 384] = "BinaryOrOctalSpecifier";
/* @internal */
TokenFlags[TokenFlags["NumericLiteralFlags"] = 1008] = "NumericLiteralFlags";
@@ -3473,32 +3529,32 @@ var ts;
SymbolFlags[SymbolFlags["All"] = 67108863] = "All";
SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum";
SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable";
- SymbolFlags[SymbolFlags["Value"] = 67220415] = "Value";
- SymbolFlags[SymbolFlags["Type"] = 67897832] = "Type";
+ SymbolFlags[SymbolFlags["Value"] = 111551] = "Value";
+ SymbolFlags[SymbolFlags["Type"] = 788968] = "Type";
SymbolFlags[SymbolFlags["Namespace"] = 1920] = "Namespace";
SymbolFlags[SymbolFlags["Module"] = 1536] = "Module";
SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor";
// Variables can be redeclared, but can not redeclare a block-scoped declaration with the
// same name, or any other value that is not a variable, e.g. ValueModule or Class
- SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 67220414] = "FunctionScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 111550] = "FunctionScopedVariableExcludes";
// Block-scoped declarations are not allowed to be re-declared
// they can not merge with anything in the value space
- SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 67220415] = "BlockScopedVariableExcludes";
- SymbolFlags[SymbolFlags["ParameterExcludes"] = 67220415] = "ParameterExcludes";
+ SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 111551] = "BlockScopedVariableExcludes";
+ SymbolFlags[SymbolFlags["ParameterExcludes"] = 111551] = "ParameterExcludes";
SymbolFlags[SymbolFlags["PropertyExcludes"] = 0] = "PropertyExcludes";
- SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 68008959] = "EnumMemberExcludes";
- SymbolFlags[SymbolFlags["FunctionExcludes"] = 67219887] = "FunctionExcludes";
- SymbolFlags[SymbolFlags["ClassExcludes"] = 68008383] = "ClassExcludes";
- SymbolFlags[SymbolFlags["InterfaceExcludes"] = 67897736] = "InterfaceExcludes";
- SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 68008191] = "RegularEnumExcludes";
- SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 68008831] = "ConstEnumExcludes";
+ SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes";
+ SymbolFlags[SymbolFlags["FunctionExcludes"] = 110991] = "FunctionExcludes";
+ SymbolFlags[SymbolFlags["ClassExcludes"] = 899503] = "ClassExcludes";
+ SymbolFlags[SymbolFlags["InterfaceExcludes"] = 788872] = "InterfaceExcludes";
+ SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes";
+ SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes";
SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 110735] = "ValueModuleExcludes";
SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes";
- SymbolFlags[SymbolFlags["MethodExcludes"] = 67212223] = "MethodExcludes";
- SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 67154879] = "GetAccessorExcludes";
- SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 67187647] = "SetAccessorExcludes";
- SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 67635688] = "TypeParameterExcludes";
- SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 67897832] = "TypeAliasExcludes";
+ SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes";
+ SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes";
+ SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes";
+ SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes";
+ SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes";
SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes";
SymbolFlags[SymbolFlags["ModuleMember"] = 2623475] = "ModuleMember";
SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal";
@@ -3826,8 +3882,11 @@ var ts;
ModuleKind[ModuleKind["AMD"] = 2] = "AMD";
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
ModuleKind[ModuleKind["System"] = 4] = "System";
+ // NOTE: ES module kinds should be contiguous to more easily check whether a module kind is *any* ES module kind.
+ // Non-ES module kinds should not come between ES2015 (the earliest ES module kind) and ESNext (the last ES
+ // module kind).
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
- ModuleKind[ModuleKind["ESNext"] = 6] = "ESNext";
+ ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
var JsxEmit;
(function (JsxEmit) {
@@ -3866,9 +3925,9 @@ var ts;
ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018";
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
- ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext";
+ ScriptTarget[ScriptTarget["ESNext"] = 99] = "ESNext";
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
- ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest";
+ ScriptTarget[ScriptTarget["Latest"] = 99] = "Latest";
})(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
var LanguageVariant;
(function (LanguageVariant) {
@@ -4564,6 +4623,38 @@ var ts;
}
}
ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
+ /* @internal */
+ function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
+ var cache = ts.createMap();
+ var callbacksCache = ts.createMultiMap();
+ var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
+ return function (fileName, callback, pollingInterval) {
+ var path = toCanonicalFileName(fileName);
+ var existing = cache.get(path);
+ if (existing) {
+ existing.refCount++;
+ }
+ else {
+ cache.set(path, {
+ watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval),
+ refCount: 1
+ });
+ }
+ callbacksCache.add(path, callback);
+ return {
+ close: function () {
+ var watcher = ts.Debug.assertDefined(cache.get(path));
+ callbacksCache.remove(path, callback);
+ watcher.refCount--;
+ if (watcher.refCount)
+ return;
+ cache.delete(path);
+ ts.closeFileWatcherOf(watcher);
+ }
+ };
+ };
+ }
+ ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
/**
* Returns true if file status changed
*/
@@ -4590,6 +4681,8 @@ var ts;
ts.getFileWatcherEventKind = getFileWatcherEventKind;
/*@internal*/
ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
+ /*@internal*/
+ ts.sysLog = ts.noop;
/**
* Watch the directory recursively using host provided method to watch child directories
* that means if this is recursive watcher, watch the children directories as well
@@ -4730,6 +4823,7 @@ var ts;
var Buffer = require("buffer").Buffer;
var nodeVersion = getNodeMajorVersion();
var isNode4OrLater = nodeVersion >= 4;
+ var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
var platform = _os.platform();
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
var FileSystemEntryKind;
@@ -4740,6 +4834,7 @@ var ts;
var useNonPollingWatchers = process.env.TSC_NONPOLLING_WATCHER;
var tscWatchFile = process.env.TSC_WATCHFILE;
var tscWatchDirectory = process.env.TSC_WATCHDIRECTORY;
+ var fsWatchFile = createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames);
var dynamicPollingWatchFile;
var nodeSystem = {
args: process.argv.slice(2),
@@ -4876,7 +4971,7 @@ var ts;
return useNonPollingWatchers ?
createNonPollingWatchFile() :
// Default to do not use polling interval as it is before this experiment branch
- function (fileName, callback) { return fsWatchFile(fileName, callback); };
+ function (fileName, callback) { return fsWatchFile(fileName, callback, /*pollingInterval*/ undefined); };
}
function getWatchDirectory() {
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
@@ -4950,7 +5045,7 @@ var ts;
return watcher;
}
}
- function fsWatchFile(fileName, callback, pollingInterval) {
+ function fsWatchFileWorker(fileName, callback, pollingInterval) {
_fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
var eventKind;
return {
@@ -5008,6 +5103,12 @@ var ts;
}
function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingWatchFile, pollingInterval) {
var options;
+ var lastDirectoryPartWithDirectorySeparator;
+ var lastDirectoryPart;
+ if (isLinuxOrMacOs) {
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
+ }
/** Watcher for the file system entry depending on whether it is missing or present */
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
watchMissingFileSystemEntry() :
@@ -5024,6 +5125,7 @@ var ts;
* @param createWatcher
*/
function invokeCallbackAndUpdateWatcher(createWatcher) {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
// Call the callback for current directory
callback("rename", "");
// If watcher is not closed, update it
@@ -5048,7 +5150,9 @@ var ts;
}
}
try {
- var presentWatcher = _fs.watch(fileOrDirectory, options, callback);
+ var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
+ callbackChangingToMissingFileSystemEntry :
+ callback);
// Watch the missing file or directory or error
presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
return presentWatcher;
@@ -5060,11 +5164,23 @@ var ts;
return watchPresentFileSystemEntryWithFsWatchFile();
}
}
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
+ return event === "rename" &&
+ (!relativeName ||
+ relativeName === lastDirectoryPart ||
+ relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length) &&
+ !fileSystemEntryExists(fileOrDirectory, entryKind) ?
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
+ callback(event, relativeName);
+ }
/**
* Watch the file or directory using fs.watchFile since fs.watch threw exception
* Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
*/
function watchPresentFileSystemEntryWithFsWatchFile() {
+ ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
return fallbackPollingWatchFile(fileOrDirectory, createFileWatcherCallback(callback), pollingInterval);
}
/**
@@ -5097,7 +5213,7 @@ var ts;
function createWatchDirectoryUsing(fsWatchFile) {
return function (directoryName, callback) { return fsWatchFile(directoryName, function () { return callback(directoryName); }, PollingInterval.Medium); };
}
- function readFile(fileName, _encoding) {
+ function readFileWorker(fileName, _encoding) {
if (!fileExists(fileName)) {
return undefined;
}
@@ -5125,7 +5241,14 @@ var ts;
// Default is UTF-8 with no byte order mark
return buffer.toString("utf8");
}
+ function readFile(fileName, _encoding) {
+ ts.perfLogger.logStartReadFile(fileName);
+ var file = readFileWorker(fileName, _encoding);
+ ts.perfLogger.logStopReadFile();
+ return file;
+ }
function writeFile(fileName, data, writeByteOrderMark) {
+ ts.perfLogger.logEvent("WriteFile: " + fileName);
// If a BOM is required, emit one
if (writeByteOrderMark) {
data = byteOrderMarkIndicator + data;
@@ -5142,6 +5265,7 @@ var ts;
}
}
function getAccessibleFileSystemEntries(path) {
+ ts.perfLogger.logEvent("ReadDir: " + (path || "."));
try {
var entries = _fs.readdirSync(path || ".").sort();
var files = [];
@@ -5197,6 +5321,7 @@ var ts;
return fileSystemEntryExists(path, 1 /* Directory */);
}
function getDirectories(path) {
+ ts.perfLogger.logEvent("ReadDir: " + path);
return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); });
}
function realpath(path) {
@@ -5387,7 +5512,6 @@ var ts;
A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."),
Invalid_reference_directive_syntax: diag(1084, ts.DiagnosticCategory.Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, ts.DiagnosticCategory.Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."),
- An_accessor_cannot_be_declared_in_an_ambient_context: diag(1086, ts.DiagnosticCategory.Error, "An_accessor_cannot_be_declared_in_an_ambient_context_1086", "An accessor cannot be declared in an ambient context."),
_0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."),
_0_modifier_cannot_appear_on_a_parameter: diag(1090, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."),
Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."),
@@ -5540,6 +5664,7 @@ var ts;
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
+ Keywords_cannot_contain_escape_characters: diag(1260, ts.DiagnosticCategory.Error, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -5572,7 +5697,7 @@ var ts;
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
- The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_option_1343", "The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options."),
+ The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system_1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'esnext' or 'system'."),
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness"),
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
@@ -6695,7 +6820,7 @@ var ts;
_a.of = 148 /* OfKeyword */,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */, "`": 59 /* BacktickToken */ }));
/*
As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
IdentifierStart ::
@@ -6742,6 +6867,14 @@ var ts;
*/
var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
+ /**
+ * Generated by scripts/regenerate-unicode-identifier-parts.js on node v12.4.0 with unicode 12.1
+ * based on http://www.unicode.org/reports/tr31/ and https://www.ecma-international.org/ecma-262/6.0/#sec-names-and-keywords
+ * unicodeESNextIdentifierStart corresponds to the ID_Start and Other_ID_Start property, and
+ * unicodeESNextIdentifierPart corresponds to ID_Continue, Other_ID_Continue, plus ID_Start and Other_ID_Start
+ */
+ var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3133, 3160, 3162, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101];
+ var unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3328, 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7673, 7675, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65071, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69376, 69404, 69415, 69415, 69424, 69456, 69600, 69622, 69632, 69702, 69734, 69743, 69759, 69818, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69958, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70096, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70206, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70751, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71680, 71738, 71840, 71913, 71935, 71935, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123584, 123641, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101, 917760, 917999];
function lookupInUnicodeMap(code, map) {
// Bail out quickly if it couldn't possibly be in the map.
if (code < map[0]) {
@@ -6768,15 +6901,17 @@ var ts;
return false;
}
/* @internal */ function isUnicodeIdentifierStart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
- lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierStart);
+ return languageVersion >= 2 /* ES2015 */ ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierStart) :
+ languageVersion === 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierStart);
}
ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;
function isUnicodeIdentifierPart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
- lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
- lookupInUnicodeMap(code, unicodeES3IdentifierPart);
+ return languageVersion >= 2 /* ES2015 */ ?
+ lookupInUnicodeMap(code, unicodeESNextIdentifierPart) :
+ languageVersion === 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierPart);
}
function makeReverseMap(source) {
var result = [];
@@ -7272,11 +7407,12 @@ var ts;
ts.isIdentifierPart = isIdentifierPart;
/* @internal */
function isIdentifierText(name, languageVersion) {
- if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {
+ var ch = codePointAt(name, 0);
+ if (!isIdentifierStart(ch, languageVersion)) {
return false;
}
- for (var i = 1; i < name.length; i++) {
- if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) {
+ for (var i = charSize(ch); i < name.length; i += charSize(ch)) {
+ if (!isIdentifierPart(ch = codePointAt(name, i), languageVersion)) {
return false;
}
}
@@ -7307,6 +7443,7 @@ var ts;
getTokenPos: function () { return tokenPos; },
getTokenText: function () { return text.substring(tokenPos, pos); },
getTokenValue: function () { return tokenValue; },
+ hasUnicodeEscape: function () { return (tokenFlags & 1024 /* UnicodeEscape */) !== 0; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; },
@@ -7433,7 +7570,7 @@ var ts;
}
}
function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
- if (!isIdentifierStart(text.charCodeAt(pos), languageVersion)) {
+ if (!isIdentifierStart(codePointAt(text, pos), languageVersion)) {
return;
}
var identifierStart = pos;
@@ -7641,6 +7778,7 @@ var ts;
pos++;
return scanExtendedUnicodeEscape();
}
+ tokenFlags |= 1024 /* UnicodeEscape */;
// '\uDDDD'
return scanHexadecimalEscape(/*numDigits*/ 4);
case 120 /* x */:
@@ -7723,21 +7861,41 @@ var ts;
}
return -1;
}
+ function peekExtendedUnicodeEscape() {
+ if (languageVersion >= 2 /* ES2015 */ && codePointAt(text, pos + 1) === 117 /* u */ && codePointAt(text, pos + 2) === 123 /* openBrace */) {
+ var start_2 = pos;
+ pos += 3;
+ var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
+ var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
+ pos = start_2;
+ return escapedValue;
+ }
+ return -1;
+ }
function scanIdentifierParts() {
var result = "";
var start = pos;
while (pos < end) {
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
if (isIdentifierPart(ch, languageVersion)) {
- pos++;
+ pos += charSize(ch);
}
else if (ch === 92 /* backslash */) {
+ ch = peekExtendedUnicodeEscape();
+ if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ result += scanExtendedUnicodeEscape();
+ start = pos;
+ continue;
+ }
ch = peekUnicodeEscape();
if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
break;
}
+ tokenFlags |= 1024 /* UnicodeEscape */;
result += text.substring(start, pos);
- result += String.fromCharCode(ch);
+ result += utf16EncodeAsString(ch);
// Valid Unicode escape is always six characters
pos += 6;
start = pos;
@@ -7832,7 +7990,7 @@ var ts;
if (pos >= end) {
return token = 1 /* EndOfFileToken */;
}
- var ch = text.charCodeAt(pos);
+ var ch = codePointAt(text, pos);
// Special handling for shebang
if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) {
pos = scanShebangTrivia(text, pos);
@@ -8197,9 +8355,17 @@ var ts;
pos++;
return token = 58 /* AtToken */;
case 92 /* backslash */:
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
var cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
pos += 6;
+ tokenFlags |= 1024 /* UnicodeEscape */;
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
return token = getIdentifierToken();
}
@@ -8208,9 +8374,9 @@ var ts;
return token = 0 /* Unknown */;
default:
if (isIdentifierStart(ch, languageVersion)) {
- pos++;
- while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))
- pos++;
+ pos += charSize(ch);
+ while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion))
+ pos += charSize(ch);
tokenValue = text.substring(tokenPos, pos);
if (ch === 92 /* backslash */) {
tokenValue += scanIdentifierParts();
@@ -8218,16 +8384,16 @@ var ts;
return token = getIdentifierToken();
}
else if (isWhiteSpaceSingleLine(ch)) {
- pos++;
+ pos += charSize(ch);
continue;
}
else if (isLineBreak(ch)) {
tokenFlags |= 1 /* PrecedingLineBreak */;
- pos++;
+ pos += charSize(ch);
continue;
}
error(ts.Diagnostics.Invalid_character);
- pos++;
+ pos += charSize(ch);
return token = 0 /* Unknown */;
}
}
@@ -8344,7 +8510,7 @@ var ts;
// First non-whitespace character on this line.
var firstNonWhitespace = 0;
// These initial values are special because the first line is:
- // firstNonWhitespace = 0 to indicate that we want leading whitspace,
+ // firstNonWhitespace = 0 to indicate that we want leading whitespace,
while (pos < end) {
char = text.charCodeAt(pos);
if (char === 123 /* openBrace */) {
@@ -8378,17 +8544,22 @@ var ts;
// they allow dashes
function scanJsxIdentifier() {
if (tokenIsIdentifierOrKeyword(token)) {
- var firstCharPosition = pos;
+ // An identifier or keyword has already been parsed - check for a `-` and then append it and everything after it to the token
+ // Do note that this means that `scanJsxIdentifier` effectively _mutates_ the visible token without advancing to a new token
+ // Any caller should be expecting this behavior and should only read the pos or token value after calling it.
while (pos < end) {
var ch = text.charCodeAt(pos);
- if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
+ if (ch === 45 /* minus */) {
+ tokenValue += "-";
pos++;
+ continue;
}
- else {
+ var oldPos = pos;
+ tokenValue += scanIdentifierParts(); // reuse `scanIdentifierParts` so unicode escapes are handled
+ if (pos === oldPos) {
break;
}
}
- tokenValue += text.substring(firstCharPosition, pos);
}
return token;
}
@@ -8410,8 +8581,8 @@ var ts;
if (pos >= end) {
return token = 1 /* EndOfFileToken */;
}
- var ch = text.charCodeAt(pos);
- pos++;
+ var ch = codePointAt(text, pos);
+ pos += charSize(ch);
switch (ch) {
case 9 /* tab */:
case 11 /* verticalTab */:
@@ -8449,12 +8620,33 @@ var ts;
return token = 24 /* DotToken */;
case 96 /* backtick */:
return token = 59 /* BacktickToken */;
- }
- if (isIdentifierStart(ch, 8 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) {
+ case 92 /* backslash */:
+ pos--;
+ var extendedCookedChar = peekExtendedUnicodeEscape();
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
+ pos += 3;
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
+ var cookedChar = peekUnicodeEscape();
+ if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
+ pos += 6;
+ tokenFlags |= 1024 /* UnicodeEscape */;
+ tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
+ return token = getIdentifierToken();
+ }
pos++;
- }
+ return token = 0 /* Unknown */;
+ }
+ if (isIdentifierStart(ch, languageVersion)) {
+ var char = ch;
+ while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion))
+ pos += charSize(char);
tokenValue = text.substring(tokenPos, pos);
+ if (char === 92 /* backslash */) {
+ tokenValue += scanIdentifierParts();
+ }
return token = getIdentifierToken();
}
else {
@@ -8537,6 +8729,33 @@ var ts;
}
}
ts.createScanner = createScanner;
+ /* @internal */
+ var codePointAt = String.prototype.codePointAt ? function (s, i) { return s.codePointAt(i); } : function codePointAt(str, i) {
+ // from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt
+ var size = str.length;
+ // Account for out-of-bounds indices:
+ if (i < 0 || i >= size) {
+ return undefined; // String.codePointAt returns `undefined` for OOB indexes
+ }
+ // Get the first code unit
+ var first = str.charCodeAt(i);
+ // check if it’s the start of a surrogate pair
+ if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { // high surrogate and there is a next code unit
+ var second = str.charCodeAt(i + 1);
+ if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
+ // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
+ }
+ }
+ return first;
+ };
+ /* @internal */
+ function charSize(ch) {
+ if (ch >= 0x10000) {
+ return 2;
+ }
+ return 1;
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -8992,7 +9211,7 @@ var ts;
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 313 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 314 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -9050,6 +9269,8 @@ var ts;
return emitNode && emitNode.flags || 0;
}
ts.getEmitFlags = getEmitFlags;
+ var escapeNoSubstitutionTemplateLiteralText = ts.compose(escapeString, escapeTemplateSubstitution);
+ var escapeNonAsciiNoSubstitutionTemplateLiteralText = ts.compose(escapeNonAsciiString, escapeTemplateSubstitution);
function getLiteralText(node, sourceFile, neverAsciiEscape) {
// If we don't need to downlevel and we can reach the original source text using
// the node's parent reference, then simply get the text as it was originally written.
@@ -9057,7 +9278,11 @@ var ts;
ts.isBigIntLiteral(node))) {
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
}
- var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216 /* NoAsciiEscaping */) ? escapeString : escapeNonAsciiString;
+ // If a NoSubstitutionTemplateLiteral appears to have a substitution in it, the original text
+ // had to include a backslash: `not \${a} substitution`.
+ var escapeText = neverAsciiEscape || (getEmitFlags(node) & 16777216 /* NoAsciiEscaping */) ?
+ node.kind === 14 /* NoSubstitutionTemplateLiteral */ ? escapeNoSubstitutionTemplateLiteralText : escapeString :
+ node.kind === 14 /* NoSubstitutionTemplateLiteral */ ? escapeNonAsciiNoSubstitutionTemplateLiteralText : escapeNonAsciiString;
// If we can't reach the original source text, use the canonical form if it's a number,
// or a (possibly escaped) quoted form of the original text if it's string-like.
switch (node.kind) {
@@ -9172,6 +9397,43 @@ var ts;
return ts.isExternalModule(node) || compilerOptions.isolatedModules || ((ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS) && !!node.commonJsModuleIndicator);
}
ts.isEffectiveExternalModule = isEffectiveExternalModule;
+ /**
+ * Returns whether the source file will be treated as if it were in strict mode at runtime.
+ */
+ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
+ // We can only verify strict mode for JS/TS files
+ switch (node.scriptKind) {
+ case 1 /* JS */:
+ case 3 /* TS */:
+ case 2 /* JSX */:
+ case 4 /* TSX */:
+ break;
+ default:
+ return false;
+ }
+ // Strict mode does not matter for declaration files.
+ if (node.isDeclarationFile) {
+ return false;
+ }
+ // If `alwaysStrict` is set, then treat the file as strict.
+ if (ts.getStrictOptionValue(compilerOptions, "alwaysStrict")) {
+ return true;
+ }
+ // Starting with a "use strict" directive indicates the file is strict.
+ if (ts.startsWithUseStrict(node.statements)) {
+ return true;
+ }
+ if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
+ // ECMAScript Modules are always strict.
+ if (ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
+ return true;
+ }
+ // Other modules are strict unless otherwise specified.
+ return !compilerOptions.noImplicitUseStrict;
+ }
+ return false;
+ }
+ ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile;
function isBlockScope(node, parentNode) {
switch (node.kind) {
case 285 /* SourceFile */:
@@ -9199,9 +9461,9 @@ var ts;
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
- case 299 /* JSDocSignature */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 300 /* JSDocSignature */:
return true;
default:
ts.assertType(node);
@@ -9222,7 +9484,7 @@ var ts;
case 210 /* ClassExpression */:
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
case 240 /* FunctionDeclaration */:
case 157 /* MethodDeclaration */:
case 158 /* Constructor */:
@@ -9450,6 +9712,12 @@ var ts;
return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */;
}
ts.isImportCall = isImportCall;
+ function isImportMeta(n) {
+ return ts.isMetaProperty(n)
+ && n.keywordToken === 93 /* ImportKeyword */
+ && n.name.escapedText === "meta";
+ }
+ ts.isImportMeta = isImportMeta;
function isLiteralImportTypeNode(n) {
return ts.isImportTypeNode(n) && ts.isLiteralTypeNode(n.argument) && ts.isStringLiteral(n.argument.literal);
}
@@ -9542,7 +9810,7 @@ var ts;
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
case 151 /* TypeParameter */:
return node === parent.constraint;
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return node === parent.constraint;
case 155 /* PropertyDeclaration */:
case 154 /* PropertySignature */:
@@ -10573,7 +10841,7 @@ var ts;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 311 /* JSDocTypedefTag */ || node.kind === 304 /* JSDocCallbackTag */;
+ return node.kind === 312 /* JSDocTypedefTag */ || node.kind === 305 /* JSDocCallbackTag */ || node.kind === 306 /* JSDocEnumTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -11023,6 +11291,10 @@ var ts;
return isKeyword(token) && !isContextualKeyword(token);
}
ts.isNonContextualKeyword = isNonContextualKeyword;
+ function isFutureReservedKeyword(token) {
+ return 110 /* FirstFutureReservedWord */ <= token && token <= 118 /* LastFutureReservedWord */;
+ }
+ ts.isFutureReservedKeyword = isFutureReservedKeyword;
function isStringANonContextualKeyword(name) {
var token = ts.stringToToken(name);
return token !== undefined && isNonContextualKeyword(token);
@@ -11282,7 +11554,7 @@ var ts;
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return 0;
case 209 /* SpreadElement */:
return 1;
@@ -11468,6 +11740,10 @@ var ts;
}
}
ts.createDiagnosticCollection = createDiagnosticCollection;
+ var templateSubstitutionRegExp = /\$\{/g;
+ function escapeTemplateSubstitution(str) {
+ return str.replace(templateSubstitutionRegExp, "\\${");
+ }
// This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator,
// paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in
// the language service. These characters should be escaped when printing, and if any characters are added,
@@ -11836,6 +12112,7 @@ var ts;
return accessor.parameters[hasThis ? 1 : 0];
}
}
+ ts.getSetAccessorValueParameter = getSetAccessorValueParameter;
/** Get the type annotation for the value parameter. */
function getSetAccessorTypeAnnotationNode(accessor) {
var parameter = getSetAccessorValueParameter(accessor);
@@ -11944,7 +12221,7 @@ var ts;
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
/** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 298 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
}
/**
* Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -12735,8 +13012,8 @@ var ts;
/**
* Mutates the map with newMap such that keys in map will be same as newMap.
*/
- function mutateMap(map, newMap, options) {
- var createNewValue = options.createNewValue, onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
+ function mutateMapSkippingNewValues(map, newMap, options) {
+ var onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
// Needs update
map.forEach(function (existingValue, key) {
var valueInNewMap = newMap.get(key);
@@ -12750,6 +13027,15 @@ var ts;
onExistingValue(existingValue, valueInNewMap, key);
}
});
+ }
+ ts.mutateMapSkippingNewValues = mutateMapSkippingNewValues;
+ /**
+ * Mutates the map with newMap such that keys in map will be same as newMap.
+ */
+ function mutateMap(map, newMap, options) {
+ // Needs update
+ mutateMapSkippingNewValues(map, newMap, options);
+ var createNewValue = options.createNewValue;
// Add new values that are not already present
newMap.forEach(function (valueInNewMap, key) {
if (!map.has(key)) {
@@ -12886,7 +13172,7 @@ var ts;
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 8 /* ESNext */:
+ case 99 /* ESNext */:
return "lib.esnext.full.d.ts";
case 7 /* ES2020 */:
return "lib.es2020.full.d.ts";
@@ -13306,6 +13592,9 @@ var ts;
break;
case 222 /* ExpressionStatement */:
var expr = hostNode.expression;
+ if (expr.kind === 205 /* BinaryExpression */ && expr.operatorToken.kind === 60 /* EqualsToken */) {
+ expr = expr.left;
+ }
switch (expr.kind) {
case 190 /* PropertyAccessExpression */:
return expr.name;
@@ -13345,8 +13634,8 @@ var ts;
switch (declaration.kind) {
case 73 /* Identifier */:
return declaration;
- case 312 /* JSDocPropertyTag */:
- case 306 /* JSDocParameterTag */: {
+ case 313 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */: {
var name = declaration.name;
if (name.kind === 149 /* QualifiedName */) {
return name.right;
@@ -13370,8 +13659,10 @@ var ts;
return undefined;
}
}
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
+ case 306 /* JSDocEnumTag */:
+ return nameForNamelessJSDocTypedef(declaration);
case 255 /* ExportAssignment */: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
@@ -13577,7 +13868,7 @@ var ts;
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 298 /* JSDocComment */);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -13849,7 +14140,7 @@ var ts;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 315 /* PartiallyEmittedExpression */) {
+ while (node.kind === 316 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
@@ -14261,67 +14552,67 @@ var ts;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 297 /* JSDocComment */;
+ return node.kind === 298 /* JSDocComment */;
}
ts.isJSDoc = isJSDoc;
function isJSDocAuthorTag(node) {
- return node.kind === 302 /* JSDocAuthorTag */;
+ return node.kind === 303 /* JSDocAuthorTag */;
}
ts.isJSDocAuthorTag = isJSDocAuthorTag;
function isJSDocAugmentsTag(node) {
- return node.kind === 301 /* JSDocAugmentsTag */;
+ return node.kind === 302 /* JSDocAugmentsTag */;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 303 /* JSDocClassTag */;
+ return node.kind === 304 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 305 /* JSDocEnumTag */;
+ return node.kind === 306 /* JSDocEnumTag */;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 308 /* JSDocThisTag */;
+ return node.kind === 309 /* JSDocThisTag */;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 306 /* JSDocParameterTag */;
+ return node.kind === 307 /* JSDocParameterTag */;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 307 /* JSDocReturnTag */;
+ return node.kind === 308 /* JSDocReturnTag */;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 309 /* JSDocTypeTag */;
+ return node.kind === 310 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 310 /* JSDocTemplateTag */;
+ return node.kind === 311 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 311 /* JSDocTypedefTag */;
+ return node.kind === 312 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 312 /* JSDocPropertyTag */;
+ return node.kind === 313 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 312 /* JSDocPropertyTag */ || node.kind === 306 /* JSDocParameterTag */;
+ return node.kind === 313 /* JSDocPropertyTag */ || node.kind === 307 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 298 /* JSDocTypeLiteral */;
+ return node.kind === 299 /* JSDocTypeLiteral */;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 304 /* JSDocCallbackTag */;
+ return node.kind === 305 /* JSDocCallbackTag */;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 299 /* JSDocSignature */;
+ return node.kind === 300 /* JSDocSignature */;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
@@ -14332,7 +14623,7 @@ var ts;
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 313 /* SyntaxList */;
+ return n.kind === 314 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -14484,7 +14775,7 @@ var ts;
switch (kind) {
case 156 /* MethodSignature */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 162 /* ConstructSignature */:
case 163 /* IndexSignature */:
case 166 /* FunctionType */:
@@ -14779,8 +15070,8 @@ var ts;
case 209 /* SpreadElement */:
case 213 /* AsExpression */:
case 211 /* OmittedExpression */:
- case 316 /* CommaListExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 317 /* CommaListExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -14794,12 +15085,12 @@ var ts;
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 315 /* PartiallyEmittedExpression */;
+ return node.kind === 316 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 314 /* NotEmittedStatement */;
+ return node.kind === 315 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -14910,9 +15201,9 @@ var ts;
|| kind === 243 /* TypeAliasDeclaration */
|| kind === 151 /* TypeParameter */
|| kind === 238 /* VariableDeclaration */
- || kind === 311 /* JSDocTypedefTag */
- || kind === 304 /* JSDocCallbackTag */
- || kind === 312 /* JSDocPropertyTag */;
+ || kind === 312 /* JSDocTypedefTag */
+ || kind === 305 /* JSDocCallbackTag */
+ || kind === 313 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
return kind === 240 /* FunctionDeclaration */
@@ -14947,14 +15238,14 @@ var ts;
|| kind === 220 /* VariableStatement */
|| kind === 225 /* WhileStatement */
|| kind === 232 /* WithStatement */
- || kind === 314 /* NotEmittedStatement */
- || kind === 318 /* EndOfDeclarationMarker */
- || kind === 317 /* MergeDeclarationMarker */;
+ || kind === 315 /* NotEmittedStatement */
+ || kind === 319 /* EndOfDeclarationMarker */
+ || kind === 318 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
if (node.kind === 151 /* TypeParameter */) {
- return (node.parent && node.parent.kind !== 310 /* JSDocTemplateTag */) || ts.isInJSFile(node);
+ return (node.parent && node.parent.kind !== 311 /* JSDocTemplateTag */) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -15049,18 +15340,18 @@ var ts;
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 312 /* LastJSDocNode */;
+ return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 313 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 298 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 312 /* LastJSDocTagNode */;
+ return node.kind >= 301 /* FirstJSDocTagNode */ && node.kind <= 313 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
@@ -17091,7 +17382,7 @@ var ts;
return visitNode(cbNode, node.expression);
case 259 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
case 261 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
@@ -17129,26 +17420,26 @@ var ts;
case 295 /* JSDocFunctionType */:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 297 /* JSDocComment */:
+ case 298 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 302 /* JSDocAuthorTag */:
+ case 303 /* JSDocAuthorTag */:
return visitNode(cbNode, node.tagName);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
node.typeExpression.kind === 289 /* JSDocTypeExpression */
@@ -17156,26 +17447,26 @@ var ts;
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 304 /* JSDocCallbackTag */:
+ case 305 /* JSDocCallbackTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 308 /* JSDocThisTag */:
- case 305 /* JSDocEnumTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 309 /* JSDocThisTag */:
+ case 306 /* JSDocEnumTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 300 /* JSDocTag */:
- case 303 /* JSDocClassTag */:
+ case 301 /* JSDocTag */:
+ case 304 /* JSDocClassTag */:
return visitNode(cbNode, node.tagName);
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -17184,12 +17475,14 @@ var ts;
if (setParentNodes === void 0) { setParentNodes = false; }
ts.performance.mark("beforeParse");
var result;
+ ts.perfLogger.logStartParseSourceFile(fileName);
if (languageVersion === 100 /* JSON */) {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, 6 /* JSON */);
}
else {
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
}
+ ts.perfLogger.logStopParseSourceFile();
ts.performance.mark("afterParse");
ts.performance.measure("Parse", "beforeParse", "afterParse");
return result;
@@ -17255,7 +17548,7 @@ var ts;
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
+ var scanner = ts.createScanner(99 /* Latest */, /*skipTrivia*/ true);
var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
@@ -17273,6 +17566,7 @@ var ts;
var identifiers;
var identifierCount;
var parsingContext;
+ var notParenthesizedArrow;
// Flags that dictate what parsing context we're in. For example:
// Whether or not we are in strict parsing mode. All that changes in strict parsing mode is
// that some tokens that would be considered identifiers may be considered keywords.
@@ -17480,6 +17774,7 @@ var ts;
identifiers = undefined;
syntaxCursor = undefined;
sourceText = undefined;
+ notParenthesizedArrow = undefined;
}
function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {
var isDeclarationFile = isDeclarationFileName(fileName);
@@ -17689,9 +17984,17 @@ var ts;
function token() {
return currentToken;
}
- function nextToken() {
+ function nextTokenWithoutCheck() {
return currentToken = scanner.scan();
}
+ function nextToken() {
+ // if the keyword had an escape
+ if (ts.isKeyword(currentToken) && (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape())) {
+ // issue a parse error for the escape
+ parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), ts.Diagnostics.Keywords_cannot_contain_escape_characters);
+ }
+ return nextTokenWithoutCheck();
+ }
function nextTokenJSDoc() {
return currentToken = scanner.scanJsDocToken();
}
@@ -17930,7 +18233,7 @@ var ts;
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
- nextToken();
+ nextTokenWithoutCheck();
return finishNode(node);
}
// Only for end of file because the error gets reported incorrectly on embedded script tags.
@@ -18840,6 +19143,23 @@ var ts;
}
function parseJSDocType() {
scanner.setInJSDocType(true);
+ var moduleSpecifier = parseOptionalToken(131 /* ModuleKeyword */);
+ if (moduleSpecifier) {
+ var moduleTag = createNode(297 /* JSDocNamepathType */, moduleSpecifier.pos);
+ terminate: while (true) {
+ switch (token()) {
+ case 19 /* CloseBraceToken */:
+ case 1 /* EndOfFileToken */:
+ case 27 /* CommaToken */:
+ case 5 /* WhitespaceTrivia */:
+ break terminate;
+ default:
+ nextTokenJSDoc();
+ }
+ }
+ scanner.setInJSDocType(false);
+ return finishNode(moduleTag);
+ }
var dotdotdot = parseOptionalToken(25 /* DotDotDotToken */);
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
@@ -19963,7 +20283,15 @@ var ts;
}
}
function parsePossibleParenthesizedArrowFunctionExpressionHead() {
- return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ var tokenPos = scanner.getTokenPos();
+ if (notParenthesizedArrow && notParenthesizedArrow.has(tokenPos.toString())) {
+ return undefined;
+ }
+ var result = parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ if (!result) {
+ (notParenthesizedArrow || (notParenthesizedArrow = ts.createMap())).set(tokenPos.toString(), true);
+ }
+ return result;
}
function tryParseAsyncSimpleArrowFunctionExpression() {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
@@ -22374,8 +22702,8 @@ var ts;
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
+ initializeState(content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 99 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -22397,9 +22725,9 @@ var ts;
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion
- var jsDoc = parseJSDocCommentWorker(start, length);
+ var jsDoc = doInsideOfContext(2097152 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
var diagnostics = parseDiagnostics;
clearState();
return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined;
@@ -22410,7 +22738,7 @@ var ts;
var saveToken = currentToken;
var saveParseDiagnosticsLength = parseDiagnostics.length;
var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
- var comment = parseJSDocCommentWorker(start, length);
+ var comment = doInsideOfContext(2097152 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
if (comment) {
comment.parent = parent;
}
@@ -22549,7 +22877,7 @@ var ts;
}
}
function createJSDocComment() {
- var result = createNode(297 /* JSDocComment */, start);
+ var result = createNode(298 /* JSDocComment */, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -22749,7 +23077,7 @@ var ts;
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(300 /* JSDocTag */, start);
+ var result = createNode(301 /* JSDocTag */, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -22812,8 +23140,8 @@ var ts;
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(312 /* JSDocPropertyTag */, start) :
- createNode(306 /* JSDocParameterTag */, start);
+ createNode(313 /* JSDocPropertyTag */, start) :
+ createNode(307 /* JSDocParameterTag */, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -22833,15 +23161,15 @@ var ts;
var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
- var start_2 = scanner.getStartPos();
+ var start_3 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 306 /* JSDocParameterTag */ || child.kind === 312 /* JSDocPropertyTag */) {
+ if (child.kind === 307 /* JSDocParameterTag */ || child.kind === 313 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2);
+ jsdocTypeLiteral = createNode(299 /* JSDocTypeLiteral */, start_3);
jsdocTypeLiteral.jsDocPropertyTags = children;
if (typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
@@ -22855,7 +23183,7 @@ var ts;
if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307 /* JSDocReturnTag */, start);
+ var result = createNode(308 /* JSDocReturnTag */, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
@@ -22864,13 +23192,13 @@ var ts;
if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(309 /* JSDocTypeTag */, start);
+ var result = createNode(310 /* JSDocTypeTag */, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
return finishNode(result);
}
function parseAuthorTag(start, tagName, indent) {
- var result = createNode(302 /* JSDocAuthorTag */, start);
+ var result = createNode(303 /* JSDocAuthorTag */, start);
result.tagName = tagName;
var authorInfoWithEmail = tryParse(function () { return tryParseAuthorNameAndEmail(); });
if (!authorInfoWithEmail) {
@@ -22924,7 +23252,7 @@ var ts;
}
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(301 /* JSDocAugmentsTag */, start);
+ var result = createNode(302 /* JSDocAugmentsTag */, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
@@ -22951,19 +23279,19 @@ var ts;
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(303 /* JSDocClassTag */, start);
+ var tag = createNode(304 /* JSDocClassTag */, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(308 /* JSDocThisTag */, start);
+ var tag = createNode(309 /* JSDocThisTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(305 /* JSDocEnumTag */, start);
+ var tag = createNode(306 /* JSDocEnumTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
@@ -22972,7 +23300,7 @@ var ts;
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(311 /* JSDocTypedefTag */, start);
+ var typedefTag = createNode(312 /* JSDocTypedefTag */, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -22986,9 +23314,9 @@ var ts;
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start);
+ jsdocTypeLiteral = createNode(299 /* JSDocTypeLiteral */, start);
}
- if (child.kind === 309 /* JSDocTypeTag */) {
+ if (child.kind === 310 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -23034,14 +23362,14 @@ var ts;
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(304 /* JSDocCallbackTag */, start);
+ var callbackTag = createNode(305 /* JSDocCallbackTag */, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(299 /* JSDocSignature */, start);
+ var jsdocSignature = createNode(300 /* JSDocSignature */, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -23049,7 +23377,7 @@ var ts;
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58 /* AtToken */)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 307 /* JSDocReturnTag */) {
+ if (tag && tag.kind === 308 /* JSDocReturnTag */) {
return tag;
}
}
@@ -23094,7 +23422,7 @@ var ts;
case 58 /* AtToken */:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 306 /* JSDocParameterTag */ || child.kind === 312 /* JSDocPropertyTag */) &&
+ if (child && (child.kind === 307 /* JSDocParameterTag */ || child.kind === 313 /* JSDocPropertyTag */) &&
target !== 4 /* CallbackParameter */ &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -23164,7 +23492,7 @@ var ts;
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27 /* CommaToken */));
- var result = createNode(310 /* JSDocTemplateTag */, start);
+ var result = createNode(311 /* JSDocTemplateTag */, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
@@ -23199,16 +23527,19 @@ var ts;
if (!ts.tokenIsIdentifierOrKeyword(token())) {
return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
}
+ identifierCount++;
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
var result = createNode(73 /* Identifier */, pos);
- result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
+ if (token() !== 73 /* Identifier */) {
+ result.originalKeywordKind = token();
+ }
+ result.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
finishNode(result, end);
nextTokenJSDoc();
return result;
}
}
- JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker;
})(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {}));
})(Parser || (Parser = {}));
var IncrementalParser;
@@ -24125,7 +24456,7 @@ var ts;
es2018: 5 /* ES2018 */,
es2019: 6 /* ES2019 */,
es2020: 7 /* ES2020 */,
- esnext: 8 /* ESNext */,
+ esnext: 99 /* ESNext */,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
@@ -25493,10 +25824,10 @@ var ts;
var config = __assign({ compilerOptions: __assign({}, ts.arrayFrom(optionMap.entries()).reduce(function (prev, cur) {
var _a;
return (__assign({}, prev, (_a = {}, _a[cur[0]] = cur[1], _a)));
- }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath, originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
+ }, {}), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign({}, r, { path: r.originalPath ? r.originalPath : "", originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (configParseResult.configFileSpecs ? {
include: filterSameAsDefaultInclude(configParseResult.configFileSpecs.validatedIncludeSpecs),
exclude: configParseResult.configFileSpecs.validatedExcludeSpecs
- } : {}), { compilerOnSave: !!configParseResult.compileOnSave ? true : undefined });
+ } : {}), { compileOnSave: !!configParseResult.compileOnSave ? true : undefined });
return config;
}
ts.convertToTSConfig = convertToTSConfig;
@@ -27021,6 +27352,7 @@ var ts;
trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
}
}
+ ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
switch (moduleResolution) {
case ts.ModuleResolutionKind.NodeJs:
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
@@ -27031,6 +27363,9 @@ var ts;
default:
return ts.Debug.fail("Unexpected moduleResolution: " + moduleResolution);
}
+ if (result && result.resolvedModule)
+ ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
+ ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
if (perFolderCache) {
perFolderCache.set(moduleName, result);
if (!ts.isExternalModuleNameRelative(moduleName)) {
@@ -27863,7 +28198,9 @@ var ts;
var binder = createBinder();
function bindSourceFile(file, options) {
ts.performance.mark("beforeBind");
+ ts.perfLogger.logStartBindFile("" + file.fileName);
binder(file, options);
+ ts.perfLogger.logStopBindFile();
ts.performance.mark("afterBind");
ts.performance.measure("Bind", "beforeBind", "afterBind");
}
@@ -27976,7 +28313,7 @@ var ts;
if (symbol.constEnumOnlyModule && (symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */))) {
symbol.constEnumOnlyModule = false;
}
- if (symbolFlags & 67220415 /* Value */) {
+ if (symbolFlags & 111551 /* Value */) {
setValueDeclaration(symbol, node);
}
}
@@ -28020,7 +28357,7 @@ var ts;
return "__constructor" /* Constructor */;
case 166 /* FunctionType */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return "__call" /* Call */;
case 167 /* ConstructorType */:
case 162 /* ConstructSignature */:
@@ -28205,10 +28542,10 @@ var ts;
if (ts.isJSDocTypeAlias(node))
ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file.
if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32 /* ExportContext */)) || ts.isJSDocTypeAlias(node)) {
- if (ts.hasModifier(node, 512 /* Default */) && !getDeclarationName(node)) {
+ if (!container.locals || (ts.hasModifier(node, 512 /* Default */) && !getDeclarationName(node))) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default!
}
- var exportKind = symbolFlags & 67220415 /* Value */ ? 1048576 /* ExportValue */ : 0;
+ var exportKind = symbolFlags & 111551 /* Value */ ? 1048576 /* ExportValue */ : 0;
var local = declareSymbol(container.locals, /*parent*/ undefined, node, exportKind, symbolExcludes);
local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
node.localSymbol = local;
@@ -28438,8 +28775,9 @@ var ts;
case 192 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
bindJSDocTypeAlias(node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
@@ -29096,7 +29434,7 @@ var ts;
}
function bindJSDocTypeAlias(node) {
node.tagName.parent = node;
- if (node.fullName) {
+ if (node.kind !== 306 /* JSDocEnumTag */ && node.fullName) {
setParentPointers(node, node.fullName);
}
}
@@ -29130,7 +29468,7 @@ var ts;
case 244 /* EnumDeclaration */:
case 189 /* ObjectLiteralExpression */:
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 269 /* JsxAttributes */:
return 1 /* IsContainer */;
case 242 /* InterfaceDeclaration */:
@@ -29152,7 +29490,7 @@ var ts;
case 159 /* GetAccessor */:
case 160 /* SetAccessor */:
case 161 /* CallSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 295 /* JSDocFunctionType */:
case 166 /* FunctionType */:
case 162 /* ConstructSignature */:
@@ -29215,7 +29553,7 @@ var ts;
case 244 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 189 /* ObjectLiteralExpression */:
case 242 /* InterfaceDeclaration */:
case 269 /* JsxAttributes */:
@@ -29229,7 +29567,7 @@ var ts;
case 167 /* ConstructorType */:
case 161 /* CallSignature */:
case 162 /* ConstructSignature */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 163 /* IndexSignature */:
case 157 /* MethodDeclaration */:
case 156 /* MethodSignature */:
@@ -29240,8 +29578,8 @@ var ts;
case 197 /* FunctionExpression */:
case 198 /* ArrowFunction */:
case 295 /* JSDocFunctionType */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
case 243 /* TypeAliasDeclaration */:
case 182 /* MappedType */:
// All the children of these container types are never visible through another
@@ -29422,9 +29760,21 @@ var ts;
currentFlow = { flags: 2 /* Start */ };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
+ var declName = ts.getNameOfDeclaration(typeAlias);
+ if ((ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName) && declName && ts.isPropertyAccessEntityNameExpression(declName.parent)) {
+ // typedef anchored to an A.B.C assignment - we need to bind into B's namespace under name C
+ var isTopLevel = isTopLevelNamespaceAssignment(declName.parent);
+ if (isTopLevel) {
+ bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
+ var oldContainer = container;
+ container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
+ declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
+ container = oldContainer;
+ }
+ }
+ else if (ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
parent = typeAlias.parent;
- bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
}
else {
bind(typeAlias.fullName);
@@ -29443,7 +29793,8 @@ var ts;
node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ &&
node.originalKeywordKind <= 118 /* LastFutureReservedWord */ &&
!ts.isIdentifierName(node) &&
- !(node.flags & 4194304 /* Ambient */)) {
+ !(node.flags & 4194304 /* Ambient */) &&
+ !(node.flags & 2097152 /* JSDoc */)) {
// Report error only if there are no parse errors in file
if (!file.parseDiagnostics.length) {
file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));
@@ -29696,7 +30047,7 @@ var ts;
while (parentNode && !ts.isJSDocTypeAlias(parentNode)) {
parentNode = parentNode.parent;
}
- bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
break;
}
// falls through
@@ -29717,7 +30068,7 @@ var ts;
file.commonJsModuleIndicator &&
ts.isModuleExportsPropertyAccessExpression(node) &&
!lookupSymbolForNameWorker(blockScopeContainer, "module")) {
- declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */);
+ declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 111550 /* FunctionScopedVariableExcludes */);
}
break;
case 205 /* BinaryExpression */:
@@ -29783,7 +30134,7 @@ var ts;
case 277 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
case 279 /* EnumMember */:
- return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */);
case 161 /* CallSignature */:
case 162 /* ConstructSignature */:
case 163 /* IndexSignature */:
@@ -29794,22 +30145,22 @@ var ts;
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
- return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */);
case 240 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
case 158 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
case 159 /* GetAccessor */:
- return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */);
case 160 /* SetAccessor */:
- return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */);
+ return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 78783 /* SetAccessorExcludes */);
case 166 /* FunctionType */:
case 295 /* JSDocFunctionType */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
case 167 /* ConstructorType */:
return bindFunctionOrConstructorType(node);
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 182 /* MappedType */:
return bindAnonymousTypeWorker(node);
case 189 /* ObjectLiteralExpression */:
@@ -29842,9 +30193,9 @@ var ts;
inStrictMode = true;
return bindClassLikeDeclaration(node);
case 242 /* InterfaceDeclaration */:
- return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */);
+ return bindBlockScopedDeclaration(node, 64 /* Interface */, 788872 /* InterfaceExcludes */);
case 243 /* TypeAliasDeclaration */:
- return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
+ return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
case 244 /* EnumDeclaration */:
return bindEnumDeclaration(node);
case 245 /* ModuleDeclaration */:
@@ -29878,22 +30229,23 @@ var ts;
// falls through
case 246 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
- case 306 /* JSDocParameterTag */:
- if (node.parent.kind === 299 /* JSDocSignature */) {
+ case 307 /* JSDocParameterTag */:
+ if (node.parent.kind === 300 /* JSDocSignature */) {
return bindParameter(node);
}
- if (node.parent.kind !== 298 /* JSDocTypeLiteral */) {
+ if (node.parent.kind !== 299 /* JSDocTypeLiteral */) {
break;
}
// falls through
- case 312 /* JSDocPropertyTag */:
+ case 313 /* JSDocPropertyTag */:
var propTag = node;
var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -30071,7 +30423,7 @@ var ts;
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220414 /* FunctionScopedVariableExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
}
break;
default:
@@ -30152,7 +30504,7 @@ var ts;
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false);
}
function bindPotentiallyMissingNamespaces(namespaceSymbol, entityName, isToplevel, isPrototypeProperty) {
- if (isToplevel && !isPrototypeProperty && (!namespaceSymbol || !(namespaceSymbol.flags & 1920 /* Namespace */))) {
+ if (isToplevel && !isPrototypeProperty) {
// make symbols or add declarations for intermediate containers
var flags_1 = 1536 /* Module */ | 67108864 /* Assignment */;
var excludeFlags_1 = 110735 /* ValueModuleExcludes */ & ~67108864 /* Assignment */;
@@ -30180,14 +30532,17 @@ var ts;
(namespaceSymbol.exports || (namespaceSymbol.exports = ts.createSymbolTable()));
var isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedExpandoInitializer(declaration));
var includes = isMethod ? 8192 /* Method */ : 4 /* Property */;
- var excludes = isMethod ? 67212223 /* MethodExcludes */ : 0 /* PropertyExcludes */;
+ var excludes = isMethod ? 103359 /* MethodExcludes */ : 0 /* PropertyExcludes */;
declareSymbol(symbolTable, namespaceSymbol, declaration, includes | 67108864 /* Assignment */, excludes & ~67108864 /* Assignment */);
}
+ function isTopLevelNamespaceAssignment(propertyAccess) {
+ return ts.isBinaryExpression(propertyAccess.parent)
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
+ : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
+ }
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
- var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
- : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
+ var isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -30258,7 +30613,7 @@ var ts;
}
function bindClassLikeDeclaration(node) {
if (node.kind === 241 /* ClassDeclaration */) {
- bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */);
+ bindBlockScopedDeclaration(node, 32 /* Class */, 899503 /* ClassExcludes */);
}
else {
var bindingName = node.name ? node.name.escapedText : "__class" /* Class */;
@@ -30291,19 +30646,16 @@ var ts;
}
function bindEnumDeclaration(node) {
return ts.isEnumConst(node)
- ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 68008831 /* ConstEnumExcludes */)
- : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 68008191 /* RegularEnumExcludes */);
+ ? bindBlockScopedDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */)
+ : bindBlockScopedDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */);
}
function bindVariableDeclarationOrBindingElement(node) {
if (inStrictMode) {
checkStrictModeEvalOrArguments(node, node.name);
}
if (!ts.isBindingPattern(node.name)) {
- var isEnum = ts.isInJSFile(node) && !!ts.getJSDocEnumTag(node);
- var enumFlags = (isEnum ? 256 /* RegularEnum */ : 0 /* None */);
- var enumExcludes = (isEnum ? 68008191 /* RegularEnumExcludes */ : 0 /* None */);
if (ts.isBlockOrCatchScoped(node)) {
- bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */ | enumFlags, 67220415 /* BlockScopedVariableExcludes */ | enumExcludes);
+ bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
}
else if (ts.isParameterDeclaration(node)) {
// It is safe to walk up parent chain to find whether the node is a destructuring parameter declaration
@@ -30315,15 +30667,15 @@ var ts;
// function foo([a,a]) {} // Duplicate Identifier error
// function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter
// // which correctly set excluded symbols
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220415 /* ParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */ | enumFlags, 67220414 /* FunctionScopedVariableExcludes */ | enumExcludes);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
}
}
}
function bindParameter(node) {
- if (node.kind === 306 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) {
+ if (node.kind === 307 /* JSDocParameterTag */ && container.kind !== 300 /* JSDocSignature */) {
return;
}
if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) {
@@ -30335,7 +30687,7 @@ var ts;
bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, "__" + node.parent.parameters.indexOf(node));
}
else {
- declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 67220415 /* ParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
}
// If this is a property-parameter, then also declare the property symbol into the
// containing class.
@@ -30353,10 +30705,10 @@ var ts;
checkStrictModeFunctionName(node);
if (inStrictMode) {
checkStrictModeFunctionDeclaration(node);
- bindBlockScopedDeclaration(node, 16 /* Function */, 67219887 /* FunctionExcludes */);
+ bindBlockScopedDeclaration(node, 16 /* Function */, 110991 /* FunctionExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 67219887 /* FunctionExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 110991 /* FunctionExcludes */);
}
}
function bindFunctionExpression(node) {
@@ -30394,10 +30746,10 @@ var ts;
if (!container_1.locals) {
container_1.locals = ts.createSymbolTable();
}
- declareSymbol(container_1.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbol(container_1.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
}
else if (node.parent.kind === 177 /* InferType */) {
@@ -30406,14 +30758,14 @@ var ts;
if (!container_2.locals) {
container_2.locals = ts.createSymbolTable();
}
- declareSymbol(container_2.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbol(container_2.locals, /*parent*/ undefined, node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
else {
bindAnonymousDeclaration(node, 262144 /* TypeParameter */, getDeclarationName(node)); // TODO: GH#18217
}
}
else {
- declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
+ declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
}
}
// reachability checks
@@ -31024,7 +31376,7 @@ var ts;
break;
case 195 /* TypeAssertionExpression */:
case 213 /* AsExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
excludeFlags = 536870912 /* OuterExpressionExcludes */;
@@ -31283,7 +31635,7 @@ var ts;
return 536875008 /* BindingPatternExcludes */;
case 195 /* TypeAssertionExpression */:
case 213 /* AsExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
case 196 /* ParenthesizedExpression */:
case 99 /* SuperKeyword */:
return 536870912 /* OuterExpressionExcludes */;
@@ -31514,6 +31866,179 @@ var ts;
WideningKind[WideningKind["Normal"] = 0] = "Normal";
WideningKind[WideningKind["GeneratorYield"] = 1] = "GeneratorYield";
})(WideningKind || (WideningKind = {}));
+ var TypeFacts;
+ (function (TypeFacts) {
+ TypeFacts[TypeFacts["None"] = 0] = "None";
+ TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
+ TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
+ TypeFacts[TypeFacts["TypeofEQBigInt"] = 4] = "TypeofEQBigInt";
+ TypeFacts[TypeFacts["TypeofEQBoolean"] = 8] = "TypeofEQBoolean";
+ TypeFacts[TypeFacts["TypeofEQSymbol"] = 16] = "TypeofEQSymbol";
+ TypeFacts[TypeFacts["TypeofEQObject"] = 32] = "TypeofEQObject";
+ TypeFacts[TypeFacts["TypeofEQFunction"] = 64] = "TypeofEQFunction";
+ TypeFacts[TypeFacts["TypeofEQHostObject"] = 128] = "TypeofEQHostObject";
+ TypeFacts[TypeFacts["TypeofNEString"] = 256] = "TypeofNEString";
+ TypeFacts[TypeFacts["TypeofNENumber"] = 512] = "TypeofNENumber";
+ TypeFacts[TypeFacts["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt";
+ TypeFacts[TypeFacts["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean";
+ TypeFacts[TypeFacts["TypeofNESymbol"] = 4096] = "TypeofNESymbol";
+ TypeFacts[TypeFacts["TypeofNEObject"] = 8192] = "TypeofNEObject";
+ TypeFacts[TypeFacts["TypeofNEFunction"] = 16384] = "TypeofNEFunction";
+ TypeFacts[TypeFacts["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject";
+ TypeFacts[TypeFacts["EQUndefined"] = 65536] = "EQUndefined";
+ TypeFacts[TypeFacts["EQNull"] = 131072] = "EQNull";
+ TypeFacts[TypeFacts["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull";
+ TypeFacts[TypeFacts["NEUndefined"] = 524288] = "NEUndefined";
+ TypeFacts[TypeFacts["NENull"] = 1048576] = "NENull";
+ TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
+ TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
+ TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
+ TypeFacts[TypeFacts["All"] = 16777215] = "All";
+ // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
+ // The presence of a particular fact means that the given test is true for some (and possibly all) values
+ // of that kind of type.
+ TypeFacts[TypeFacts["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts";
+ TypeFacts[TypeFacts["BaseStringFacts"] = 12582401] = "BaseStringFacts";
+ TypeFacts[TypeFacts["StringStrictFacts"] = 16317953] = "StringStrictFacts";
+ TypeFacts[TypeFacts["StringFacts"] = 16776705] = "StringFacts";
+ TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts";
+ TypeFacts[TypeFacts["EmptyStringFacts"] = 12582401] = "EmptyStringFacts";
+ TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts";
+ TypeFacts[TypeFacts["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts";
+ TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts";
+ TypeFacts[TypeFacts["BaseNumberFacts"] = 12582146] = "BaseNumberFacts";
+ TypeFacts[TypeFacts["NumberStrictFacts"] = 16317698] = "NumberStrictFacts";
+ TypeFacts[TypeFacts["NumberFacts"] = 16776450] = "NumberFacts";
+ TypeFacts[TypeFacts["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts";
+ TypeFacts[TypeFacts["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts";
+ TypeFacts[TypeFacts["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts";
+ TypeFacts[TypeFacts["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts";
+ TypeFacts[TypeFacts["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts";
+ TypeFacts[TypeFacts["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts";
+ TypeFacts[TypeFacts["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts";
+ TypeFacts[TypeFacts["BigIntFacts"] = 16775940] = "BigIntFacts";
+ TypeFacts[TypeFacts["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts";
+ TypeFacts[TypeFacts["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts";
+ TypeFacts[TypeFacts["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts";
+ TypeFacts[TypeFacts["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts";
+ TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts";
+ TypeFacts[TypeFacts["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts";
+ TypeFacts[TypeFacts["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts";
+ TypeFacts[TypeFacts["BooleanFacts"] = 16774920] = "BooleanFacts";
+ TypeFacts[TypeFacts["FalseStrictFacts"] = 12121864] = "FalseStrictFacts";
+ TypeFacts[TypeFacts["FalseFacts"] = 12580616] = "FalseFacts";
+ TypeFacts[TypeFacts["TrueStrictFacts"] = 7927560] = "TrueStrictFacts";
+ TypeFacts[TypeFacts["TrueFacts"] = 16774920] = "TrueFacts";
+ TypeFacts[TypeFacts["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts";
+ TypeFacts[TypeFacts["SymbolFacts"] = 16772880] = "SymbolFacts";
+ TypeFacts[TypeFacts["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts";
+ TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
+ TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
+ TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
+ TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
+ TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
+ TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
+ TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
+ })(TypeFacts || (TypeFacts = {}));
+ var typeofEQFacts = ts.createMapFromTemplate({
+ string: 1 /* TypeofEQString */,
+ number: 2 /* TypeofEQNumber */,
+ bigint: 4 /* TypeofEQBigInt */,
+ boolean: 8 /* TypeofEQBoolean */,
+ symbol: 16 /* TypeofEQSymbol */,
+ undefined: 65536 /* EQUndefined */,
+ object: 32 /* TypeofEQObject */,
+ function: 64 /* TypeofEQFunction */
+ });
+ var typeofNEFacts = ts.createMapFromTemplate({
+ string: 256 /* TypeofNEString */,
+ number: 512 /* TypeofNENumber */,
+ bigint: 1024 /* TypeofNEBigInt */,
+ boolean: 2048 /* TypeofNEBoolean */,
+ symbol: 4096 /* TypeofNESymbol */,
+ undefined: 524288 /* NEUndefined */,
+ object: 8192 /* TypeofNEObject */,
+ function: 16384 /* TypeofNEFunction */
+ });
+ var TypeSystemPropertyName;
+ (function (TypeSystemPropertyName) {
+ TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
+ TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
+ TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
+ TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
+ TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
+ })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
+ var CheckMode;
+ (function (CheckMode) {
+ CheckMode[CheckMode["Normal"] = 0] = "Normal";
+ CheckMode[CheckMode["Contextual"] = 1] = "Contextual";
+ CheckMode[CheckMode["Inferential"] = 2] = "Inferential";
+ CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
+ CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
+ CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
+ })(CheckMode || (CheckMode = {}));
+ var ContextFlags;
+ (function (ContextFlags) {
+ ContextFlags[ContextFlags["None"] = 0] = "None";
+ ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
+ })(ContextFlags || (ContextFlags = {}));
+ var AccessFlags;
+ (function (AccessFlags) {
+ AccessFlags[AccessFlags["None"] = 0] = "None";
+ AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
+ AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
+ AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
+ AccessFlags[AccessFlags["NoTupleBoundsCheck"] = 8] = "NoTupleBoundsCheck";
+ })(AccessFlags || (AccessFlags = {}));
+ var CallbackCheck;
+ (function (CallbackCheck) {
+ CallbackCheck[CallbackCheck["None"] = 0] = "None";
+ CallbackCheck[CallbackCheck["Bivariant"] = 1] = "Bivariant";
+ CallbackCheck[CallbackCheck["Strict"] = 2] = "Strict";
+ })(CallbackCheck || (CallbackCheck = {}));
+ var MappedTypeModifiers;
+ (function (MappedTypeModifiers) {
+ MappedTypeModifiers[MappedTypeModifiers["IncludeReadonly"] = 1] = "IncludeReadonly";
+ MappedTypeModifiers[MappedTypeModifiers["ExcludeReadonly"] = 2] = "ExcludeReadonly";
+ MappedTypeModifiers[MappedTypeModifiers["IncludeOptional"] = 4] = "IncludeOptional";
+ MappedTypeModifiers[MappedTypeModifiers["ExcludeOptional"] = 8] = "ExcludeOptional";
+ })(MappedTypeModifiers || (MappedTypeModifiers = {}));
+ var ExpandingFlags;
+ (function (ExpandingFlags) {
+ ExpandingFlags[ExpandingFlags["None"] = 0] = "None";
+ ExpandingFlags[ExpandingFlags["Source"] = 1] = "Source";
+ ExpandingFlags[ExpandingFlags["Target"] = 2] = "Target";
+ ExpandingFlags[ExpandingFlags["Both"] = 3] = "Both";
+ })(ExpandingFlags || (ExpandingFlags = {}));
+ var MembersOrExportsResolutionKind;
+ (function (MembersOrExportsResolutionKind) {
+ MembersOrExportsResolutionKind["resolvedExports"] = "resolvedExports";
+ MembersOrExportsResolutionKind["resolvedMembers"] = "resolvedMembers";
+ })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {}));
+ var UnusedKind;
+ (function (UnusedKind) {
+ UnusedKind[UnusedKind["Local"] = 0] = "Local";
+ UnusedKind[UnusedKind["Parameter"] = 1] = "Parameter";
+ })(UnusedKind || (UnusedKind = {}));
+ var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
+ var DeclarationMeaning;
+ (function (DeclarationMeaning) {
+ DeclarationMeaning[DeclarationMeaning["GetAccessor"] = 1] = "GetAccessor";
+ DeclarationMeaning[DeclarationMeaning["SetAccessor"] = 2] = "SetAccessor";
+ DeclarationMeaning[DeclarationMeaning["PropertyAssignment"] = 4] = "PropertyAssignment";
+ DeclarationMeaning[DeclarationMeaning["Method"] = 8] = "Method";
+ DeclarationMeaning[DeclarationMeaning["GetOrSetAccessor"] = 3] = "GetOrSetAccessor";
+ DeclarationMeaning[DeclarationMeaning["PropertyAssignmentOrMethod"] = 12] = "PropertyAssignmentOrMethod";
+ })(DeclarationMeaning || (DeclarationMeaning = {}));
+ var DeclarationSpaces;
+ (function (DeclarationSpaces) {
+ DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None";
+ DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue";
+ DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType";
+ DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace";
+ })(DeclarationSpaces || (DeclarationSpaces = {}));
function getNodeId(node) {
if (!node.id) {
node.id = nextNodeId;
@@ -31839,7 +32364,7 @@ var ts;
// Ensure file is type checked
checkSourceFile(file);
ts.Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
- diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.get(file.fileName));
+ diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
if (!file.isDeclarationFile && (!unusedIsError(0 /* Local */) || !unusedIsError(1 /* Parameter */))) {
addUnusedDiagnostics();
}
@@ -32063,102 +32588,7 @@ var ts;
var potentialNewTargetCollisions = [];
var awaitedTypeStack = [];
var diagnostics = ts.createDiagnosticCollection();
- // Suggestion diagnostics must have a file. Keyed by source file name.
- var suggestionDiagnostics = ts.createMultiMap();
- var TypeFacts;
- (function (TypeFacts) {
- TypeFacts[TypeFacts["None"] = 0] = "None";
- TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString";
- TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber";
- TypeFacts[TypeFacts["TypeofEQBigInt"] = 4] = "TypeofEQBigInt";
- TypeFacts[TypeFacts["TypeofEQBoolean"] = 8] = "TypeofEQBoolean";
- TypeFacts[TypeFacts["TypeofEQSymbol"] = 16] = "TypeofEQSymbol";
- TypeFacts[TypeFacts["TypeofEQObject"] = 32] = "TypeofEQObject";
- TypeFacts[TypeFacts["TypeofEQFunction"] = 64] = "TypeofEQFunction";
- TypeFacts[TypeFacts["TypeofEQHostObject"] = 128] = "TypeofEQHostObject";
- TypeFacts[TypeFacts["TypeofNEString"] = 256] = "TypeofNEString";
- TypeFacts[TypeFacts["TypeofNENumber"] = 512] = "TypeofNENumber";
- TypeFacts[TypeFacts["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt";
- TypeFacts[TypeFacts["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean";
- TypeFacts[TypeFacts["TypeofNESymbol"] = 4096] = "TypeofNESymbol";
- TypeFacts[TypeFacts["TypeofNEObject"] = 8192] = "TypeofNEObject";
- TypeFacts[TypeFacts["TypeofNEFunction"] = 16384] = "TypeofNEFunction";
- TypeFacts[TypeFacts["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject";
- TypeFacts[TypeFacts["EQUndefined"] = 65536] = "EQUndefined";
- TypeFacts[TypeFacts["EQNull"] = 131072] = "EQNull";
- TypeFacts[TypeFacts["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull";
- TypeFacts[TypeFacts["NEUndefined"] = 524288] = "NEUndefined";
- TypeFacts[TypeFacts["NENull"] = 1048576] = "NENull";
- TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
- TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
- TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
- TypeFacts[TypeFacts["All"] = 16777215] = "All";
- // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
- // The presence of a particular fact means that the given test is true for some (and possibly all) values
- // of that kind of type.
- TypeFacts[TypeFacts["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts";
- TypeFacts[TypeFacts["BaseStringFacts"] = 12582401] = "BaseStringFacts";
- TypeFacts[TypeFacts["StringStrictFacts"] = 16317953] = "StringStrictFacts";
- TypeFacts[TypeFacts["StringFacts"] = 16776705] = "StringFacts";
- TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts";
- TypeFacts[TypeFacts["EmptyStringFacts"] = 12582401] = "EmptyStringFacts";
- TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts";
- TypeFacts[TypeFacts["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts";
- TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts";
- TypeFacts[TypeFacts["BaseNumberFacts"] = 12582146] = "BaseNumberFacts";
- TypeFacts[TypeFacts["NumberStrictFacts"] = 16317698] = "NumberStrictFacts";
- TypeFacts[TypeFacts["NumberFacts"] = 16776450] = "NumberFacts";
- TypeFacts[TypeFacts["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts";
- TypeFacts[TypeFacts["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts";
- TypeFacts[TypeFacts["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts";
- TypeFacts[TypeFacts["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts";
- TypeFacts[TypeFacts["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts";
- TypeFacts[TypeFacts["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts";
- TypeFacts[TypeFacts["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts";
- TypeFacts[TypeFacts["BigIntFacts"] = 16775940] = "BigIntFacts";
- TypeFacts[TypeFacts["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts";
- TypeFacts[TypeFacts["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts";
- TypeFacts[TypeFacts["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts";
- TypeFacts[TypeFacts["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts";
- TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts";
- TypeFacts[TypeFacts["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts";
- TypeFacts[TypeFacts["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts";
- TypeFacts[TypeFacts["BooleanFacts"] = 16774920] = "BooleanFacts";
- TypeFacts[TypeFacts["FalseStrictFacts"] = 12121864] = "FalseStrictFacts";
- TypeFacts[TypeFacts["FalseFacts"] = 12580616] = "FalseFacts";
- TypeFacts[TypeFacts["TrueStrictFacts"] = 7927560] = "TrueStrictFacts";
- TypeFacts[TypeFacts["TrueFacts"] = 16774920] = "TrueFacts";
- TypeFacts[TypeFacts["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts";
- TypeFacts[TypeFacts["SymbolFacts"] = 16772880] = "SymbolFacts";
- TypeFacts[TypeFacts["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts";
- TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
- TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
- TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
- TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
- TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
- TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
- TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
- })(TypeFacts || (TypeFacts = {}));
- var typeofEQFacts = ts.createMapFromTemplate({
- string: 1 /* TypeofEQString */,
- number: 2 /* TypeofEQNumber */,
- bigint: 4 /* TypeofEQBigInt */,
- boolean: 8 /* TypeofEQBoolean */,
- symbol: 16 /* TypeofEQSymbol */,
- undefined: 65536 /* EQUndefined */,
- object: 32 /* TypeofEQObject */,
- function: 64 /* TypeofEQFunction */
- });
- var typeofNEFacts = ts.createMapFromTemplate({
- string: 256 /* TypeofNEString */,
- number: 512 /* TypeofNENumber */,
- bigint: 1024 /* TypeofNEBigInt */,
- boolean: 2048 /* TypeofNEBoolean */,
- symbol: 4096 /* TypeofNESymbol */,
- undefined: 524288 /* NEUndefined */,
- object: 8192 /* TypeofNEObject */,
- function: 16384 /* TypeofNEFunction */
- });
+ var suggestionDiagnostics = ts.createDiagnosticCollection();
var typeofTypesByName = ts.createMapFromTemplate({
string: stringType,
number: numberType,
@@ -32176,71 +32606,8 @@ var ts;
var comparableRelation = ts.createMap();
var identityRelation = ts.createMap();
var enumRelation = ts.createMap();
- var TypeSystemPropertyName;
- (function (TypeSystemPropertyName) {
- TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type";
- TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType";
- TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType";
- TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
- TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
- TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
- TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
- })(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
- var CheckMode;
- (function (CheckMode) {
- CheckMode[CheckMode["Normal"] = 0] = "Normal";
- CheckMode[CheckMode["Contextual"] = 1] = "Contextual";
- CheckMode[CheckMode["Inferential"] = 2] = "Inferential";
- CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
- CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
- CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
- })(CheckMode || (CheckMode = {}));
- var ContextFlags;
- (function (ContextFlags) {
- ContextFlags[ContextFlags["None"] = 0] = "None";
- ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
- })(ContextFlags || (ContextFlags = {}));
- var AccessFlags;
- (function (AccessFlags) {
- AccessFlags[AccessFlags["None"] = 0] = "None";
- AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
- AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
- AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
- AccessFlags[AccessFlags["NoTupleBoundsCheck"] = 8] = "NoTupleBoundsCheck";
- })(AccessFlags || (AccessFlags = {}));
- var CallbackCheck;
- (function (CallbackCheck) {
- CallbackCheck[CallbackCheck["None"] = 0] = "None";
- CallbackCheck[CallbackCheck["Bivariant"] = 1] = "Bivariant";
- CallbackCheck[CallbackCheck["Strict"] = 2] = "Strict";
- })(CallbackCheck || (CallbackCheck = {}));
- var MappedTypeModifiers;
- (function (MappedTypeModifiers) {
- MappedTypeModifiers[MappedTypeModifiers["IncludeReadonly"] = 1] = "IncludeReadonly";
- MappedTypeModifiers[MappedTypeModifiers["ExcludeReadonly"] = 2] = "ExcludeReadonly";
- MappedTypeModifiers[MappedTypeModifiers["IncludeOptional"] = 4] = "IncludeOptional";
- MappedTypeModifiers[MappedTypeModifiers["ExcludeOptional"] = 8] = "ExcludeOptional";
- })(MappedTypeModifiers || (MappedTypeModifiers = {}));
- var ExpandingFlags;
- (function (ExpandingFlags) {
- ExpandingFlags[ExpandingFlags["None"] = 0] = "None";
- ExpandingFlags[ExpandingFlags["Source"] = 1] = "Source";
- ExpandingFlags[ExpandingFlags["Target"] = 2] = "Target";
- ExpandingFlags[ExpandingFlags["Both"] = 3] = "Both";
- })(ExpandingFlags || (ExpandingFlags = {}));
- var MembersOrExportsResolutionKind;
- (function (MembersOrExportsResolutionKind) {
- MembersOrExportsResolutionKind["resolvedExports"] = "resolvedExports";
- MembersOrExportsResolutionKind["resolvedMembers"] = "resolvedMembers";
- })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {}));
- var UnusedKind;
- (function (UnusedKind) {
- UnusedKind[UnusedKind["Local"] = 0] = "Local";
- UnusedKind[UnusedKind["Parameter"] = 1] = "Parameter";
- })(UnusedKind || (UnusedKind = {}));
var builtinGlobals = ts.createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
- var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
initializeTypeChecker();
return checker;
function getJsxNamespace(location) {
@@ -32305,7 +32672,7 @@ var ts;
diagnostics.add(diagnostic);
}
else {
- suggestionDiagnostics.add(diagnostic.file.fileName, __assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
+ suggestionDiagnostics.add(__assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion }));
}
}
function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
@@ -32331,35 +32698,35 @@ var ts;
function getExcludedSymbolFlags(flags) {
var result = 0;
if (flags & 2 /* BlockScopedVariable */)
- result |= 67220415 /* BlockScopedVariableExcludes */;
+ result |= 111551 /* BlockScopedVariableExcludes */;
if (flags & 1 /* FunctionScopedVariable */)
- result |= 67220414 /* FunctionScopedVariableExcludes */;
+ result |= 111550 /* FunctionScopedVariableExcludes */;
if (flags & 4 /* Property */)
result |= 0 /* PropertyExcludes */;
if (flags & 8 /* EnumMember */)
- result |= 68008959 /* EnumMemberExcludes */;
+ result |= 900095 /* EnumMemberExcludes */;
if (flags & 16 /* Function */)
- result |= 67219887 /* FunctionExcludes */;
+ result |= 110991 /* FunctionExcludes */;
if (flags & 32 /* Class */)
- result |= 68008383 /* ClassExcludes */;
+ result |= 899503 /* ClassExcludes */;
if (flags & 64 /* Interface */)
- result |= 67897736 /* InterfaceExcludes */;
+ result |= 788872 /* InterfaceExcludes */;
if (flags & 256 /* RegularEnum */)
- result |= 68008191 /* RegularEnumExcludes */;
+ result |= 899327 /* RegularEnumExcludes */;
if (flags & 128 /* ConstEnum */)
- result |= 68008831 /* ConstEnumExcludes */;
+ result |= 899967 /* ConstEnumExcludes */;
if (flags & 512 /* ValueModule */)
result |= 110735 /* ValueModuleExcludes */;
if (flags & 8192 /* Method */)
- result |= 67212223 /* MethodExcludes */;
+ result |= 103359 /* MethodExcludes */;
if (flags & 32768 /* GetAccessor */)
- result |= 67154879 /* GetAccessorExcludes */;
+ result |= 46015 /* GetAccessorExcludes */;
if (flags & 65536 /* SetAccessor */)
- result |= 67187647 /* SetAccessorExcludes */;
+ result |= 78783 /* SetAccessorExcludes */;
if (flags & 262144 /* TypeParameter */)
- result |= 67635688 /* TypeParameterExcludes */;
+ result |= 526824 /* TypeParameterExcludes */;
if (flags & 524288 /* TypeAlias */)
- result |= 67897832 /* TypeAliasExcludes */;
+ result |= 788968 /* TypeAliasExcludes */;
if (flags & 2097152 /* Alias */)
result |= 2097152 /* AliasExcludes */;
return result;
@@ -32612,8 +32979,8 @@ var ts;
function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) {
var constructorDeclaration = parameter.parent;
var classDeclaration = parameter.parent.parent;
- var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 67220415 /* Value */);
- var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 67220415 /* Value */);
+ var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 111551 /* Value */);
+ var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 111551 /* Value */);
if (parameterSymbol && propertySymbol) {
return [parameterSymbol, propertySymbol];
}
@@ -32792,7 +33159,7 @@ var ts;
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) {
+ if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 298 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
// type parameters are visible in parameter list, return type and type parameter list
? lastLocation === location.type ||
@@ -32895,7 +33262,7 @@ var ts;
if (!ts.hasModifier(location, 32 /* Static */)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
- if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) {
+ if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
// Remember the property node, it will be used later to report appropriate error
propertyWithInvalidInitializer = location;
}
@@ -32908,7 +33275,7 @@ var ts;
// The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals
// These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would
// trigger resolving late-bound names, which we may already be in the process of doing while we're here!
- if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 67897832 /* Type */)) {
+ if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
// ignore type parameters not declared in this container
result = undefined;
@@ -32935,7 +33302,7 @@ var ts;
// The type parameters of a class are not in scope in the base class expression.
if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) {
var container = location.parent.parent;
- if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) {
+ if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 788968 /* Type */))) {
if (nameNotFoundMessage) {
error(errorLocation, ts.Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
}
@@ -32955,7 +33322,7 @@ var ts;
grandparent = location.parent.parent;
if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
- if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) {
+ if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
return undefined;
}
@@ -33019,8 +33386,9 @@ var ts;
location = location.parent;
}
break;
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
break;
@@ -33118,21 +33486,21 @@ var ts;
// we want to check for block-scoped
if (errorLocation &&
(meaning & 2 /* BlockScopedVariable */ ||
- ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 67220415 /* Value */) === 67220415 /* Value */))) {
+ ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */))) {
var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
}
}
// If we're in an external module, we can't reference value symbols created from UMD export declarations
- if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
+ if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
}
}
// If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
- if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) {
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
var candidate = getMergedSymbol(getLateBoundSymbol(result));
var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
// A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
@@ -33249,9 +33617,9 @@ var ts;
}
}
function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
- var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(errorLocation) ? 67220415 /* Value */ : 0);
+ var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(errorLocation) ? 111551 /* Value */ : 0);
if (meaning === namespaceMeaning) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 /* Type */ & ~namespaceMeaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~namespaceMeaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
var parent = errorLocation.parent;
if (symbol) {
if (ts.isQualifiedName(parent)) {
@@ -33270,8 +33638,8 @@ var ts;
return false;
}
function checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning) {
- if (meaning & (67897832 /* Type */ & ~1920 /* Namespace */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, ~67897832 /* Type */ & 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ if (meaning & (788968 /* Type */ & ~1920 /* Namespace */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, ~788968 /* Type */ & 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol && !(symbol.flags & 1920 /* Namespace */)) {
error(errorLocation, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here, ts.unescapeLeadingUnderscores(name));
return true;
@@ -33280,12 +33648,12 @@ var ts;
return false;
}
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 /* Value */ & ~1024 /* NamespaceModule */)) {
+ if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
if (name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never") {
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
return true;
}
- var symbol = resolveSymbol(resolveName(errorLocation, name, 67897832 /* Type */ & ~67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol && !(symbol.flags & 1024 /* NamespaceModule */)) {
var message = isES2015OrLaterConstructorName(name)
? ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later
@@ -33309,15 +33677,15 @@ var ts;
return false;
}
function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) {
- if (meaning & (67220415 /* Value */ & ~1024 /* NamespaceModule */ & ~67897832 /* Type */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */ & ~788968 /* Type */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
return true;
}
}
- else if (meaning & (67897832 /* Type */ & ~1024 /* NamespaceModule */ & ~67220415 /* Value */)) {
- var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* ValueModule */ | 1024 /* NamespaceModule */) & ~67897832 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
+ else if (meaning & (788968 /* Type */ & ~1024 /* NamespaceModule */ & ~111551 /* Value */)) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* ValueModule */ | 1024 /* NamespaceModule */) & ~788968 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
if (symbol) {
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
return true;
@@ -33328,7 +33696,7 @@ var ts;
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
// Block-scoped variables cannot be used before their definition
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -33480,7 +33848,7 @@ var ts;
if (valueSymbol === unknownSymbol && typeSymbol === unknownSymbol) {
return unknownSymbol;
}
- if (valueSymbol.flags & (67897832 /* Type */ | 1920 /* Namespace */)) {
+ if (valueSymbol.flags & (788968 /* Type */ | 1920 /* Namespace */)) {
return valueSymbol;
}
var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName);
@@ -33570,7 +33938,7 @@ var ts;
if (ts.isClassExpression(expression)) {
return checkExpression(expression).symbol;
}
- var aliasLike = resolveEntityName(expression, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias);
+ var aliasLike = resolveEntityName(expression, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontResolveAlias);
if (aliasLike) {
return aliasLike;
}
@@ -33589,7 +33957,7 @@ var ts;
case 254 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
case 258 /* ExportSpecifier */:
- return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
+ return getTargetOfExportSpecifier(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
case 255 /* ExportAssignment */:
case 205 /* BinaryExpression */:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
@@ -33604,7 +33972,7 @@ var ts;
* OR Is a JSContainer which may merge an alias with a local declaration
*/
function isNonLocalAlias(symbol, excludes) {
- if (excludes === void 0) { excludes = 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */; }
+ if (excludes === void 0) { excludes = 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */; }
if (!symbol)
return false;
return (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */ || !!(symbol.flags & 2097152 /* Alias */ && symbol.flags & 67108864 /* Assignment */);
@@ -33638,7 +34006,7 @@ var ts;
var target = resolveAlias(symbol);
if (target) {
var markAlias = target === unknownSymbol ||
- ((target.flags & 67220415 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));
+ ((target.flags & 111551 /* Value */) && !isConstEnumOrConstEnumOnlyModule(target));
if (markAlias) {
markAliasSymbolAsReferenced(symbol);
}
@@ -33654,17 +34022,15 @@ var ts;
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 255 /* ExportAssignment */) {
- // export default
- checkExpressionCached(node.expression);
- }
- else if (node.kind === 258 /* ExportSpecifier */) {
- // export { } or export { as foo }
- checkExpressionCached(node.propertyName || node.name);
- }
- else if (ts.isInternalModuleImportEqualsDeclaration(node)) {
- // import foo =
- checkExpressionCached(node.moduleReference);
+ // We defer checking of the reference of an `import =` until the import itself is referenced,
+ // This way a chain of imports can be elided if ultimately the final input is only used in a type
+ // position.
+ if (ts.isInternalModuleImportEqualsDeclaration(node)) {
+ var target = resolveSymbol(symbol);
+ if (target === unknownSymbol || target.flags & 111551 /* Value */) {
+ // import foo =
+ checkExpressionCached(node.moduleReference);
+ }
}
}
}
@@ -33687,7 +34053,7 @@ var ts;
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */);
- return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
+ return resolveEntityName(entityName, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
function getFullyQualifiedName(symbol, containingLocation) {
@@ -33700,7 +34066,7 @@ var ts;
if (ts.nodeIsMissing(name)) {
return undefined;
}
- var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0);
+ var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 111551 /* Value */ : 0);
var symbol;
if (name.kind === 73 /* Identifier */) {
var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
@@ -34201,7 +34567,7 @@ var ts;
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 ? symbol.exportSymbol : symbol);
}
function symbolIsValue(symbol) {
- return !!(symbol.flags & 67220415 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 67220415 /* Value */);
+ return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */);
}
function findConstructorDeclaration(node) {
var members = node.members;
@@ -34309,7 +34675,7 @@ var ts;
}
function getQualifiedLeftMeaning(rightMeaning) {
// If we are looking in value space, the parent meaning is value, other wise it is namespace
- return rightMeaning === 67220415 /* Value */ ? 67220415 /* Value */ : 1920 /* Namespace */;
+ return rightMeaning === 111551 /* Value */ ? 111551 /* Value */ : 1920 /* Namespace */;
}
function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) {
if (visitedSymbolTablesMap === void 0) { visitedSymbolTablesMap = ts.createMap(); }
@@ -34427,11 +34793,11 @@ var ts;
return false;
}
function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67897832 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 788968 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false);
return access.accessibility === 0 /* Accessible */;
}
function isValueSymbolAccessible(typeSymbol, enclosingDeclaration) {
- var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67220415 /* Value */, /*shouldComputeAliasesToMakeVisible*/ false);
+ var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 111551 /* Value */, /*shouldComputeAliasesToMakeVisible*/ false);
return access.accessibility === 0 /* Accessible */;
}
function isAnySymbolAccessible(symbols, enclosingDeclaration, initialSymbol, meaning, shouldComputeAliasesToMakeVisible) {
@@ -34474,7 +34840,7 @@ var ts;
// from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however,
// we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal.
var firstDecl = ts.first(symbol.declarations);
- if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
+ if (!ts.length(containers) && meaning & 111551 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
containers = [getSymbolOfNode(firstDecl.parent)];
}
@@ -34587,7 +34953,7 @@ var ts;
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
entityName.parent.kind === 150 /* ComputedPropertyName */) {
// Typeof value
- meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
}
else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ ||
entityName.parent.kind === 249 /* ImportEqualsDeclaration */) {
@@ -34597,7 +34963,7 @@ var ts;
}
else {
// Type Reference or TypeAlias entity = Identifier
- meaning = 67897832 /* Type */;
+ meaning = 788968 /* Type */;
}
var firstIdentifier = getFirstIdentifier(entityName);
var symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
@@ -34769,14 +35135,14 @@ var ts;
}
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
var parentSymbol = getParentOfSymbol(type.symbol);
- var parentName = symbolToTypeNode(parentSymbol, context, 67897832 /* Type */);
+ var parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
var enumLiteralName = getDeclaredTypeOfSymbol(parentSymbol) === type
? parentName
: appendReferenceToType(parentName, ts.createTypeReferenceNode(ts.symbolName(type.symbol), /*typeArguments*/ undefined));
return enumLiteralName;
}
if (type.flags & 1056 /* EnumLike */) {
- return symbolToTypeNode(type.symbol, context, 67897832 /* Type */);
+ return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
}
if (type.flags & 128 /* StringLiteral */) {
context.approximateLength += (type.value.length + 2);
@@ -34799,7 +35165,7 @@ var ts;
if (!(context.flags & 1048576 /* AllowUniqueESSymbolType */)) {
if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
context.approximateLength += 6;
- return symbolToTypeNode(type.symbol, context, 67220415 /* Value */);
+ return symbolToTypeNode(type.symbol, context, 111551 /* Value */);
}
if (context.tracker.reportInaccessibleUniqueSymbolError) {
context.tracker.reportInaccessibleUniqueSymbolError();
@@ -34862,14 +35228,14 @@ var ts;
}
// Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter.
return type.symbol
- ? symbolToTypeNode(type.symbol, context, 67897832 /* Type */)
+ ? symbolToTypeNode(type.symbol, context, 788968 /* Type */)
: ts.createTypeReferenceNode(ts.createIdentifier("?"), /*typeArguments*/ undefined);
}
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */))
return ts.createTypeReferenceNode(ts.createIdentifier(""), typeArgumentNodes);
- return symbolToTypeNode(type.aliasSymbol, context, 67897832 /* Type */, typeArgumentNodes);
+ return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
}
if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) {
var types = type.flags & 1048576 /* Union */ ? formatUnionTypes(type.types) : type.types;
@@ -34948,21 +35314,21 @@ var ts;
id = (isConstructorObject ? "+" : "") + getSymbolId(symbol);
if (isJSConstructor(symbol.valueDeclaration)) {
// Instance and static types share the same symbol; only add 'typeof' for the static side.
- var isInstanceType = type === getInferredClassType(symbol) ? 67897832 /* Type */ : 67220415 /* Value */;
+ var isInstanceType = type === getInferredClassType(symbol) ? 788968 /* Type */ : 111551 /* Value */;
return symbolToTypeNode(symbol, context, isInstanceType);
}
// Always use 'typeof T' for type of class, enum, and module objects
else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) ||
shouldWriteTypeOfFunctionSymbol()) {
- return symbolToTypeNode(symbol, context, 67220415 /* Value */);
+ return symbolToTypeNode(symbol, context, 111551 /* Value */);
}
else if (context.visitedTypes && context.visitedTypes.has(typeId)) {
// If type is an anonymous type literal in a type alias declaration, use type alias name
var typeAlias = getTypeAliasForTypeLiteral(type);
if (typeAlias) {
// The specified symbol flags need to be reinterpreted as type flags
- return symbolToTypeNode(typeAlias, context, 67897832 /* Type */);
+ return symbolToTypeNode(typeAlias, context, 788968 /* Type */);
}
else {
return createElidedInformationPlaceholder(context);
@@ -35095,7 +35461,7 @@ var ts;
var typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
var flags_2 = context.flags;
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
- var ref = symbolToTypeNode(parent, context, 67897832 /* Type */, typeArgumentSlice);
+ var ref = symbolToTypeNode(parent, context, 788968 /* Type */, typeArgumentSlice);
context.flags = flags_2;
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
}
@@ -35108,7 +35474,7 @@ var ts;
}
var flags = context.flags;
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
- var finalRef = symbolToTypeNode(type.symbol, context, 67897832 /* Type */, typeArgumentNodes);
+ var finalRef = symbolToTypeNode(type.symbol, context, 788968 /* Type */, typeArgumentNodes);
context.flags = flags;
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
}
@@ -35225,7 +35591,7 @@ var ts;
trackComputedName(decl.name, saveEnclosingDeclaration, context);
}
}
- var propertyName = symbolToName(propertySymbol, context, 67220415 /* Value */, /*expectsIdentifier*/ true);
+ var propertyName = symbolToName(propertySymbol, context, 111551 /* Value */, /*expectsIdentifier*/ true);
context.approximateLength += (ts.symbolName(propertySymbol).length + 1);
context.enclosingDeclaration = saveEnclosingDeclaration;
var optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? ts.createToken(56 /* QuestionToken */) : undefined;
@@ -35375,7 +35741,7 @@ var ts;
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 306 /* JSDocParameterTag */);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 307 /* JSDocParameterTag */);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -35419,9 +35785,9 @@ var ts;
return;
// get symbol of the first identifier of the entityName
var firstIdentifier = getFirstIdentifier(node.expression);
- var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
+ var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (name) {
- context.tracker.trackSymbol(name, enclosingDeclaration, 67220415 /* Value */);
+ context.tracker.trackSymbol(name, enclosingDeclaration, 111551 /* Value */);
}
}
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
@@ -35583,7 +35949,7 @@ var ts;
}
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
- var isTypeOf = meaning === 67220415 /* Value */;
+ var isTypeOf = meaning === 111551 /* Value */;
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
// module is root, must use `ImportTypeNode`
var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
@@ -35662,7 +36028,7 @@ var ts;
}
}
function typeParameterShadowsNameInScope(escapedName, context) {
- return !!resolveName(context.enclosingDeclaration, escapedName, 67897832 /* Type */, /*nameNotFoundArg*/ undefined, escapedName, /*isUse*/ false);
+ return !!resolveName(context.enclosingDeclaration, escapedName, 788968 /* Type */, /*nameNotFoundArg*/ undefined, escapedName, /*isUse*/ false);
}
function typeParameterToName(type, context) {
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
@@ -35671,7 +36037,7 @@ var ts;
return cached;
}
}
- var result = symbolToName(type.symbol, context, 67897832 /* Type */, /*expectsIdentifier*/ true);
+ var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
var rawtext = result.escapedText;
var i = 0;
@@ -35898,8 +36264,9 @@ var ts;
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 304 /* JSDocCallbackTag */:
- case 311 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 306 /* JSDocEnumTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
@@ -35982,10 +36349,10 @@ var ts;
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
if (node.parent && node.parent.kind === 255 /* ExportAssignment */) {
- exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
+ exportSymbol = resolveName(node, node.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
}
else if (node.parent.kind === 258 /* ExportSpecifier */) {
- exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
var result;
if (exportSymbol) {
@@ -36006,7 +36373,7 @@ var ts;
// Add the referenced top container visible
var internalModuleReference = declaration.moduleReference;
var firstIdentifier = getFirstIdentifier(internalModuleReference);
- var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, undefined, undefined, /*isUse*/ false);
+ var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, undefined, undefined, /*isUse*/ false);
if (importSymbol) {
buildVisibleNodeList(importSymbol.declarations);
}
@@ -36070,8 +36437,10 @@ var ts;
}
return ts.Debug.assertNever(propertyName);
}
- // Pop an entry from the type resolution stack and return its associated result value. The result value will
- // be true if no circularities were detected, or false if a circularity was found.
+ /**
+ * Pop an entry from the type resolution stack and return its associated result value. The result value will
+ * be true if no circularities were detected, or false if a circularity was found.
+ */
function popTypeResolution() {
resolutionTargets.pop();
resolutionPropertyNames.pop();
@@ -36400,7 +36769,7 @@ var ts;
// No type specified and nothing can be inferred
return undefined;
}
- function getWidenedTypeFromAssignmentDeclaration(symbol, resolvedSymbol) {
+ function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
// function/class/{} initializers are themselves containers, so they won't merge in the same way as other initializers
var container = ts.getAssignedExpandoInitializer(symbol.valueDeclaration);
if (container) {
@@ -36433,7 +36802,7 @@ var ts;
}
}
if (!ts.isCallExpression(expression)) {
- jsdocType = getJSDocTypeFromAssignmentDeclaration(jsdocType, expression, symbol, declaration);
+ jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
}
if (!jsdocType) {
(types || (types = [])).push((ts.isBinaryExpression(expression) || ts.isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
@@ -36480,8 +36849,8 @@ var ts;
type.objectFlags |= 16384 /* JSLiteral */;
return type;
}
- function getJSDocTypeFromAssignmentDeclaration(declaredType, expression, _symbol, declaration) {
- var typeNode = ts.getJSDocType(expression.parent);
+ function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) {
+ var typeNode = ts.getEffectiveTypeAnnotationNode(expression.parent);
if (typeNode) {
var type = getWidenedType(getTypeFromTypeNode(typeNode));
if (!declaredType) {
@@ -36491,6 +36860,12 @@ var ts;
errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
}
}
+ if (symbol.parent) {
+ var typeNode_2 = ts.getEffectiveTypeAnnotationNode(symbol.parent.valueDeclaration);
+ if (typeNode_2) {
+ return getTypeOfPropertyOfType(getTypeFromTypeNode(typeNode_2), symbol.escapedName);
+ }
+ }
return declaredType;
}
/** If we don't have an explicit JSDoc type, get the type from the initializer. */
@@ -36761,7 +37136,7 @@ var ts;
}
else if (ts.isInJSFile(declaration) &&
(ts.isCallExpression(declaration) || ts.isBinaryExpression(declaration) || ts.isPropertyAccessExpression(declaration) && ts.isBinaryExpression(declaration.parent))) {
- type = getWidenedTypeFromAssignmentDeclaration(symbol);
+ type = getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (ts.isJSDocPropertyLikeTag(declaration)
|| ts.isPropertyAccessExpression(declaration)
@@ -36776,7 +37151,7 @@ var ts;
return getTypeOfFuncClassEnumModule(symbol);
}
type = ts.isBinaryExpression(declaration.parent) ?
- getWidenedTypeFromAssignmentDeclaration(symbol) :
+ getWidenedTypeForAssignmentDeclaration(symbol) :
tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
}
else if (ts.isPropertyAssignment(declaration)) {
@@ -36878,7 +37253,9 @@ var ts;
// Otherwise, fall back to 'any'.
else {
if (setter) {
- errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ if (!isPrivateWithinAmbient(setter)) {
+ errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
+ }
}
else {
ts.Debug.assert(!!getter, "there must existed getter as we are current checking either setter or getter in this function");
@@ -36933,7 +37310,7 @@ var ts;
}
else if (declaration.kind === 205 /* BinaryExpression */ ||
declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) {
- return getWidenedTypeFromAssignmentDeclaration(symbol);
+ return getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
var resolvedModule = resolveExternalModuleSymbol(symbol);
@@ -36942,7 +37319,7 @@ var ts;
return errorType;
}
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
- var type_2 = getWidenedTypeFromAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
+ var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
if (!popTypeResolution()) {
return reportCircularityError(symbol);
}
@@ -36971,7 +37348,7 @@ var ts;
// type symbol, call getDeclaredTypeOfSymbol.
// This check is important because without it, a call to getTypeOfSymbol could end
// up recursively calling getTypeOfAlias, causing a stack overflow.
- links.type = targetSymbol.flags & 67220415 /* Value */
+ links.type = targetSymbol.flags & 111551 /* Value */
? getTypeOfSymbol(targetSymbol)
: errorType;
}
@@ -37098,9 +37475,10 @@ var ts;
case 197 /* FunctionExpression */:
case 198 /* ArrowFunction */:
case 243 /* TypeAliasDeclaration */:
- case 310 /* JSDocTemplateTag */:
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 311 /* JSDocTemplateTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 306 /* JSDocEnumTag */:
+ case 305 /* JSDocCallbackTag */:
case 182 /* MappedType */:
case 176 /* ConditionalType */:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
@@ -37370,7 +37748,7 @@ var ts;
for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {
var node = baseTypeNodes_1[_b];
if (ts.isEntityNameExpression(node.expression)) {
- var baseSymbol = resolveEntityName(node.expression, 67897832 /* Type */, /*ignoreErrors*/ true);
+ var baseSymbol = resolveEntityName(node.expression, 788968 /* Type */, /*ignoreErrors*/ true);
if (!baseSymbol || !(baseSymbol.flags & 64 /* Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {
return false;
}
@@ -37417,9 +37795,10 @@ var ts;
if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {
return errorType;
}
- var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */;
- });
+ var declaration = ts.find(symbol.declarations, ts.isTypeAlias);
+ if (!declaration) {
+ return ts.Debug.fail("Type alias symbol with no valid declaration found");
+ }
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
// If typeNode is missing, we will error in checkJSDocTypedefTag.
var type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
@@ -37435,7 +37814,7 @@ var ts;
}
else {
type = errorType;
- error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
+ error(ts.isJSDocEnumTag(declaration) ? declaration : declaration.name || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
}
links.declaredType = type;
}
@@ -37752,7 +38131,7 @@ var ts;
else {
symbol.declarations.push(member);
}
- if (symbolFlags & 67220415 /* Value */) {
+ if (symbolFlags & 111551 /* Value */) {
if (!symbol.valueDeclaration || symbol.valueDeclaration.kind !== member.kind) {
symbol.valueDeclaration = member;
}
@@ -38058,8 +38437,9 @@ var ts;
}
var result;
for (var i = 0; i < signatureLists.length; i++) {
- // Allow matching non-generic signatures to have excess parameters and different return types
- var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true);
+ // Allow matching non-generic signatures to have excess parameters and different return types.
+ // Prefer matching this types if possible.
+ var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true);
if (!match) {
return undefined;
}
@@ -38083,7 +38463,7 @@ var ts;
for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {
var signature = _a[_i];
// Only process signatures with parameter lists that aren't already in the result list
- if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) {
+ if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true)) {
var unionSignatures = findMatchingSignatures(signatureLists, signature, i);
if (unionSignatures) {
var s = signature;
@@ -38092,7 +38472,7 @@ var ts;
var thisParameter = signature.thisParameter;
var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
if (firstThisParameterOfUnionSignatures) {
- var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */);
+ var thisType = getIntersectionType(ts.mapDefined(unionSignatures, function (sig) { return sig.thisParameter && getTypeOfSymbol(sig.thisParameter); }));
thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
@@ -38136,8 +38516,8 @@ var ts;
}
// A signature `this` type might be a read or a write position... It's very possible that it should be invariant
// and we should refuse to merge signatures if there are `this` types and they do not match. However, so as to be
- // permissive when calling, for now, we'll union the `this` types just like the overlapping-union-signature check does
- var thisType = getUnionType([getTypeOfSymbol(left), getTypeOfSymbol(right)], 2 /* Subtype */);
+ // permissive when calling, for now, we'll intersect the `this` types just like we do for param types in union signatures.
+ var thisType = getIntersectionType([getTypeOfSymbol(left), getTypeOfSymbol(right)]);
return createSymbolWithType(left, thisType);
}
function combineUnionParameters(left, right) {
@@ -38511,7 +38891,7 @@ var ts;
else {
// Otherwise, get the declared constraint type, and if the constraint type is a type parameter,
// get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T',
- // the modifiers type is T. Otherwise, the modifiers type is {}.
+ // the modifiers type is T. Otherwise, the modifiers type is unknown.
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint;
@@ -38956,7 +39336,7 @@ var ts;
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 /* StringLike */ ? globalStringType :
t.flags & 296 /* NumberLike */ ? globalNumberType :
- t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) :
+ t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 99 /* ESNext */) :
t.flags & 528 /* BooleanLike */ ? globalBooleanType :
t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) :
t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType :
@@ -39310,7 +39690,7 @@ var ts;
var type = ts.isJSDocParameterTag(param) ? (param.typeExpression && param.typeExpression.type) : param.type;
// Include parameter symbol instead of property symbol in the signature
if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !ts.isBindingPattern(param.name)) {
- var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 67220415 /* Value */, undefined, undefined, /*isUse*/ false);
+ var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 111551 /* Value */, undefined, undefined, /*isUse*/ false);
paramSymbol = resolvedSymbol;
}
if (i === 0 && paramSymbol.escapedName === "this" /* This */) {
@@ -39893,20 +40273,6 @@ var ts;
if (type) {
return type;
}
- // JS enums are 'string' or 'number', not an enum type.
- var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
- if (enumTag) {
- var links = getNodeLinks(enumTag);
- if (!pushTypeResolution(enumTag, 5 /* EnumTagType */)) {
- return errorType;
- }
- var type_4 = enumTag.typeExpression ? getTypeFromTypeNode(enumTag.typeExpression) : errorType;
- if (!popTypeResolution()) {
- type_4 = errorType;
- error(node, ts.Diagnostics.Enum_type_0_circularly_references_itself, symbolToString(symbol));
- }
- return (links.resolvedEnumType = type_4);
- }
// Get type from reference to named type that cannot be generic (enum or type parameter)
var res = tryGetDeclaredTypeOfSymbol(symbol);
if (res) {
@@ -39914,7 +40280,7 @@ var ts;
res.flags & 262144 /* TypeParameter */ ? getConstrainedTypeVariable(res, node) : getRegularTypeOfLiteralType(res) :
errorType;
}
- if (!(symbol.flags & 67220415 /* Value */ && isJSDocTypeReference(node))) {
+ if (!(symbol.flags & 111551 /* Value */ && isJSDocTypeReference(node))) {
return errorType;
}
var jsdocType = getJSDocTypeReference(node, symbol, typeArguments);
@@ -39922,7 +40288,7 @@ var ts;
return jsdocType;
}
// Resolve the type reference as a Type for the purpose of reporting errors.
- resolveTypeReferenceName(getTypeReferenceName(node), 67897832 /* Type */);
+ resolveTypeReferenceName(getTypeReferenceName(node), 788968 /* Type */);
return getTypeOfSymbol(symbol);
}
/**
@@ -39990,7 +40356,7 @@ var ts;
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) {
+ while (node && !ts.isStatement(node) && node.kind !== 298 /* JSDocComment */) {
var parent = node.parent;
if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
@@ -40068,10 +40434,10 @@ var ts;
if (!links.resolvedType) {
var symbol = void 0;
var type = void 0;
- var meaning = 67897832 /* Type */;
+ var meaning = 788968 /* Type */;
if (isJSDocTypeReference(node)) {
type = getIntendedTypeFromJSDocTypeReference(node);
- meaning |= 67220415 /* Value */;
+ meaning |= 111551 /* Value */;
}
if (!type) {
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
@@ -40126,10 +40492,10 @@ var ts;
return type;
}
function getGlobalValueSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67220415 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
+ return getGlobalSymbol(name, 111551 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
}
function getGlobalTypeSymbol(name, reportErrors) {
- return getGlobalSymbol(name, 67897832 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
+ return getGlobalSymbol(name, 788968 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
}
function getGlobalSymbol(name, meaning, diagnostic) {
// Don't track references for global symbols anyway, so value if `isReference` is arbitrary
@@ -40198,7 +40564,7 @@ var ts;
}
function getGlobalTypeOrUndefined(name, arity) {
if (arity === void 0) { arity = 0; }
- var symbol = getGlobalSymbol(name, 67897832 /* Type */, /*diagnostic*/ undefined);
+ var symbol = getGlobalSymbol(name, 788968 /* Type */, /*diagnostic*/ undefined);
return symbol && getTypeOfGlobalSymbol(symbol, arity);
}
function getGlobalExtractSymbol() {
@@ -40562,7 +40928,7 @@ var ts;
if (isEmptyAnonymousObjectType(type)) {
if (!(includes & 8388608 /* IncludesEmptyObject */)) {
includes |= 8388608 /* IncludesEmptyObject */;
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
}
else {
@@ -40570,13 +40936,13 @@ var ts;
if (type === wildcardType)
includes |= 4194304 /* IncludesWildcard */;
}
- else if ((strictNullChecks || !(flags & 98304 /* Nullable */)) && !ts.contains(typeSet, type)) {
+ else if ((strictNullChecks || !(flags & 98304 /* Nullable */)) && !typeSet.has(type.id.toString())) {
if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
// We have seen two distinct unit types which means we should reduce to an
// empty intersection. Adding TypeFlags.NonPrimitive causes that to happen.
includes |= 67108864 /* NonPrimitive */;
}
- typeSet.push(type);
+ typeSet.set(type.id.toString(), type);
}
includes |= flags & 68943871 /* IncludesMask */;
}
@@ -40689,8 +41055,9 @@ var ts;
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
// for intersections of types with signatures can be deterministic.
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
- var typeSet = [];
- var includes = addTypesToIntersection(typeSet, 0, types);
+ var typeMembershipMap = ts.createMap();
+ var includes = addTypesToIntersection(typeMembershipMap, 0, types);
+ var typeSet = ts.arrayFrom(typeMembershipMap.values());
// An intersection type is considered empty if it contains
// the type never, or
// more than one unit type or,
@@ -41385,7 +41752,7 @@ var ts;
links.resolvedSymbol = unknownSymbol;
return links.resolvedType = errorType;
}
- var targetMeaning = node.isTypeOf ? 67220415 /* Value */ : node.flags & 2097152 /* JSDoc */ ? 67220415 /* Value */ | 67897832 /* Type */ : 67897832 /* Type */;
+ var targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 2097152 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */;
// TODO: Future work: support unions/generics/whatever via a deferred import-type
var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
if (!innerModuleSymbol) {
@@ -41415,7 +41782,7 @@ var ts;
resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
}
else {
- var errorMessage = targetMeaning === 67220415 /* Value */
+ var errorMessage = targetMeaning === 111551 /* Value */
? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here
: ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
error(node, errorMessage, node.argument.literal.text);
@@ -41429,7 +41796,7 @@ var ts;
function resolveImportSymbolType(node, links, symbol, meaning) {
var resolvedSymbol = resolveSymbol(symbol);
links.resolvedSymbol = resolvedSymbol;
- if (meaning === 67220415 /* Value */) {
+ if (meaning === 111551 /* Value */) {
return links.resolvedType = getTypeOfSymbol(symbol); // intentionally doesn't use resolved symbol so type is cached as expected on the alias
}
else {
@@ -41727,9 +42094,9 @@ var ts;
case 166 /* FunctionType */:
case 167 /* ConstructorType */:
case 169 /* TypeLiteral */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
case 295 /* JSDocFunctionType */:
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 180 /* TypeOperator */:
return getTypeFromTypeOperatorNode(node);
@@ -41956,7 +42323,8 @@ var ts;
}
function maybeTypeParameterReference(node) {
return !(node.kind === 149 /* QualifiedName */ ||
- node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
+ node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName ||
+ node.parent.kind === 184 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier);
}
function isTypeParameterPossiblyReferenced(tp, node) {
// If the type parameter doesn't have exactly one declaration, if there are invening statement blocks
@@ -43224,7 +43592,7 @@ var ts;
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */);
- var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
+ var isPerformingExcessPropertyChecks = !isApparentIntersectionConstituent && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
@@ -43234,11 +43602,11 @@ var ts;
return 0 /* False */;
}
}
- if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
+ var isPerformingCommonPropertyChecks = relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
target.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target) &&
- (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)) &&
- !hasCommonProperties(source, target, isComparingJsxAttributes)) {
+ (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
+ if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
if (reportErrors) {
var calls = getSignaturesOfType(source, 0 /* Call */);
var constructs = getSignaturesOfType(source, 1 /* Construct */);
@@ -43266,10 +43634,10 @@ var ts;
else {
if (target.flags & 1048576 /* Union */) {
result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
// Validate against excess props using the original `source`
var discriminantType = findMatchingDiscriminantType(source, target) || filterPrimitivesIfContainsNonPrimitive(target);
- if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined)) {
+ if (!propertiesRelatedTo(source, discriminantType, reportErrors, /*excludedProperties*/ undefined, isIntersectionConstituent)) {
return 0 /* False */;
}
}
@@ -43277,9 +43645,9 @@ var ts;
else if (target.flags & 2097152 /* Intersection */) {
isIntersectionConstituent = true; // set here to affect the following trio of checks
result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
- if (result && isPerformingExcessPropertyChecks) {
+ if (result && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks)) {
// Validate against excess props using the original `source`
- if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) {
+ if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, /*isIntersectionConstituent*/ false)) {
return 0 /* False */;
}
}
@@ -43594,7 +43962,7 @@ var ts;
}
return result;
}
- function typeArgumentsRelatedTo(sources, targets, variances, reportErrors) {
+ function typeArgumentsRelatedTo(sources, targets, variances, reportErrors, isIntersectionConstituent) {
if (sources === void 0) { sources = ts.emptyArray; }
if (targets === void 0) { targets = ts.emptyArray; }
if (variances === void 0) { variances = ts.emptyArray; }
@@ -43621,10 +43989,10 @@ var ts;
related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t);
}
else if (variance === 1 /* Covariant */) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
else if (variance === 2 /* Contravariant */) {
- related = isRelatedTo(t, s, reportErrors);
+ related = isRelatedTo(t, s, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
else if (variance === 3 /* Bivariant */) {
// In the bivariant case we first compare contravariantly without reporting
@@ -43633,16 +44001,16 @@ var ts;
// which is generally easier to reason about.
related = isRelatedTo(t, s, /*reportErrors*/ false);
if (!related) {
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
else {
// In the invariant case we first compare covariantly, and only when that
// succeeds do we proceed to compare contravariantly. Thus, error elaboration
// will typically be based on the covariant check.
- related = isRelatedTo(s, t, reportErrors);
+ related = isRelatedTo(s, t, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
if (related) {
- related &= isRelatedTo(t, s, reportErrors);
+ related &= isRelatedTo(t, s, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
if (!related) {
@@ -43785,7 +44153,7 @@ var ts;
source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
!(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
var variances = getAliasVariances(source.aliasSymbol);
- var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances);
+ var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -43960,13 +44328,16 @@ var ts;
if (relation !== identityRelation) {
source = getApparentType(source);
}
+ else if (isGenericMappedType(source)) {
+ return 0 /* False */;
+ }
if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target &&
!(ts.getObjectFlags(source) & 8192 /* MarkerType */ || ts.getObjectFlags(target) & 8192 /* MarkerType */)) {
// We have type references to the same generic type, and the type references are not marker
// type references (which are intended by be compared structurally). Obtain the variance
// information for the type parameters and relate the type arguments accordingly.
var variances = getVariances(source.target);
- var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances);
+ var varianceResult = relateVariances(source.typeArguments, target.typeArguments, variances, isIntersectionConstituent);
if (varianceResult !== undefined) {
return varianceResult;
}
@@ -43994,7 +44365,7 @@ var ts;
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) {
// Report structural errors only if we haven't reported any errors yet
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined, isIntersectionConstituent);
if (result) {
result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors);
if (result) {
@@ -44029,8 +44400,8 @@ var ts;
}
}
return 0 /* False */;
- function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
- if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
+ function relateVariances(sourceTypeArguments, targetTypeArguments, variances, isIntersectionConstituent) {
+ if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors, isIntersectionConstituent)) {
return result;
}
if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) {
@@ -44155,7 +44526,7 @@ var ts;
if (sourceProperty === targetProperty)
return "continue";
// We compare the source property to the target in the context of a single discriminant type.
- var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false);
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false, /*isIntersectionConstituent*/ false);
// If the target property could not be found, or if the properties were not related,
// then this constituent is not a match.
if (!related) {
@@ -44185,7 +44556,7 @@ var ts;
var result = -1 /* True */;
for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
var type = matchingTypes_1[_b];
- result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties);
+ result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties, /*isIntersectionConstituent*/ false);
if (result) {
result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false);
if (result) {
@@ -44220,7 +44591,7 @@ var ts;
}
return result || properties;
}
- function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */);
var source = getTypeOfSourceProperty(sourceProp);
if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) {
@@ -44260,10 +44631,10 @@ var ts;
return result_7;
}
else {
- return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors, /*headMessage*/ undefined, isIntersectionConstituent);
}
}
- function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {
@@ -44301,7 +44672,7 @@ var ts;
return 0 /* False */;
}
// If the target comes from a partial union prop, allow `undefined` in the target type
- var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
@@ -44324,7 +44695,7 @@ var ts;
}
return related;
}
- function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties, isIntersectionConstituent) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target, excludedProperties);
}
@@ -44413,7 +44784,7 @@ var ts;
if (!(targetProp.flags & 4194304 /* Prototype */)) {
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp && sourceProp !== targetProp) {
- var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, isIntersectionConstituent);
if (!related) {
return 0 /* False */;
}
@@ -44648,23 +45019,27 @@ var ts;
}
}
function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue) {
- var match;
+ // undefined=unknown, true=discriminated, false=not discriminated
+ // The state of each type progresses from left to right. Discriminated types stop at 'true'.
+ var discriminable = target.types.map(function (_) { return undefined; });
for (var _i = 0, discriminators_1 = discriminators; _i < discriminators_1.length; _i++) {
var _a = discriminators_1[_i], getDiscriminatingType = _a[0], propertyName = _a[1];
+ var i = 0;
for (var _b = 0, _c = target.types; _b < _c.length; _b++) {
var type = _c[_b];
var targetType = getTypeOfPropertyOfType(type, propertyName);
if (targetType && related(getDiscriminatingType(), targetType)) {
- if (match) {
- if (type === match)
- continue; // Finding multiple fields which discriminate to the same type is fine
- return defaultValue;
- }
- match = type;
+ discriminable[i] = discriminable[i] === undefined ? true : discriminable[i];
}
+ else {
+ discriminable[i] = false;
+ }
+ i++;
}
}
- return match || defaultValue;
+ var match = discriminable.indexOf(/*searchElement*/ true);
+ // make sure exactly 1 matches before returning it
+ return match === -1 || discriminable.indexOf(/*searchElement*/ true, match + 1) !== -1 ? defaultValue : target.types[match];
}
/**
* A type is 'weak' if it is an object type with at least one optional property
@@ -45476,7 +45851,7 @@ var ts;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
param.parent.parameters.indexOf(param) > -1 &&
- (resolveName(param, param.name.escapedText, 67897832 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
+ (resolveName(param, param.name.escapedText, 788968 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
param.name.originalKeywordKind && ts.isTypeNodeKind(param.name.originalKeywordKind))) {
var newName = "arg" + param.parent.parameters.indexOf(param);
errorOrSuggestion(noImplicitAny, declaration, ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, ts.declarationNameToString(param.name));
@@ -45640,7 +46015,7 @@ var ts;
objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
objectFlags & 32 /* Mapped */ ||
- type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));
+ type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && couldUnionOrIntersectionContainTypeVariables(type));
}
function couldUnionOrIntersectionContainTypeVariables(type) {
if (type.couldContainTypeVariables === undefined) {
@@ -45795,6 +46170,8 @@ var ts;
var visited;
var bivariant = false;
var propagationType;
+ var inferenceMatch = false;
+ var inferenceIncomplete = false;
var allowComplexConstraintInference = true;
inferFromTypes(originalSource, originalTarget);
function inferFromTypes(source, target) {
@@ -45817,43 +46194,54 @@ var ts;
inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
return;
}
- if (source.flags & 1048576 /* Union */ && target.flags & 1048576 /* Union */ && !(source.flags & 1024 /* EnumLiteral */ && target.flags & 1024 /* EnumLiteral */) ||
- source.flags & 2097152 /* Intersection */ && target.flags & 2097152 /* Intersection */) {
- // Source and target are both unions or both intersections. If source and target
- // are the same type, just relate each constituent type to itself.
- if (source === target) {
- for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
- var t = _a[_i];
- inferFromTypes(t, t);
- }
- return;
+ if (source === target && source.flags & 3145728 /* UnionOrIntersection */) {
+ // When source and target are the same union or intersection type, just relate each constituent
+ // type to itself.
+ for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ inferFromTypes(t, t);
}
- // Find each source constituent type that has an identically matching target constituent
- // type, and for each such type infer from the type to itself. When inferring from a
- // type to itself we effectively find all type parameter occurrences within that type
- // and infer themselves as their type arguments. We have special handling for numeric
- // and string literals because the number and string types are not represented as unions
- // of all their possible values.
- var matchingTypes = void 0;
- for (var _b = 0, _c = source.types; _b < _c.length; _b++) {
- var t = _c[_b];
- if (typeIdenticalToSomeType(t, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t);
- inferFromTypes(t, t);
- }
- else if (t.flags & (256 /* NumberLiteral */ | 128 /* StringLiteral */)) {
- var b = getBaseTypeOfLiteralType(t);
- if (typeIdenticalToSomeType(b, target.types)) {
- (matchingTypes || (matchingTypes = [])).push(t, b);
- }
+ return;
+ }
+ if (target.flags & 1048576 /* Union */) {
+ if (source.flags & 1048576 /* Union */) {
+ // First, infer between identically matching source and target constituents and remove the
+ // matching types.
+ var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
+ // Next, infer between closely matching source and target constituents and remove
+ // the matching types. Types closely match when they are instantiations of the same
+ // object type or instantiations of the same type alias.
+ var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
}
+ source = getUnionType(sources);
+ target = getUnionType(targets);
}
- // Next, to improve the quality of inferences, reduce the source and target types by
- // removing the identically matched constituents. For example, when inferring from
- // 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'.
- if (matchingTypes) {
- source = removeTypesFromUnionOrIntersection(source, matchingTypes);
- target = removeTypesFromUnionOrIntersection(target, matchingTypes);
+ else {
+ if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
+ return;
+ if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
+ return;
+ }
+ }
+ else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
+ // We reduce intersection types only when they contain naked type parameters. For example, when
+ // inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
+ // infer { extra: any } for T. But when inferring to 'string[] & Iterable' we want to keep the
+ // string[] on the source side and infer string for T.
+ if (source.flags & 2097152 /* Intersection */) {
+ // Infer between identically matching source and target constituents and remove the matching types.
+ var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
+ if (sources.length === 0 || targets.length === 0) {
+ return;
+ }
+ source = getIntersectionType(sources);
+ target = getIntersectionType(targets);
+ }
+ else if (!(source.flags & 1048576 /* Union */)) {
+ if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
+ return;
}
}
else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
@@ -45899,13 +46287,14 @@ var ts;
clearCachedInferences(inferences);
}
}
+ inferenceMatch = true;
return;
}
else {
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
var simplified = getSimplifiedType(target, /*writing*/ false);
if (simplified !== target) {
- inferFromTypesOnce(source, simplified);
+ invokeOnce(source, simplified, inferFromTypes);
}
else if (target.flags & 8388608 /* IndexedAccess */) {
var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
@@ -45914,13 +46303,13 @@ var ts;
if (indexType.flags & 63176704 /* Instantiable */) {
var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
if (simplified_1 && simplified_1 !== target) {
- inferFromTypesOnce(source, simplified_1);
+ invokeOnce(source, simplified_1, inferFromTypes);
}
}
}
}
}
- if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {
+ if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
// If source and target are references to the same generic type, infer from type arguments
inferFromTypeArguments(source.typeArguments || ts.emptyArray, target.typeArguments || ts.emptyArray, getVariances(source.target));
}
@@ -45950,16 +46339,16 @@ var ts;
}
else if (target.flags & 16777216 /* Conditional */ && !contravariant) {
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
- inferToMultipleTypes(source, targetTypes, /*isIntersection*/ false);
+ inferToMultipleTypes(source, targetTypes, target.flags);
}
else if (target.flags & 3145728 /* UnionOrIntersection */) {
- inferToMultipleTypes(source, target.types, !!(target.flags & 2097152 /* Intersection */));
+ inferToMultipleTypes(source, target.types, target.flags);
}
else if (source.flags & 1048576 /* Union */) {
// Source is a union or intersection type, infer from each constituent type
var sourceTypes = source.types;
- for (var _d = 0, sourceTypes_3 = sourceTypes; _d < sourceTypes_3.length; _d++) {
- var sourceType = sourceTypes_3[_d];
+ for (var _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) {
+ var sourceType = sourceTypes_3[_e];
inferFromTypes(sourceType, target);
}
}
@@ -45983,38 +46372,59 @@ var ts;
source = apparentSource;
}
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
- var key = source.id + "," + target.id;
- if (visited && visited.get(key)) {
- return;
- }
- (visited || (visited = ts.createMap())).set(key, true);
- // If we are already processing another target type with the same associated symbol (such as
- // an instantiation of the same generic type), we do not explore this target as it would yield
- // no further inferences. We exclude the static side of classes from this check since it shares
- // its symbol with the instance side which would lead to false positives.
- var isNonConstructorObject = target.flags & 524288 /* Object */ &&
- !(ts.getObjectFlags(target) & 16 /* Anonymous */ && target.symbol && target.symbol.flags & 32 /* Class */);
- var symbol = isNonConstructorObject ? target.symbol : undefined;
- if (symbol) {
- if (ts.contains(symbolStack, symbol)) {
- return;
- }
- (symbolStack || (symbolStack = [])).push(symbol);
- inferFromObjectTypes(source, target);
- symbolStack.pop();
- }
- else {
- inferFromObjectTypes(source, target);
+ invokeOnce(source, target, inferFromObjectTypes);
+ }
+ }
+ }
+ function invokeOnce(source, target, action) {
+ var key = source.id + "," + target.id;
+ var status = visited && visited.get(key);
+ if (status !== undefined) {
+ if (status & 1)
+ inferenceMatch = true;
+ if (status & 2)
+ inferenceIncomplete = true;
+ return;
+ }
+ (visited || (visited = ts.createMap())).set(key, 0);
+ var saveInferenceMatch = inferenceMatch;
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceMatch = false;
+ inferenceIncomplete = false;
+ action(source, target);
+ visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0));
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ }
+ function inferFromMatchingType(source, targets, matches) {
+ var matched = false;
+ for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
+ var t = targets_1[_i];
+ if (matches(source, t)) {
+ inferFromTypes(source, t);
+ matched = true;
+ }
+ }
+ return matched;
+ }
+ function inferFromMatchingTypes(sources, targets, matches) {
+ var matchedSources;
+ var matchedTargets;
+ for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
+ var t = targets_2[_i];
+ for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
+ var s = sources_1[_a];
+ if (matches(s, t)) {
+ inferFromTypes(s, t);
+ matchedSources = ts.appendIfUnique(matchedSources, s);
+ matchedTargets = ts.appendIfUnique(matchedTargets, t);
}
}
}
- function inferFromTypesOnce(source, target) {
- var key = source.id + "," + target.id;
- if (!visited || !visited.get(key)) {
- (visited || (visited = ts.createMap())).set(key, true);
- inferFromTypes(source, target);
- }
- }
+ return [
+ matchedSources ? ts.filter(sources, function (t) { return !ts.contains(matchedSources, t); }) : sources,
+ matchedTargets ? ts.filter(targets, function (t) { return !ts.contains(matchedTargets, t); }) : targets,
+ ];
}
function inferFromTypeArguments(sourceTypes, targetTypes, variances) {
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
@@ -46048,29 +46458,69 @@ var ts;
}
return undefined;
}
- function inferToMultipleTypes(source, targets, isIntersection) {
- // We infer from types that are not naked type variables first so that inferences we
- // make from nested naked type variables and given slightly higher priority by virtue
- // of being first in the candidates array.
+ function inferToMultipleTypes(source, targets, targetFlags) {
var typeVariableCount = 0;
- for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
- var t = targets_1[_i];
- if (getInferenceInfoForType(t)) {
- typeVariableCount++;
+ if (targetFlags & 1048576 /* Union */) {
+ var nakedTypeVariable = void 0;
+ var sources = source.flags & 1048576 /* Union */ ? source.types : [source];
+ var matched_1 = new Array(sources.length);
+ var saveInferenceIncomplete = inferenceIncomplete;
+ inferenceIncomplete = false;
+ // First infer to types that are not naked type variables. For each source type we
+ // track whether inferences were made from that particular type to some target.
+ for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
+ var t = targets_3[_i];
+ if (getInferenceInfoForType(t)) {
+ nakedTypeVariable = t;
+ typeVariableCount++;
+ }
+ else {
+ for (var i = 0; i < sources.length; i++) {
+ var saveInferenceMatch = inferenceMatch;
+ inferenceMatch = false;
+ inferFromTypes(sources[i], t);
+ if (inferenceMatch)
+ matched_1[i] = true;
+ inferenceMatch = inferenceMatch || saveInferenceMatch;
+ }
+ }
}
- else {
- inferFromTypes(source, t);
+ var inferenceComplete = !inferenceIncomplete;
+ inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
+ // If the target has a single naked type variable and inference completed (meaning we
+ // explored the types fully), create a union of the source types from which no inferences
+ // have been made so far and infer from that union to the naked type variable.
+ if (typeVariableCount === 1 && inferenceComplete) {
+ var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; });
+ if (unmatched.length) {
+ inferFromTypes(getUnionType(unmatched), nakedTypeVariable);
+ return;
+ }
+ }
+ }
+ else {
+ // We infer from types that are not naked type variables first so that inferences we
+ // make from nested naked type variables and given slightly higher priority by virtue
+ // of being first in the candidates array.
+ for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
+ var t = targets_4[_a];
+ if (getInferenceInfoForType(t)) {
+ typeVariableCount++;
+ }
+ else {
+ inferFromTypes(source, t);
+ }
}
}
// Inferences directly to naked type variables are given lower priority as they are
// less specific. For example, when inferring from Promise to T | Promise,
// we want to infer string for T, not Promise | string. For intersection types
// we only infer to single naked type variables.
- if (isIntersection ? typeVariableCount === 1 : typeVariableCount !== 0) {
+ if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) {
var savePriority = priority;
priority |= 1 /* NakedTypeVariable */;
- for (var _a = 0, targets_2 = targets; _a < targets_2.length; _a++) {
- var t = targets_2[_a];
+ for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
+ var t = targets_5[_b];
if (getInferenceInfoForType(t)) {
inferFromTypes(source, t);
}
@@ -46135,6 +46585,27 @@ var ts;
return false;
}
function inferFromObjectTypes(source, target) {
+ // If we are already processing another target type with the same associated symbol (such as
+ // an instantiation of the same generic type), we do not explore this target as it would yield
+ // no further inferences. We exclude the static side of classes from this check since it shares
+ // its symbol with the instance side which would lead to false positives.
+ var isNonConstructorObject = target.flags & 524288 /* Object */ &&
+ !(ts.getObjectFlags(target) & 16 /* Anonymous */ && target.symbol && target.symbol.flags & 32 /* Class */);
+ var symbol = isNonConstructorObject ? target.symbol : undefined;
+ if (symbol) {
+ if (ts.contains(symbolStack, symbol)) {
+ inferenceIncomplete = true;
+ return;
+ }
+ (symbolStack || (symbolStack = [])).push(symbol);
+ inferFromObjectTypesWorker(source, target);
+ symbolStack.pop();
+ }
+ else {
+ inferFromObjectTypesWorker(source, target);
+ }
+ }
+ function inferFromObjectTypesWorker(source, target) {
if (isGenericMappedType(source) && isGenericMappedType(target)) {
// The source and target types are generic types { [P in S]: X } and { [P in T]: Y }, so we infer
// from S to T and from X to Y.
@@ -46233,28 +46704,12 @@ var ts;
}
}
}
- function typeIdenticalToSomeType(type, types) {
- for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
- var t = types_11[_i];
- if (isTypeIdenticalTo(t, type)) {
- return true;
- }
- }
- return false;
+ function isTypeOrBaseIdenticalTo(s, t) {
+ return isTypeIdenticalTo(s, t) || !!(s.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t);
}
- /**
- * Return a new union or intersection type computed by removing a given set of types
- * from a given union or intersection type.
- */
- function removeTypesFromUnionOrIntersection(type, typesToRemove) {
- var reducedTypes = [];
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (!typeIdenticalToSomeType(t, typesToRemove)) {
- reducedTypes.push(t);
- }
- }
- return type.flags & 1048576 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);
+ function isTypeCloselyMatchedBy(s, t) {
+ return !!(s.flags & 524288 /* Object */ && t.flags & 524288 /* Object */ && s.symbol && s.symbol === t.symbol ||
+ s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol);
}
function hasPrimitiveConstraint(type) {
var constraint = getConstraintOfTypeParameter(type);
@@ -46405,7 +46860,7 @@ var ts;
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
+ resolveName(node, node.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
/*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
@@ -46602,8 +47057,8 @@ var ts;
}
function getTypeFactsOfTypes(types) {
var result = 0 /* None */;
- for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
- var t = types_12[_i];
+ for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
+ var t = types_11[_i];
result |= getTypeFacts(t);
}
return result;
@@ -46978,8 +47433,8 @@ var ts;
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var t = types_13[_i];
+ for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
+ var t = types_12[_i];
if (!(t.flags & 131072 /* Never */)) {
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
return false;
@@ -47931,8 +48386,11 @@ var ts;
}
return type;
}
+ function isExportOrExportExpression(location) {
+ return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); });
+ }
function markAliasReferenced(symbol, location) {
- if (isNonLocalAlias(symbol, /*excludes*/ 67220415 /* Value */) && !isInTypeQuery(location) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && ((compilerOptions.preserveConstEnums && isExportOrExportExpression(location)) || !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol)))) {
markAliasSymbolAsReferenced(symbol);
}
}
@@ -48825,6 +49283,15 @@ var ts;
}
return false;
}
+ function getContextualIterationType(kind, functionDecl) {
+ var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2 /* Async */);
+ var contextualReturnType = getContextualReturnType(functionDecl);
+ if (contextualReturnType) {
+ return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
+ || undefined;
+ }
+ return undefined;
+ }
function getContextualReturnType(functionDecl) {
// If the containing function has a return type annotation, is a constructor, or is a get accessor whose
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
@@ -48918,7 +49385,7 @@ var ts;
}
else if (ts.isIdentifier(lhs.expression)) {
var id = lhs.expression;
- var parentSymbol = resolveName(id, id.escapedText, 67220415 /* Value */, undefined, id.escapedText, /*isUse*/ true);
+ var parentSymbol = resolveName(id, id.escapedText, 111551 /* Value */, undefined, id.escapedText, /*isUse*/ true);
if (parentSymbol) {
var annotated = ts.getEffectiveTypeAnnotationNode(parentSymbol.valueDeclaration);
if (annotated) {
@@ -49106,9 +49573,12 @@ var ts;
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
// be "pushed" onto a node using the contextualType property.
function getApparentTypeOfContextualType(node, contextFlags) {
- var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
- if (contextualType) {
- var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true);
+ var contextualType = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, contextFlags) :
+ getContextualType(node, contextFlags);
+ var instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
+ if (instantiatedType) {
+ var apparentType = mapType(instantiatedType, getApparentType, /*noReductions*/ true);
if (apparentType.flags & 1048576 /* Union */) {
if (ts.isObjectLiteralExpression(node)) {
return discriminateContextualTypeByObjectMembers(node, apparentType);
@@ -49158,7 +49628,7 @@ var ts;
return type;
}
/**
- * Woah! Do you really want to use this function?
+ * Whoa! Do you really want to use this function?
*
* Unless you're trying to get the *non-apparent* type for a
* value-literal type or you're authoring relevant portions of this algorithm,
@@ -49409,9 +49879,7 @@ var ts;
if (typeTagSignature) {
return typeTagSignature;
}
- var type = ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) :
- getApparentTypeOfContextualType(node, 1 /* Signature */);
+ var type = getApparentTypeOfContextualType(node, 1 /* Signature */);
if (!type) {
return undefined;
}
@@ -49420,8 +49888,8 @@ var ts;
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var current = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var current = types_13[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -49972,7 +50440,7 @@ var ts;
function getJsxType(name, location) {
var namespace = getJsxNamespaceAt(location);
var exports = namespace && getExportsOfSymbol(namespace);
- var typeSymbol = exports && getSymbol(exports, name, 67897832 /* Type */);
+ var typeSymbol = exports && getSymbol(exports, name, 788968 /* Type */);
return typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType;
}
/**
@@ -50046,7 +50514,7 @@ var ts;
*/
function getNameFromJsxElementAttributesContainer(nameOfAttribPropContainer, jsxNamespace) {
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [symbol]
- var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 67897832 /* Type */);
+ var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 788968 /* Type */);
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [type]
var jsxElementAttribPropInterfaceType = jsxElementAttribPropInterfaceSym && getDeclaredTypeOfSymbol(jsxElementAttribPropInterfaceSym);
// The properties of JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute
@@ -50070,7 +50538,7 @@ var ts;
}
function getJsxLibraryManagedAttributes(jsxNamespace) {
// JSX.LibraryManagedAttributes [symbol]
- return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 67897832 /* Type */);
+ return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 788968 /* Type */);
}
/// e.g. "props" for React.d.ts,
/// or 'undefined' if ElementAttributesProperty doesn't exist (which means all
@@ -50222,13 +50690,13 @@ var ts;
var reactRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
var reactNamespace = getJsxNamespace(node);
var reactLocation = isNodeOpeningLikeElement ? node.tagName : node;
- var reactSym = resolveName(reactLocation, reactNamespace, 67220415 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true);
+ var reactSym = resolveName(reactLocation, reactNamespace, 111551 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true);
if (reactSym) {
// Mark local symbol as referenced here because it might not have been marked
// if jsx emit was not react as there wont be error being emitted
reactSym.isReferenced = 67108863 /* All */;
- // If react symbol is alias, mark it as referenced
- if (reactSym.flags & 2097152 /* Alias */ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) {
+ // If react symbol is alias, mark it as refereced
+ if (reactSym.flags & 2097152 /* Alias */) {
markAliasSymbolAsReferenced(reactSym);
}
}
@@ -50553,7 +51021,7 @@ var ts;
}
function checkPropertyNotUsedBeforeDeclaration(prop, node, right) {
var valueDeclaration = prop.valueDeclaration;
- if (!valueDeclaration) {
+ if (!valueDeclaration || ts.getSourceFileOfNode(node).isDeclarationFile) {
return;
}
var diagnosticMessage;
@@ -50669,7 +51137,7 @@ var ts;
return prop !== undefined && prop.valueDeclaration && ts.hasModifier(prop.valueDeclaration, 32 /* Static */);
}
function getSuggestedSymbolForNonexistentProperty(name, containingType) {
- return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 67220415 /* Value */);
+ return getSpellingSuggestionForName(ts.isString(name) ? name : ts.idText(name), getPropertiesOfType(containingType), 111551 /* Value */);
}
function getSuggestionForNonexistentProperty(name, containingType) {
var suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
@@ -52153,8 +52621,8 @@ var ts;
if (apparentType.flags & 1048576 /* Union */) {
var types = apparentType.types;
var hasSignatures = false;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var constituent = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var constituent = types_14[_i];
var signatures = getSignaturesOfType(constituent, kind);
if (signatures.length !== 0) {
hasSignatures = true;
@@ -52305,8 +52773,8 @@ var ts;
var exports = namespace && getExportsOfSymbol(namespace);
// We fake up a SFC signature for each intrinsic, however a more specific per-element signature drawn from the JSX declaration
// file would probably be preferable.
- var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */);
- var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node);
+ var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* Type */);
+ var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* Type */, node);
var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */));
var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
parameterSymbol.type = result;
@@ -52535,7 +53003,7 @@ var ts;
if (!globalESSymbol) {
return false;
}
- return globalESSymbol === resolveName(left, "Symbol", 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
+ return globalESSymbol === resolveName(left, "Symbol", 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
}
function checkImportCallExpression(node) {
// Check grammar of dynamic import
@@ -52595,7 +53063,7 @@ var ts;
// Make sure require is not a local function
if (!ts.isIdentifier(node.expression))
return ts.Debug.fail();
- var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); // TODO: GH#18217
+ var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); // TODO: GH#18217
if (resolvedRequire === requireSymbol) {
return true;
}
@@ -52704,8 +53172,8 @@ var ts;
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
- error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
+ error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system);
}
var file = ts.getSourceFileOfNode(node);
ts.Debug.assert(!!(file.flags & 1048576 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
@@ -52895,7 +53363,7 @@ var ts;
links.type = contextualType;
var decl = parameter.valueDeclaration;
if (decl.name.kind !== 73 /* Identifier */) {
- // if inference didn't come up with anything but {}, fall back to the binding pattern if present.
+ // if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
@@ -53003,7 +53471,7 @@ var ts;
nextType && isUnitType(nextType)) {
var contextualType = !contextualSignature ? undefined :
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
- getReturnTypeOfSignature(contextualSignature);
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
if (isGenerator) {
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0 /* Yield */, isAsync);
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1 /* Return */, isAsync);
@@ -53021,7 +53489,7 @@ var ts;
nextType = getWidenedType(nextType);
}
if (isGenerator) {
- return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || unknownType, isAsync);
+ return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || getContextualIterationType(2 /* Next */, func) || unknownType, isAsync);
}
else {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -53141,8 +53609,8 @@ var ts;
var witnesses = getSwitchClauseTypeOfWitnesses(node);
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
- var type_5 = getBaseConstraintOfType(operandType) || operandType;
- return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
+ var type_4 = getBaseConstraintOfType(operandType) || operandType;
+ return !!(filterType(type_4, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
}
var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
@@ -53515,7 +53983,11 @@ var ts;
}
}
var operandType = checkExpression(node.expression);
- return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ var awaitedType = checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
+ if (awaitedType === operandType && awaitedType !== errorType && !(operandType.flags & 3 /* AnyOrUnknown */)) {
+ addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(node, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
+ }
+ return awaitedType;
}
function checkPrefixUnaryExpression(node) {
var operandType = checkExpression(node.operand);
@@ -53600,8 +54072,8 @@ var ts;
}
if (type.flags & 3145728 /* UnionOrIntersection */) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -53710,7 +54182,7 @@ var ts;
error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
else {
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(property, 4 /* Rest */);
}
var nonRestNames = [];
@@ -54084,7 +54556,7 @@ var ts;
var propType = getTypeOfSymbol(prop);
if (propType.symbol && propType.symbol.flags & 32 /* Class */) {
var name = prop.escapedName;
- var symbol = resolveName(prop.valueDeclaration, name, 67897832 /* Type */, undefined, name, /*isUse*/ false);
+ var symbol = resolveName(prop.valueDeclaration, name, 788968 /* Type */, undefined, name, /*isUse*/ false);
if (symbol && symbol.declarations.some(ts.isJSDocTypedefTag)) {
grammarErrorOnNode(symbol.declarations[0], ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
return grammarErrorOnNode(prop.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name));
@@ -54233,7 +54705,7 @@ var ts;
if (node.asteriskToken) {
// Async generator functions prior to ESNext require the __await, __asyncDelegator,
// and __asyncValues helpers
- if (isAsync && languageVersion < 8 /* ESNext */) {
+ if (isAsync && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 53248 /* AsyncDelegatorIncludes */);
}
// Generator functions prior to ES2015 require the __values helper
@@ -54263,7 +54735,7 @@ var ts;
return getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, isAsync)
|| anyType;
}
- return anyType;
+ return getContextualIterationType(2 /* Next */, func) || anyType;
}
function checkConditionalExpression(node, checkMode) {
checkTruthinessExpression(node.condition);
@@ -54613,7 +55085,8 @@ var ts;
var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) ||
(node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) ||
((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node));
+ (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node)) ||
+ (node.parent.kind === 258 /* ExportSpecifier */ && (compilerOptions.preserveConstEnums || node.flags & 4194304 /* Ambient */)); // We allow reexporting const enums
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -54878,7 +55351,7 @@ var ts;
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4 /* Invalid */)) {
// Async generators prior to ESNext require the __await and __asyncGenerator helpers
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) {
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 12288 /* AsyncGeneratorIncludes */);
}
// Async functions prior to ES2017 require the __awaiter helper
@@ -54941,13 +55414,6 @@ var ts;
}
}
function checkClassForDuplicateDeclarations(node) {
- var Declaration;
- (function (Declaration) {
- Declaration[Declaration["Getter"] = 1] = "Getter";
- Declaration[Declaration["Setter"] = 2] = "Setter";
- Declaration[Declaration["Method"] = 4] = "Method";
- Declaration[Declaration["Property"] = 3] = "Property";
- })(Declaration || (Declaration = {}));
var instanceNames = ts.createUnderscoreEscapedMap();
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
@@ -54956,7 +55422,7 @@ var ts;
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
- addName(instanceNames, param.name, param.name.escapedText, 3 /* Property */);
+ addName(instanceNames, param.name, param.name.escapedText, 3 /* GetOrSetAccessor */);
}
}
}
@@ -54968,16 +55434,16 @@ var ts;
if (name && memberName) {
switch (member.kind) {
case 159 /* GetAccessor */:
- addName(names, name, memberName, 1 /* Getter */);
+ addName(names, name, memberName, 1 /* GetAccessor */);
break;
case 160 /* SetAccessor */:
- addName(names, name, memberName, 2 /* Setter */);
+ addName(names, name, memberName, 2 /* SetAccessor */);
break;
case 155 /* PropertyDeclaration */:
- addName(names, name, memberName, 3 /* Property */);
+ addName(names, name, memberName, 3 /* GetOrSetAccessor */);
break;
case 157 /* MethodDeclaration */:
- addName(names, name, memberName, 4 /* Method */);
+ addName(names, name, memberName, 8 /* Method */);
break;
}
}
@@ -54986,8 +55452,8 @@ var ts;
function addName(names, location, name, meaning) {
var prev = names.get(name);
if (prev) {
- if (prev & 4 /* Method */) {
- if (meaning !== 4 /* Method */) {
+ if (prev & 8 /* Method */) {
+ if (meaning !== 8 /* Method */) {
error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));
}
}
@@ -55555,6 +56021,7 @@ var ts;
}
var duplicateFunctionDeclaration = false;
var multipleConstructorImplementation = false;
+ var hasNonAmbientClass = false;
for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
var current = declarations_4[_i];
var node = current;
@@ -55570,6 +56037,9 @@ var ts;
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
+ if ((node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */) && !inAmbientContext) {
+ hasNonAmbientClass = true;
+ }
if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
@@ -55611,6 +56081,15 @@ var ts;
error(ts.getNameOfDeclaration(declaration), ts.Diagnostics.Duplicate_function_implementation);
});
}
+ if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */) {
+ // A non-ambient class cannot be an implementation for a non-constructor function/class merge
+ // TODO: The below just replicates our older error from when classes and functions were
+ // entirely unable to merge - a more helpful message like "Class declaration cannot implement overload list"
+ // might be warranted. :shrug:
+ ts.forEach(declarations, function (declaration) {
+ addDuplicateDeclarationError(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Duplicate_identifier_0, ts.symbolName(symbol), ts.filter(declarations, function (d) { return d !== declaration; }));
+ });
+ }
// Abstract methods can't have an implementation -- in particular, they don't need one.
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&
!ts.hasModifier(lastSeenNonAmbientDeclaration, 128 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) {
@@ -55632,13 +56111,6 @@ var ts;
}
}
}
- var DeclarationSpaces;
- (function (DeclarationSpaces) {
- DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None";
- DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue";
- DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType";
- DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace";
- })(DeclarationSpaces || (DeclarationSpaces = {}));
function checkExportsOnMergedDeclarations(node) {
if (!produceDiagnostics) {
return;
@@ -55702,8 +56174,9 @@ var ts;
case 242 /* InterfaceDeclaration */:
case 243 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return 2 /* ExportType */;
case 245 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
@@ -55801,9 +56274,6 @@ var ts;
*/
function checkAwaitedType(type, errorNode, diagnosticMessage, arg0) {
var awaitedType = getAwaitedType(type, errorNode, diagnosticMessage, arg0);
- if (awaitedType === type && !(type.flags & 3 /* AnyOrUnknown */)) {
- addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(errorNode, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
- }
return awaitedType || errorType;
}
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -55962,7 +56432,7 @@ var ts;
error(returnTypeNode, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
return;
}
- var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true);
+ var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 111551 /* Value */, /*ignoreErrors*/ true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
@@ -55985,7 +56455,7 @@ var ts;
}
// Verify there is no local declaration that could collide with the promise constructor.
var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
- var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 67220415 /* Value */);
+ var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 111551 /* Value */);
if (collidingSymbol) {
error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, ts.idText(rootName), ts.entityNameToString(promiseConstructorName));
return;
@@ -56042,7 +56512,7 @@ var ts;
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
+ var meaning = (typeName.kind === 73 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true);
if (rootSymbol
&& rootSymbol.flags & 2097152 /* Alias */
@@ -56081,8 +56551,8 @@ var ts;
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
@@ -56810,7 +57280,7 @@ var ts;
}
}
if (node.kind === 187 /* BindingElement */) {
- if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) {
+ if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 99 /* ESNext */) {
checkExternalEmitHelpers(node, 4 /* Rest */);
}
// check computed properties inside property names of binding elements
@@ -57024,7 +57494,7 @@ var ts;
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) {
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 99 /* ESNext */) {
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
checkExternalEmitHelpers(node, 32768 /* ForAwaitOfIncludes */);
}
@@ -58301,7 +58771,7 @@ var ts;
// derived class instance member variables and accessors, but not by other kinds of members.
// NOTE: assignability is checked in checkClassDeclaration
var baseProperties = getPropertiesOfType(baseType);
- for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
+ basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304 /* Prototype */) {
@@ -58310,54 +58780,65 @@ var ts;
var derived = getTargetSymbol(getPropertyOfObjectType(type, base.escapedName)); // TODO: GH#18217
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration.");
- if (derived) {
- // In order to resolve whether the inherited method was overridden in the base class or not,
- // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
- // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
- if (derived === base) {
- // derived class inherits base without override/redeclaration
- var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
- // It is an error to inherit an abstract member without implementing it or being declared abstract.
- // If there is no declaration for the derived class (as in the case of class expressions),
- // then the class cannot be declared abstract.
- if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 210 /* ClassExpression */) {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
- }
- else {
- error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
+ // In order to resolve whether the inherited method was overridden in the base class or not,
+ // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
+ // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
+ if (derived === base) {
+ // derived class inherits base without override/redeclaration
+ var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
+ // It is an error to inherit an abstract member without implementing it or being declared abstract.
+ // If there is no declaration for the derived class (as in the case of class expressions),
+ // then the class cannot be declared abstract.
+ if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
+ // Searches other base types for a declaration that would satisfy the inherited abstract member.
+ // (The class may have more than one base type via declaration merging with an interface with the
+ // same name.)
+ for (var _a = 0, _b = getBaseTypes(type); _a < _b.length; _a++) {
+ var otherBaseType = _b[_a];
+ if (otherBaseType === baseType)
+ continue;
+ var baseSymbol = getPropertyOfObjectType(otherBaseType, base.escapedName);
+ var derivedElsewhere = baseSymbol && getTargetSymbol(baseSymbol);
+ if (derivedElsewhere && derivedElsewhere !== base) {
+ continue basePropertyCheck;
}
}
- }
- else {
- // derived overrides base.
- var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
- if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
- // either base or derived property is private - not override, skip it
- continue;
- }
- if (isPrototypeProperty(base) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) {
- // method is overridden with method or property/accessor is overridden with property/accessor - correct case
- continue;
- }
- var errorMessage = void 0;
- if (isPrototypeProperty(base)) {
- if (derived.flags & 98304 /* Accessor */) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
- }
- else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
- }
- }
- else if (base.flags & 98304 /* Accessor */) {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ if (derivedClassDecl.kind === 210 /* ClassExpression */) {
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
- errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
}
- error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
}
}
+ else {
+ // derived overrides base.
+ var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
+ if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
+ // either base or derived property is private - not override, skip it
+ continue;
+ }
+ if (isPrototypeProperty(base) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) {
+ // method is overridden with method or property/accessor is overridden with property/accessor - correct case
+ continue;
+ }
+ var errorMessage = void 0;
+ if (isPrototypeProperty(base)) {
+ if (derived.flags & 98304 /* Accessor */) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
+ }
+ }
+ else if (base.flags & 98304 /* Accessor */) {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ else {
+ errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
+ }
+ error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
+ }
}
}
function checkInheritedPropertiesAreIdentical(type, typeNode) {
@@ -58901,15 +59382,16 @@ var ts;
function checkAliasSymbol(node) {
var symbol = getSymbolOfNode(node);
var target = resolveAlias(symbol);
- if (target !== unknownSymbol) {
- // For external modules symbol represent local symbol for an alias.
+ var shouldSkipWithJSExpandoTargets = symbol.flags & 67108864 /* Assignment */;
+ if (!shouldSkipWithJSExpandoTargets && target !== unknownSymbol) {
+ // For external modules symbol represents local symbol for an alias.
// This local symbol will merge any other local declarations (excluding other aliases)
// and symbol.flags will contains combined representation for all merged declaration.
// Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,
// otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export*
// in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).
- var excludedMeanings = (symbol.flags & (67220415 /* Value */ | 1048576 /* ExportValue */) ? 67220415 /* Value */ : 0) |
- (symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) |
+ var excludedMeanings = (symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */) ? 111551 /* Value */ : 0) |
+ (symbol.flags & 788968 /* Type */ ? 788968 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
var message = node.kind === 258 /* ExportSpecifier */ ?
@@ -58920,7 +59402,7 @@ var ts;
// Don't allow to re-export something with no value side when `--isolatedModules` is set.
if (compilerOptions.isolatedModules
&& node.kind === 258 /* ExportSpecifier */
- && !(target.flags & 67220415 /* Value */)
+ && !(target.flags & 111551 /* Value */)
&& !(node.flags & 4194304 /* Ambient */)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
}
@@ -58973,14 +59455,14 @@ var ts;
if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
- if (target.flags & 67220415 /* Value */) {
+ if (target.flags & 111551 /* Value */) {
// Target is a value symbol, check that it is not hidden by a local declaration with the same name
var moduleName = getFirstIdentifier(node.moduleReference);
- if (!(resolveEntityName(moduleName, 67220415 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
+ if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
}
}
- if (target.flags & 67897832 /* Type */) {
+ if (target.flags & 788968 /* Type */) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
}
}
@@ -59040,13 +59522,17 @@ var ts;
if (!node.parent.parent.moduleSpecifier) {
var exportedName = node.propertyName || node.name;
// find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases)
- var symbol = resolveName(exportedName, exportedName.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
+ var symbol = resolveName(exportedName, exportedName.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
/*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
}
else {
markExportAsReferenced(node);
+ var target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
+ if (!target || target === unknownSymbol || target.flags & 111551 /* Value */) {
+ checkExpressionCached(node.propertyName || node.name);
+ }
}
}
}
@@ -59070,7 +59556,17 @@ var ts;
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
if (node.expression.kind === 73 /* Identifier */) {
- markExportAsReferenced(node);
+ var id = node.expression;
+ var sym = resolveEntityName(id, 67108863 /* All */, /*ignoreErrors*/ true, /*dontResolveAlias*/ true, node);
+ if (sym) {
+ markAliasReferenced(sym, id);
+ // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
+ var target = sym.flags & 2097152 /* Alias */ ? resolveAlias(sym) : sym;
+ if (target === unknownSymbol || target.flags & 111551 /* Value */) {
+ // However if it is a value, we need to check it's being used correctly
+ checkExpressionCached(node.expression);
+ }
+ }
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, /*setVisibility*/ true);
}
@@ -59139,14 +59635,6 @@ var ts;
links.exportsChecked = true;
}
}
- function isNotAccessor(declaration) {
- // Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
- return !ts.isAccessor(declaration);
- }
- function isNotOverload(declaration) {
- return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
- !!declaration.body;
- }
function checkSourceElement(node) {
if (node) {
var saveCurrentNode = currentNode;
@@ -59226,16 +59714,17 @@ var ts;
return checkInferType(node);
case 184 /* ImportType */:
return checkImportType(node);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 311 /* JSDocTypedefTag */:
- case 304 /* JSDocCallbackTag */:
+ case 312 /* JSDocTypedefTag */:
+ case 305 /* JSDocCallbackTag */:
+ case 306 /* JSDocEnumTag */:
return checkJSDocTypeAliasTag(node);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return checkJSDocTemplateTag(node);
- case 309 /* JSDocTypeTag */:
+ case 310 /* JSDocTypeTag */:
return checkJSDocTypeTag(node);
- case 306 /* JSDocParameterTag */:
+ case 307 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
case 295 /* JSDocFunctionType */:
checkJSDocFunctionType(node);
@@ -59244,7 +59733,7 @@ var ts;
case 292 /* JSDocNullableType */:
case 290 /* JSDocAllType */:
case 291 /* JSDocUnknownType */:
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
@@ -59585,7 +60074,7 @@ var ts;
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
// Note: that the memberFlags come from previous iteration.
if (!isStatic) {
- copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */);
+ copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* Type */);
}
break;
case 197 /* FunctionExpression */:
@@ -59738,7 +60227,7 @@ var ts;
if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
// Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression
var success = resolveEntityName(entityName,
- /*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
+ /*all meanings*/ 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
if (success && success !== unknownSymbol) {
return success;
}
@@ -59764,10 +60253,10 @@ var ts;
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) {
- meaning = 67897832 /* Type */;
+ meaning = 788968 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
- meaning |= 67220415 /* Value */;
+ meaning |= 111551 /* Value */;
}
}
else {
@@ -59779,10 +60268,10 @@ var ts;
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 306 /* JSDocParameterTag */) {
+ if (entityName.parent.kind === 307 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 310 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 311 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -59797,7 +60286,7 @@ var ts;
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
- return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
+ return resolveEntityName(entityName, 111551 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) {
var links = getNodeLinks(entityName);
@@ -59814,7 +60303,7 @@ var ts;
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
+ var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
if (entityName.parent.kind === 164 /* TypePredicate */) {
@@ -59924,7 +60413,7 @@ var ts;
}
function getShorthandAssignmentValueSymbol(location) {
if (location && location.kind === 277 /* ShorthandPropertyAssignment */) {
- return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */);
+ return resolveEntityName(location.name, 111551 /* Value */ | 2097152 /* Alias */);
}
return undefined;
}
@@ -59932,7 +60421,7 @@ var ts;
function getExportSpecifierLocalTargetSymbol(node) {
return node.parent.parent.moduleSpecifier ?
getExternalModuleMember(node.parent.parent, node) :
- resolveEntityName(node.propertyName || node.name, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ resolveEntityName(node.propertyName || node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
function getTypeOfNode(node) {
if (node.flags & 8388608 /* InWithStatement */) {
@@ -60133,13 +60622,13 @@ var ts;
// for export assignments - check if resolved symbol for RHS is itself a value
// otherwise - check if at least one export is value
symbolLinks.exportsSomeValue = hasExportAssignment
- ? !!(moduleSymbol.flags & 67220415 /* Value */)
+ ? !!(moduleSymbol.flags & 111551 /* Value */)
: ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue);
}
return symbolLinks.exportsSomeValue;
function isValue(s) {
s = resolveSymbol(s);
- return s && !!(s.flags & 67220415 /* Value */);
+ return s && !!(s.flags & 111551 /* Value */);
}
}
function isNameOfModuleOrEnumDeclaration(node) {
@@ -60188,7 +60677,7 @@ var ts;
var symbol = getReferencedValueSymbol(node);
// We should only get the declaration of an alias if there isn't a local value
// declaration for the symbol
- if (isNonLocalAlias(symbol, /*excludes*/ 67220415 /* Value */)) {
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */)) {
return getDeclarationOfAliasSymbol(symbol);
}
}
@@ -60205,7 +60694,7 @@ var ts;
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
- if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
+ if (resolveName(container.parent, symbol.escapedName, 111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
// redeclaration - always should be renamed
links.isDeclarationWithCollidingName = true;
}
@@ -60301,7 +60790,7 @@ var ts;
}
// const enums and modules that contain only const enums are not considered values from the emit perspective
// unless 'preserveConstEnums' option is set to true
- return !!(target.flags & 67220415 /* Value */) &&
+ return !!(target.flags & 111551 /* Value */) &&
(compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));
}
function isConstEnumOrConstEnumOnlyModule(s) {
@@ -60315,7 +60804,7 @@ var ts;
}
var target = getSymbolLinks(symbol).target; // TODO: GH#18217
if (target && ts.getModifierFlags(node) & 1 /* Export */ &&
- target.flags & 67220415 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
+ target.flags & 111551 /* Value */ && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target))) {
// An `export import ... =` of a value symbol is always considered referenced
return true;
}
@@ -60369,7 +60858,7 @@ var ts;
if (!symbol || !(symbol.flags & 16 /* Function */)) {
return false;
}
- return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 67220415 /* Value */ && ts.isPropertyAccessExpression(p.valueDeclaration); });
+ return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 111551 /* Value */ && p.valueDeclaration && ts.isPropertyAccessExpression(p.valueDeclaration); });
}
function getPropertiesOfContainerFunction(node) {
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
@@ -60423,9 +60912,9 @@ var ts;
return ts.TypeReferenceSerializationKind.Unknown;
}
// Resolve the symbol as a value to ensure the type can be reached at runtime during emit.
- var valueSymbol = resolveEntityName(typeName, 67220415 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
+ var valueSymbol = resolveEntityName(typeName, 111551 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
// Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.
- var typeSymbol = resolveEntityName(typeName, 67897832 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
+ var typeSymbol = resolveEntityName(typeName, 788968 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
if (valueSymbol && valueSymbol === typeSymbol) {
var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(/*reportErrors*/ false);
if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) {
@@ -60530,7 +61019,7 @@ var ts;
location = getDeclarationContainer(parent);
}
}
- return resolveName(location, reference.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
+ return resolveName(location, reference.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
}
function getReferencedValueDeclaration(referenceIn) {
if (!ts.isGeneratedIdentifier(referenceIn)) {
@@ -60551,7 +61040,7 @@ var ts;
return false;
}
function literalTypeToNode(type, enclosing, tracker) {
- var enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(type.symbol, 67220415 /* Value */, enclosing, /*flags*/ undefined, tracker)
+ var enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(type.symbol, 111551 /* Value */, enclosing, /*flags*/ undefined, tracker)
: type === trueType ? ts.createTrue() : type === falseType && ts.createFalse();
return enumResult || ts.createLiteral(type.value);
}
@@ -60664,9 +61153,9 @@ var ts;
// property access can only be used as values, or types when within an expression with type arguments inside a heritage clause
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
- var meaning = 67897832 /* Type */ | 1920 /* Namespace */;
+ var meaning = 788968 /* Type */ | 1920 /* Namespace */;
if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
- meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
}
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
@@ -60889,7 +61378,7 @@ var ts;
for (var helper = 1 /* FirstEmitHelper */; helper <= 131072 /* LastEmitHelper */; helper <<= 1) {
if (uncheckedHelpers & helper) {
var name = getHelperName(helper);
- var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 67220415 /* Value */);
+ var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 111551 /* Value */);
if (!symbol) {
error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name);
}
@@ -61468,13 +61957,6 @@ var ts;
return !!exclamationToken && grammarErrorOnNode(exclamationToken, message);
}
function checkGrammarObjectLiteralExpression(node, inDestructuring) {
- var Flags;
- (function (Flags) {
- Flags[Flags["Property"] = 1] = "Property";
- Flags[Flags["GetAccessor"] = 2] = "GetAccessor";
- Flags[Flags["SetAccessor"] = 4] = "SetAccessor";
- Flags[Flags["GetOrSetAccessor"] = 6] = "GetOrSetAccessor";
- })(Flags || (Flags = {}));
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
@@ -61526,15 +62008,16 @@ var ts;
if (name.kind === 8 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
- // falls through
+ currentKind = 4 /* PropertyAssignment */;
+ break;
case 157 /* MethodDeclaration */:
- currentKind = 1 /* Property */;
+ currentKind = 8 /* Method */;
break;
case 159 /* GetAccessor */:
- currentKind = 2 /* GetAccessor */;
+ currentKind = 1 /* GetAccessor */;
break;
case 160 /* SetAccessor */:
- currentKind = 4 /* SetAccessor */;
+ currentKind = 2 /* SetAccessor */;
break;
default:
throw ts.Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
@@ -61548,11 +62031,11 @@ var ts;
seen.set(effectiveName, currentKind);
}
else {
- if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) {
+ if ((currentKind & 12 /* PropertyAssignmentOrMethod */) && (existingKind & 12 /* PropertyAssignmentOrMethod */)) {
grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name));
}
- else if ((currentKind & 6 /* GetOrSetAccessor */) && (existingKind & 6 /* GetOrSetAccessor */)) {
- if (existingKind !== 6 /* GetOrSetAccessor */ && currentKind !== existingKind) {
+ else if ((currentKind & 3 /* GetOrSetAccessor */) && (existingKind & 3 /* GetOrSetAccessor */)) {
+ if (existingKind !== 3 /* GetOrSetAccessor */ && currentKind !== existingKind) {
seen.set(effectiveName, currentKind | existingKind);
}
else {
@@ -61650,42 +62133,38 @@ var ts;
return false;
}
function checkGrammarAccessor(accessor) {
- var kind = accessor.kind;
- if (languageVersion < 1 /* ES5 */) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ if (!(accessor.flags & 4194304 /* Ambient */)) {
+ if (languageVersion < 1 /* ES5 */) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
+ }
+ if (accessor.body === undefined && !ts.hasModifier(accessor, 128 /* Abstract */)) {
+ return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
+ }
}
- else if (accessor.flags & 4194304 /* Ambient */) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);
- }
- else if (accessor.body === undefined && !ts.hasModifier(accessor, 128 /* Abstract */)) {
- return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
- }
- else if (accessor.body && ts.hasModifier(accessor, 128 /* Abstract */)) {
+ if (accessor.body && ts.hasModifier(accessor, 128 /* Abstract */)) {
return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
}
- else if (accessor.typeParameters) {
+ if (accessor.typeParameters) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
- else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ?
+ if (!doesAccessorHaveCorrectParameterCount(accessor)) {
+ return grammarErrorOnNode(accessor.name, accessor.kind === 159 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 160 /* SetAccessor */) {
+ if (accessor.kind === 160 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
- else {
- var parameter = accessor.parameters[0];
- if (parameter.dotDotDotToken) {
- return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
- }
- else if (parameter.questionToken) {
- return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
- }
- else if (parameter.initializer) {
- return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
- }
+ var parameter = ts.Debug.assertDefined(ts.getSetAccessorValueParameter(accessor), "Return value does not match parameter count assertion.");
+ if (parameter.dotDotDotToken) {
+ return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
+ }
+ if (parameter.questionToken) {
+ return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
+ }
+ if (parameter.initializer) {
+ return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
}
}
return false;
@@ -62120,13 +62599,9 @@ var ts;
}
function checkGrammarStatementInAmbientContext(node) {
if (node.flags & 4194304 /* Ambient */) {
- // An accessors is already reported about the ambient context
- if (ts.isAccessor(node.parent)) {
- return getNodeLinks(node).hasReportedStatementInAmbientContext = true;
- }
// Find containing block which is either Block, ModuleBlock, SourceFile
var links = getNodeLinks(node);
- if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) {
+ if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
}
// We are either parented by another statement, or some sort of block.
@@ -62174,7 +62649,7 @@ var ts;
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -62224,6 +62699,14 @@ var ts;
}
}
ts.createTypeChecker = createTypeChecker;
+ function isNotAccessor(declaration) {
+ // Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
+ return !ts.isAccessor(declaration);
+ }
+ function isNotOverload(declaration) {
+ return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
+ !!declaration.body;
+ }
/** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
@@ -64202,7 +64685,7 @@ var ts;
ts.createJSDocTypeExpression = createJSDocTypeExpression;
/* @internal */
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(309 /* JSDocTypeTag */, "type");
+ var tag = createJSDocTag(310 /* JSDocTypeTag */, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -64210,7 +64693,7 @@ var ts;
ts.createJSDocTypeTag = createJSDocTypeTag;
/* @internal */
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(307 /* JSDocReturnTag */, "returns");
+ var tag = createJSDocTag(308 /* JSDocReturnTag */, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -64218,14 +64701,14 @@ var ts;
ts.createJSDocReturnTag = createJSDocReturnTag;
/** @internal */
function createJSDocThisTag(typeExpression) {
- var tag = createJSDocTag(308 /* JSDocThisTag */, "this");
+ var tag = createJSDocTag(309 /* JSDocThisTag */, "this");
tag.typeExpression = typeExpression;
return tag;
}
ts.createJSDocThisTag = createJSDocThisTag;
/* @internal */
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(306 /* JSDocParameterTag */, "param");
+ var tag = createJSDocTag(307 /* JSDocParameterTag */, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -64235,7 +64718,7 @@ var ts;
ts.createJSDocParamTag = createJSDocParamTag;
/* @internal */
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(297 /* JSDocComment */);
+ var node = createSynthesizedNode(298 /* JSDocComment */);
node.comment = comment;
node.tags = tags;
return node;
@@ -64600,7 +65083,7 @@ var ts;
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(314 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(315 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -64612,7 +65095,7 @@ var ts;
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(318 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(319 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -64624,7 +65107,7 @@ var ts;
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(317 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(318 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -64639,7 +65122,7 @@ var ts;
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(315 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(316 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -64655,7 +65138,7 @@ var ts;
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 316 /* CommaListExpression */) {
+ if (node.kind === 317 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) {
@@ -64665,7 +65148,7 @@ var ts;
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(316 /* CommaListExpression */);
+ var node = createSynthesizedNode(317 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -65513,29 +65996,34 @@ var ts;
}
ts.createExpressionForJsxFragment = createExpressionForJsxFragment;
// Helpers
- function getHelperName(name) {
+ /**
+ * Gets an identifier for the name of an *unscoped* emit helper.
+ */
+ function getUnscopedHelperName(name) {
return ts.setEmitFlags(ts.createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */);
}
- ts.getHelperName = getHelperName;
+ ts.getUnscopedHelperName = getUnscopedHelperName;
ts.valuesHelper = {
name: "typescript:values",
+ importName: "__values",
scoped: false,
- text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };"
+ text: "\n var __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n };"
};
function createValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.valuesHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__values"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__values"),
/*typeArguments*/ undefined, [expression]), location);
}
ts.createValuesHelper = createValuesHelper;
ts.readHelper = {
name: "typescript:read",
+ importName: "__read",
scoped: false,
text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };"
};
function createReadHelper(context, iteratorRecord, count, location) {
context.requestEmitHelper(ts.readHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__read"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__read"),
/*typeArguments*/ undefined, count !== undefined
? [iteratorRecord, ts.createLiteral(count)]
: [iteratorRecord]), location);
@@ -65543,24 +66031,26 @@ var ts;
ts.createReadHelper = createReadHelper;
ts.spreadHelper = {
name: "typescript:spread",
+ importName: "__spread",
scoped: false,
text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };"
};
function createSpreadHelper(context, argumentList, location) {
context.requestEmitHelper(ts.readHelper);
context.requestEmitHelper(ts.spreadHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spread"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spread"),
/*typeArguments*/ undefined, argumentList), location);
}
ts.createSpreadHelper = createSpreadHelper;
ts.spreadArraysHelper = {
name: "typescript:spreadArrays",
+ importName: "__spreadArrays",
scoped: false,
text: "\n var __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n };"
};
function createSpreadArraysHelper(context, argumentList, location) {
context.requestEmitHelper(ts.spreadArraysHelper);
- return ts.setTextRange(ts.createCall(getHelperName("__spreadArrays"),
+ return ts.setTextRange(ts.createCall(getUnscopedHelperName("__spreadArrays"),
/*typeArguments*/ undefined, argumentList), location);
}
ts.createSpreadArraysHelper = createSpreadArraysHelper;
@@ -66405,7 +66895,7 @@ var ts;
case 191 /* ElementAccessExpression */:
case 190 /* PropertyAccessExpression */:
case 214 /* NonNullExpression */:
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -66422,7 +66912,7 @@ var ts;
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
- node.kind === 316 /* CommaListExpression */;
+ node.kind === 317 /* CommaListExpression */;
}
ts.isCommaSequence = isCommaSequence;
var OuterExpressionKinds;
@@ -66441,7 +66931,7 @@ var ts;
case 213 /* AsExpression */:
case 214 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -66478,7 +66968,7 @@ var ts;
case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 315 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 316 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -66521,6 +67011,60 @@ var ts;
return emitNode && emitNode.externalHelpersModuleName;
}
ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function hasRecordedExternalHelpers(sourceFile) {
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return !!emitNode && (!!emitNode.externalHelpersModuleName || !!emitNode.externalHelpers);
+ }
+ ts.hasRecordedExternalHelpers = hasRecordedExternalHelpers;
+ function createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) {
+ if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
+ var namedBindings = void 0;
+ var moduleKind = ts.getEmitModuleKind(compilerOptions);
+ if (moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) {
+ // use named imports
+ var helpers = ts.getEmitHelpers(sourceFile);
+ if (helpers) {
+ var helperNames = [];
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!helper.scoped) {
+ var importName = helper.importName;
+ if (importName) {
+ ts.pushIfUnique(helperNames, importName);
+ }
+ }
+ }
+ if (ts.some(helperNames)) {
+ helperNames.sort(ts.compareStringsCaseSensitive);
+ // Alias the imports if the names are used somewhere in the file.
+ // NOTE: We don't need to care about global import collisions as this is a module.
+ namedBindings = ts.createNamedImports(ts.map(helperNames, function (name) { return ts.isFileLevelUniqueName(sourceFile, name)
+ ? ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(name))
+ : ts.createImportSpecifier(ts.createIdentifier(name), getUnscopedHelperName(name)); }));
+ var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
+ var emitNode = ts.getOrCreateEmitNode(parseNode);
+ emitNode.externalHelpers = true;
+ }
+ }
+ }
+ else {
+ // use a namespace import
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
+ if (externalHelpersModuleName) {
+ namedBindings = ts.createNamespaceImport(externalHelpersModuleName);
+ }
+ }
+ if (namedBindings) {
+ var externalHelpersImportDeclaration = ts.createImportDeclaration(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, namedBindings), ts.createLiteral(ts.externalHelpersModuleNameText));
+ ts.addEmitFlags(externalHelpersImportDeclaration, 67108864 /* NeverApplyImportHelper */);
+ return externalHelpersImportDeclaration;
+ }
+ }
+ }
+ ts.createExternalHelpersImportDeclarationIfNeeded = createExternalHelpersImportDeclarationIfNeeded;
function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(node, compilerOptions)) {
var externalHelpersModuleName = getExternalHelpersModuleName(node);
@@ -66535,8 +67079,8 @@ var ts;
if (!create) {
var helpers = ts.getEmitHelpers(node);
if (helpers) {
- for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
- var helper = helpers_2[_i];
+ for (var _i = 0, helpers_3 = helpers; _i < helpers_3.length; _i++) {
+ var helper = helpers_3[_i];
if (!helper.scoped) {
create = true;
break;
@@ -67275,9 +67819,9 @@ var ts;
case 285 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -67333,7 +67877,7 @@ var ts;
case 221 /* EmptyStatement */:
case 211 /* OmittedExpression */:
case 237 /* DebuggerStatement */:
- case 314 /* NotEmittedStatement */:
+ case 315 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
@@ -67714,10 +68258,10 @@ var ts;
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -68505,7 +69049,8 @@ var ts;
var hasExportDefault = false;
var exportEquals;
var hasExportStarsToExportValues = false;
- var hasImportStarOrImportDefault = false;
+ var hasImportStar = false;
+ var hasImportDefault = false;
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
@@ -68515,7 +69060,12 @@ var ts;
// import * as x from "mod"
// import { x, y } from "mod"
externalImports.push(node);
- hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
+ if (!hasImportStar && getImportNeedsImportStarHelper(node)) {
+ hasImportStar = true;
+ }
+ if (!hasImportDefault && getImportNeedsImportDefaultHelper(node)) {
+ hasImportDefault = true;
+ }
break;
case 249 /* ImportEqualsDeclaration */:
if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
@@ -68609,12 +69159,8 @@ var ts;
break;
}
}
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault);
- var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault);
if (externalHelpersImportDeclaration) {
- ts.addEmitFlags(externalHelpersImportDeclaration, 67108864 /* NeverApplyImportHelper */);
externalImports.unshift(externalHelpersImportDeclaration);
}
return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
@@ -69202,6 +69748,7 @@ var ts;
}
ts.restHelper = {
name: "typescript:rest",
+ importName: "__rest",
scoped: false,
text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
@@ -69226,7 +69773,7 @@ var ts;
}
}
}
- return ts.createCall(ts.getHelperName("__rest"),
+ return ts.createCall(ts.getUnscopedHelperName("__rest"),
/*typeArguments*/ undefined, [
value,
ts.setTextRange(ts.createArrayLiteral(propertyNames), location)
@@ -70591,8 +71138,8 @@ var ts;
// Note when updating logic here also update getEntityNameForDecoratorMetadata
// so that aliases can be marked as referenced
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
@@ -70734,7 +71281,7 @@ var ts;
* available.
*/
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 8 /* ESNext */
+ return languageVersion < 99 /* ESNext */
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -71872,18 +72419,19 @@ var ts;
}
}
context.requestEmitHelper(ts.decorateHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__decorate"),
/*typeArguments*/ undefined, argumentsArray), location);
}
ts.decorateHelper = {
name: "typescript:decorate",
+ importName: "__decorate",
scoped: false,
priority: 2,
text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
};
function createMetadataHelper(context, metadataKey, metadataValue) {
context.requestEmitHelper(ts.metadataHelper);
- return ts.createCall(ts.getHelperName("__metadata"),
+ return ts.createCall(ts.getUnscopedHelperName("__metadata"),
/*typeArguments*/ undefined, [
ts.createLiteral(metadataKey),
metadataValue
@@ -71891,13 +72439,14 @@ var ts;
}
ts.metadataHelper = {
name: "typescript:metadata",
+ importName: "__metadata",
scoped: false,
priority: 3,
text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
};
function createParamHelper(context, expression, parameterOffset, location) {
context.requestEmitHelper(ts.paramHelper);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__param"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__param"),
/*typeArguments*/ undefined, [
ts.createLiteral(parameterOffset),
expression
@@ -71905,6 +72454,7 @@ var ts;
}
ts.paramHelper = {
name: "typescript:param",
+ importName: "__param",
scoped: false,
priority: 4,
text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
@@ -72349,6 +72899,7 @@ var ts;
var hasSuperElementAccess;
/** A set of node IDs for generated super accessors (variable statements). */
var substitutedSuperAccessors = [];
+ var topLevel;
// Save the previous transformation hooks.
var previousOnEmitNode = context.onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
@@ -72360,10 +72911,23 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitor(node) {
if ((node.transformFlags & 32 /* ContainsES2017 */) === 0) {
return node;
@@ -72375,11 +72939,11 @@ var ts;
case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
case 157 /* MethodDeclaration */:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 240 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197 /* FunctionExpression */:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198 /* ArrowFunction */:
return visitArrowFunction(node);
case 190 /* PropertyAccessExpression */:
@@ -72392,6 +72956,12 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -72643,7 +73213,7 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.body.statements, /*ensureUseStrict*/ false, visitor);
- statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
@@ -72670,7 +73240,7 @@ var ts;
result = block;
}
else {
- var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
+ var expression = createAwaiterHelper(context, !topLevel, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
var declarations = endLexicalEnvironment();
if (ts.some(declarations)) {
var block = ts.convertToFunctionBody(expression);
@@ -72869,11 +73439,12 @@ var ts;
ts.createSuperAccessVariableStatement = createSuperAccessVariableStatement;
ts.awaiterHelper = {
name: "typescript:awaiter",
+ importName: "__awaiter",
scoped: false,
priority: 5,
- text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };"
};
- function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ function createAwaiterHelper(context, hasLexicalThis, hasLexicalArguments, promiseConstructor, body) {
context.requestEmitHelper(ts.awaiterHelper);
var generatorFunc = ts.createFunctionExpression(
/*modifiers*/ undefined, ts.createToken(40 /* AsteriskToken */),
@@ -72883,9 +73454,9 @@ var ts;
/*type*/ undefined, body);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */ | 524288 /* ReuseTempVariableScope */;
- return ts.createCall(ts.getHelperName("__awaiter"),
+ return ts.createCall(ts.getUnscopedHelperName("__awaiter"),
/*typeArguments*/ undefined, [
- ts.createThis(),
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
generatorFunc
@@ -72919,9 +73490,11 @@ var ts;
context.onEmitNode = onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
+ var exportedVariableStatement = false;
var enabledSubstitutions;
var enclosingFunctionFlags;
var enclosingSuperContainerFlags = 0;
+ var topLevel;
/** Keeps track of property names accessed on super (`super.x`) within async functions. */
var capturedSuperProperties;
/** Whether the async function contains an element access on super (`super[x]`). */
@@ -72933,6 +73506,8 @@ var ts;
if (node.isDeclarationFile) {
return node;
}
+ exportedVariableStatement = false;
+ topLevel = ts.isEffectiveStrictModeSourceFile(node, compilerOptions);
var visited = ts.visitEachChild(node, visitor, context);
ts.addEmitHelpers(visited, context.readEmitHelpers());
return visited;
@@ -72949,6 +73524,18 @@ var ts;
}
return node;
}
+ function doOutsideOfTopLevel(cb, value) {
+ if (topLevel) {
+ topLevel = false;
+ var result = cb(value);
+ topLevel = true;
+ return result;
+ }
+ return cb(value);
+ }
+ function visitDefault(node) {
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitorWorker(node, noDestructuringValue) {
if ((node.transformFlags & 16 /* ContainsES2018 */) === 0) {
return node;
@@ -72968,6 +73555,8 @@ var ts;
return visitBinaryExpression(node, noDestructuringValue);
case 275 /* CatchClause */:
return visitCatchClause(node);
+ case 220 /* VariableStatement */:
+ return visitVariableStatement(node);
case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
case 228 /* ForOfStatement */:
@@ -72977,17 +73566,17 @@ var ts;
case 201 /* VoidExpression */:
return visitVoidExpression(node);
case 158 /* Constructor */:
- return visitConstructorDeclaration(node);
+ return doOutsideOfTopLevel(visitConstructorDeclaration, node);
case 157 /* MethodDeclaration */:
- return visitMethodDeclaration(node);
+ return doOutsideOfTopLevel(visitMethodDeclaration, node);
case 159 /* GetAccessor */:
- return visitGetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitGetAccessorDeclaration, node);
case 160 /* SetAccessor */:
- return visitSetAccessorDeclaration(node);
+ return doOutsideOfTopLevel(visitSetAccessorDeclaration, node);
case 240 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
+ return doOutsideOfTopLevel(visitFunctionDeclaration, node);
case 197 /* FunctionExpression */:
- return visitFunctionExpression(node);
+ return doOutsideOfTopLevel(visitFunctionExpression, node);
case 198 /* ArrowFunction */:
return visitArrowFunction(node);
case 152 /* Parameter */:
@@ -73006,6 +73595,9 @@ var ts;
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ return doOutsideOfTopLevel(visitDefault, node);
default:
return ts.visitEachChild(node, visitor, context);
}
@@ -73073,14 +73665,39 @@ var ts;
if (node.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
// spread elements emit like so:
// non-spread elements are chunked together into object literals, and then all are passed to __assign:
- // { a, ...o, b } => __assign({a}, o, {b});
+ // { a, ...o, b } => __assign(__assign({a}, o), {b});
// If the first element is a spread element, then the first argument to __assign is {}:
- // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
+ // { ...o, a, b, ...o2 } => __assign(__assign(__assign({}, o), {a, b}), o2)
+ //
+ // We cannot call __assign with more than two elements, since any element could cause side effects. For
+ // example:
+ // var k = { a: 1, b: 2 };
+ // var o = { a: 3, ...k, b: k.a++ };
+ // // expected: { a: 1, b: 1 }
+ // If we translate the above to `__assign({ a: 3 }, k, { b: k.a++ })`, the `k.a++` will evaluate before
+ // `k` is spread and we end up with `{ a: 2, b: 1 }`.
+ //
+ // This also occurs for spread elements, not just property assignments:
+ // var k = { a: 1, get b() { l = { z: 9 }; return 2; } };
+ // var l = { c: 3 };
+ // var o = { ...k, ...l };
+ // // expected: { a: 1, b: 2, z: 9 }
+ // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we
+ // end up with `{ a: 1, b: 2, c: 3 }`
var objects = chunkObjectLiteralElements(node.properties);
if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) {
objects.unshift(ts.createObjectLiteral());
}
- return createAssignHelper(context, objects);
+ var expression = objects[0];
+ if (objects.length > 1) {
+ for (var i = 1; i < objects.length; i++) {
+ expression = createAssignHelper(context, [expression, objects[i]]);
+ }
+ return expression;
+ }
+ else {
+ return createAssignHelper(context, objects);
+ }
}
return ts.visitEachChild(node, visitor, context);
}
@@ -73121,15 +73738,36 @@ var ts;
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitVariableStatement(node) {
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = true;
+ var visited = ts.visitEachChild(node, visitor, context);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
/**
* Visits a VariableDeclaration node with a binding pattern.
*
* @param node A VariableDeclaration node.
*/
function visitVariableDeclaration(node) {
+ if (exportedVariableStatement) {
+ var savedExportedVariableStatement = exportedVariableStatement;
+ exportedVariableStatement = false;
+ var visited = visitVariableDeclarationWorker(node, /*exportedVariableStatement*/ true);
+ exportedVariableStatement = savedExportedVariableStatement;
+ return visited;
+ }
+ return visitVariableDeclarationWorker(node, /*exportedVariableStatement*/ false);
+ }
+ function visitVariableDeclarationWorker(node, exportedVariableStatement) {
// If we are here it is because the name contains a binding pattern with a rest somewhere in it.
if (ts.isBindingPattern(node.name) && node.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
- return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */);
+ return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */,
+ /*rval*/ undefined, exportedVariableStatement);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -73347,7 +73985,7 @@ var ts;
/*modifiers*/ undefined, ts.createToken(40 /* AsteriskToken */), node.name && ts.getGeneratedNameForNode(node.name),
/*typeParameters*/ undefined,
/*parameters*/ [],
- /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))));
+ /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !topLevel));
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
var emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* AsyncMethodWithSuperBinding */ | 2048 /* AsyncMethodWithSuper */);
@@ -73527,6 +74165,7 @@ var ts;
ts.transformES2018 = transformES2018;
ts.assignHelper = {
name: "typescript:assign",
+ importName: "__assign",
scoped: false,
priority: 1,
text: "\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"
@@ -73537,55 +74176,59 @@ var ts;
/*typeArguments*/ undefined, attributesSegments);
}
context.requestEmitHelper(ts.assignHelper);
- return ts.createCall(ts.getHelperName("__assign"),
+ return ts.createCall(ts.getUnscopedHelperName("__assign"),
/*typeArguments*/ undefined, attributesSegments);
}
ts.createAssignHelper = createAssignHelper;
ts.awaitHelper = {
name: "typescript:await",
+ importName: "__await",
scoped: false,
text: "\n var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }"
};
function createAwaitHelper(context, expression) {
context.requestEmitHelper(ts.awaitHelper);
- return ts.createCall(ts.getHelperName("__await"), /*typeArguments*/ undefined, [expression]);
+ return ts.createCall(ts.getUnscopedHelperName("__await"), /*typeArguments*/ undefined, [expression]);
}
ts.asyncGeneratorHelper = {
name: "typescript:asyncGenerator",
+ importName: "__asyncGenerator",
scoped: false,
text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n };"
};
- function createAsyncGeneratorHelper(context, generatorFunc) {
+ function createAsyncGeneratorHelper(context, generatorFunc, hasLexicalThis) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncGeneratorHelper);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 /* AsyncFunctionBody */;
- return ts.createCall(ts.getHelperName("__asyncGenerator"),
+ return ts.createCall(ts.getUnscopedHelperName("__asyncGenerator"),
/*typeArguments*/ undefined, [
- ts.createThis(),
+ hasLexicalThis ? ts.createThis() : ts.createVoidZero(),
ts.createIdentifier("arguments"),
generatorFunc
]);
}
ts.asyncDelegator = {
name: "typescript:asyncDelegator",
+ importName: "__asyncDelegator",
scoped: false,
text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n };"
};
function createAsyncDelegatorHelper(context, expression, location) {
context.requestEmitHelper(ts.awaitHelper);
context.requestEmitHelper(ts.asyncDelegator);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncDelegator"),
/*typeArguments*/ undefined, [expression]), location);
}
ts.asyncValues = {
name: "typescript:asyncValues",
+ importName: "__asyncValues",
scoped: false,
text: "\n var __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n };"
};
function createAsyncValuesHelper(context, expression, location) {
context.requestEmitHelper(ts.asyncValues);
- return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"),
+ return ts.setTextRange(ts.createCall(ts.getUnscopedHelperName("__asyncValues"),
/*typeArguments*/ undefined, [expression]), location);
}
})(ts || (ts = {}));
@@ -77397,7 +78040,7 @@ var ts;
ts.transformES2015 = transformES2015;
function createExtendsHelper(context, name) {
context.requestEmitHelper(ts.extendsHelper);
- return ts.createCall(ts.getHelperName("__extends"),
+ return ts.createCall(ts.getUnscopedHelperName("__extends"),
/*typeArguments*/ undefined, [
name,
ts.createFileLevelUniqueName("_super")
@@ -77405,7 +78048,7 @@ var ts;
}
function createTemplateObjectHelper(context, cooked, raw) {
context.requestEmitHelper(ts.templateObjectHelper);
- return ts.createCall(ts.getHelperName("__makeTemplateObject"),
+ return ts.createCall(ts.getUnscopedHelperName("__makeTemplateObject"),
/*typeArguments*/ undefined, [
cooked,
raw
@@ -77413,12 +78056,14 @@ var ts;
}
ts.extendsHelper = {
name: "typescript:extends",
+ importName: "__extends",
scoped: false,
priority: 0,
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
};
ts.templateObjectHelper = {
name: "typescript:makeTemplateObject",
+ importName: "__makeTemplateObject",
scoped: false,
priority: 0,
text: "\n var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n };"
@@ -80112,7 +80757,7 @@ var ts;
ts.transformGenerators = transformGenerators;
function createGeneratorHelper(context, body) {
context.requestEmitHelper(ts.generatorHelper);
- return ts.createCall(ts.getHelperName("__generator"),
+ return ts.createCall(ts.getUnscopedHelperName("__generator"),
/*typeArguments*/ undefined, [ts.createThis(), body]);
}
// The __generator helper is used by down-level transformations to emulate the runtime
@@ -80176,6 +80821,7 @@ var ts;
// For examples of how these are used, see the comments in ./transformers/generators.ts
ts.generatorHelper = {
name: "typescript:generator",
+ importName: "__generator",
scoped: false,
priority: 6,
text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
@@ -80549,9 +81195,9 @@ var ts;
return visitFunctionDeclaration(node);
case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 317 /* MergeDeclarationMarker */:
+ case 318 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 318 /* EndOfDeclarationMarker */:
+ case 319 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -80710,7 +81356,7 @@ var ts;
var promise = ts.createNew(ts.createIdentifier("Promise"), /*typeArguments*/ undefined, [func]);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), /*typeArguments*/ undefined, [ts.getHelperName("__importStar")]);
+ return ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), /*typeArguments*/ undefined, [ts.getUnscopedHelperName("__importStar")]);
}
return promise;
}
@@ -80724,7 +81370,7 @@ var ts;
var requireCall = ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
if (compilerOptions.esModuleInterop) {
context.requestEmitHelper(ts.importStarHelper);
- requireCall = ts.createCall(ts.getHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
+ requireCall = ts.createCall(ts.getUnscopedHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
}
var func;
if (languageVersion >= 2 /* ES2015 */) {
@@ -80758,11 +81404,11 @@ var ts;
}
if (ts.getImportNeedsImportStarHelper(node)) {
context.requestEmitHelper(ts.importStarHelper);
- return ts.createCall(ts.getHelperName("__importStar"), /*typeArguments*/ undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importStar"), /*typeArguments*/ undefined, [innerExpr]);
}
if (ts.getImportNeedsImportDefaultHelper(node)) {
context.requestEmitHelper(ts.importDefaultHelper);
- return ts.createCall(ts.getHelperName("__importDefault"), /*typeArguments*/ undefined, [innerExpr]);
+ return ts.createCall(ts.getUnscopedHelperName("__importDefault"), /*typeArguments*/ undefined, [innerExpr]);
}
return innerExpr;
}
@@ -81534,7 +82180,7 @@ var ts;
function createExportStarHelper(context, module) {
var compilerOptions = context.getCompilerOptions();
return compilerOptions.importHelpers
- ? ts.createCall(ts.getHelperName("__exportStar"), /*typeArguments*/ undefined, [module, ts.createIdentifier("exports")])
+ ? ts.createCall(ts.getUnscopedHelperName("__exportStar"), /*typeArguments*/ undefined, [module, ts.createIdentifier("exports")])
: ts.createCall(ts.createIdentifier("__export"), /*typeArguments*/ undefined, [module]);
}
// emit helper for dynamic import
@@ -81546,12 +82192,14 @@ var ts;
// emit helper for `import * as Name from "foo"`
ts.importStarHelper = {
name: "typescript:commonjsimportstar",
+ importName: "__importStar",
scoped: false,
text: "\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};"
};
// emit helper for `import Name from "foo"`
ts.importDefaultHelper = {
name: "typescript:commonjsimportdefault",
+ importName: "__importDefault",
scoped: false,
text: "\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};"
};
@@ -81573,11 +82221,13 @@ var ts;
context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(215 /* MetaProperty */); // Substitutes 'import.meta'
context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var exportFunctionsMap = []; // The export function associated with a source file.
var noSubstitutionMap = []; // Set of nodes for which substitution rules should be ignored for each file.
+ var contextObjectMap = []; // The context object associated with a source file.
var currentSourceFile; // The current file.
var moduleInfo; // ExternalModuleInfo for the current file.
var exportFunction; // The export function for the current file.
@@ -81616,7 +82266,7 @@ var ts;
// existing identifiers.
exportFunction = ts.createUniqueName("exports");
exportFunctionsMap[id] = exportFunction;
- contextObject = ts.createUniqueName("context");
+ contextObject = contextObjectMap[id] = ts.createUniqueName("context");
// Add the body of the module.
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
@@ -82486,9 +83136,9 @@ var ts;
return visitCatchClause(node);
case 219 /* Block */:
return visitBlock(node);
- case 317 /* MergeDeclarationMarker */:
+ case 318 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 318 /* EndOfDeclarationMarker */:
+ case 319 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -82774,6 +83424,7 @@ var ts;
moduleInfo = moduleInfoMap[id];
exportFunction = exportFunctionsMap[id];
noSubstitution = noSubstitutionMap[id];
+ contextObject = contextObjectMap[id];
if (noSubstitution) {
delete noSubstitutionMap[id];
}
@@ -82781,6 +83432,7 @@ var ts;
currentSourceFile = undefined;
moduleInfo = undefined;
exportFunction = undefined;
+ contextObject = undefined;
noSubstitution = undefined;
}
else {
@@ -82857,6 +83509,8 @@ var ts;
case 203 /* PrefixUnaryExpression */:
case 204 /* PostfixUnaryExpression */:
return substituteUnaryExpression(node);
+ case 215 /* MetaProperty */:
+ return substituteMetaProperty(node);
}
return node;
}
@@ -82965,6 +83619,12 @@ var ts;
}
return node;
}
+ function substituteMetaProperty(node) {
+ if (ts.isImportMeta(node)) {
+ return ts.createPropertyAccess(contextObject, ts.createIdentifier("meta"));
+ }
+ return node;
+ }
/**
* Gets the exports of a name.
*
@@ -83018,22 +83678,18 @@ var ts;
context.onSubstituteNode = onSubstituteNode;
context.enableEmitNotification(285 /* SourceFile */);
context.enableSubstitution(73 /* Identifier */);
- var currentSourceFile;
+ var helperNameSubstitutions;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
if (node.isDeclarationFile) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
- if (externalHelpersModuleName) {
+ var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(node, compilerOptions);
+ if (externalHelpersImportDeclaration) {
var statements = [];
var statementOffset = ts.addPrologue(statements, node.statements);
- var tslibImport = ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- ts.addEmitFlags(tslibImport, 67108864 /* NeverApplyImportHelper */);
- ts.append(statements, tslibImport);
+ ts.append(statements, externalHelpersImportDeclaration);
ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements));
}
@@ -83069,9 +83725,9 @@ var ts;
*/
function onEmitNode(hint, node, emitCallback) {
if (ts.isSourceFile(node)) {
- currentSourceFile = node;
+ helperNameSubstitutions = ts.createMap();
previousOnEmitNode(hint, node, emitCallback);
- currentSourceFile = undefined;
+ helperNameSubstitutions = undefined;
}
else {
previousOnEmitNode(hint, node, emitCallback);
@@ -83088,19 +83744,18 @@ var ts;
*/
function onSubstituteNode(hint, node) {
node = previousOnSubstituteNode(hint, node);
- if (ts.isIdentifier(node) && hint === 1 /* Expression */) {
- return substituteExpressionIdentifier(node);
+ if (helperNameSubstitutions && ts.isIdentifier(node) && ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ return substituteHelperName(node);
}
return node;
}
- function substituteExpressionIdentifier(node) {
- if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
- var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
- if (externalHelpersModuleName) {
- return ts.createPropertyAccess(externalHelpersModuleName, node);
- }
+ function substituteHelperName(node) {
+ var name = ts.idText(node);
+ var substitution = helperNameSubstitutions.get(name);
+ if (!substitution) {
+ helperNameSubstitutions.set(name, substitution = ts.createFileLevelUniqueName(name));
}
- return node;
+ return substitution;
}
}
ts.transformES2015Module = transformES2015Module;
@@ -83599,6 +84254,7 @@ var ts;
var currentSourceFile;
var refs;
var libs;
+ var emittedImports; // must be declared in container so it can be `undefined` while transformer's first pass
var resolver = context.getEmitResolver();
var options = context.getCompilerOptions();
var newLine = ts.getNewLineCharacter(options);
@@ -83761,7 +84417,7 @@ var ts;
var statements = ts.visitNodes(node.statements, visitDeclarationStatements);
var combinedStatements = ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
refs.forEach(referenceVisitor);
- var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
+ emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
if (ts.isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) {
combinedStatements = ts.setTextRange(ts.createNodeArray(__spreadArrays(combinedStatements, [createEmptyExports()])), combinedStatements);
}
@@ -83859,14 +84515,14 @@ var ts;
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
}
}
- function ensureParameter(p, modifierMask) {
+ function ensureParameter(p, modifierMask, type) {
var oldDiag;
if (!suppressNewDiagnosticContexts) {
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
}
var newParam = ts.updateParameter(p,
- /*decorators*/ undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56 /* QuestionToken */)) : undefined, ensureType(p, p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
+ /*decorators*/ undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || ts.createToken(56 /* QuestionToken */)) : undefined, ensureType(p, type || p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
ensureNoInitializer(p));
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
@@ -83973,6 +84629,33 @@ var ts;
}
return ts.createNodeArray(newParams, params.hasTrailingComma);
}
+ function updateAccessorParamsList(input, isPrivate) {
+ var newParams;
+ if (!isPrivate) {
+ var thisParameter = ts.getThisParameter(input);
+ if (thisParameter) {
+ newParams = [ensureParameter(thisParameter)];
+ }
+ }
+ if (ts.isSetAccessorDeclaration(input)) {
+ var newValueParameter = void 0;
+ if (!isPrivate) {
+ var valueParameter = ts.getSetAccessorValueParameter(input);
+ if (valueParameter) {
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ newValueParameter = ensureParameter(valueParameter, /*modifierMask*/ undefined, accessorType);
+ }
+ }
+ if (!newValueParameter) {
+ newValueParameter = ts.createParameter(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*dotDotDotToken*/ undefined, "value");
+ }
+ newParams = ts.append(newParams, newValueParameter);
+ }
+ return ts.createNodeArray(newParams || ts.emptyArray);
+ }
function ensureTypeParams(node, params) {
return ts.hasModifier(node, 8 /* Private */) ? undefined : ts.visitNodes(params, visitDeclarationSubtree);
}
@@ -84139,6 +84822,11 @@ var ts;
enclosingDeclaration = input;
}
var oldDiag = getSymbolAccessibilityDiagnostic;
+ // Setup diagnostic-related flags before first potential `cleanup` call, otherwise
+ // We'd see a TDZ violation at runtime
+ var canProduceDiagnostic = ts.canProduceDiagnostics(input);
+ var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
// Emit methods which are private as properties with no type information
if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) {
if (ts.hasModifier(input, 8 /* Private */)) {
@@ -84147,15 +84835,12 @@ var ts;
return cleanup(ts.createProperty(/*decorators*/ undefined, ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined));
}
}
- var canProdiceDiagnostic = ts.canProduceDiagnostics(input);
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input);
}
if (ts.isTypeQueryNode(input)) {
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
- var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
// We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
suppressNewDiagnosticContexts = true;
@@ -84194,10 +84879,24 @@ var ts;
return cleanup(sig);
}
case 159 /* GetAccessor */: {
+ // For now, only emit class accessors as accessors if they were already declared in an ambient context.
+ if (input.flags & 4194304 /* Ambient */) {
+ var isPrivate = ts.hasModifier(input, 8 /* Private */);
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
+ return cleanup(ts.updateGetAccessor(input,
+ /*decorators*/ undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, isPrivate), !isPrivate ? ensureType(input, accessorType) : undefined,
+ /*body*/ undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
case 160 /* SetAccessor */: {
+ // For now, only emit class accessors as accessors if they were already declared in an ambient context.
+ if (input.flags & 4194304 /* Ambient */) {
+ return cleanup(ts.updateSetAccessor(input,
+ /*decorators*/ undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasModifier(input, 8 /* Private */)),
+ /*body*/ undefined));
+ }
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
@@ -84258,13 +84957,13 @@ var ts;
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
function cleanup(returnValue) {
- if (returnValue && canProdiceDiagnostic && ts.hasDynamicName(input)) {
+ if (returnValue && canProduceDiagnostic && ts.hasDynamicName(input)) {
checkName(input);
}
if (isEnclosingDeclaration(input)) {
enclosingDeclaration = previousEnclosingDeclaration;
}
- if (canProdiceDiagnostic && !suppressNewDiagnosticContexts) {
+ if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
if (shouldEnterSuppressNewDiagnosticsContextContext) {
@@ -84633,17 +85332,26 @@ var ts;
}
return maskModifierFlags(node, mask, additions);
}
+ function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) {
+ var accessorType = getTypeAnnotationFromAccessor(node);
+ if (!accessorType && node !== accessors.firstAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.firstAccessor);
+ // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.firstAccessor);
+ }
+ if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) {
+ accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
+ // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
+ getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
+ }
+ return accessorType;
+ }
function ensureAccessor(node) {
var accessors = resolver.getAllAccessorDeclarations(node);
if (node.kind !== accessors.firstAccessor.kind) {
return;
}
- var accessorType = getTypeAnnotationFromAccessor(node);
- if (!accessorType && accessors.secondAccessor) {
- accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
- // If we end up pulling the type from the second accessor, we also need to change the diagnostic context to get the expected error message
- getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
- }
+ var accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessors);
var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
@@ -84806,7 +85514,7 @@ var ts;
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 8 /* ESNext */) {
+ if (languageVersion < 99 /* ESNext */) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6 /* ES2019 */) {
@@ -84882,7 +85590,7 @@ var ts;
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(319 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(320 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -86407,30 +87115,30 @@ var ts;
case 279 /* EnumMember */:
return emitEnumMember(node);
// JSDoc nodes (only used in codefixes currently)
- case 306 /* JSDocParameterTag */:
- case 312 /* JSDocPropertyTag */:
+ case 307 /* JSDocParameterTag */:
+ case 313 /* JSDocPropertyTag */:
return emitJSDocPropertyLikeTag(node);
- case 307 /* JSDocReturnTag */:
- case 309 /* JSDocTypeTag */:
- case 308 /* JSDocThisTag */:
- case 305 /* JSDocEnumTag */:
+ case 308 /* JSDocReturnTag */:
+ case 310 /* JSDocTypeTag */:
+ case 309 /* JSDocThisTag */:
+ case 306 /* JSDocEnumTag */:
return emitJSDocSimpleTypedTag(node);
- case 301 /* JSDocAugmentsTag */:
+ case 302 /* JSDocAugmentsTag */:
return emitJSDocAugmentsTag(node);
- case 310 /* JSDocTemplateTag */:
+ case 311 /* JSDocTemplateTag */:
return emitJSDocTemplateTag(node);
- case 311 /* JSDocTypedefTag */:
+ case 312 /* JSDocTypedefTag */:
return emitJSDocTypedefTag(node);
- case 304 /* JSDocCallbackTag */:
+ case 305 /* JSDocCallbackTag */:
return emitJSDocCallbackTag(node);
- case 299 /* JSDocSignature */:
+ case 300 /* JSDocSignature */:
return emitJSDocSignature(node);
- case 298 /* JSDocTypeLiteral */:
+ case 299 /* JSDocTypeLiteral */:
return emitJSDocTypeLiteral(node);
- case 303 /* JSDocClassTag */:
- case 300 /* JSDocTag */:
+ case 304 /* JSDocClassTag */:
+ case 301 /* JSDocTag */:
return emitJSDocSimpleTag(node);
- case 297 /* JSDocComment */:
+ case 298 /* JSDocComment */:
return emitJSDoc(node);
// Transformation nodes (ignored)
}
@@ -86529,9 +87237,9 @@ var ts;
case 265 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 315 /* PartiallyEmittedExpression */:
+ case 316 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 316 /* CommaListExpression */:
+ case 317 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -86559,8 +87267,8 @@ var ts;
var helpers = getSortedEmitHelpers(sourceFile);
if (!helpers)
continue;
- for (var _c = 0, helpers_3 = helpers; _c < helpers_3.length; _c++) {
- var helper = helpers_3[_c];
+ for (var _c = 0, helpers_4 = helpers; _c < helpers_4.length; _c++) {
+ var helper = helpers_4[_c];
if (!helper.scoped && !shouldSkip && !bundledHelpers.get(helper.name)) {
bundledHelpers.set(helper.name, true);
(result || (result = [])).push(helper.name);
@@ -86580,12 +87288,12 @@ var ts;
for (var i = 0; i < numNodes; i++) {
var currentNode = bundle ? i < numPrepends ? bundle.prepends[i] : bundle.sourceFiles[i - numPrepends] : node;
var sourceFile = ts.isSourceFile(currentNode) ? currentNode : ts.isUnparsedSource(currentNode) ? undefined : currentSourceFile;
- var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.hasRecordedExternalHelpers(sourceFile));
var shouldBundle = (ts.isSourceFile(currentNode) || ts.isUnparsedSource(currentNode)) && !isOwnFileEmit;
var helpers = ts.isUnparsedSource(currentNode) ? currentNode.helpers : getSortedEmitHelpers(currentNode);
if (helpers) {
- for (var _a = 0, helpers_4 = helpers; _a < helpers_4.length; _a++) {
- var helper = helpers_4[_a];
+ for (var _a = 0, helpers_5 = helpers; _a < helpers_5.length; _a++) {
+ var helper = helpers_5[_a];
if (!helper.scoped) {
// Skip the helper if it can be skipped and the noEmitHelpers compiler
// option is set, or if it can be imported and the importHelpers compiler
@@ -88025,7 +88733,7 @@ var ts;
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 309 /* JSDocTypeTag */ && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 310 /* JSDocTypeTag */ && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -88078,7 +88786,7 @@ var ts;
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) {
+ if (tag.typeExpression && tag.typeExpression.kind === 299 /* JSDocTypeLiteral */) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -88212,8 +88920,8 @@ var ts;
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// ");
if (bundleFileInfo)
@@ -89067,7 +89775,7 @@ var ts;
if (node.locals) {
var local = node.locals.get(ts.escapeLeadingUnderscores(name));
// We conservatively include alias symbols to cover cases where they're emitted as locals
- if (local && local.flags & (67220415 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
+ if (local && local.flags & (111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
return false;
}
}
@@ -89254,7 +89962,7 @@ var ts;
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 314 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 315 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
@@ -89535,7 +90243,7 @@ var ts;
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 314 /* NotEmittedStatement */
+ if (node.kind !== 315 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -89548,7 +90256,7 @@ var ts;
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 314 /* NotEmittedStatement */
+ if (node.kind !== 315 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -89916,6 +90624,9 @@ var ts;
var createFileWatcher = getCreateFileWatcher(watchLogLevel, watchFile);
var createFilePathWatcher = watchLogLevel === WatchLogLevel.None ? watchFilePath : createFileWatcher;
var createDirectoryWatcher = getCreateFileWatcher(watchLogLevel, watchDirectory);
+ if (watchLogLevel === WatchLogLevel.Verbose && ts.sysLog === ts.noop) {
+ ts.sysLog = function (s) { return log(s); };
+ }
return {
watchFile: function (host, file, callback, pollingInterval, detailInfo1, detailInfo2) {
return createFileWatcher(host, file, callback, pollingInterval, /*passThrough*/ undefined, detailInfo1, detailInfo2, watchFile, log, "FileWatcher", getDetailWatchInfo);
@@ -90460,8 +91171,8 @@ var ts;
}
var resolutions = [];
var cache = ts.createMap();
- for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name = names_1[_i];
+ for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
+ var name = names_2[_i];
var result = void 0;
if (cache.has(name)) {
result = cache.get(name);
@@ -90622,7 +91333,7 @@ var ts;
var resolveModuleNamesWorker;
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
if (host.resolveModuleNames) {
- resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference).map(function (resolved) {
+ resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames, redirectedReference, options).map(function (resolved) {
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
if (!resolved || resolved.extension !== undefined) {
return resolved;
@@ -90639,7 +91350,7 @@ var ts;
}
var resolveTypeReferenceDirectiveNamesWorker;
if (host.resolveTypeReferenceDirectives) {
- resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference); };
+ resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile, redirectedReference, options); };
}
else {
var loader_2 = function (typesRef, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference).resolvedTypeReferenceDirective; }; // TODO: GH#18217
@@ -90669,7 +91380,10 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
- var structuralIsReused = tryReuseStructureFromOldProgram();
+ // We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks
+ // `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`.
+ var structuralIsReused;
+ structuralIsReused = tryReuseStructureFromOldProgram();
if (structuralIsReused !== 2 /* Completely */) {
processingDefaultLibFiles = [];
processingOtherFiles = [];
@@ -94338,8 +95052,8 @@ var ts;
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
!!redirectedReference;
var seenNamesInFile = ts.createMap();
- for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
- var name = names_2[_i];
+ for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
+ var name = names_3[_i];
var resolution = resolutionsInFile.get(name);
// Resolution is valid if it is present and not invalidated
if (!seenNamesInFile.has(name) &&
@@ -94845,7 +95559,7 @@ var ts;
return [ambient];
var info = getInfo(importingSourceFile.path, host);
var moduleSourceFile = ts.getSourceFileOfNode(moduleSymbol.valueDeclaration || ts.getNonAugmentationDeclaration(moduleSymbol));
- var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.fileName, info.getCanonicalFileName, host, redirectTargetsMap);
+ var modulePaths = getAllModulePaths(files, importingSourceFile.path, moduleSourceFile.originalFileName, info.getCanonicalFileName, host, redirectTargetsMap);
var preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
var global = ts.mapDefined(modulePaths, function (moduleFileName) { return tryGetModuleNameAsNodeModule(moduleFileName, info, host, compilerOptions); });
return global.length ? global : modulePaths.map(function (moduleFileName) { return getLocalModuleSpecifier(moduleFileName, info, compilerOptions, preferences); });
@@ -94861,7 +95575,7 @@ var ts;
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
var ending = _b.ending, relativePreference = _b.relativePreference;
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
- var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) ||
+ var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
if (!baseUrl || relativePreference === 0 /* Relative */) {
return relativePath;
@@ -94987,14 +95701,16 @@ var ts;
}
}
}
- function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) {
+ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
if (normalizedTargetPath === undefined) {
return undefined;
}
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
- return ts.removeFileExtension(relativePath);
+ return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
+ ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
+ : ts.removeFileExtension(relativePath);
}
function tryGetModuleNameAsNodeModule(moduleFileName, _a, host, options) {
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
@@ -95644,10 +96360,22 @@ var ts;
/*logChangesWhenResolvingModule*/ false);
// Resolve module using host module resolution strategy if provided otherwise use resolution cache to resolve module names
compilerHost.resolveModuleNames = host.resolveModuleNames ?
- (function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveModuleNames.apply(host, args);
+ }) :
(function (moduleNames, containingFile, reusedNames, redirectedReference) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); });
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
- (function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); }) :
+ (function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return host.resolveTypeReferenceDirectives.apply(host, args);
+ }) :
(function (typeDirectiveNames, containingFile, redirectedReference) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); });
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
@@ -95873,13 +96601,19 @@ var ts;
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
switch (reloadLevel) {
case ts.ConfigFileProgramReloadLevel.Partial:
- return reloadFileNamesFromConfigFile();
+ ts.perfLogger.logStartUpdateProgram("PartialConfigReload");
+ reloadFileNamesFromConfigFile();
+ break;
case ts.ConfigFileProgramReloadLevel.Full:
- return reloadConfigFile();
+ ts.perfLogger.logStartUpdateProgram("FullConfigReload");
+ reloadConfigFile();
+ break;
default:
+ ts.perfLogger.logStartUpdateProgram("SynchronizeProgram");
synchronizeProgram();
- return;
+ break;
}
+ ts.perfLogger.logStopUpdateProgram("Done");
}
function reloadFileNamesFromConfigFile() {
writeLog("Reloading new file names and options");
@@ -96258,8 +96992,31 @@ var ts;
}
}
function getBuildOrder(state) {
- return state.buildOrder ||
- (state.buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); })));
+ return state.buildOrder || createStateBuildOrder(state);
+ }
+ function createStateBuildOrder(state) {
+ var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
+ if (ts.arrayIsEqualTo(state.buildOrder, buildOrder))
+ return state.buildOrder;
+ // Clear all to ResolvedConfigFilePaths cache to start fresh
+ state.resolvedConfigFilePaths.clear();
+ var currentProjects = ts.arrayToSet(buildOrder, function (resolved) { return toResolvedConfigFilePath(state, resolved); });
+ var noopOnDelete = { onDeleteValue: ts.noop };
+ // Config file cache
+ ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
+ ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
+ // Remove watches for the program no longer in the solution
+ if (state.watch) {
+ ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
+ ts.mutateMapSkippingNewValues(state.allWatchedWildcardDirectories, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcherOf); } });
+ ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
+ }
+ return state.buildOrder = buildOrder;
}
function getBuildOrderFor(state, project, onlyReferences) {
var resolvedProject = project && resolveProjectName(state, project);
@@ -97716,66 +98473,82 @@ var ts;
}
}
JsTyping.discoverTypings = discoverTypings;
- var PackageNameValidationResult;
- (function (PackageNameValidationResult) {
- PackageNameValidationResult[PackageNameValidationResult["Ok"] = 0] = "Ok";
- PackageNameValidationResult[PackageNameValidationResult["ScopedPackagesNotSupported"] = 1] = "ScopedPackagesNotSupported";
- PackageNameValidationResult[PackageNameValidationResult["EmptyName"] = 2] = "EmptyName";
- PackageNameValidationResult[PackageNameValidationResult["NameTooLong"] = 3] = "NameTooLong";
- PackageNameValidationResult[PackageNameValidationResult["NameStartsWithDot"] = 4] = "NameStartsWithDot";
- PackageNameValidationResult[PackageNameValidationResult["NameStartsWithUnderscore"] = 5] = "NameStartsWithUnderscore";
- PackageNameValidationResult[PackageNameValidationResult["NameContainsNonURISafeCharacters"] = 6] = "NameContainsNonURISafeCharacters";
- })(PackageNameValidationResult = JsTyping.PackageNameValidationResult || (JsTyping.PackageNameValidationResult = {}));
+ var NameValidationResult;
+ (function (NameValidationResult) {
+ NameValidationResult[NameValidationResult["Ok"] = 0] = "Ok";
+ NameValidationResult[NameValidationResult["EmptyName"] = 1] = "EmptyName";
+ NameValidationResult[NameValidationResult["NameTooLong"] = 2] = "NameTooLong";
+ NameValidationResult[NameValidationResult["NameStartsWithDot"] = 3] = "NameStartsWithDot";
+ NameValidationResult[NameValidationResult["NameStartsWithUnderscore"] = 4] = "NameStartsWithUnderscore";
+ NameValidationResult[NameValidationResult["NameContainsNonURISafeCharacters"] = 5] = "NameContainsNonURISafeCharacters";
+ })(NameValidationResult = JsTyping.NameValidationResult || (JsTyping.NameValidationResult = {}));
var maxPackageNameLength = 214;
/**
* Validates package name using rules defined at https://docs.npmjs.com/files/package.json
*/
function validatePackageName(packageName) {
+ return validatePackageNameWorker(packageName, /*supportScopedPackage*/ true);
+ }
+ JsTyping.validatePackageName = validatePackageName;
+ function validatePackageNameWorker(packageName, supportScopedPackage) {
if (!packageName) {
- return 2 /* EmptyName */;
+ return 1 /* EmptyName */;
}
if (packageName.length > maxPackageNameLength) {
- return 3 /* NameTooLong */;
+ return 2 /* NameTooLong */;
}
if (packageName.charCodeAt(0) === 46 /* dot */) {
- return 4 /* NameStartsWithDot */;
+ return 3 /* NameStartsWithDot */;
}
if (packageName.charCodeAt(0) === 95 /* _ */) {
- return 5 /* NameStartsWithUnderscore */;
+ return 4 /* NameStartsWithUnderscore */;
}
// check if name is scope package like: starts with @ and has one '/' in the middle
// scoped packages are not currently supported
- // TODO: when support will be added we'll need to split and check both scope and package name
- if (/^@[^/]+\/[^/]+$/.test(packageName)) {
- return 1 /* ScopedPackagesNotSupported */;
+ if (supportScopedPackage) {
+ var matches = /^@([^/]+)\/([^/]+)$/.exec(packageName);
+ if (matches) {
+ var scopeResult = validatePackageNameWorker(matches[1], /*supportScopedPackage*/ false);
+ if (scopeResult !== 0 /* Ok */) {
+ return { name: matches[1], isScopeName: true, result: scopeResult };
+ }
+ var packageResult = validatePackageNameWorker(matches[2], /*supportScopedPackage*/ false);
+ if (packageResult !== 0 /* Ok */) {
+ return { name: matches[2], isScopeName: false, result: packageResult };
+ }
+ return 0 /* Ok */;
+ }
}
if (encodeURIComponent(packageName) !== packageName) {
- return 6 /* NameContainsNonURISafeCharacters */;
+ return 5 /* NameContainsNonURISafeCharacters */;
}
return 0 /* Ok */;
}
- JsTyping.validatePackageName = validatePackageName;
function renderPackageNameValidationFailure(result, typing) {
+ return typeof result === "object" ?
+ renderPackageNameValidationFailureWorker(typing, result.result, result.name, result.isScopeName) :
+ renderPackageNameValidationFailureWorker(typing, result, typing, /*isScopeName*/ false);
+ }
+ JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
+ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeName) {
+ var kind = isScopeName ? "Scope" : "Package";
switch (result) {
- case 2 /* EmptyName */:
- return "Package name '" + typing + "' cannot be empty";
- case 3 /* NameTooLong */:
- return "Package name '" + typing + "' should be less than " + maxPackageNameLength + " characters";
- case 4 /* NameStartsWithDot */:
- return "Package name '" + typing + "' cannot start with '.'";
- case 5 /* NameStartsWithUnderscore */:
- return "Package name '" + typing + "' cannot start with '_'";
- case 1 /* ScopedPackagesNotSupported */:
- return "Package '" + typing + "' is scoped and currently is not supported";
- case 6 /* NameContainsNonURISafeCharacters */:
- return "Package name '" + typing + "' contains non URI safe characters";
+ case 1 /* EmptyName */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot be empty";
+ case 2 /* NameTooLong */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' should be less than " + maxPackageNameLength + " characters";
+ case 3 /* NameStartsWithDot */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot start with '.'";
+ case 4 /* NameStartsWithUnderscore */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' cannot start with '_'";
+ case 5 /* NameContainsNonURISafeCharacters */:
+ return "'" + typing + "':: " + kind + " name '" + name + "' contains non URI safe characters";
case 0 /* Ok */:
return ts.Debug.fail(); // Shouldn't have called this.
default:
throw ts.Debug.assertNever(result);
}
}
- JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
})(JsTyping = ts.JsTyping || (ts.JsTyping = {}));
})(ts || (ts = {}));
var ts;
@@ -97998,31 +98771,32 @@ var ts;
};
TypingsInstaller.prototype.filterTypings = function (typingsToInstall) {
var _this = this;
- return typingsToInstall.filter(function (typing) {
- if (_this.missingTypingsSet.get(typing)) {
+ return ts.mapDefined(typingsToInstall, function (typing) {
+ var typingKey = ts.mangleScopedPackageName(typing);
+ if (_this.missingTypingsSet.get(typingKey)) {
if (_this.log.isEnabled())
- _this.log.writeLine("'" + typing + "' is in missingTypingsSet - skipping...");
- return false;
+ _this.log.writeLine("'" + typing + "':: '" + typingKey + "' is in missingTypingsSet - skipping...");
+ return undefined;
}
var validationResult = ts.JsTyping.validatePackageName(typing);
if (validationResult !== 0 /* Ok */) {
// add typing name to missing set so we won't process it again
- _this.missingTypingsSet.set(typing, true);
+ _this.missingTypingsSet.set(typingKey, true);
if (_this.log.isEnabled())
_this.log.writeLine(ts.JsTyping.renderPackageNameValidationFailure(validationResult, typing));
- return false;
+ return undefined;
}
- if (!_this.typesRegistry.has(typing)) {
+ if (!_this.typesRegistry.has(typingKey)) {
if (_this.log.isEnabled())
- _this.log.writeLine("Entry for package '" + typing + "' does not exist in local types registry - skipping...");
- return false;
+ _this.log.writeLine("'" + typing + "':: Entry for package '" + typingKey + "' does not exist in local types registry - skipping...");
+ return undefined;
}
- if (_this.packageNameToTypingLocation.get(typing) && ts.JsTyping.isTypingUpToDate(_this.packageNameToTypingLocation.get(typing), _this.typesRegistry.get(typing))) {
+ if (_this.packageNameToTypingLocation.get(typingKey) && ts.JsTyping.isTypingUpToDate(_this.packageNameToTypingLocation.get(typingKey), _this.typesRegistry.get(typingKey))) {
if (_this.log.isEnabled())
- _this.log.writeLine("'" + typing + "' already has an up-to-date typing - skipping...");
- return false;
+ _this.log.writeLine("'" + typing + "':: '" + typingKey + "' already has an up-to-date typing - skipping...");
+ return undefined;
}
- return true;
+ return typingKey;
});
};
TypingsInstaller.prototype.ensurePackageDirectoryExists = function (directory) {