@typescript-deploys/pr-build 5.6.0-pr-59467-2 → 5.6.0-pr-59644-8
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/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +355 -183
- package/lib/tsserver.js +2 -2
- package/lib/typescript.d.ts +2 -0
- package/lib/typescript.js +523 -329
- package/lib/typingsInstaller.js +1 -1
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- 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.20240815`;
|
|
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);
|
|
@@ -35829,7 +35840,6 @@ var commonOptionsWithBuild = [
|
|
|
35829
35840
|
name: "generateTrace",
|
|
35830
35841
|
type: "string",
|
|
35831
35842
|
isFilePath: true,
|
|
35832
|
-
isCommandLineOnly: true,
|
|
35833
35843
|
paramType: Diagnostics.DIRECTORY,
|
|
35834
35844
|
category: Diagnostics.Compiler_Diagnostics,
|
|
35835
35845
|
description: Diagnostics.Generates_an_event_trace_and_a_list_of_types
|
|
@@ -38566,7 +38576,7 @@ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sour
|
|
|
38566
38576
|
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
38567
38577
|
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
38578
|
}
|
|
38569
|
-
var invalidTrailingRecursionPattern = /(
|
|
38579
|
+
var invalidTrailingRecursionPattern = /(?:^|\/)\*\*\/?$/;
|
|
38570
38580
|
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
|
38571
38581
|
function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
|
|
38572
38582
|
basePath = normalizePath(basePath);
|
|
@@ -42672,6 +42682,8 @@ function createBinder() {
|
|
|
42672
42682
|
}
|
|
42673
42683
|
function bindJSDocImportTag(node) {
|
|
42674
42684
|
bind(node.tagName);
|
|
42685
|
+
bind(node.moduleSpecifier);
|
|
42686
|
+
bind(node.attributes);
|
|
42675
42687
|
if (typeof node.comment !== "string") {
|
|
42676
42688
|
bindEach(node.comment);
|
|
42677
42689
|
}
|
|
@@ -44055,21 +44067,25 @@ function createBinder() {
|
|
|
44055
44067
|
const reportError = (
|
|
44056
44068
|
// report error on all statements except empty ones
|
|
44057
44069
|
isStatementButNotDeclaration(node) && node.kind !== 242 /* EmptyStatement */ || // report error on class declarations
|
|
44058
|
-
node.kind === 263 /* ClassDeclaration */ || // report
|
|
44070
|
+
node.kind === 263 /* ClassDeclaration */ || // report errors on enums with preserved emit
|
|
44071
|
+
isEnumDeclarationWithPreservedEmit(node, options) || // report error on instantiated modules
|
|
44059
44072
|
node.kind === 267 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
|
|
44060
44073
|
);
|
|
44061
44074
|
if (reportError) {
|
|
44062
44075
|
currentFlow = reportedUnreachableFlow;
|
|
44063
44076
|
if (!options.allowUnreachableCode) {
|
|
44064
44077
|
const isError = unreachableCodeIsError(options) && !(node.flags & 33554432 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) || node.declarationList.declarations.some((d) => !!d.initializer));
|
|
44065
|
-
eachUnreachableRange(node, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
|
|
44078
|
+
eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
|
|
44066
44079
|
}
|
|
44067
44080
|
}
|
|
44068
44081
|
}
|
|
44069
44082
|
return true;
|
|
44070
44083
|
}
|
|
44071
44084
|
}
|
|
44072
|
-
function
|
|
44085
|
+
function isEnumDeclarationWithPreservedEmit(node, options) {
|
|
44086
|
+
return node.kind === 266 /* EnumDeclaration */ && (!isEnumConst(node) || shouldPreserveConstEnums(options));
|
|
44087
|
+
}
|
|
44088
|
+
function eachUnreachableRange(node, options, cb) {
|
|
44073
44089
|
if (isStatement(node) && isExecutableStatement(node) && isBlock(node.parent)) {
|
|
44074
44090
|
const { statements } = node.parent;
|
|
44075
44091
|
const slice = sliceAfter(statements, node);
|
|
@@ -44077,22 +44093,22 @@ function eachUnreachableRange(node, cb) {
|
|
|
44077
44093
|
} else {
|
|
44078
44094
|
cb(node, node);
|
|
44079
44095
|
}
|
|
44080
|
-
|
|
44081
|
-
|
|
44082
|
-
|
|
44083
|
-
|
|
44084
|
-
|
|
44085
|
-
|
|
44086
|
-
|
|
44087
|
-
|
|
44088
|
-
|
|
44089
|
-
|
|
44090
|
-
|
|
44091
|
-
|
|
44092
|
-
|
|
44093
|
-
|
|
44094
|
-
|
|
44095
|
-
|
|
44096
|
+
function isExecutableStatement(s) {
|
|
44097
|
+
return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && // `var x;` may declare a variable used above
|
|
44098
|
+
!(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
|
|
44099
|
+
}
|
|
44100
|
+
function isPurelyTypeDeclaration(s) {
|
|
44101
|
+
switch (s.kind) {
|
|
44102
|
+
case 264 /* InterfaceDeclaration */:
|
|
44103
|
+
case 265 /* TypeAliasDeclaration */:
|
|
44104
|
+
return true;
|
|
44105
|
+
case 267 /* ModuleDeclaration */:
|
|
44106
|
+
return getModuleInstanceState(s) !== 1 /* Instantiated */;
|
|
44107
|
+
case 266 /* EnumDeclaration */:
|
|
44108
|
+
return !isEnumDeclarationWithPreservedEmit(s, options);
|
|
44109
|
+
default:
|
|
44110
|
+
return false;
|
|
44111
|
+
}
|
|
44096
44112
|
}
|
|
44097
44113
|
}
|
|
44098
44114
|
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
|
|
@@ -44343,9 +44359,32 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
44343
44359
|
}
|
|
44344
44360
|
|
|
44345
44361
|
// src/compiler/moduleSpecifiers.ts
|
|
44346
|
-
|
|
44362
|
+
var stringToRegex = memoizeOne((pattern) => {
|
|
44363
|
+
try {
|
|
44364
|
+
let slash = pattern.indexOf("/");
|
|
44365
|
+
if (slash !== 0) {
|
|
44366
|
+
return new RegExp(pattern);
|
|
44367
|
+
}
|
|
44368
|
+
const lastSlash = pattern.lastIndexOf("/");
|
|
44369
|
+
if (slash === lastSlash) {
|
|
44370
|
+
return new RegExp(pattern);
|
|
44371
|
+
}
|
|
44372
|
+
while ((slash = pattern.indexOf("/", slash + 1)) !== lastSlash) {
|
|
44373
|
+
if (pattern[slash - 1] !== "\\") {
|
|
44374
|
+
return new RegExp(pattern);
|
|
44375
|
+
}
|
|
44376
|
+
}
|
|
44377
|
+
const flags = pattern.substring(lastSlash + 1).replace(/[^iu]/g, "");
|
|
44378
|
+
pattern = pattern.substring(1, lastSlash);
|
|
44379
|
+
return new RegExp(pattern, flags);
|
|
44380
|
+
} catch {
|
|
44381
|
+
return void 0;
|
|
44382
|
+
}
|
|
44383
|
+
});
|
|
44384
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding, autoImportSpecifierExcludeRegexes }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
44347
44385
|
const filePreferredEnding = getPreferredEnding();
|
|
44348
44386
|
return {
|
|
44387
|
+
excludeRegexes: autoImportSpecifierExcludeRegexes,
|
|
44349
44388
|
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
44389
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
44351
44390
|
const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
|
|
@@ -44414,7 +44453,13 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
|
|
|
44414
44453
|
function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
44415
44454
|
let computedWithoutCache = false;
|
|
44416
44455
|
const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
|
|
44417
|
-
if (ambient)
|
|
44456
|
+
if (ambient) {
|
|
44457
|
+
return {
|
|
44458
|
+
kind: "ambient",
|
|
44459
|
+
moduleSpecifiers: !(forAutoImport && isExcludedByRegex(ambient, userPreferences.autoImportSpecifierExcludeRegexes)) ? [ambient] : emptyArray,
|
|
44460
|
+
computedWithoutCache
|
|
44461
|
+
};
|
|
44462
|
+
}
|
|
44418
44463
|
let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
|
|
44419
44464
|
moduleSymbol,
|
|
44420
44465
|
importingSourceFile,
|
|
@@ -44474,9 +44519,11 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
44474
44519
|
void 0,
|
|
44475
44520
|
options.overrideImportMode
|
|
44476
44521
|
) : void 0;
|
|
44477
|
-
|
|
44478
|
-
|
|
44479
|
-
|
|
44522
|
+
if (specifier && !(forAutoImport && isExcludedByRegex(specifier, preferences.excludeRegexes))) {
|
|
44523
|
+
nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
|
|
44524
|
+
if (modulePath.isRedirect) {
|
|
44525
|
+
return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
|
|
44526
|
+
}
|
|
44480
44527
|
}
|
|
44481
44528
|
if (!specifier) {
|
|
44482
44529
|
const local = getLocalModuleSpecifier(
|
|
@@ -44489,7 +44536,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
44489
44536
|
/*pathsOnly*/
|
|
44490
44537
|
modulePath.isRedirect
|
|
44491
44538
|
);
|
|
44492
|
-
if (!local) {
|
|
44539
|
+
if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
|
|
44493
44540
|
continue;
|
|
44494
44541
|
}
|
|
44495
44542
|
if (modulePath.isRedirect) {
|
|
@@ -44505,7 +44552,13 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
44505
44552
|
}
|
|
44506
44553
|
}
|
|
44507
44554
|
}
|
|
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:
|
|
44555
|
+
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 };
|
|
44556
|
+
}
|
|
44557
|
+
function isExcludedByRegex(moduleSpecifier, excludeRegexes) {
|
|
44558
|
+
return some(excludeRegexes, (pattern) => {
|
|
44559
|
+
var _a;
|
|
44560
|
+
return !!((_a = stringToRegex(pattern)) == null ? void 0 : _a.test(moduleSpecifier));
|
|
44561
|
+
});
|
|
44509
44562
|
}
|
|
44510
44563
|
function getInfo(importingSourceFileName, host) {
|
|
44511
44564
|
importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
|
|
@@ -44518,7 +44571,7 @@ function getInfo(importingSourceFileName, host) {
|
|
|
44518
44571
|
canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
|
|
44519
44572
|
};
|
|
44520
44573
|
}
|
|
44521
|
-
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
|
|
44574
|
+
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference, excludeRegexes }, pathsOnly) {
|
|
44522
44575
|
const { baseUrl, paths, rootDirs } = compilerOptions;
|
|
44523
44576
|
if (pathsOnly && !paths) {
|
|
44524
44577
|
return void 0;
|
|
@@ -44534,7 +44587,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
44534
44587
|
if (!relativeToBaseUrl) {
|
|
44535
44588
|
return pathsOnly ? void 0 : relativePath;
|
|
44536
44589
|
}
|
|
44537
|
-
const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(
|
|
44590
|
+
const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(
|
|
44591
|
+
moduleFileName,
|
|
44592
|
+
sourceDirectory,
|
|
44593
|
+
compilerOptions,
|
|
44594
|
+
host,
|
|
44595
|
+
importMode,
|
|
44596
|
+
prefersTsExtension(allowedEndings)
|
|
44597
|
+
);
|
|
44538
44598
|
const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
|
|
44539
44599
|
if (pathsOnly) {
|
|
44540
44600
|
return fromPaths;
|
|
@@ -44543,6 +44603,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
44543
44603
|
if (!maybeNonRelative) {
|
|
44544
44604
|
return relativePath;
|
|
44545
44605
|
}
|
|
44606
|
+
const relativeIsExcluded = isExcludedByRegex(relativePath, excludeRegexes);
|
|
44607
|
+
const nonRelativeIsExcluded = isExcludedByRegex(maybeNonRelative, excludeRegexes);
|
|
44608
|
+
if (!relativeIsExcluded && nonRelativeIsExcluded) {
|
|
44609
|
+
return relativePath;
|
|
44610
|
+
}
|
|
44611
|
+
if (relativeIsExcluded && !nonRelativeIsExcluded) {
|
|
44612
|
+
return maybeNonRelative;
|
|
44613
|
+
}
|
|
44546
44614
|
if (relativePreference === 1 /* NonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
44547
44615
|
return maybeNonRelative;
|
|
44548
44616
|
}
|
|
@@ -44767,7 +44835,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
|
|
|
44767
44835
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
44768
44836
|
}
|
|
44769
44837
|
}
|
|
44770
|
-
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports) {
|
|
44838
|
+
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports, preferTsExtension) {
|
|
44771
44839
|
if (typeof exports2 === "string") {
|
|
44772
44840
|
const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
|
|
44773
44841
|
const getCommonSourceDirectory2 = () => host.getCommonSourceDirectory();
|
|
@@ -44779,6 +44847,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44779
44847
|
void 0
|
|
44780
44848
|
);
|
|
44781
44849
|
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
|
|
44850
|
+
const canTryTsExtension = preferTsExtension && hasImplementationTSFileExtension(targetFilePath);
|
|
44782
44851
|
switch (mode) {
|
|
44783
44852
|
case 0 /* Exact */:
|
|
44784
44853
|
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 +44855,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44786
44855
|
}
|
|
44787
44856
|
break;
|
|
44788
44857
|
case 1 /* Directory */:
|
|
44858
|
+
if (canTryTsExtension && containsPath(targetFilePath, pathOrPattern, ignoreCase)) {
|
|
44859
|
+
const fragment = getRelativePathFromDirectory(
|
|
44860
|
+
pathOrPattern,
|
|
44861
|
+
targetFilePath,
|
|
44862
|
+
/*ignoreCase*/
|
|
44863
|
+
false
|
|
44864
|
+
);
|
|
44865
|
+
return { moduleFileToTry: getNormalizedAbsolutePath(
|
|
44866
|
+
combinePaths(combinePaths(packageName, exports2), fragment),
|
|
44867
|
+
/*currentDirectory*/
|
|
44868
|
+
void 0
|
|
44869
|
+
) };
|
|
44870
|
+
}
|
|
44789
44871
|
if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) {
|
|
44790
44872
|
const fragment = getRelativePathFromDirectory(
|
|
44791
44873
|
pathOrPattern,
|
|
@@ -44799,7 +44881,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44799
44881
|
void 0
|
|
44800
44882
|
) };
|
|
44801
44883
|
}
|
|
44802
|
-
if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
|
|
44884
|
+
if (!canTryTsExtension && containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
|
|
44803
44885
|
const fragment = getRelativePathFromDirectory(
|
|
44804
44886
|
pathOrPattern,
|
|
44805
44887
|
targetFilePath,
|
|
@@ -44822,12 +44904,12 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44822
44904
|
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
44823
44905
|
}
|
|
44824
44906
|
if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) {
|
|
44825
|
-
const fragment = getRelativePathFromDirectory(
|
|
44907
|
+
const fragment = changeFullExtension(getRelativePathFromDirectory(
|
|
44826
44908
|
pathOrPattern,
|
|
44827
44909
|
declarationFile,
|
|
44828
44910
|
/*ignoreCase*/
|
|
44829
44911
|
false
|
|
44830
|
-
);
|
|
44912
|
+
), getJSExtensionForFile(declarationFile, options));
|
|
44831
44913
|
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
44832
44914
|
}
|
|
44833
44915
|
break;
|
|
@@ -44835,11 +44917,15 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44835
44917
|
const starPos = pathOrPattern.indexOf("*");
|
|
44836
44918
|
const leadingSlice = pathOrPattern.slice(0, starPos);
|
|
44837
44919
|
const trailingSlice = pathOrPattern.slice(starPos + 1);
|
|
44920
|
+
if (canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
|
|
44921
|
+
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
44922
|
+
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
44923
|
+
}
|
|
44838
44924
|
if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) {
|
|
44839
44925
|
const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
|
|
44840
44926
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
44841
44927
|
}
|
|
44842
|
-
if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
|
|
44928
|
+
if (!canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
|
|
44843
44929
|
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
44844
44930
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
44845
44931
|
}
|
|
@@ -44849,17 +44935,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
44849
44935
|
}
|
|
44850
44936
|
if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) {
|
|
44851
44937
|
const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
|
|
44852
|
-
|
|
44938
|
+
const substituted = replaceFirstStar(packageName, starReplacement);
|
|
44939
|
+
const jsExtension = tryGetJSExtensionForFile(declarationFile, options);
|
|
44940
|
+
return jsExtension ? { moduleFileToTry: changeFullExtension(substituted, jsExtension) } : void 0;
|
|
44853
44941
|
}
|
|
44854
44942
|
break;
|
|
44855
44943
|
}
|
|
44856
44944
|
} else if (Array.isArray(exports2)) {
|
|
44857
|
-
return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
|
|
44945
|
+
return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports, preferTsExtension));
|
|
44858
44946
|
} else if (typeof exports2 === "object" && exports2 !== null) {
|
|
44859
44947
|
for (const key of getOwnKeys(exports2)) {
|
|
44860
44948
|
if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
|
|
44861
44949
|
const subTarget = exports2[key];
|
|
44862
|
-
const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
|
|
44950
|
+
const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports, preferTsExtension);
|
|
44863
44951
|
if (result) {
|
|
44864
44952
|
return result;
|
|
44865
44953
|
}
|
|
@@ -44887,6 +44975,8 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
|
|
|
44887
44975
|
conditions,
|
|
44888
44976
|
mode,
|
|
44889
44977
|
/*isImports*/
|
|
44978
|
+
false,
|
|
44979
|
+
/*preferTsExtension*/
|
|
44890
44980
|
false
|
|
44891
44981
|
);
|
|
44892
44982
|
});
|
|
@@ -44901,10 +44991,12 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
|
|
|
44901
44991
|
conditions,
|
|
44902
44992
|
0 /* Exact */,
|
|
44903
44993
|
/*isImports*/
|
|
44994
|
+
false,
|
|
44995
|
+
/*preferTsExtension*/
|
|
44904
44996
|
false
|
|
44905
44997
|
);
|
|
44906
44998
|
}
|
|
44907
|
-
function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
|
|
44999
|
+
function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode, preferTsExtension) {
|
|
44908
45000
|
var _a, _b, _c;
|
|
44909
45001
|
if (!host.readFile || !getResolvePackageJsonImports(options)) {
|
|
44910
45002
|
return void 0;
|
|
@@ -44937,7 +45029,8 @@ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory,
|
|
|
44937
45029
|
conditions,
|
|
44938
45030
|
mode,
|
|
44939
45031
|
/*isImports*/
|
|
44940
|
-
true
|
|
45032
|
+
true,
|
|
45033
|
+
preferTsExtension
|
|
44941
45034
|
);
|
|
44942
45035
|
})) == null ? void 0 : _c.moduleFileToTry;
|
|
44943
45036
|
}
|
|
@@ -45019,7 +45112,15 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
45019
45112
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
45020
45113
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
45021
45114
|
const conditions = getConditions(options, importMode);
|
|
45022
|
-
const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(
|
|
45115
|
+
const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(
|
|
45116
|
+
options,
|
|
45117
|
+
host,
|
|
45118
|
+
path,
|
|
45119
|
+
packageRootPath,
|
|
45120
|
+
packageName2,
|
|
45121
|
+
packageJsonContent.exports,
|
|
45122
|
+
conditions
|
|
45123
|
+
) : void 0;
|
|
45023
45124
|
if (fromExports) {
|
|
45024
45125
|
return { ...fromExports, verbatimFromExports: true };
|
|
45025
45126
|
}
|
|
@@ -45167,6 +45268,10 @@ function isPathRelativeToParent(path) {
|
|
|
45167
45268
|
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
45168
45269
|
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
45169
45270
|
}
|
|
45271
|
+
function prefersTsExtension(allowedEndings) {
|
|
45272
|
+
const tsPriority = allowedEndings.indexOf(3 /* TsExtension */);
|
|
45273
|
+
return tsPriority > -1 && tsPriority < allowedEndings.indexOf(2 /* JsExtension */);
|
|
45274
|
+
}
|
|
45170
45275
|
|
|
45171
45276
|
// src/compiler/checker.ts
|
|
45172
45277
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -49361,6 +49466,7 @@ function createTypeChecker(host) {
|
|
|
49361
49466
|
}
|
|
49362
49467
|
function symbolToString(symbol, enclosingDeclaration, meaning, flags = 4 /* AllowAnyNodeKind */, writer) {
|
|
49363
49468
|
let nodeFlags = 70221824 /* IgnoreErrors */;
|
|
49469
|
+
let internalNodeFlags = 0 /* None */;
|
|
49364
49470
|
if (flags & 2 /* UseOnlyExternalAliasing */) {
|
|
49365
49471
|
nodeFlags |= 128 /* UseOnlyExternalAliasing */;
|
|
49366
49472
|
}
|
|
@@ -49371,15 +49477,15 @@ function createTypeChecker(host) {
|
|
|
49371
49477
|
nodeFlags |= 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
49372
49478
|
}
|
|
49373
49479
|
if (flags & 32 /* DoNotIncludeSymbolChain */) {
|
|
49374
|
-
|
|
49480
|
+
internalNodeFlags |= 4 /* DoNotIncludeSymbolChain */;
|
|
49375
49481
|
}
|
|
49376
49482
|
if (flags & 16 /* WriteComputedProps */) {
|
|
49377
|
-
|
|
49483
|
+
internalNodeFlags |= 1 /* WriteComputedProps */;
|
|
49378
49484
|
}
|
|
49379
49485
|
const builder = flags & 4 /* AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName;
|
|
49380
49486
|
return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
|
|
49381
49487
|
function symbolToStringWorker(writer2) {
|
|
49382
|
-
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
|
|
49488
|
+
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags, internalNodeFlags);
|
|
49383
49489
|
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 307 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
|
|
49384
49490
|
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
|
49385
49491
|
printer.writeNode(
|
|
@@ -49416,7 +49522,13 @@ function createTypeChecker(host) {
|
|
|
49416
49522
|
}
|
|
49417
49523
|
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
|
|
49418
49524
|
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
|
49419
|
-
const typeNode = nodeBuilder.typeToTypeNode(
|
|
49525
|
+
const typeNode = nodeBuilder.typeToTypeNode(
|
|
49526
|
+
type,
|
|
49527
|
+
enclosingDeclaration,
|
|
49528
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0 /* None */),
|
|
49529
|
+
/*internalFlags*/
|
|
49530
|
+
void 0
|
|
49531
|
+
);
|
|
49420
49532
|
if (typeNode === void 0) return Debug.fail("should always get typenode");
|
|
49421
49533
|
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
|
|
49422
49534
|
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
|
@@ -49465,31 +49577,31 @@ function createTypeChecker(host) {
|
|
|
49465
49577
|
}
|
|
49466
49578
|
function createNodeBuilder() {
|
|
49467
49579
|
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(
|
|
49580
|
+
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
49581
|
+
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
49582
|
+
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
49583
|
+
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
|
|
49584
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
49585
|
+
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
49474
49586
|
indexInfo,
|
|
49475
49587
|
context,
|
|
49476
49588
|
/*typeNode*/
|
|
49477
49589
|
void 0
|
|
49478
49590
|
)),
|
|
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(
|
|
49591
|
+
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
|
49592
|
+
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToName(
|
|
49481
49593
|
symbol,
|
|
49482
49594
|
context,
|
|
49483
49595
|
meaning,
|
|
49484
49596
|
/*expectsIdentifier*/
|
|
49485
49597
|
false
|
|
49486
49598
|
)),
|
|
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))
|
|
49599
|
+
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
|
|
49600
|
+
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
49601
|
+
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
49602
|
+
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
49603
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
49604
|
+
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
49493
49605
|
};
|
|
49494
49606
|
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
|
49495
49607
|
const type = getTypeFromTypeNodeWithoutContext(node);
|
|
@@ -49511,13 +49623,13 @@ function createTypeChecker(host) {
|
|
|
49511
49623
|
return setTextRange(setOriginalNode(range, location), location);
|
|
49512
49624
|
}
|
|
49513
49625
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
49514
|
-
const
|
|
49515
|
-
if (expr && !(context.
|
|
49626
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
49627
|
+
if (expr && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
49516
49628
|
syntacticNodeBuilder.serializeTypeOfExpression(expr, context, addUndefined);
|
|
49517
49629
|
}
|
|
49518
|
-
context.
|
|
49630
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
49519
49631
|
const result = expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined);
|
|
49520
|
-
|
|
49632
|
+
restoreFlags();
|
|
49521
49633
|
return result;
|
|
49522
49634
|
}
|
|
49523
49635
|
function expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined) {
|
|
@@ -49570,7 +49682,7 @@ function createTypeChecker(host) {
|
|
|
49570
49682
|
return void 0;
|
|
49571
49683
|
}
|
|
49572
49684
|
function symbolToNode(symbol, context, meaning) {
|
|
49573
|
-
if (context.
|
|
49685
|
+
if (context.internalFlags & 1 /* WriteComputedProps */) {
|
|
49574
49686
|
if (symbol.valueDeclaration) {
|
|
49575
49687
|
const name = getNameOfDeclaration(symbol.valueDeclaration);
|
|
49576
49688
|
if (name && isComputedPropertyName(name)) return name;
|
|
@@ -49583,12 +49695,13 @@ function createTypeChecker(host) {
|
|
|
49583
49695
|
}
|
|
49584
49696
|
return symbolToExpression(symbol, context, meaning);
|
|
49585
49697
|
}
|
|
49586
|
-
function withContext(enclosingDeclaration, flags, tracker, cb) {
|
|
49587
|
-
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost :
|
|
49698
|
+
function withContext(enclosingDeclaration, flags, internalFlags, tracker, cb) {
|
|
49699
|
+
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
|
49588
49700
|
const context = {
|
|
49589
49701
|
enclosingDeclaration,
|
|
49590
49702
|
enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
|
|
49591
49703
|
flags: flags || 0 /* None */,
|
|
49704
|
+
internalFlags: internalFlags || 0 /* None */,
|
|
49592
49705
|
tracker: void 0,
|
|
49593
49706
|
encounteredError: false,
|
|
49594
49707
|
reportedDiagnostic: false,
|
|
@@ -49618,14 +49731,23 @@ function createTypeChecker(host) {
|
|
|
49618
49731
|
}
|
|
49619
49732
|
return context.encounteredError ? void 0 : resultingNode;
|
|
49620
49733
|
}
|
|
49734
|
+
function saveRestoreFlags(context) {
|
|
49735
|
+
const flags = context.flags;
|
|
49736
|
+
const internalFlags = context.internalFlags;
|
|
49737
|
+
return restore;
|
|
49738
|
+
function restore() {
|
|
49739
|
+
context.flags = flags;
|
|
49740
|
+
context.internalFlags = internalFlags;
|
|
49741
|
+
}
|
|
49742
|
+
}
|
|
49621
49743
|
function checkTruncationLength(context) {
|
|
49622
49744
|
if (context.truncating) return context.truncating;
|
|
49623
49745
|
return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
|
49624
49746
|
}
|
|
49625
49747
|
function typeToTypeNodeHelper(type, context) {
|
|
49626
|
-
const
|
|
49748
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
49627
49749
|
const typeNode = typeToTypeNodeWorker(type, context);
|
|
49628
|
-
|
|
49750
|
+
restoreFlags();
|
|
49629
49751
|
return typeNode;
|
|
49630
49752
|
}
|
|
49631
49753
|
function typeToTypeNodeWorker(type, context) {
|
|
@@ -50079,7 +50201,7 @@ function createTypeChecker(host) {
|
|
|
50079
50201
|
context.symbolDepth = /* @__PURE__ */ new Map();
|
|
50080
50202
|
}
|
|
50081
50203
|
const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
|
50082
|
-
const key = `${getTypeId(type2)}|${context.flags}`;
|
|
50204
|
+
const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
|
|
50083
50205
|
if (links) {
|
|
50084
50206
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
|
50085
50207
|
}
|
|
@@ -50185,10 +50307,10 @@ function createTypeChecker(host) {
|
|
|
50185
50307
|
}
|
|
50186
50308
|
return typeToTypeNodeHelper(getIntersectionType(types), context);
|
|
50187
50309
|
}
|
|
50188
|
-
const
|
|
50310
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50189
50311
|
context.flags |= 4194304 /* InObjectTypeLiteral */;
|
|
50190
50312
|
const members = createTypeNodesFromResolvedType(resolved);
|
|
50191
|
-
|
|
50313
|
+
restoreFlags();
|
|
50192
50314
|
const typeLiteralNode = factory.createTypeLiteralNode(members);
|
|
50193
50315
|
context.approximateLength += 2;
|
|
50194
50316
|
setEmitFlags(typeLiteralNode, context.flags & 1024 /* MultilineObjectLiterals */ ? 0 : 1 /* SingleLine */);
|
|
@@ -50251,10 +50373,10 @@ function createTypeChecker(host) {
|
|
|
50251
50373
|
} while (i < length2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent);
|
|
50252
50374
|
if (!rangeEquals(outerTypeParameters, typeArguments, start, i)) {
|
|
50253
50375
|
const typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
|
|
50254
|
-
const
|
|
50376
|
+
const restoreFlags2 = saveRestoreFlags(context);
|
|
50255
50377
|
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
|
|
50256
50378
|
const ref = symbolToTypeNode(parent, context, 788968 /* Type */, typeArgumentSlice);
|
|
50257
|
-
|
|
50379
|
+
restoreFlags2();
|
|
50258
50380
|
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
|
|
50259
50381
|
}
|
|
50260
50382
|
}
|
|
@@ -50292,10 +50414,10 @@ function createTypeChecker(host) {
|
|
|
50292
50414
|
}
|
|
50293
50415
|
typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
|
|
50294
50416
|
}
|
|
50295
|
-
const
|
|
50417
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50296
50418
|
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
|
|
50297
50419
|
const finalRef = symbolToTypeNode(type2.symbol, context, 788968 /* Type */, typeArgumentNodes);
|
|
50298
|
-
|
|
50420
|
+
restoreFlags();
|
|
50299
50421
|
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
|
|
50300
50422
|
}
|
|
50301
50423
|
}
|
|
@@ -50607,7 +50729,7 @@ function createTypeChecker(host) {
|
|
|
50607
50729
|
}
|
|
50608
50730
|
}
|
|
50609
50731
|
if (seenNames) {
|
|
50610
|
-
const
|
|
50732
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50611
50733
|
context.flags |= 64 /* UseFullyQualifiedType */;
|
|
50612
50734
|
seenNames.forEach((types2) => {
|
|
50613
50735
|
if (!arrayIsHomogeneous(types2, ([a], [b]) => typesAreSameReference(a, b))) {
|
|
@@ -50616,7 +50738,7 @@ function createTypeChecker(host) {
|
|
|
50616
50738
|
}
|
|
50617
50739
|
}
|
|
50618
50740
|
});
|
|
50619
|
-
|
|
50741
|
+
restoreFlags();
|
|
50620
50742
|
}
|
|
50621
50743
|
return result;
|
|
50622
50744
|
}
|
|
@@ -50668,19 +50790,19 @@ function createTypeChecker(host) {
|
|
|
50668
50790
|
} else {
|
|
50669
50791
|
typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context));
|
|
50670
50792
|
}
|
|
50671
|
-
const
|
|
50793
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50672
50794
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
50673
50795
|
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
50796
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
50675
50797
|
if (thisParameter) {
|
|
50676
50798
|
parameters.unshift(thisParameter);
|
|
50677
50799
|
}
|
|
50678
|
-
|
|
50800
|
+
restoreFlags();
|
|
50679
50801
|
const returnTypeNode = serializeReturnTypeForSignature(context, signature);
|
|
50680
50802
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
50681
50803
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
50682
|
-
const
|
|
50683
|
-
modifiers = factory.createModifiersFromModifierFlags(
|
|
50804
|
+
const flags = modifiersToFlags(modifiers);
|
|
50805
|
+
modifiers = factory.createModifiersFromModifierFlags(flags | 64 /* Abstract */);
|
|
50684
50806
|
}
|
|
50685
50807
|
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
50808
|
modifiers,
|
|
@@ -50900,13 +51022,13 @@ function createTypeChecker(host) {
|
|
|
50900
51022
|
}
|
|
50901
51023
|
}
|
|
50902
51024
|
function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
|
|
50903
|
-
const
|
|
51025
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
50904
51026
|
context.flags &= ~512 /* WriteTypeParametersInQualifiedName */;
|
|
50905
51027
|
const modifiers = factory.createModifiersFromModifierFlags(getTypeParameterModifiers(type));
|
|
50906
51028
|
const name = typeParameterToName(type, context);
|
|
50907
51029
|
const defaultParameter = getDefaultFromTypeParameter(type);
|
|
50908
51030
|
const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context);
|
|
50909
|
-
|
|
51031
|
+
restoreFlags();
|
|
50910
51032
|
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
|
|
50911
51033
|
}
|
|
50912
51034
|
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
|
|
@@ -51010,7 +51132,7 @@ function createTypeChecker(host) {
|
|
|
51010
51132
|
function lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol) {
|
|
51011
51133
|
let chain;
|
|
51012
51134
|
const isTypeParameter = symbol.flags & 262144 /* TypeParameter */;
|
|
51013
|
-
if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.
|
|
51135
|
+
if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.internalFlags & 4 /* DoNotIncludeSymbolChain */)) {
|
|
51014
51136
|
chain = Debug.checkDefined(getSymbolChain(
|
|
51015
51137
|
symbol,
|
|
51016
51138
|
meaning,
|
|
@@ -51534,21 +51656,21 @@ function createTypeChecker(host) {
|
|
|
51534
51656
|
}
|
|
51535
51657
|
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
51536
51658
|
var _a, _b;
|
|
51537
|
-
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51659
|
+
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
|
51538
51660
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51539
|
-
const
|
|
51540
|
-
if (declaration && hasInferredType(declaration) && !(context.
|
|
51661
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
51662
|
+
if (declaration && hasInferredType(declaration) && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
51541
51663
|
syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, context);
|
|
51542
51664
|
}
|
|
51543
|
-
context.
|
|
51544
|
-
if (enclosingDeclaration && (!isErrorType(type) || context.
|
|
51665
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
51666
|
+
if (enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */)) {
|
|
51545
51667
|
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
51546
51668
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
51547
51669
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
51548
51670
|
const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
|
|
51549
51671
|
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
51550
51672
|
if (result2) {
|
|
51551
|
-
|
|
51673
|
+
restoreFlags();
|
|
51552
51674
|
return result2;
|
|
51553
51675
|
}
|
|
51554
51676
|
}
|
|
@@ -51559,7 +51681,7 @@ function createTypeChecker(host) {
|
|
|
51559
51681
|
const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
|
|
51560
51682
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
51561
51683
|
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
|
|
51562
|
-
|
|
51684
|
+
restoreFlags();
|
|
51563
51685
|
return result;
|
|
51564
51686
|
}
|
|
51565
51687
|
function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
|
|
@@ -51573,26 +51695,26 @@ function createTypeChecker(host) {
|
|
|
51573
51695
|
}
|
|
51574
51696
|
function serializeReturnTypeForSignature(context, signature) {
|
|
51575
51697
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
51576
|
-
const
|
|
51698
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
51577
51699
|
if (suppressAny) context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
51578
51700
|
let returnTypeNode;
|
|
51579
51701
|
const returnType = getReturnTypeOfSignature(signature);
|
|
51580
51702
|
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
51581
|
-
if (signature.declaration && !(context.
|
|
51703
|
+
if (signature.declaration && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
51582
51704
|
syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, context);
|
|
51583
51705
|
}
|
|
51584
|
-
context.
|
|
51706
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
51585
51707
|
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
|
|
51586
51708
|
} else if (!suppressAny) {
|
|
51587
51709
|
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
51588
51710
|
}
|
|
51589
|
-
|
|
51711
|
+
restoreFlags();
|
|
51590
51712
|
return returnTypeNode;
|
|
51591
51713
|
}
|
|
51592
51714
|
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
51593
51715
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
51594
51716
|
const type = getReturnTypeOfSignature(signature);
|
|
51595
|
-
if (context.enclosingDeclaration && (!isErrorType(type) || context.
|
|
51717
|
+
if (context.enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
51596
51718
|
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
51597
51719
|
if (annotation) {
|
|
51598
51720
|
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
|
|
@@ -52094,7 +52216,7 @@ function createTypeChecker(host) {
|
|
|
52094
52216
|
if (!hasDynamicName(node)) {
|
|
52095
52217
|
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
52096
52218
|
}
|
|
52097
|
-
if (!(context.
|
|
52219
|
+
if (!(context.internalFlags & 8 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
52098
52220
|
return void 0;
|
|
52099
52221
|
}
|
|
52100
52222
|
}
|
|
@@ -52746,7 +52868,7 @@ function createTypeChecker(host) {
|
|
|
52746
52868
|
const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
|
|
52747
52869
|
const jsdocAliasDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isJSDocTypeAlias);
|
|
52748
52870
|
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
|
|
52749
|
-
const
|
|
52871
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
52750
52872
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
52751
52873
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
52752
52874
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
@@ -52770,7 +52892,7 @@ function createTypeChecker(host) {
|
|
|
52770
52892
|
),
|
|
52771
52893
|
modifierFlags
|
|
52772
52894
|
);
|
|
52773
|
-
|
|
52895
|
+
restoreFlags();
|
|
52774
52896
|
context.enclosingDeclaration = oldEnclosingDecl;
|
|
52775
52897
|
}
|
|
52776
52898
|
function serializeInterface(symbol, symbolName2, modifierFlags) {
|
|
@@ -53779,10 +53901,10 @@ function createTypeChecker(host) {
|
|
|
53779
53901
|
}
|
|
53780
53902
|
function getNameCandidateWorker(symbol, localName) {
|
|
53781
53903
|
if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
|
|
53782
|
-
const
|
|
53904
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
53783
53905
|
context.flags |= 16777216 /* InInitialEntityName */;
|
|
53784
53906
|
const nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
|
53785
|
-
|
|
53907
|
+
restoreFlags();
|
|
53786
53908
|
localName = nameCandidate.length > 0 && isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? stripQuotes(nameCandidate) : nameCandidate;
|
|
53787
53909
|
}
|
|
53788
53910
|
if (localName === "default" /* Default */) {
|
|
@@ -53790,7 +53912,7 @@ function createTypeChecker(host) {
|
|
|
53790
53912
|
} else if (localName === "export=" /* ExportEquals */) {
|
|
53791
53913
|
localName = "_exports";
|
|
53792
53914
|
}
|
|
53793
|
-
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-
|
|
53915
|
+
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
|
|
53794
53916
|
return localName;
|
|
53795
53917
|
}
|
|
53796
53918
|
function getInternalSymbolName(symbol, localName) {
|
|
@@ -55365,7 +55487,8 @@ function createTypeChecker(host) {
|
|
|
55365
55487
|
if (!node) {
|
|
55366
55488
|
return void 0;
|
|
55367
55489
|
}
|
|
55368
|
-
|
|
55490
|
+
const kind = node.kind;
|
|
55491
|
+
switch (kind) {
|
|
55369
55492
|
case 263 /* ClassDeclaration */:
|
|
55370
55493
|
case 231 /* ClassExpression */:
|
|
55371
55494
|
case 264 /* InterfaceDeclaration */:
|
|
@@ -55387,13 +55510,19 @@ function createTypeChecker(host) {
|
|
|
55387
55510
|
case 200 /* MappedType */:
|
|
55388
55511
|
case 194 /* ConditionalType */: {
|
|
55389
55512
|
const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
|
|
55390
|
-
if (
|
|
55513
|
+
if ((kind === 218 /* FunctionExpression */ || kind === 219 /* ArrowFunction */ || isObjectLiteralMethod(node)) && isContextSensitive(node)) {
|
|
55514
|
+
const signature = firstOrUndefined(getSignaturesOfType(getTypeOfSymbol(getSymbolOfDeclaration(node)), 0 /* Call */));
|
|
55515
|
+
if (signature && signature.typeParameters) {
|
|
55516
|
+
return [...outerTypeParameters || emptyArray, ...signature.typeParameters];
|
|
55517
|
+
}
|
|
55518
|
+
}
|
|
55519
|
+
if (kind === 200 /* MappedType */) {
|
|
55391
55520
|
return append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter)));
|
|
55392
|
-
} else if (
|
|
55521
|
+
} else if (kind === 194 /* ConditionalType */) {
|
|
55393
55522
|
return concatenate(outerTypeParameters, getInferTypeParameters(node));
|
|
55394
55523
|
}
|
|
55395
55524
|
const outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, getEffectiveTypeParameterDeclarations(node));
|
|
55396
|
-
const thisType = includeThisTypes && (
|
|
55525
|
+
const thisType = includeThisTypes && (kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 264 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType;
|
|
55397
55526
|
return thisType ? append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
|
|
55398
55527
|
}
|
|
55399
55528
|
case 341 /* JSDocParameterTag */:
|
|
@@ -58205,8 +58334,11 @@ function createTypeChecker(host) {
|
|
|
58205
58334
|
true
|
|
58206
58335
|
);
|
|
58207
58336
|
}
|
|
58337
|
+
function getTypeParametersForMapper(signature) {
|
|
58338
|
+
return sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp);
|
|
58339
|
+
}
|
|
58208
58340
|
function createSignatureTypeMapper(signature, typeArguments) {
|
|
58209
|
-
return createTypeMapper(
|
|
58341
|
+
return createTypeMapper(getTypeParametersForMapper(signature), typeArguments);
|
|
58210
58342
|
}
|
|
58211
58343
|
function getErasedSignature(signature) {
|
|
58212
58344
|
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
|
|
@@ -60111,7 +60243,7 @@ function createTypeChecker(host) {
|
|
|
60111
60243
|
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
|
|
60112
60244
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
60113
60245
|
result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60114
|
-
} else if (typeSet.length >=
|
|
60246
|
+
} else if (typeSet.length >= 3 && types.length > 2) {
|
|
60115
60247
|
const middle = Math.floor(typeSet.length / 2);
|
|
60116
60248
|
result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
|
|
60117
60249
|
} else {
|
|
@@ -73465,7 +73597,7 @@ function createTypeChecker(host) {
|
|
|
73465
73597
|
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
|
|
73466
73598
|
}
|
|
73467
73599
|
function containerSeemsToBeEmptyDomElement(containingType) {
|
|
73468
|
-
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(EventTarget|Node|(
|
|
73600
|
+
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
73601
|
}
|
|
73470
73602
|
function typeHasStaticProperty(propName, containingType) {
|
|
73471
73603
|
const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
|
|
@@ -73906,7 +74038,7 @@ function createTypeChecker(host) {
|
|
|
73906
74038
|
return void 0;
|
|
73907
74039
|
}
|
|
73908
74040
|
function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) {
|
|
73909
|
-
const context = createInferenceContext(signature
|
|
74041
|
+
const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0 /* None */, compareTypes);
|
|
73910
74042
|
const restType = getEffectiveRestType(contextualSignature);
|
|
73911
74043
|
const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
|
|
73912
74044
|
const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
|
|
@@ -76780,11 +76912,6 @@ function createTypeChecker(host) {
|
|
|
76780
76912
|
/*errorNode*/
|
|
76781
76913
|
void 0
|
|
76782
76914
|
) || unknownType;
|
|
76783
|
-
nextType = resolver.resolveIterationType(
|
|
76784
|
-
nextType,
|
|
76785
|
-
/*errorNode*/
|
|
76786
|
-
void 0
|
|
76787
|
-
) || unknownType;
|
|
76788
76915
|
if (globalGeneratorType === emptyGenericType) {
|
|
76789
76916
|
const globalIterableIteratorType = resolver.getGlobalIterableIteratorType(
|
|
76790
76917
|
/*reportErrors*/
|
|
@@ -78008,6 +78135,29 @@ function createTypeChecker(host) {
|
|
|
78008
78135
|
}
|
|
78009
78136
|
if (leftOk && rightOk) {
|
|
78010
78137
|
checkAssignmentOperator(resultType2);
|
|
78138
|
+
switch (operator) {
|
|
78139
|
+
case 48 /* LessThanLessThanToken */:
|
|
78140
|
+
case 71 /* LessThanLessThanEqualsToken */:
|
|
78141
|
+
case 49 /* GreaterThanGreaterThanToken */:
|
|
78142
|
+
case 72 /* GreaterThanGreaterThanEqualsToken */:
|
|
78143
|
+
case 50 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
78144
|
+
case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
|
|
78145
|
+
const rhsEval = evaluate(right);
|
|
78146
|
+
if (typeof rhsEval.value === "number" && Math.abs(rhsEval.value) >= 32) {
|
|
78147
|
+
errorOrSuggestion(
|
|
78148
|
+
isEnumMember(walkUpParenthesizedExpressions(right.parent.parent)),
|
|
78149
|
+
// elevate from suggestion to error within an enum member
|
|
78150
|
+
errorNode || operatorToken,
|
|
78151
|
+
Diagnostics.This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2,
|
|
78152
|
+
getTextOfNode(left),
|
|
78153
|
+
tokenToString(operator),
|
|
78154
|
+
rhsEval.value % 32
|
|
78155
|
+
);
|
|
78156
|
+
}
|
|
78157
|
+
break;
|
|
78158
|
+
default:
|
|
78159
|
+
break;
|
|
78160
|
+
}
|
|
78011
78161
|
}
|
|
78012
78162
|
return resultType2;
|
|
78013
78163
|
}
|
|
@@ -78366,9 +78516,8 @@ function createTypeChecker(host) {
|
|
|
78366
78516
|
const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
|
|
78367
78517
|
const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
|
|
78368
78518
|
const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
|
|
78369
|
-
const resolvedSignatureNextType = isAsync ? getAwaitedType(signatureNextType) || anyType : signatureNextType;
|
|
78370
78519
|
const yieldExpressionType = node.expression ? checkExpression(node.expression) : undefinedWideningType;
|
|
78371
|
-
const yieldedType = getYieldedTypeOfYieldExpression(node, yieldExpressionType,
|
|
78520
|
+
const yieldedType = getYieldedTypeOfYieldExpression(node, yieldExpressionType, signatureNextType, isAsync);
|
|
78372
78521
|
if (returnType && yieldedType) {
|
|
78373
78522
|
checkTypeAssignableToAndOptionallyElaborate(yieldedType, signatureYieldType, node.expression || node, node.expression);
|
|
78374
78523
|
}
|
|
@@ -81324,7 +81473,7 @@ function createTypeChecker(host) {
|
|
|
81324
81473
|
);
|
|
81325
81474
|
if (globalAsyncDisposableType !== emptyObjectType && globalDisposableType !== emptyObjectType) {
|
|
81326
81475
|
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);
|
|
81476
|
+
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
81477
|
}
|
|
81329
81478
|
} else if (blockScopeKind === 4 /* Using */) {
|
|
81330
81479
|
const globalDisposableType = getGlobalDisposableType(
|
|
@@ -81333,7 +81482,7 @@ function createTypeChecker(host) {
|
|
|
81333
81482
|
);
|
|
81334
81483
|
if (globalDisposableType !== emptyObjectType) {
|
|
81335
81484
|
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);
|
|
81485
|
+
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
81486
|
}
|
|
81338
81487
|
}
|
|
81339
81488
|
}
|
|
@@ -85665,11 +85814,17 @@ function createTypeChecker(host) {
|
|
|
85665
85814
|
const type = getTypeFromTypeNode(typeNode);
|
|
85666
85815
|
return containsUndefinedType(type);
|
|
85667
85816
|
}
|
|
85668
|
-
function requiresAddingImplicitUndefined(parameter) {
|
|
85669
|
-
return (isRequiredInitializedParameter(parameter) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
|
|
85817
|
+
function requiresAddingImplicitUndefined(parameter, enclosingDeclaration) {
|
|
85818
|
+
return (isRequiredInitializedParameter(parameter, enclosingDeclaration) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
|
|
85670
85819
|
}
|
|
85671
|
-
function isRequiredInitializedParameter(parameter) {
|
|
85672
|
-
|
|
85820
|
+
function isRequiredInitializedParameter(parameter, enclosingDeclaration) {
|
|
85821
|
+
if (!strictNullChecks || isOptionalParameter(parameter) || isJSDocParameterTag(parameter) || !parameter.initializer) {
|
|
85822
|
+
return false;
|
|
85823
|
+
}
|
|
85824
|
+
if (hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */)) {
|
|
85825
|
+
return !!enclosingDeclaration && isFunctionLikeDeclaration(enclosingDeclaration);
|
|
85826
|
+
}
|
|
85827
|
+
return true;
|
|
85673
85828
|
}
|
|
85674
85829
|
function isOptionalUninitializedParameterProperty(parameter) {
|
|
85675
85830
|
return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
@@ -85943,14 +86098,14 @@ function createTypeChecker(host) {
|
|
|
85943
86098
|
return 11 /* ObjectType */;
|
|
85944
86099
|
}
|
|
85945
86100
|
}
|
|
85946
|
-
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker) {
|
|
86101
|
+
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
85947
86102
|
const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor);
|
|
85948
86103
|
if (!declaration) {
|
|
85949
86104
|
return factory.createToken(133 /* AnyKeyword */);
|
|
85950
86105
|
}
|
|
85951
86106
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
85952
86107
|
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);
|
|
86108
|
+
return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
|
|
85954
86109
|
}
|
|
85955
86110
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
85956
86111
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
@@ -85993,14 +86148,14 @@ function createTypeChecker(host) {
|
|
|
85993
86148
|
}
|
|
85994
86149
|
return candidateExpr;
|
|
85995
86150
|
}
|
|
85996
|
-
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
|
|
86151
|
+
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
85997
86152
|
const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
|
|
85998
86153
|
if (!signatureDeclaration) {
|
|
85999
86154
|
return factory.createToken(133 /* AnyKeyword */);
|
|
86000
86155
|
}
|
|
86001
|
-
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
86156
|
+
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
|
|
86002
86157
|
}
|
|
86003
|
-
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
86158
|
+
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
86004
86159
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
86005
86160
|
if (!expr) {
|
|
86006
86161
|
return factory.createToken(133 /* AnyKeyword */);
|
|
@@ -86013,6 +86168,7 @@ function createTypeChecker(host) {
|
|
|
86013
86168
|
void 0,
|
|
86014
86169
|
enclosingDeclaration,
|
|
86015
86170
|
flags | 1024 /* MultilineObjectLiterals */,
|
|
86171
|
+
internalFlags,
|
|
86016
86172
|
tracker
|
|
86017
86173
|
);
|
|
86018
86174
|
}
|
|
@@ -86118,6 +86274,8 @@ function createTypeChecker(host) {
|
|
|
86118
86274
|
enclosing,
|
|
86119
86275
|
/*flags*/
|
|
86120
86276
|
void 0,
|
|
86277
|
+
/*internalFlags*/
|
|
86278
|
+
void 0,
|
|
86121
86279
|
tracker
|
|
86122
86280
|
) : type === trueType ? factory.createTrue() : type === falseType && factory.createFalse();
|
|
86123
86281
|
if (enumResult) return enumResult;
|
|
@@ -86246,15 +86404,15 @@ function createTypeChecker(host) {
|
|
|
86246
86404
|
const parseDecl = getParseTreeNode(decl);
|
|
86247
86405
|
return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
|
|
86248
86406
|
},
|
|
86249
|
-
getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
|
|
86407
|
+
getDeclarationStatementsForSourceFile: (node, flags, internalFlags, tracker) => {
|
|
86250
86408
|
const n = getParseTreeNode(node);
|
|
86251
86409
|
Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
|
|
86252
86410
|
const sym = getSymbolOfDeclaration(node);
|
|
86253
86411
|
if (!sym) {
|
|
86254
|
-
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
|
|
86412
|
+
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, internalFlags, tracker);
|
|
86255
86413
|
}
|
|
86256
86414
|
resolveExternalModuleSymbol(sym);
|
|
86257
|
-
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
|
86415
|
+
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
|
|
86258
86416
|
},
|
|
86259
86417
|
isImportRequiredByAugmentation,
|
|
86260
86418
|
isDefinitelyReferenceToGlobalSymbolObject
|
|
@@ -101587,7 +101745,7 @@ function transformJsx(context) {
|
|
|
101587
101745
|
const name = node.name;
|
|
101588
101746
|
if (isIdentifier(name)) {
|
|
101589
101747
|
const text = idText(name);
|
|
101590
|
-
return /^[A-
|
|
101748
|
+
return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text);
|
|
101591
101749
|
}
|
|
101592
101750
|
return factory2.createStringLiteral(idText(name.namespace) + ":" + idText(name.name));
|
|
101593
101751
|
}
|
|
@@ -111288,7 +111446,11 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
111288
111446
|
if (isSetAccessor(node.parent)) {
|
|
111289
111447
|
return createAccessorTypeError(node.parent);
|
|
111290
111448
|
}
|
|
111291
|
-
const addUndefined = resolver.requiresAddingImplicitUndefined(
|
|
111449
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(
|
|
111450
|
+
node,
|
|
111451
|
+
/*enclosingDeclaration*/
|
|
111452
|
+
void 0
|
|
111453
|
+
);
|
|
111292
111454
|
if (!addUndefined && node.initializer) {
|
|
111293
111455
|
return createExpressionError(node.initializer);
|
|
111294
111456
|
}
|
|
@@ -111354,7 +111516,8 @@ function getDeclarationDiagnostics(host, resolver, file) {
|
|
|
111354
111516
|
false
|
|
111355
111517
|
).diagnostics : void 0;
|
|
111356
111518
|
}
|
|
111357
|
-
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ |
|
|
111519
|
+
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
|
|
111520
|
+
var declarationEmitInternalNodeBuilderFlags = 8 /* AllowUnresolvedNames */;
|
|
111358
111521
|
function transformDeclarations(context) {
|
|
111359
111522
|
const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
|
|
111360
111523
|
let getSymbolAccessibilityDiagnostic = throwDiagnostic;
|
|
@@ -111510,7 +111673,7 @@ function transformDeclarations(context) {
|
|
|
111510
111673
|
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
111674
|
errorNode: s.errorNode || sourceFile
|
|
111512
111675
|
};
|
|
111513
|
-
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
111676
|
+
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
111514
111677
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
111515
111678
|
return result;
|
|
111516
111679
|
}
|
|
@@ -111763,7 +111926,7 @@ function transformDeclarations(context) {
|
|
|
111763
111926
|
if (shouldPrintWithInitializer(node)) {
|
|
111764
111927
|
return;
|
|
111765
111928
|
}
|
|
111766
|
-
const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node);
|
|
111929
|
+
const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node, enclosingDeclaration);
|
|
111767
111930
|
if (type && !shouldAddImplicitUndefined) {
|
|
111768
111931
|
return visitNode(type, visitDeclarationSubtree, isTypeNode);
|
|
111769
111932
|
}
|
|
@@ -111780,7 +111943,7 @@ function transformDeclarations(context) {
|
|
|
111780
111943
|
case 172 /* PropertyDeclaration */:
|
|
111781
111944
|
case 208 /* BindingElement */:
|
|
111782
111945
|
case 260 /* VariableDeclaration */:
|
|
111783
|
-
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
111946
|
+
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
111784
111947
|
break;
|
|
111785
111948
|
case 262 /* FunctionDeclaration */:
|
|
111786
111949
|
case 180 /* ConstructSignature */:
|
|
@@ -111788,7 +111951,7 @@ function transformDeclarations(context) {
|
|
|
111788
111951
|
case 174 /* MethodDeclaration */:
|
|
111789
111952
|
case 177 /* GetAccessor */:
|
|
111790
111953
|
case 179 /* CallSignature */:
|
|
111791
|
-
typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
111954
|
+
typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
111792
111955
|
break;
|
|
111793
111956
|
default:
|
|
111794
111957
|
Debug.assertNever(node);
|
|
@@ -112389,7 +112552,7 @@ function transformDeclarations(context) {
|
|
|
112389
112552
|
newId,
|
|
112390
112553
|
/*exclamationToken*/
|
|
112391
112554
|
void 0,
|
|
112392
|
-
resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
|
|
112555
|
+
resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
|
|
112393
112556
|
/*initializer*/
|
|
112394
112557
|
void 0
|
|
112395
112558
|
);
|
|
@@ -112515,7 +112678,7 @@ function transformDeclarations(context) {
|
|
|
112515
112678
|
return void 0;
|
|
112516
112679
|
}
|
|
112517
112680
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
|
|
112518
|
-
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags |
|
|
112681
|
+
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags | 2 /* NoSyntacticPrinter */, symbolTracker);
|
|
112519
112682
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
112520
112683
|
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
|
|
112521
112684
|
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
|
|
@@ -112718,7 +112881,7 @@ function transformDeclarations(context) {
|
|
|
112718
112881
|
newId,
|
|
112719
112882
|
/*exclamationToken*/
|
|
112720
112883
|
void 0,
|
|
112721
|
-
resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
|
|
112884
|
+
resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
|
|
112722
112885
|
/*initializer*/
|
|
112723
112886
|
void 0
|
|
112724
112887
|
);
|
|
@@ -116545,7 +116708,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116545
116708
|
if (node.comment) {
|
|
116546
116709
|
const text = getTextOfJSDocComment(node.comment);
|
|
116547
116710
|
if (text) {
|
|
116548
|
-
const lines = text.split(/\r\n?|\n/
|
|
116711
|
+
const lines = text.split(/\r\n?|\n/);
|
|
116549
116712
|
for (const line of lines) {
|
|
116550
116713
|
writeLine();
|
|
116551
116714
|
writeSpace();
|
|
@@ -116972,7 +117135,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116972
117135
|
if (isFunctionLike(parentNode) && parentNode.typeArguments) {
|
|
116973
117136
|
return emitTypeArguments(parentNode, parentNode.typeArguments);
|
|
116974
117137
|
}
|
|
116975
|
-
emitList(parentNode, typeParameters, 53776 /* TypeParameters */);
|
|
117138
|
+
emitList(parentNode, typeParameters, 53776 /* TypeParameters */ | (isArrowFunction(parentNode) ? 64 /* AllowTrailingComma */ : 0 /* None */));
|
|
116976
117139
|
}
|
|
116977
117140
|
function emitParameters(parentNode, parameters) {
|
|
116978
117141
|
emitList(parentNode, parameters, 2576 /* Parameters */);
|
|
@@ -117240,7 +117403,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
117240
117403
|
}
|
|
117241
117404
|
}
|
|
117242
117405
|
function writeLines(text) {
|
|
117243
|
-
const lines = text.split(/\r\n?|\n/
|
|
117406
|
+
const lines = text.split(/\r\n?|\n/);
|
|
117244
117407
|
const indentation = guessIndentation(lines);
|
|
117245
117408
|
for (const lineText of lines) {
|
|
117246
117409
|
const line = indentation ? lineText.slice(indentation) : lineText;
|
|
@@ -118477,7 +118640,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118477
118640
|
}
|
|
118478
118641
|
try {
|
|
118479
118642
|
return createCachedFileSystemEntries(rootDir, rootDirPath);
|
|
118480
|
-
} catch
|
|
118643
|
+
} catch {
|
|
118481
118644
|
Debug.assert(!cachedReadDirectoryResult.has(ensureTrailingDirectorySeparator(rootDirPath)));
|
|
118482
118645
|
return void 0;
|
|
118483
118646
|
}
|
|
@@ -118566,6 +118729,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118566
118729
|
function realpath(s) {
|
|
118567
118730
|
return host.realpath ? host.realpath(s) : s;
|
|
118568
118731
|
}
|
|
118732
|
+
function clearFirstAncestorEntry(fileOrDirectoryPath) {
|
|
118733
|
+
forEachAncestorDirectory(
|
|
118734
|
+
getDirectoryPath(fileOrDirectoryPath),
|
|
118735
|
+
(ancestor) => cachedReadDirectoryResult.delete(ensureTrailingDirectorySeparator(ancestor)) ? true : void 0
|
|
118736
|
+
);
|
|
118737
|
+
}
|
|
118569
118738
|
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
|
118570
118739
|
const existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
|
118571
118740
|
if (existingResult !== void 0) {
|
|
@@ -118574,6 +118743,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118574
118743
|
}
|
|
118575
118744
|
const parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath);
|
|
118576
118745
|
if (!parentResult) {
|
|
118746
|
+
clearFirstAncestorEntry(fileOrDirectoryPath);
|
|
118577
118747
|
return void 0;
|
|
118578
118748
|
}
|
|
118579
118749
|
if (!host.directoryExists) {
|
|
@@ -118599,6 +118769,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118599
118769
|
const parentResult = getCachedFileSystemEntriesForBaseDir(filePath);
|
|
118600
118770
|
if (parentResult) {
|
|
118601
118771
|
updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === 0 /* Created */);
|
|
118772
|
+
} else {
|
|
118773
|
+
clearFirstAncestorEntry(filePath);
|
|
118602
118774
|
}
|
|
118603
118775
|
}
|
|
118604
118776
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists2) {
|
|
@@ -120870,7 +121042,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120870
121042
|
return line;
|
|
120871
121043
|
}
|
|
120872
121044
|
const lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
|
|
120873
|
-
if (lineText !== "" &&
|
|
121045
|
+
if (lineText !== "" && !/^\s*\/\/.*$/.test(lineText)) {
|
|
120874
121046
|
return -1;
|
|
120875
121047
|
}
|
|
120876
121048
|
line--;
|
|
@@ -124871,9 +125043,9 @@ function removeIgnoredPath(path) {
|
|
|
124871
125043
|
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
124872
125044
|
if (length2 <= 1) return 1;
|
|
124873
125045
|
let indexAfterOsRoot = 1;
|
|
124874
|
-
let isDosStyle = pathComponents2[0].search(/[a-
|
|
125046
|
+
let isDosStyle = pathComponents2[0].search(/[a-z]:/i) === 0;
|
|
124875
125047
|
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
|
|
124876
|
-
pathComponents2[1].search(/[a-
|
|
125048
|
+
pathComponents2[1].search(/[a-z]\$$/i) === 0) {
|
|
124877
125049
|
if (length2 === 2) return 2;
|
|
124878
125050
|
indexAfterOsRoot = 2;
|
|
124879
125051
|
isDosStyle = true;
|
|
@@ -130225,7 +130397,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
130225
130397
|
return typeFromAccessor(parent, context);
|
|
130226
130398
|
}
|
|
130227
130399
|
const declaredType = getEffectiveTypeAnnotationNode(node);
|
|
130228
|
-
const addUndefined = resolver.requiresAddingImplicitUndefined(node);
|
|
130400
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(node, context.enclosingDeclaration);
|
|
130229
130401
|
let resultType;
|
|
130230
130402
|
if (declaredType) {
|
|
130231
130403
|
resultType = serializeExistingTypeAnnotation(declaredType, addUndefined);
|