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