@typescript-deploys/pr-build 5.6.0-pr-59467-2 → 5.6.0-pr-59519-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +330 -155
- package/lib/tsserver.js +2 -2
- package/lib/typescript.d.ts +2 -0
- package/lib/typescript.js +457 -225
- package/lib/typingsInstaller.js +1 -1
- package/package.json +14 -11
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240814`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -1688,7 +1688,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1688
1688
|
Object.defineProperties(array, {
|
|
1689
1689
|
__tsDebuggerDisplay: {
|
|
1690
1690
|
value(defaultValue) {
|
|
1691
|
-
defaultValue = String(defaultValue).replace(/(?:,[\s\w
|
|
1691
|
+
defaultValue = String(defaultValue).replace(/(?:,[\s\w]+:[^,]+)+\]$/, "]");
|
|
1692
1692
|
return `NodeArray ${defaultValue}`;
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
@@ -2231,7 +2231,7 @@ var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-
|
|
|
2231
2231
|
var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i;
|
|
2232
2232
|
var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
|
|
2233
2233
|
var buildPartRegExp = /^[a-z0-9-]+$/i;
|
|
2234
|
-
var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
|
|
2234
|
+
var numericIdentifierRegExp = /^(?:0|[1-9]\d*)$/;
|
|
2235
2235
|
var _Version = class _Version {
|
|
2236
2236
|
constructor(major, minor = 0, patch = 0, prerelease = "", build2 = "") {
|
|
2237
2237
|
if (typeof major === "string") {
|
|
@@ -2354,11 +2354,11 @@ var VersionRange = class _VersionRange {
|
|
|
2354
2354
|
return formatDisjunction(this._alternatives);
|
|
2355
2355
|
}
|
|
2356
2356
|
};
|
|
2357
|
-
var logicalOrRegExp =
|
|
2358
|
-
var whitespaceRegExp = /\s
|
|
2359
|
-
var partialRegExp = /^([
|
|
2357
|
+
var logicalOrRegExp = /\|\|/;
|
|
2358
|
+
var whitespaceRegExp = /\s+/;
|
|
2359
|
+
var partialRegExp = /^([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
|
|
2360
2360
|
var hyphenRegExp = /^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i;
|
|
2361
|
-
var rangeRegExp = /^(
|
|
2361
|
+
var rangeRegExp = /^([~^<>=]|<=|>=)?\s*([a-z0-9-+.*]+)$/i;
|
|
2362
2362
|
function parseRange(text) {
|
|
2363
2363
|
const alternatives = [];
|
|
2364
2364
|
for (let range of text.trim().split(logicalOrRegExp)) {
|
|
@@ -4843,7 +4843,7 @@ function patchWriteFileEnsuringDirectory(sys2) {
|
|
|
4843
4843
|
var sys = (() => {
|
|
4844
4844
|
const byteOrderMarkIndicator = "\uFEFF";
|
|
4845
4845
|
function getNodeSystem() {
|
|
4846
|
-
const nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[
|
|
4846
|
+
const nativePattern = /^native |^\([^)]+\)$|^(?:internal[\\/]|[\w\s]+(?:\.js)?$)/;
|
|
4847
4847
|
const _fs = require("fs");
|
|
4848
4848
|
const _path = require("path");
|
|
4849
4849
|
const _os = require("os");
|
|
@@ -4954,7 +4954,7 @@ var sys = (() => {
|
|
|
4954
4954
|
disableCPUProfiler,
|
|
4955
4955
|
cpuProfilingEnabled: () => !!activeSession || contains(process.execArgv, "--cpu-prof") || contains(process.execArgv, "--prof"),
|
|
4956
4956
|
realpath,
|
|
4957
|
-
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(inspect|debug)(
|
|
4957
|
+
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(?:inspect|debug)(?:-brk)?(?:=\d+)?$/i.test(arg)) || !!process.recordreplay,
|
|
4958
4958
|
tryEnableSourceMapsForHost() {
|
|
4959
4959
|
try {
|
|
4960
4960
|
require("source-map-support").install();
|
|
@@ -5109,7 +5109,7 @@ var sys = (() => {
|
|
|
5109
5109
|
let buffer;
|
|
5110
5110
|
try {
|
|
5111
5111
|
buffer = _fs.readFileSync(fileName);
|
|
5112
|
-
} catch
|
|
5112
|
+
} catch {
|
|
5113
5113
|
return void 0;
|
|
5114
5114
|
}
|
|
5115
5115
|
let len = buffer.length;
|
|
@@ -5168,7 +5168,7 @@ var sys = (() => {
|
|
|
5168
5168
|
if (!stat) {
|
|
5169
5169
|
continue;
|
|
5170
5170
|
}
|
|
5171
|
-
} catch
|
|
5171
|
+
} catch {
|
|
5172
5172
|
continue;
|
|
5173
5173
|
}
|
|
5174
5174
|
} else {
|
|
@@ -5183,7 +5183,7 @@ var sys = (() => {
|
|
|
5183
5183
|
files.sort();
|
|
5184
5184
|
directories.sort();
|
|
5185
5185
|
return { files, directories };
|
|
5186
|
-
} catch
|
|
5186
|
+
} catch {
|
|
5187
5187
|
return emptyFileSystemEntries;
|
|
5188
5188
|
}
|
|
5189
5189
|
}
|
|
@@ -5206,7 +5206,7 @@ var sys = (() => {
|
|
|
5206
5206
|
default:
|
|
5207
5207
|
return false;
|
|
5208
5208
|
}
|
|
5209
|
-
} catch
|
|
5209
|
+
} catch {
|
|
5210
5210
|
return false;
|
|
5211
5211
|
} finally {
|
|
5212
5212
|
Error.stackTraceLimit = originalStackTraceLimit;
|
|
@@ -5237,7 +5237,7 @@ var sys = (() => {
|
|
|
5237
5237
|
Error.stackTraceLimit = 0;
|
|
5238
5238
|
try {
|
|
5239
5239
|
return (_a = statSync(path)) == null ? void 0 : _a.mtime;
|
|
5240
|
-
} catch
|
|
5240
|
+
} catch {
|
|
5241
5241
|
return void 0;
|
|
5242
5242
|
} finally {
|
|
5243
5243
|
Error.stackTraceLimit = originalStackTraceLimit;
|
|
@@ -5246,14 +5246,14 @@ var sys = (() => {
|
|
|
5246
5246
|
function setModifiedTime(path, time) {
|
|
5247
5247
|
try {
|
|
5248
5248
|
_fs.utimesSync(path, time, time);
|
|
5249
|
-
} catch
|
|
5249
|
+
} catch {
|
|
5250
5250
|
return;
|
|
5251
5251
|
}
|
|
5252
5252
|
}
|
|
5253
5253
|
function deleteFile(path) {
|
|
5254
5254
|
try {
|
|
5255
5255
|
return _fs.unlinkSync(path);
|
|
5256
|
-
} catch
|
|
5256
|
+
} catch {
|
|
5257
5257
|
return;
|
|
5258
5258
|
}
|
|
5259
5259
|
}
|
|
@@ -5301,7 +5301,7 @@ function pathIsAbsolute(path) {
|
|
|
5301
5301
|
return getEncodedRootLength(path) !== 0;
|
|
5302
5302
|
}
|
|
5303
5303
|
function pathIsRelative(path) {
|
|
5304
|
-
return /^\.\.?(
|
|
5304
|
+
return /^\.\.?(?:$|[\\/])/.test(path);
|
|
5305
5305
|
}
|
|
5306
5306
|
function pathIsBareSpecifier(path) {
|
|
5307
5307
|
return !pathIsAbsolute(path) && !pathIsRelative(path);
|
|
@@ -5527,7 +5527,14 @@ function changeAnyExtension(path, ext, extensions, ignoreCase) {
|
|
|
5527
5527
|
const pathext = extensions !== void 0 && ignoreCase !== void 0 ? getAnyExtensionFromPath(path, extensions, ignoreCase) : getAnyExtensionFromPath(path);
|
|
5528
5528
|
return pathext ? path.slice(0, path.length - pathext.length) + (startsWith(ext, ".") ? ext : "." + ext) : path;
|
|
5529
5529
|
}
|
|
5530
|
-
|
|
5530
|
+
function changeFullExtension(path, newExtension) {
|
|
5531
|
+
const declarationExtension = getDeclarationFileExtension(path);
|
|
5532
|
+
if (declarationExtension) {
|
|
5533
|
+
return path.slice(0, path.length - declarationExtension.length) + (startsWith(newExtension, ".") ? newExtension : "." + newExtension);
|
|
5534
|
+
}
|
|
5535
|
+
return changeAnyExtension(path, newExtension);
|
|
5536
|
+
}
|
|
5537
|
+
var relativePathSegmentRegExp = /\/\/|(?:^|\/)\.\.?(?:$|\/)/;
|
|
5531
5538
|
function comparePathsWorker(a, b, componentComparer) {
|
|
5532
5539
|
if (a === b) return 0 /* EqualTo */;
|
|
5533
5540
|
if (a === void 0) return -1 /* LessThan */;
|
|
@@ -7383,6 +7390,7 @@ var Diagnostics = {
|
|
|
7383
7390
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
7384
7391
|
Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
|
|
7385
7392
|
Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
|
|
7393
|
+
This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
|
|
7386
7394
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
7387
7395
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
7388
7396
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -11179,7 +11187,7 @@ function getNodeFlags(node) {
|
|
|
11179
11187
|
var supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"];
|
|
11180
11188
|
function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
11181
11189
|
const lowerCaseLocale = locale.toLowerCase();
|
|
11182
|
-
const matchResult = /^([a-z]+)([_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
11190
|
+
const matchResult = /^([a-z]+)(?:[_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
11183
11191
|
if (!matchResult) {
|
|
11184
11192
|
if (errors) {
|
|
11185
11193
|
errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
|
|
@@ -11187,7 +11195,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
|
11187
11195
|
return;
|
|
11188
11196
|
}
|
|
11189
11197
|
const language = matchResult[1];
|
|
11190
|
-
const territory = matchResult[
|
|
11198
|
+
const territory = matchResult[2];
|
|
11191
11199
|
if (contains(supportedLocaleDirectories, lowerCaseLocale) && !trySetLanguageAndTerritory(language, territory, errors)) {
|
|
11192
11200
|
trySetLanguageAndTerritory(
|
|
11193
11201
|
language,
|
|
@@ -11211,7 +11219,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
|
11211
11219
|
let fileContents = "";
|
|
11212
11220
|
try {
|
|
11213
11221
|
fileContents = sys2.readFile(filePath);
|
|
11214
|
-
} catch
|
|
11222
|
+
} catch {
|
|
11215
11223
|
if (errors2) {
|
|
11216
11224
|
errors2.push(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, filePath));
|
|
11217
11225
|
}
|
|
@@ -13863,12 +13871,12 @@ function getJSDocCommentRanges(node, text) {
|
|
|
13863
13871
|
return filter(commentRanges, (comment) => comment.end <= node.end && // Due to parse errors sometime empty parameter may get comments assigned to it that end up not in parameter range
|
|
13864
13872
|
text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
|
|
13865
13873
|
}
|
|
13866
|
-
var fullTripleSlashReferencePathRegEx =
|
|
13867
|
-
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx =
|
|
13868
|
-
var fullTripleSlashLibReferenceRegEx =
|
|
13869
|
-
var fullTripleSlashAMDReferencePathRegEx =
|
|
13870
|
-
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s
|
|
13871
|
-
var defaultLibReferenceRegEx =
|
|
13874
|
+
var fullTripleSlashReferencePathRegEx = /^\/\/\/\s*<reference\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13875
|
+
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^\/\/\/\s*<reference\s+types\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13876
|
+
var fullTripleSlashLibReferenceRegEx = /^\/\/\/\s*<reference\s+lib\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13877
|
+
var fullTripleSlashAMDReferencePathRegEx = /^\/\/\/\s*<amd-dependency\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13878
|
+
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s+(?:\S.*?)??\/>/;
|
|
13879
|
+
var defaultLibReferenceRegEx = /^\/\/\/\s*<reference\s+no-default-lib\s*=\s*(?:'[^']*'|"[^"]*")\s*\/>/;
|
|
13872
13880
|
function isPartOfTypeNode(node) {
|
|
13873
13881
|
if (182 /* FirstTypeNode */ <= node.kind && node.kind <= 205 /* LastTypeNode */) {
|
|
13874
13882
|
return true;
|
|
@@ -15919,9 +15927,9 @@ function containsInvalidEscapeFlag(node) {
|
|
|
15919
15927
|
function hasInvalidEscape(template) {
|
|
15920
15928
|
return template && !!(isNoSubstitutionTemplateLiteral(template) ? containsInvalidEscapeFlag(template) : containsInvalidEscapeFlag(template.head) || some(template.templateSpans, (span) => containsInvalidEscapeFlag(span.literal)));
|
|
15921
15929
|
}
|
|
15922
|
-
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\
|
|
15923
|
-
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\
|
|
15924
|
-
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\
|
|
15930
|
+
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15931
|
+
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15932
|
+
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15925
15933
|
var escapedCharsMap = new Map(Object.entries({
|
|
15926
15934
|
" ": "\\t",
|
|
15927
15935
|
"\v": "\\v",
|
|
@@ -17324,7 +17332,7 @@ var objectAllocator = {
|
|
|
17324
17332
|
getSourceMapSourceConstructor: () => SourceMapSource
|
|
17325
17333
|
};
|
|
17326
17334
|
function formatStringFromArgs(text, args) {
|
|
17327
|
-
return text.replace(
|
|
17335
|
+
return text.replace(/\{(\d+)\}/g, (_match, index) => "" + Debug.checkDefined(args[+index]));
|
|
17328
17336
|
}
|
|
17329
17337
|
var localizedDiagnosticMessages;
|
|
17330
17338
|
function setLocalizedDiagnosticMessages(messages) {
|
|
@@ -18255,6 +18263,9 @@ function hasJSFileExtension(fileName) {
|
|
|
18255
18263
|
function hasTSFileExtension(fileName) {
|
|
18256
18264
|
return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
|
|
18257
18265
|
}
|
|
18266
|
+
function hasImplementationTSFileExtension(fileName) {
|
|
18267
|
+
return some(supportedTSImplementationExtensions, (extension) => fileExtensionIs(fileName, extension)) && !isDeclarationFileName(fileName);
|
|
18268
|
+
}
|
|
18258
18269
|
function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtension, hasTSFileExtension)) {
|
|
18259
18270
|
return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
|
|
18260
18271
|
}
|
|
@@ -35452,8 +35463,8 @@ function getNamedArgRegEx(name) {
|
|
|
35452
35463
|
namedArgRegExCache.set(name, result);
|
|
35453
35464
|
return result;
|
|
35454
35465
|
}
|
|
35455
|
-
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/
|
|
35456
|
-
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)
|
|
35466
|
+
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/m;
|
|
35467
|
+
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)((?:[^\S\r\n]|:).*)?$/m;
|
|
35457
35468
|
function extractPragmas(pragmas, range, text) {
|
|
35458
35469
|
const tripleSlash = range.kind === 2 /* SingleLineCommentTrivia */ && tripleSlashXMLCommentStartRegEx.exec(text);
|
|
35459
35470
|
if (tripleSlash) {
|
|
@@ -35494,7 +35505,7 @@ function extractPragmas(pragmas, range, text) {
|
|
|
35494
35505
|
return addPragmaForMatch(pragmas, range, 2 /* SingleLine */, singleLine);
|
|
35495
35506
|
}
|
|
35496
35507
|
if (range.kind === 3 /* MultiLineCommentTrivia */) {
|
|
35497
|
-
const multiLinePragmaRegEx = /@(\S+)(\s
|
|
35508
|
+
const multiLinePragmaRegEx = /@(\S+)(\s+(?:\S.*)?)?$/gm;
|
|
35498
35509
|
let multiLineMatch;
|
|
35499
35510
|
while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
|
|
35500
35511
|
addPragmaForMatch(pragmas, range, 4 /* MultiLine */, multiLineMatch);
|
|
@@ -38566,7 +38577,7 @@ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sour
|
|
|
38566
38577
|
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
38567
38578
|
return filter(map(values, (v, index) => convertJsonOption(option.element, v, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile)), (v) => option.listPreserveFalsyValues ? true : !!v);
|
|
38568
38579
|
}
|
|
38569
|
-
var invalidTrailingRecursionPattern = /(
|
|
38580
|
+
var invalidTrailingRecursionPattern = /(?:^|\/)\*\*\/?$/;
|
|
38570
38581
|
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
|
38571
38582
|
function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
|
|
38572
38583
|
basePath = normalizePath(basePath);
|
|
@@ -42672,6 +42683,8 @@ function createBinder() {
|
|
|
42672
42683
|
}
|
|
42673
42684
|
function bindJSDocImportTag(node) {
|
|
42674
42685
|
bind(node.tagName);
|
|
42686
|
+
bind(node.moduleSpecifier);
|
|
42687
|
+
bind(node.attributes);
|
|
42675
42688
|
if (typeof node.comment !== "string") {
|
|
42676
42689
|
bindEach(node.comment);
|
|
42677
42690
|
}
|
|
@@ -44343,9 +44356,32 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
44343
44356
|
}
|
|
44344
44357
|
|
|
44345
44358
|
// src/compiler/moduleSpecifiers.ts
|
|
44346
|
-
|
|
44359
|
+
var stringToRegex = memoizeOne((pattern) => {
|
|
44360
|
+
try {
|
|
44361
|
+
let slash = pattern.indexOf("/");
|
|
44362
|
+
if (slash !== 0) {
|
|
44363
|
+
return new RegExp(pattern);
|
|
44364
|
+
}
|
|
44365
|
+
const lastSlash = pattern.lastIndexOf("/");
|
|
44366
|
+
if (slash === lastSlash) {
|
|
44367
|
+
return new RegExp(pattern);
|
|
44368
|
+
}
|
|
44369
|
+
while ((slash = pattern.indexOf("/", slash + 1)) !== lastSlash) {
|
|
44370
|
+
if (pattern[slash - 1] !== "\\") {
|
|
44371
|
+
return new RegExp(pattern);
|
|
44372
|
+
}
|
|
44373
|
+
}
|
|
44374
|
+
const flags = pattern.substring(lastSlash + 1).replace(/[^iu]/g, "");
|
|
44375
|
+
pattern = pattern.substring(1, lastSlash);
|
|
44376
|
+
return new RegExp(pattern, flags);
|
|
44377
|
+
} catch {
|
|
44378
|
+
return void 0;
|
|
44379
|
+
}
|
|
44380
|
+
});
|
|
44381
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding, autoImportSpecifierExcludeRegexes }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
44347
44382
|
const filePreferredEnding = getPreferredEnding();
|
|
44348
44383
|
return {
|
|
44384
|
+
excludeRegexes: autoImportSpecifierExcludeRegexes,
|
|
44349
44385
|
relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
|
|
44350
44386
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
44351
44387
|
const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
|
|
@@ -44414,7 +44450,13 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
|
|
|
44414
44450
|
function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
44415
44451
|
let computedWithoutCache = false;
|
|
44416
44452
|
const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
|
|
44417
|
-
if (ambient)
|
|
44453
|
+
if (ambient) {
|
|
44454
|
+
return {
|
|
44455
|
+
kind: "ambient",
|
|
44456
|
+
moduleSpecifiers: !(forAutoImport && isExcludedByRegex(ambient, userPreferences.autoImportSpecifierExcludeRegexes)) ? [ambient] : emptyArray,
|
|
44457
|
+
computedWithoutCache
|
|
44458
|
+
};
|
|
44459
|
+
}
|
|
44418
44460
|
let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
|
|
44419
44461
|
moduleSymbol,
|
|
44420
44462
|
importingSourceFile,
|
|
@@ -44474,9 +44516,11 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
44474
44516
|
void 0,
|
|
44475
44517
|
options.overrideImportMode
|
|
44476
44518
|
) : void 0;
|
|
44477
|
-
|
|
44478
|
-
|
|
44479
|
-
|
|
44519
|
+
if (specifier && !(forAutoImport && isExcludedByRegex(specifier, preferences.excludeRegexes))) {
|
|
44520
|
+
nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
|
|
44521
|
+
if (modulePath.isRedirect) {
|
|
44522
|
+
return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
|
|
44523
|
+
}
|
|
44480
44524
|
}
|
|
44481
44525
|
if (!specifier) {
|
|
44482
44526
|
const local = getLocalModuleSpecifier(
|
|
@@ -44489,7 +44533,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
44489
44533
|
/*pathsOnly*/
|
|
44490
44534
|
modulePath.isRedirect
|
|
44491
44535
|
);
|
|
44492
|
-
if (!local) {
|
|
44536
|
+
if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
|
|
44493
44537
|
continue;
|
|
44494
44538
|
}
|
|
44495
44539
|
if (modulePath.isRedirect) {
|
|
@@ -44505,7 +44549,13 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
44505
44549
|
}
|
|
44506
44550
|
}
|
|
44507
44551
|
}
|
|
44508
|
-
return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers:
|
|
44552
|
+
return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: relativeSpecifiers ?? emptyArray, computedWithoutCache: true };
|
|
44553
|
+
}
|
|
44554
|
+
function isExcludedByRegex(moduleSpecifier, excludeRegexes) {
|
|
44555
|
+
return some(excludeRegexes, (pattern) => {
|
|
44556
|
+
var _a;
|
|
44557
|
+
return !!((_a = stringToRegex(pattern)) == null ? void 0 : _a.test(moduleSpecifier));
|
|
44558
|
+
});
|
|
44509
44559
|
}
|
|
44510
44560
|
function getInfo(importingSourceFileName, host) {
|
|
44511
44561
|
importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
|
|
@@ -44518,7 +44568,7 @@ function getInfo(importingSourceFileName, host) {
|
|
|
44518
44568
|
canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
|
|
44519
44569
|
};
|
|
44520
44570
|
}
|
|
44521
|
-
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
|
|
44571
|
+
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference, excludeRegexes }, pathsOnly) {
|
|
44522
44572
|
const { baseUrl, paths, rootDirs } = compilerOptions;
|
|
44523
44573
|
if (pathsOnly && !paths) {
|
|
44524
44574
|
return void 0;
|
|
@@ -44534,7 +44584,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
44534
44584
|
if (!relativeToBaseUrl) {
|
|
44535
44585
|
return pathsOnly ? void 0 : relativePath;
|
|
44536
44586
|
}
|
|
44537
|
-
const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(
|
|
44587
|
+
const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(
|
|
44588
|
+
moduleFileName,
|
|
44589
|
+
sourceDirectory,
|
|
44590
|
+
compilerOptions,
|
|
44591
|
+
host,
|
|
44592
|
+
importMode,
|
|
44593
|
+
prefersTsExtension(allowedEndings)
|
|
44594
|
+
);
|
|
44538
44595
|
const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
|
|
44539
44596
|
if (pathsOnly) {
|
|
44540
44597
|
return fromPaths;
|
|
@@ -44543,6 +44600,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
44543
44600
|
if (!maybeNonRelative) {
|
|
44544
44601
|
return relativePath;
|
|
44545
44602
|
}
|
|
44603
|
+
const relativeIsExcluded = isExcludedByRegex(relativePath, excludeRegexes);
|
|
44604
|
+
const nonRelativeIsExcluded = isExcludedByRegex(maybeNonRelative, excludeRegexes);
|
|
44605
|
+
if (!relativeIsExcluded && nonRelativeIsExcluded) {
|
|
44606
|
+
return relativePath;
|
|
44607
|
+
}
|
|
44608
|
+
if (relativeIsExcluded && !nonRelativeIsExcluded) {
|
|
44609
|
+
return maybeNonRelative;
|
|
44610
|
+
}
|
|
44546
44611
|
if (relativePreference === 1 /* NonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
44547
44612
|
return maybeNonRelative;
|
|
44548
44613
|
}
|
|
@@ -44767,7 +44832,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
|
|
|
44767
44832
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
44768
44833
|
}
|
|
44769
44834
|
}
|
|
44770
|
-
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports) {
|
|
44835
|
+
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports, preferTsExtension) {
|
|
44771
44836
|
if (typeof exports2 === "string") {
|
|
44772
44837
|
const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
|
|
44773
44838
|
const getCommonSourceDirectory2 = () => host.getCommonSourceDirectory();
|
|
@@ -44779,6 +44844,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44779
44844
|
void 0
|
|
44780
44845
|
);
|
|
44781
44846
|
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
|
|
44847
|
+
const canTryTsExtension = preferTsExtension && hasImplementationTSFileExtension(targetFilePath);
|
|
44782
44848
|
switch (mode) {
|
|
44783
44849
|
case 0 /* Exact */:
|
|
44784
44850
|
if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */) {
|
|
@@ -44786,6 +44852,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44786
44852
|
}
|
|
44787
44853
|
break;
|
|
44788
44854
|
case 1 /* Directory */:
|
|
44855
|
+
if (canTryTsExtension && containsPath(targetFilePath, pathOrPattern, ignoreCase)) {
|
|
44856
|
+
const fragment = getRelativePathFromDirectory(
|
|
44857
|
+
pathOrPattern,
|
|
44858
|
+
targetFilePath,
|
|
44859
|
+
/*ignoreCase*/
|
|
44860
|
+
false
|
|
44861
|
+
);
|
|
44862
|
+
return { moduleFileToTry: getNormalizedAbsolutePath(
|
|
44863
|
+
combinePaths(combinePaths(packageName, exports2), fragment),
|
|
44864
|
+
/*currentDirectory*/
|
|
44865
|
+
void 0
|
|
44866
|
+
) };
|
|
44867
|
+
}
|
|
44789
44868
|
if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) {
|
|
44790
44869
|
const fragment = getRelativePathFromDirectory(
|
|
44791
44870
|
pathOrPattern,
|
|
@@ -44799,7 +44878,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44799
44878
|
void 0
|
|
44800
44879
|
) };
|
|
44801
44880
|
}
|
|
44802
|
-
if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
|
|
44881
|
+
if (!canTryTsExtension && containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
|
|
44803
44882
|
const fragment = getRelativePathFromDirectory(
|
|
44804
44883
|
pathOrPattern,
|
|
44805
44884
|
targetFilePath,
|
|
@@ -44822,12 +44901,12 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44822
44901
|
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
44823
44902
|
}
|
|
44824
44903
|
if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) {
|
|
44825
|
-
const fragment = getRelativePathFromDirectory(
|
|
44904
|
+
const fragment = changeFullExtension(getRelativePathFromDirectory(
|
|
44826
44905
|
pathOrPattern,
|
|
44827
44906
|
declarationFile,
|
|
44828
44907
|
/*ignoreCase*/
|
|
44829
44908
|
false
|
|
44830
|
-
);
|
|
44909
|
+
), getJSExtensionForFile(declarationFile, options));
|
|
44831
44910
|
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
44832
44911
|
}
|
|
44833
44912
|
break;
|
|
@@ -44835,11 +44914,15 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44835
44914
|
const starPos = pathOrPattern.indexOf("*");
|
|
44836
44915
|
const leadingSlice = pathOrPattern.slice(0, starPos);
|
|
44837
44916
|
const trailingSlice = pathOrPattern.slice(starPos + 1);
|
|
44917
|
+
if (canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
|
|
44918
|
+
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
44919
|
+
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
44920
|
+
}
|
|
44838
44921
|
if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) {
|
|
44839
44922
|
const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
|
|
44840
44923
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
44841
44924
|
}
|
|
44842
|
-
if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
|
|
44925
|
+
if (!canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
|
|
44843
44926
|
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
44844
44927
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
44845
44928
|
}
|
|
@@ -44849,17 +44932,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44849
44932
|
}
|
|
44850
44933
|
if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) {
|
|
44851
44934
|
const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
|
|
44852
|
-
|
|
44935
|
+
const substituted = replaceFirstStar(packageName, starReplacement);
|
|
44936
|
+
const jsExtension = tryGetJSExtensionForFile(declarationFile, options);
|
|
44937
|
+
return jsExtension ? { moduleFileToTry: changeFullExtension(substituted, jsExtension) } : void 0;
|
|
44853
44938
|
}
|
|
44854
44939
|
break;
|
|
44855
44940
|
}
|
|
44856
44941
|
} else if (Array.isArray(exports2)) {
|
|
44857
|
-
return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
|
|
44942
|
+
return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports, preferTsExtension));
|
|
44858
44943
|
} else if (typeof exports2 === "object" && exports2 !== null) {
|
|
44859
44944
|
for (const key of getOwnKeys(exports2)) {
|
|
44860
44945
|
if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
|
|
44861
44946
|
const subTarget = exports2[key];
|
|
44862
|
-
const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
|
|
44947
|
+
const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports, preferTsExtension);
|
|
44863
44948
|
if (result) {
|
|
44864
44949
|
return result;
|
|
44865
44950
|
}
|
|
@@ -44887,6 +44972,8 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
|
|
|
44887
44972
|
conditions,
|
|
44888
44973
|
mode,
|
|
44889
44974
|
/*isImports*/
|
|
44975
|
+
false,
|
|
44976
|
+
/*preferTsExtension*/
|
|
44890
44977
|
false
|
|
44891
44978
|
);
|
|
44892
44979
|
});
|
|
@@ -44901,10 +44988,12 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
|
|
|
44901
44988
|
conditions,
|
|
44902
44989
|
0 /* Exact */,
|
|
44903
44990
|
/*isImports*/
|
|
44991
|
+
false,
|
|
44992
|
+
/*preferTsExtension*/
|
|
44904
44993
|
false
|
|
44905
44994
|
);
|
|
44906
44995
|
}
|
|
44907
|
-
function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
|
|
44996
|
+
function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode, preferTsExtension) {
|
|
44908
44997
|
var _a, _b, _c;
|
|
44909
44998
|
if (!host.readFile || !getResolvePackageJsonImports(options)) {
|
|
44910
44999
|
return void 0;
|
|
@@ -44937,7 +45026,8 @@ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory,
|
|
|
44937
45026
|
conditions,
|
|
44938
45027
|
mode,
|
|
44939
45028
|
/*isImports*/
|
|
44940
|
-
true
|
|
45029
|
+
true,
|
|
45030
|
+
preferTsExtension
|
|
44941
45031
|
);
|
|
44942
45032
|
})) == null ? void 0 : _c.moduleFileToTry;
|
|
44943
45033
|
}
|
|
@@ -45019,7 +45109,15 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
45019
45109
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
45020
45110
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
45021
45111
|
const conditions = getConditions(options, importMode);
|
|
45022
|
-
const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(
|
|
45112
|
+
const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(
|
|
45113
|
+
options,
|
|
45114
|
+
host,
|
|
45115
|
+
path,
|
|
45116
|
+
packageRootPath,
|
|
45117
|
+
packageName2,
|
|
45118
|
+
packageJsonContent.exports,
|
|
45119
|
+
conditions
|
|
45120
|
+
) : void 0;
|
|
45023
45121
|
if (fromExports) {
|
|
45024
45122
|
return { ...fromExports, verbatimFromExports: true };
|
|
45025
45123
|
}
|
|
@@ -45167,6 +45265,10 @@ function isPathRelativeToParent(path) {
|
|
|
45167
45265
|
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
45168
45266
|
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
45169
45267
|
}
|
|
45268
|
+
function prefersTsExtension(allowedEndings) {
|
|
45269
|
+
const tsPriority = allowedEndings.indexOf(3 /* TsExtension */);
|
|
45270
|
+
return tsPriority > -1 && tsPriority < allowedEndings.indexOf(2 /* JsExtension */);
|
|
45271
|
+
}
|
|
45170
45272
|
|
|
45171
45273
|
// src/compiler/checker.ts
|
|
45172
45274
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -49361,6 +49463,7 @@ function createTypeChecker(host) {
|
|
|
49361
49463
|
}
|
|
49362
49464
|
function symbolToString(symbol, enclosingDeclaration, meaning, flags = 4 /* AllowAnyNodeKind */, writer) {
|
|
49363
49465
|
let nodeFlags = 70221824 /* IgnoreErrors */;
|
|
49466
|
+
let internalNodeFlags = 0 /* None */;
|
|
49364
49467
|
if (flags & 2 /* UseOnlyExternalAliasing */) {
|
|
49365
49468
|
nodeFlags |= 128 /* UseOnlyExternalAliasing */;
|
|
49366
49469
|
}
|
|
@@ -49371,15 +49474,15 @@ function createTypeChecker(host) {
|
|
|
49371
49474
|
nodeFlags |= 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
49372
49475
|
}
|
|
49373
49476
|
if (flags & 32 /* DoNotIncludeSymbolChain */) {
|
|
49374
|
-
|
|
49477
|
+
internalNodeFlags |= 4 /* DoNotIncludeSymbolChain */;
|
|
49375
49478
|
}
|
|
49376
49479
|
if (flags & 16 /* WriteComputedProps */) {
|
|
49377
|
-
|
|
49480
|
+
internalNodeFlags |= 1 /* WriteComputedProps */;
|
|
49378
49481
|
}
|
|
49379
49482
|
const builder = flags & 4 /* AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName;
|
|
49380
49483
|
return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
|
|
49381
49484
|
function symbolToStringWorker(writer2) {
|
|
49382
|
-
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
|
|
49485
|
+
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags, internalNodeFlags);
|
|
49383
49486
|
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 307 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
|
|
49384
49487
|
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
|
49385
49488
|
printer.writeNode(
|
|
@@ -49416,7 +49519,13 @@ function createTypeChecker(host) {
|
|
|
49416
49519
|
}
|
|
49417
49520
|
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
|
|
49418
49521
|
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
|
49419
|
-
const typeNode = nodeBuilder.typeToTypeNode(
|
|
49522
|
+
const typeNode = nodeBuilder.typeToTypeNode(
|
|
49523
|
+
type,
|
|
49524
|
+
enclosingDeclaration,
|
|
49525
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0 /* None */),
|
|
49526
|
+
/*internalFlags*/
|
|
49527
|
+
void 0
|
|
49528
|
+
);
|
|
49420
49529
|
if (typeNode === void 0) return Debug.fail("should always get typenode");
|
|
49421
49530
|
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
|
|
49422
49531
|
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
|
@@ -49465,31 +49574,31 @@ function createTypeChecker(host) {
|
|
|
49465
49574
|
}
|
|
49466
49575
|
function createNodeBuilder() {
|
|
49467
49576
|
return {
|
|
49468
|
-
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
49469
|
-
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
49470
|
-
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
49471
|
-
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
|
|
49472
|
-
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
49473
|
-
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
49577
|
+
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
49578
|
+
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
49579
|
+
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
49580
|
+
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
|
|
49581
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
49582
|
+
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
49474
49583
|
indexInfo,
|
|
49475
49584
|
context,
|
|
49476
49585
|
/*typeNode*/
|
|
49477
49586
|
void 0
|
|
49478
49587
|
)),
|
|
49479
|
-
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
|
49480
|
-
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToName(
|
|
49588
|
+
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
|
49589
|
+
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToName(
|
|
49481
49590
|
symbol,
|
|
49482
49591
|
context,
|
|
49483
49592
|
meaning,
|
|
49484
49593
|
/*expectsIdentifier*/
|
|
49485
49594
|
false
|
|
49486
49595
|
)),
|
|
49487
|
-
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
|
|
49488
|
-
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
49489
|
-
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
49490
|
-
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
49491
|
-
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
49492
|
-
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
49596
|
+
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
|
|
49597
|
+
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
49598
|
+
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
49599
|
+
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
49600
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
49601
|
+
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
49493
49602
|
};
|
|
49494
49603
|
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
|
49495
49604
|
const type = getTypeFromTypeNodeWithoutContext(node);
|
|
@@ -49511,13 +49620,13 @@ function createTypeChecker(host) {
|
|
|
49511
49620
|
return setTextRange(setOriginalNode(range, location), location);
|
|
49512
49621
|
}
|
|
49513
49622
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
49514
|
-
const
|
|
49515
|
-
if (expr && !(context.
|
|
49623
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
49624
|
+
if (expr && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
49516
49625
|
syntacticNodeBuilder.serializeTypeOfExpression(expr, context, addUndefined);
|
|
49517
49626
|
}
|
|
49518
|
-
context.
|
|
49627
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
49519
49628
|
const result = expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined);
|
|
49520
|
-
|
|
49629
|
+
restoreFlags();
|
|
49521
49630
|
return result;
|
|
49522
49631
|
}
|
|
49523
49632
|
function expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined) {
|
|
@@ -49570,7 +49679,7 @@ function createTypeChecker(host) {
|
|
|
49570
49679
|
return void 0;
|
|
49571
49680
|
}
|
|
49572
49681
|
function symbolToNode(symbol, context, meaning) {
|
|
49573
|
-
if (context.
|
|
49682
|
+
if (context.internalFlags & 1 /* WriteComputedProps */) {
|
|
49574
49683
|
if (symbol.valueDeclaration) {
|
|
49575
49684
|
const name = getNameOfDeclaration(symbol.valueDeclaration);
|
|
49576
49685
|
if (name && isComputedPropertyName(name)) return name;
|
|
@@ -49583,12 +49692,13 @@ function createTypeChecker(host) {
|
|
|
49583
49692
|
}
|
|
49584
49693
|
return symbolToExpression(symbol, context, meaning);
|
|
49585
49694
|
}
|
|
49586
|
-
function withContext(enclosingDeclaration, flags, tracker, cb) {
|
|
49587
|
-
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost :
|
|
49695
|
+
function withContext(enclosingDeclaration, flags, internalFlags, tracker, cb) {
|
|
49696
|
+
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
|
49588
49697
|
const context = {
|
|
49589
49698
|
enclosingDeclaration,
|
|
49590
49699
|
enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
|
|
49591
49700
|
flags: flags || 0 /* None */,
|
|
49701
|
+
internalFlags: internalFlags || 0 /* None */,
|
|
49592
49702
|
tracker: void 0,
|
|
49593
49703
|
encounteredError: false,
|
|
49594
49704
|
reportedDiagnostic: false,
|
|
@@ -49618,14 +49728,23 @@ function createTypeChecker(host) {
|
|
|
49618
49728
|
}
|
|
49619
49729
|
return context.encounteredError ? void 0 : resultingNode;
|
|
49620
49730
|
}
|
|
49731
|
+
function saveRestoreFlags(context) {
|
|
49732
|
+
const flags = context.flags;
|
|
49733
|
+
const internalFlags = context.internalFlags;
|
|
49734
|
+
return restore;
|
|
49735
|
+
function restore() {
|
|
49736
|
+
context.flags = flags;
|
|
49737
|
+
context.internalFlags = internalFlags;
|
|
49738
|
+
}
|
|
49739
|
+
}
|
|
49621
49740
|
function checkTruncationLength(context) {
|
|
49622
49741
|
if (context.truncating) return context.truncating;
|
|
49623
49742
|
return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
|
49624
49743
|
}
|
|
49625
49744
|
function typeToTypeNodeHelper(type, context) {
|
|
49626
|
-
const
|
|
49745
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
49627
49746
|
const typeNode = typeToTypeNodeWorker(type, context);
|
|
49628
|
-
|
|
49747
|
+
restoreFlags();
|
|
49629
49748
|
return typeNode;
|
|
49630
49749
|
}
|
|
49631
49750
|
function typeToTypeNodeWorker(type, context) {
|
|
@@ -50079,7 +50198,7 @@ function createTypeChecker(host) {
|
|
|
50079
50198
|
context.symbolDepth = /* @__PURE__ */ new Map();
|
|
50080
50199
|
}
|
|
50081
50200
|
const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
|
50082
|
-
const key = `${getTypeId(type2)}|${context.flags}`;
|
|
50201
|
+
const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
|
|
50083
50202
|
if (links) {
|
|
50084
50203
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
|
50085
50204
|
}
|
|
@@ -50185,10 +50304,10 @@ function createTypeChecker(host) {
|
|
|
50185
50304
|
}
|
|
50186
50305
|
return typeToTypeNodeHelper(getIntersectionType(types), context);
|
|
50187
50306
|
}
|
|
50188
|
-
const
|
|
50307
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50189
50308
|
context.flags |= 4194304 /* InObjectTypeLiteral */;
|
|
50190
50309
|
const members = createTypeNodesFromResolvedType(resolved);
|
|
50191
|
-
|
|
50310
|
+
restoreFlags();
|
|
50192
50311
|
const typeLiteralNode = factory.createTypeLiteralNode(members);
|
|
50193
50312
|
context.approximateLength += 2;
|
|
50194
50313
|
setEmitFlags(typeLiteralNode, context.flags & 1024 /* MultilineObjectLiterals */ ? 0 : 1 /* SingleLine */);
|
|
@@ -50251,10 +50370,10 @@ function createTypeChecker(host) {
|
|
|
50251
50370
|
} while (i < length2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent);
|
|
50252
50371
|
if (!rangeEquals(outerTypeParameters, typeArguments, start, i)) {
|
|
50253
50372
|
const typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
|
|
50254
|
-
const
|
|
50373
|
+
const restoreFlags2 = saveRestoreFlags(context);
|
|
50255
50374
|
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
|
|
50256
50375
|
const ref = symbolToTypeNode(parent, context, 788968 /* Type */, typeArgumentSlice);
|
|
50257
|
-
|
|
50376
|
+
restoreFlags2();
|
|
50258
50377
|
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
|
|
50259
50378
|
}
|
|
50260
50379
|
}
|
|
@@ -50292,10 +50411,10 @@ function createTypeChecker(host) {
|
|
|
50292
50411
|
}
|
|
50293
50412
|
typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
|
|
50294
50413
|
}
|
|
50295
|
-
const
|
|
50414
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50296
50415
|
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
|
|
50297
50416
|
const finalRef = symbolToTypeNode(type2.symbol, context, 788968 /* Type */, typeArgumentNodes);
|
|
50298
|
-
|
|
50417
|
+
restoreFlags();
|
|
50299
50418
|
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
|
|
50300
50419
|
}
|
|
50301
50420
|
}
|
|
@@ -50607,7 +50726,7 @@ function createTypeChecker(host) {
|
|
|
50607
50726
|
}
|
|
50608
50727
|
}
|
|
50609
50728
|
if (seenNames) {
|
|
50610
|
-
const
|
|
50729
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50611
50730
|
context.flags |= 64 /* UseFullyQualifiedType */;
|
|
50612
50731
|
seenNames.forEach((types2) => {
|
|
50613
50732
|
if (!arrayIsHomogeneous(types2, ([a], [b]) => typesAreSameReference(a, b))) {
|
|
@@ -50616,7 +50735,7 @@ function createTypeChecker(host) {
|
|
|
50616
50735
|
}
|
|
50617
50736
|
}
|
|
50618
50737
|
});
|
|
50619
|
-
|
|
50738
|
+
restoreFlags();
|
|
50620
50739
|
}
|
|
50621
50740
|
return result;
|
|
50622
50741
|
}
|
|
@@ -50668,19 +50787,19 @@ function createTypeChecker(host) {
|
|
|
50668
50787
|
} else {
|
|
50669
50788
|
typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context));
|
|
50670
50789
|
}
|
|
50671
|
-
const
|
|
50790
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50672
50791
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
50673
50792
|
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */));
|
|
50674
50793
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
50675
50794
|
if (thisParameter) {
|
|
50676
50795
|
parameters.unshift(thisParameter);
|
|
50677
50796
|
}
|
|
50678
|
-
|
|
50797
|
+
restoreFlags();
|
|
50679
50798
|
const returnTypeNode = serializeReturnTypeForSignature(context, signature);
|
|
50680
50799
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
50681
50800
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
50682
|
-
const
|
|
50683
|
-
modifiers = factory.createModifiersFromModifierFlags(
|
|
50801
|
+
const flags = modifiersToFlags(modifiers);
|
|
50802
|
+
modifiers = factory.createModifiersFromModifierFlags(flags | 64 /* Abstract */);
|
|
50684
50803
|
}
|
|
50685
50804
|
const node = kind === 179 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 180 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 174 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
50686
50805
|
modifiers,
|
|
@@ -50900,13 +51019,13 @@ function createTypeChecker(host) {
|
|
|
50900
51019
|
}
|
|
50901
51020
|
}
|
|
50902
51021
|
function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
|
|
50903
|
-
const
|
|
51022
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50904
51023
|
context.flags &= ~512 /* WriteTypeParametersInQualifiedName */;
|
|
50905
51024
|
const modifiers = factory.createModifiersFromModifierFlags(getTypeParameterModifiers(type));
|
|
50906
51025
|
const name = typeParameterToName(type, context);
|
|
50907
51026
|
const defaultParameter = getDefaultFromTypeParameter(type);
|
|
50908
51027
|
const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context);
|
|
50909
|
-
|
|
51028
|
+
restoreFlags();
|
|
50910
51029
|
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
|
|
50911
51030
|
}
|
|
50912
51031
|
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
|
|
@@ -51010,7 +51129,7 @@ function createTypeChecker(host) {
|
|
|
51010
51129
|
function lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol) {
|
|
51011
51130
|
let chain;
|
|
51012
51131
|
const isTypeParameter = symbol.flags & 262144 /* TypeParameter */;
|
|
51013
|
-
if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.
|
|
51132
|
+
if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.internalFlags & 4 /* DoNotIncludeSymbolChain */)) {
|
|
51014
51133
|
chain = Debug.checkDefined(getSymbolChain(
|
|
51015
51134
|
symbol,
|
|
51016
51135
|
meaning,
|
|
@@ -51534,21 +51653,21 @@ function createTypeChecker(host) {
|
|
|
51534
51653
|
}
|
|
51535
51654
|
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
51536
51655
|
var _a, _b;
|
|
51537
|
-
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51656
|
+
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
|
51538
51657
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51539
|
-
const
|
|
51540
|
-
if (declaration && hasInferredType(declaration) && !(context.
|
|
51658
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
51659
|
+
if (declaration && hasInferredType(declaration) && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
51541
51660
|
syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, context);
|
|
51542
51661
|
}
|
|
51543
|
-
context.
|
|
51544
|
-
if (enclosingDeclaration && (!isErrorType(type) || context.
|
|
51662
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
51663
|
+
if (enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */)) {
|
|
51545
51664
|
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
51546
51665
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
51547
51666
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
51548
51667
|
const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
|
|
51549
51668
|
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
51550
51669
|
if (result2) {
|
|
51551
|
-
|
|
51670
|
+
restoreFlags();
|
|
51552
51671
|
return result2;
|
|
51553
51672
|
}
|
|
51554
51673
|
}
|
|
@@ -51559,7 +51678,7 @@ function createTypeChecker(host) {
|
|
|
51559
51678
|
const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
|
|
51560
51679
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
51561
51680
|
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
|
|
51562
|
-
|
|
51681
|
+
restoreFlags();
|
|
51563
51682
|
return result;
|
|
51564
51683
|
}
|
|
51565
51684
|
function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
|
|
@@ -51573,26 +51692,26 @@ function createTypeChecker(host) {
|
|
|
51573
51692
|
}
|
|
51574
51693
|
function serializeReturnTypeForSignature(context, signature) {
|
|
51575
51694
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
51576
|
-
const
|
|
51695
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
51577
51696
|
if (suppressAny) context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
51578
51697
|
let returnTypeNode;
|
|
51579
51698
|
const returnType = getReturnTypeOfSignature(signature);
|
|
51580
51699
|
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
51581
|
-
if (signature.declaration && !(context.
|
|
51700
|
+
if (signature.declaration && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
51582
51701
|
syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, context);
|
|
51583
51702
|
}
|
|
51584
|
-
context.
|
|
51703
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
51585
51704
|
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
|
|
51586
51705
|
} else if (!suppressAny) {
|
|
51587
51706
|
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
51588
51707
|
}
|
|
51589
|
-
|
|
51708
|
+
restoreFlags();
|
|
51590
51709
|
return returnTypeNode;
|
|
51591
51710
|
}
|
|
51592
51711
|
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
51593
51712
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
51594
51713
|
const type = getReturnTypeOfSignature(signature);
|
|
51595
|
-
if (context.enclosingDeclaration && (!isErrorType(type) || context.
|
|
51714
|
+
if (context.enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
51596
51715
|
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
51597
51716
|
if (annotation) {
|
|
51598
51717
|
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
|
|
@@ -52094,7 +52213,7 @@ function createTypeChecker(host) {
|
|
|
52094
52213
|
if (!hasDynamicName(node)) {
|
|
52095
52214
|
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
52096
52215
|
}
|
|
52097
|
-
if (!(context.
|
|
52216
|
+
if (!(context.internalFlags & 8 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
52098
52217
|
return void 0;
|
|
52099
52218
|
}
|
|
52100
52219
|
}
|
|
@@ -52746,7 +52865,7 @@ function createTypeChecker(host) {
|
|
|
52746
52865
|
const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
|
|
52747
52866
|
const jsdocAliasDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isJSDocTypeAlias);
|
|
52748
52867
|
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
|
|
52749
|
-
const
|
|
52868
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
52750
52869
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
52751
52870
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
52752
52871
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
@@ -52770,7 +52889,7 @@ function createTypeChecker(host) {
|
|
|
52770
52889
|
),
|
|
52771
52890
|
modifierFlags
|
|
52772
52891
|
);
|
|
52773
|
-
|
|
52892
|
+
restoreFlags();
|
|
52774
52893
|
context.enclosingDeclaration = oldEnclosingDecl;
|
|
52775
52894
|
}
|
|
52776
52895
|
function serializeInterface(symbol, symbolName2, modifierFlags) {
|
|
@@ -53779,10 +53898,10 @@ function createTypeChecker(host) {
|
|
|
53779
53898
|
}
|
|
53780
53899
|
function getNameCandidateWorker(symbol, localName) {
|
|
53781
53900
|
if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
|
|
53782
|
-
const
|
|
53901
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
53783
53902
|
context.flags |= 16777216 /* InInitialEntityName */;
|
|
53784
53903
|
const nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
|
53785
|
-
|
|
53904
|
+
restoreFlags();
|
|
53786
53905
|
localName = nameCandidate.length > 0 && isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? stripQuotes(nameCandidate) : nameCandidate;
|
|
53787
53906
|
}
|
|
53788
53907
|
if (localName === "default" /* Default */) {
|
|
@@ -53790,7 +53909,7 @@ function createTypeChecker(host) {
|
|
|
53790
53909
|
} else if (localName === "export=" /* ExportEquals */) {
|
|
53791
53910
|
localName = "_exports";
|
|
53792
53911
|
}
|
|
53793
|
-
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-
|
|
53912
|
+
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
|
|
53794
53913
|
return localName;
|
|
53795
53914
|
}
|
|
53796
53915
|
function getInternalSymbolName(symbol, localName) {
|
|
@@ -55365,7 +55484,8 @@ function createTypeChecker(host) {
|
|
|
55365
55484
|
if (!node) {
|
|
55366
55485
|
return void 0;
|
|
55367
55486
|
}
|
|
55368
|
-
|
|
55487
|
+
const kind = node.kind;
|
|
55488
|
+
switch (kind) {
|
|
55369
55489
|
case 263 /* ClassDeclaration */:
|
|
55370
55490
|
case 231 /* ClassExpression */:
|
|
55371
55491
|
case 264 /* InterfaceDeclaration */:
|
|
@@ -55387,13 +55507,19 @@ function createTypeChecker(host) {
|
|
|
55387
55507
|
case 200 /* MappedType */:
|
|
55388
55508
|
case 194 /* ConditionalType */: {
|
|
55389
55509
|
const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
|
|
55390
|
-
if (
|
|
55510
|
+
if ((kind === 218 /* FunctionExpression */ || kind === 219 /* ArrowFunction */ || isObjectLiteralMethod(node)) && isContextSensitive(node)) {
|
|
55511
|
+
const signature = firstOrUndefined(getSignaturesOfType(getTypeOfSymbol(getSymbolOfDeclaration(node)), 0 /* Call */));
|
|
55512
|
+
if (signature && signature.typeParameters) {
|
|
55513
|
+
return [...outerTypeParameters || emptyArray, ...signature.typeParameters];
|
|
55514
|
+
}
|
|
55515
|
+
}
|
|
55516
|
+
if (kind === 200 /* MappedType */) {
|
|
55391
55517
|
return append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter)));
|
|
55392
|
-
} else if (
|
|
55518
|
+
} else if (kind === 194 /* ConditionalType */) {
|
|
55393
55519
|
return concatenate(outerTypeParameters, getInferTypeParameters(node));
|
|
55394
55520
|
}
|
|
55395
55521
|
const outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, getEffectiveTypeParameterDeclarations(node));
|
|
55396
|
-
const thisType = includeThisTypes && (
|
|
55522
|
+
const thisType = includeThisTypes && (kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 264 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType;
|
|
55397
55523
|
return thisType ? append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
|
|
55398
55524
|
}
|
|
55399
55525
|
case 341 /* JSDocParameterTag */:
|
|
@@ -58205,8 +58331,11 @@ function createTypeChecker(host) {
|
|
|
58205
58331
|
true
|
|
58206
58332
|
);
|
|
58207
58333
|
}
|
|
58334
|
+
function getTypeParametersForMapper(signature) {
|
|
58335
|
+
return sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp);
|
|
58336
|
+
}
|
|
58208
58337
|
function createSignatureTypeMapper(signature, typeArguments) {
|
|
58209
|
-
return createTypeMapper(
|
|
58338
|
+
return createTypeMapper(getTypeParametersForMapper(signature), typeArguments);
|
|
58210
58339
|
}
|
|
58211
58340
|
function getErasedSignature(signature) {
|
|
58212
58341
|
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
|
|
@@ -73465,7 +73594,7 @@ function createTypeChecker(host) {
|
|
|
73465
73594
|
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
|
|
73466
73595
|
}
|
|
73467
73596
|
function containerSeemsToBeEmptyDomElement(containingType) {
|
|
73468
|
-
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(EventTarget|Node|(
|
|
73597
|
+
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
|
|
73469
73598
|
}
|
|
73470
73599
|
function typeHasStaticProperty(propName, containingType) {
|
|
73471
73600
|
const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
|
|
@@ -73906,7 +74035,7 @@ function createTypeChecker(host) {
|
|
|
73906
74035
|
return void 0;
|
|
73907
74036
|
}
|
|
73908
74037
|
function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) {
|
|
73909
|
-
const context = createInferenceContext(signature
|
|
74038
|
+
const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0 /* None */, compareTypes);
|
|
73910
74039
|
const restType = getEffectiveRestType(contextualSignature);
|
|
73911
74040
|
const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
|
|
73912
74041
|
const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
|
|
@@ -78008,6 +78137,29 @@ function createTypeChecker(host) {
|
|
|
78008
78137
|
}
|
|
78009
78138
|
if (leftOk && rightOk) {
|
|
78010
78139
|
checkAssignmentOperator(resultType2);
|
|
78140
|
+
switch (operator) {
|
|
78141
|
+
case 48 /* LessThanLessThanToken */:
|
|
78142
|
+
case 71 /* LessThanLessThanEqualsToken */:
|
|
78143
|
+
case 49 /* GreaterThanGreaterThanToken */:
|
|
78144
|
+
case 72 /* GreaterThanGreaterThanEqualsToken */:
|
|
78145
|
+
case 50 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
78146
|
+
case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
|
|
78147
|
+
const rhsEval = evaluate(right);
|
|
78148
|
+
if (typeof rhsEval.value === "number" && Math.abs(rhsEval.value) >= 32) {
|
|
78149
|
+
errorOrSuggestion(
|
|
78150
|
+
isEnumMember(walkUpParenthesizedExpressions(right.parent.parent)),
|
|
78151
|
+
// elevate from suggestion to error within an enum member
|
|
78152
|
+
errorNode || operatorToken,
|
|
78153
|
+
Diagnostics.This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2,
|
|
78154
|
+
getTextOfNode(left),
|
|
78155
|
+
tokenToString(operator),
|
|
78156
|
+
rhsEval.value % 32
|
|
78157
|
+
);
|
|
78158
|
+
}
|
|
78159
|
+
break;
|
|
78160
|
+
default:
|
|
78161
|
+
break;
|
|
78162
|
+
}
|
|
78011
78163
|
}
|
|
78012
78164
|
return resultType2;
|
|
78013
78165
|
}
|
|
@@ -81324,7 +81476,7 @@ function createTypeChecker(host) {
|
|
|
81324
81476
|
);
|
|
81325
81477
|
if (globalAsyncDisposableType !== emptyObjectType && globalDisposableType !== emptyObjectType) {
|
|
81326
81478
|
const optionalDisposableType = getUnionType([globalAsyncDisposableType, globalDisposableType, nullType, undefinedType]);
|
|
81327
|
-
checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81479
|
+
checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81328
81480
|
}
|
|
81329
81481
|
} else if (blockScopeKind === 4 /* Using */) {
|
|
81330
81482
|
const globalDisposableType = getGlobalDisposableType(
|
|
@@ -81333,7 +81485,7 @@ function createTypeChecker(host) {
|
|
|
81333
81485
|
);
|
|
81334
81486
|
if (globalDisposableType !== emptyObjectType) {
|
|
81335
81487
|
const optionalDisposableType = getUnionType([globalDisposableType, nullType, undefinedType]);
|
|
81336
|
-
checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81488
|
+
checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81337
81489
|
}
|
|
81338
81490
|
}
|
|
81339
81491
|
}
|
|
@@ -85665,11 +85817,17 @@ function createTypeChecker(host) {
|
|
|
85665
85817
|
const type = getTypeFromTypeNode(typeNode);
|
|
85666
85818
|
return containsUndefinedType(type);
|
|
85667
85819
|
}
|
|
85668
|
-
function requiresAddingImplicitUndefined(parameter) {
|
|
85669
|
-
return (isRequiredInitializedParameter(parameter) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
|
|
85820
|
+
function requiresAddingImplicitUndefined(parameter, enclosingDeclaration) {
|
|
85821
|
+
return (isRequiredInitializedParameter(parameter, enclosingDeclaration) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
|
|
85670
85822
|
}
|
|
85671
|
-
function isRequiredInitializedParameter(parameter) {
|
|
85672
|
-
|
|
85823
|
+
function isRequiredInitializedParameter(parameter, enclosingDeclaration) {
|
|
85824
|
+
if (!strictNullChecks || isOptionalParameter(parameter) || isJSDocParameterTag(parameter) || !parameter.initializer) {
|
|
85825
|
+
return false;
|
|
85826
|
+
}
|
|
85827
|
+
if (hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */)) {
|
|
85828
|
+
return !!enclosingDeclaration && isFunctionLikeDeclaration(enclosingDeclaration);
|
|
85829
|
+
}
|
|
85830
|
+
return true;
|
|
85673
85831
|
}
|
|
85674
85832
|
function isOptionalUninitializedParameterProperty(parameter) {
|
|
85675
85833
|
return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
@@ -85943,14 +86101,14 @@ function createTypeChecker(host) {
|
|
|
85943
86101
|
return 11 /* ObjectType */;
|
|
85944
86102
|
}
|
|
85945
86103
|
}
|
|
85946
|
-
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker) {
|
|
86104
|
+
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
85947
86105
|
const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor);
|
|
85948
86106
|
if (!declaration) {
|
|
85949
86107
|
return factory.createToken(133 /* AnyKeyword */);
|
|
85950
86108
|
}
|
|
85951
86109
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
85952
86110
|
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
|
|
85953
|
-
return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
86111
|
+
return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
|
|
85954
86112
|
}
|
|
85955
86113
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
85956
86114
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
@@ -85993,14 +86151,14 @@ function createTypeChecker(host) {
|
|
|
85993
86151
|
}
|
|
85994
86152
|
return candidateExpr;
|
|
85995
86153
|
}
|
|
85996
|
-
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
|
|
86154
|
+
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
85997
86155
|
const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
|
|
85998
86156
|
if (!signatureDeclaration) {
|
|
85999
86157
|
return factory.createToken(133 /* AnyKeyword */);
|
|
86000
86158
|
}
|
|
86001
|
-
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
86159
|
+
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
|
|
86002
86160
|
}
|
|
86003
|
-
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
86161
|
+
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
86004
86162
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
86005
86163
|
if (!expr) {
|
|
86006
86164
|
return factory.createToken(133 /* AnyKeyword */);
|
|
@@ -86013,6 +86171,7 @@ function createTypeChecker(host) {
|
|
|
86013
86171
|
void 0,
|
|
86014
86172
|
enclosingDeclaration,
|
|
86015
86173
|
flags | 1024 /* MultilineObjectLiterals */,
|
|
86174
|
+
internalFlags,
|
|
86016
86175
|
tracker
|
|
86017
86176
|
);
|
|
86018
86177
|
}
|
|
@@ -86118,6 +86277,8 @@ function createTypeChecker(host) {
|
|
|
86118
86277
|
enclosing,
|
|
86119
86278
|
/*flags*/
|
|
86120
86279
|
void 0,
|
|
86280
|
+
/*internalFlags*/
|
|
86281
|
+
void 0,
|
|
86121
86282
|
tracker
|
|
86122
86283
|
) : type === trueType ? factory.createTrue() : type === falseType && factory.createFalse();
|
|
86123
86284
|
if (enumResult) return enumResult;
|
|
@@ -86246,15 +86407,15 @@ function createTypeChecker(host) {
|
|
|
86246
86407
|
const parseDecl = getParseTreeNode(decl);
|
|
86247
86408
|
return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
|
|
86248
86409
|
},
|
|
86249
|
-
getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
|
|
86410
|
+
getDeclarationStatementsForSourceFile: (node, flags, internalFlags, tracker) => {
|
|
86250
86411
|
const n = getParseTreeNode(node);
|
|
86251
86412
|
Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
|
|
86252
86413
|
const sym = getSymbolOfDeclaration(node);
|
|
86253
86414
|
if (!sym) {
|
|
86254
|
-
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
|
|
86415
|
+
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, internalFlags, tracker);
|
|
86255
86416
|
}
|
|
86256
86417
|
resolveExternalModuleSymbol(sym);
|
|
86257
|
-
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
|
86418
|
+
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
|
|
86258
86419
|
},
|
|
86259
86420
|
isImportRequiredByAugmentation,
|
|
86260
86421
|
isDefinitelyReferenceToGlobalSymbolObject
|
|
@@ -101587,7 +101748,7 @@ function transformJsx(context) {
|
|
|
101587
101748
|
const name = node.name;
|
|
101588
101749
|
if (isIdentifier(name)) {
|
|
101589
101750
|
const text = idText(name);
|
|
101590
|
-
return /^[A-
|
|
101751
|
+
return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text);
|
|
101591
101752
|
}
|
|
101592
101753
|
return factory2.createStringLiteral(idText(name.namespace) + ":" + idText(name.name));
|
|
101593
101754
|
}
|
|
@@ -111288,7 +111449,11 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
111288
111449
|
if (isSetAccessor(node.parent)) {
|
|
111289
111450
|
return createAccessorTypeError(node.parent);
|
|
111290
111451
|
}
|
|
111291
|
-
const addUndefined = resolver.requiresAddingImplicitUndefined(
|
|
111452
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(
|
|
111453
|
+
node,
|
|
111454
|
+
/*enclosingDeclaration*/
|
|
111455
|
+
void 0
|
|
111456
|
+
);
|
|
111292
111457
|
if (!addUndefined && node.initializer) {
|
|
111293
111458
|
return createExpressionError(node.initializer);
|
|
111294
111459
|
}
|
|
@@ -111354,7 +111519,8 @@ function getDeclarationDiagnostics(host, resolver, file) {
|
|
|
111354
111519
|
false
|
|
111355
111520
|
).diagnostics : void 0;
|
|
111356
111521
|
}
|
|
111357
|
-
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ |
|
|
111522
|
+
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
|
|
111523
|
+
var declarationEmitInternalNodeBuilderFlags = 8 /* AllowUnresolvedNames */;
|
|
111358
111524
|
function transformDeclarations(context) {
|
|
111359
111525
|
const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
|
|
111360
111526
|
let getSymbolAccessibilityDiagnostic = throwDiagnostic;
|
|
@@ -111510,7 +111676,7 @@ function transformDeclarations(context) {
|
|
|
111510
111676
|
diagnosticMessage: s.errorModuleName ? Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit : Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit,
|
|
111511
111677
|
errorNode: s.errorNode || sourceFile
|
|
111512
111678
|
};
|
|
111513
|
-
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
111679
|
+
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
111514
111680
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
111515
111681
|
return result;
|
|
111516
111682
|
}
|
|
@@ -111763,7 +111929,7 @@ function transformDeclarations(context) {
|
|
|
111763
111929
|
if (shouldPrintWithInitializer(node)) {
|
|
111764
111930
|
return;
|
|
111765
111931
|
}
|
|
111766
|
-
const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node);
|
|
111932
|
+
const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node, enclosingDeclaration);
|
|
111767
111933
|
if (type && !shouldAddImplicitUndefined) {
|
|
111768
111934
|
return visitNode(type, visitDeclarationSubtree, isTypeNode);
|
|
111769
111935
|
}
|
|
@@ -111780,7 +111946,7 @@ function transformDeclarations(context) {
|
|
|
111780
111946
|
case 172 /* PropertyDeclaration */:
|
|
111781
111947
|
case 208 /* BindingElement */:
|
|
111782
111948
|
case 260 /* VariableDeclaration */:
|
|
111783
|
-
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
111949
|
+
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
111784
111950
|
break;
|
|
111785
111951
|
case 262 /* FunctionDeclaration */:
|
|
111786
111952
|
case 180 /* ConstructSignature */:
|
|
@@ -111788,7 +111954,7 @@ function transformDeclarations(context) {
|
|
|
111788
111954
|
case 174 /* MethodDeclaration */:
|
|
111789
111955
|
case 177 /* GetAccessor */:
|
|
111790
111956
|
case 179 /* CallSignature */:
|
|
111791
|
-
typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
111957
|
+
typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
111792
111958
|
break;
|
|
111793
111959
|
default:
|
|
111794
111960
|
Debug.assertNever(node);
|
|
@@ -112389,7 +112555,7 @@ function transformDeclarations(context) {
|
|
|
112389
112555
|
newId,
|
|
112390
112556
|
/*exclamationToken*/
|
|
112391
112557
|
void 0,
|
|
112392
|
-
resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
|
|
112558
|
+
resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
|
|
112393
112559
|
/*initializer*/
|
|
112394
112560
|
void 0
|
|
112395
112561
|
);
|
|
@@ -112515,7 +112681,7 @@ function transformDeclarations(context) {
|
|
|
112515
112681
|
return void 0;
|
|
112516
112682
|
}
|
|
112517
112683
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
|
|
112518
|
-
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags |
|
|
112684
|
+
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags | 2 /* NoSyntacticPrinter */, symbolTracker);
|
|
112519
112685
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
112520
112686
|
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
|
|
112521
112687
|
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
|
|
@@ -112718,7 +112884,7 @@ function transformDeclarations(context) {
|
|
|
112718
112884
|
newId,
|
|
112719
112885
|
/*exclamationToken*/
|
|
112720
112886
|
void 0,
|
|
112721
|
-
resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
|
|
112887
|
+
resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
|
|
112722
112888
|
/*initializer*/
|
|
112723
112889
|
void 0
|
|
112724
112890
|
);
|
|
@@ -116545,7 +116711,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116545
116711
|
if (node.comment) {
|
|
116546
116712
|
const text = getTextOfJSDocComment(node.comment);
|
|
116547
116713
|
if (text) {
|
|
116548
|
-
const lines = text.split(/\r\n?|\n/
|
|
116714
|
+
const lines = text.split(/\r\n?|\n/);
|
|
116549
116715
|
for (const line of lines) {
|
|
116550
116716
|
writeLine();
|
|
116551
116717
|
writeSpace();
|
|
@@ -116972,7 +117138,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116972
117138
|
if (isFunctionLike(parentNode) && parentNode.typeArguments) {
|
|
116973
117139
|
return emitTypeArguments(parentNode, parentNode.typeArguments);
|
|
116974
117140
|
}
|
|
116975
|
-
emitList(parentNode, typeParameters, 53776 /* TypeParameters */);
|
|
117141
|
+
emitList(parentNode, typeParameters, 53776 /* TypeParameters */ | (isArrowFunction(parentNode) ? 64 /* AllowTrailingComma */ : 0 /* None */));
|
|
116976
117142
|
}
|
|
116977
117143
|
function emitParameters(parentNode, parameters) {
|
|
116978
117144
|
emitList(parentNode, parameters, 2576 /* Parameters */);
|
|
@@ -117240,7 +117406,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
117240
117406
|
}
|
|
117241
117407
|
}
|
|
117242
117408
|
function writeLines(text) {
|
|
117243
|
-
const lines = text.split(/\r\n?|\n/
|
|
117409
|
+
const lines = text.split(/\r\n?|\n/);
|
|
117244
117410
|
const indentation = guessIndentation(lines);
|
|
117245
117411
|
for (const lineText of lines) {
|
|
117246
117412
|
const line = indentation ? lineText.slice(indentation) : lineText;
|
|
@@ -118477,7 +118643,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118477
118643
|
}
|
|
118478
118644
|
try {
|
|
118479
118645
|
return createCachedFileSystemEntries(rootDir, rootDirPath);
|
|
118480
|
-
} catch
|
|
118646
|
+
} catch {
|
|
118481
118647
|
Debug.assert(!cachedReadDirectoryResult.has(ensureTrailingDirectorySeparator(rootDirPath)));
|
|
118482
118648
|
return void 0;
|
|
118483
118649
|
}
|
|
@@ -118566,6 +118732,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118566
118732
|
function realpath(s) {
|
|
118567
118733
|
return host.realpath ? host.realpath(s) : s;
|
|
118568
118734
|
}
|
|
118735
|
+
function clearFirstAncestorEntry(fileOrDirectoryPath) {
|
|
118736
|
+
forEachAncestorDirectory(
|
|
118737
|
+
getDirectoryPath(fileOrDirectoryPath),
|
|
118738
|
+
(ancestor) => cachedReadDirectoryResult.delete(ensureTrailingDirectorySeparator(ancestor)) ? true : void 0
|
|
118739
|
+
);
|
|
118740
|
+
}
|
|
118569
118741
|
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
|
118570
118742
|
const existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
|
118571
118743
|
if (existingResult !== void 0) {
|
|
@@ -118574,6 +118746,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118574
118746
|
}
|
|
118575
118747
|
const parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath);
|
|
118576
118748
|
if (!parentResult) {
|
|
118749
|
+
clearFirstAncestorEntry(fileOrDirectoryPath);
|
|
118577
118750
|
return void 0;
|
|
118578
118751
|
}
|
|
118579
118752
|
if (!host.directoryExists) {
|
|
@@ -118599,6 +118772,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118599
118772
|
const parentResult = getCachedFileSystemEntriesForBaseDir(filePath);
|
|
118600
118773
|
if (parentResult) {
|
|
118601
118774
|
updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === 0 /* Created */);
|
|
118775
|
+
} else {
|
|
118776
|
+
clearFirstAncestorEntry(filePath);
|
|
118602
118777
|
}
|
|
118603
118778
|
}
|
|
118604
118779
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists2) {
|
|
@@ -120870,7 +121045,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120870
121045
|
return line;
|
|
120871
121046
|
}
|
|
120872
121047
|
const lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
|
|
120873
|
-
if (lineText !== "" &&
|
|
121048
|
+
if (lineText !== "" && !/^\s*\/\/.*$/.test(lineText)) {
|
|
120874
121049
|
return -1;
|
|
120875
121050
|
}
|
|
120876
121051
|
line--;
|
|
@@ -124871,9 +125046,9 @@ function removeIgnoredPath(path) {
|
|
|
124871
125046
|
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
124872
125047
|
if (length2 <= 1) return 1;
|
|
124873
125048
|
let indexAfterOsRoot = 1;
|
|
124874
|
-
let isDosStyle = pathComponents2[0].search(/[a-
|
|
125049
|
+
let isDosStyle = pathComponents2[0].search(/[a-z]:/i) === 0;
|
|
124875
125050
|
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
|
|
124876
|
-
pathComponents2[1].search(/[a-
|
|
125051
|
+
pathComponents2[1].search(/[a-z]\$$/i) === 0) {
|
|
124877
125052
|
if (length2 === 2) return 2;
|
|
124878
125053
|
indexAfterOsRoot = 2;
|
|
124879
125054
|
isDosStyle = true;
|
|
@@ -130225,7 +130400,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
130225
130400
|
return typeFromAccessor(parent, context);
|
|
130226
130401
|
}
|
|
130227
130402
|
const declaredType = getEffectiveTypeAnnotationNode(node);
|
|
130228
|
-
const addUndefined = resolver.requiresAddingImplicitUndefined(node);
|
|
130403
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(node, context.enclosingDeclaration);
|
|
130229
130404
|
let resultType;
|
|
130230
130405
|
if (declaredType) {
|
|
130231
130406
|
resultType = serializeExistingTypeAnnotation(declaredType, addUndefined);
|