@typescript-deploys/pr-build 5.3.0-pr-55371-11 → 5.3.0-pr-55438-2
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/cancellationToken.js +1 -1
- package/lib/tsc.js +161 -218
- package/lib/tsserver.js +178 -253
- package/lib/typescript.js +180 -249
- package/lib/typingsInstaller.js +37 -104
- package/package.json +2 -2
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.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230829`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -973,10 +973,7 @@ function getStringComparer(ignoreCase) {
|
|
|
973
973
|
return ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive;
|
|
974
974
|
}
|
|
975
975
|
var createUIStringComparer = (() => {
|
|
976
|
-
|
|
977
|
-
let enUSComparer;
|
|
978
|
-
const stringComparerFactory = getStringComparerFactory();
|
|
979
|
-
return createStringComparer;
|
|
976
|
+
return createIntlCollatorStringComparer;
|
|
980
977
|
function compareWithCallback(a, b, comparer) {
|
|
981
978
|
if (a === b)
|
|
982
979
|
return 0 /* EqualTo */;
|
|
@@ -991,41 +988,6 @@ var createUIStringComparer = (() => {
|
|
|
991
988
|
const comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant" }).compare;
|
|
992
989
|
return (a, b) => compareWithCallback(a, b, comparer);
|
|
993
990
|
}
|
|
994
|
-
function createLocaleCompareStringComparer(locale) {
|
|
995
|
-
if (locale !== void 0)
|
|
996
|
-
return createFallbackStringComparer();
|
|
997
|
-
return (a, b) => compareWithCallback(a, b, compareStrings);
|
|
998
|
-
function compareStrings(a, b) {
|
|
999
|
-
return a.localeCompare(b);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
function createFallbackStringComparer() {
|
|
1003
|
-
return (a, b) => compareWithCallback(a, b, compareDictionaryOrder);
|
|
1004
|
-
function compareDictionaryOrder(a, b) {
|
|
1005
|
-
return compareStrings(a.toUpperCase(), b.toUpperCase()) || compareStrings(a, b);
|
|
1006
|
-
}
|
|
1007
|
-
function compareStrings(a, b) {
|
|
1008
|
-
return a < b ? -1 /* LessThan */ : a > b ? 1 /* GreaterThan */ : 0 /* EqualTo */;
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
function getStringComparerFactory() {
|
|
1012
|
-
if (typeof Intl === "object" && typeof Intl.Collator === "function") {
|
|
1013
|
-
return createIntlCollatorStringComparer;
|
|
1014
|
-
}
|
|
1015
|
-
if (typeof String.prototype.localeCompare === "function" && typeof String.prototype.toLocaleUpperCase === "function" && "a".localeCompare("B") < 0) {
|
|
1016
|
-
return createLocaleCompareStringComparer;
|
|
1017
|
-
}
|
|
1018
|
-
return createFallbackStringComparer;
|
|
1019
|
-
}
|
|
1020
|
-
function createStringComparer(locale) {
|
|
1021
|
-
if (locale === void 0) {
|
|
1022
|
-
return defaultComparer || (defaultComparer = stringComparerFactory(locale));
|
|
1023
|
-
} else if (locale === "en-US") {
|
|
1024
|
-
return enUSComparer || (enUSComparer = stringComparerFactory(locale));
|
|
1025
|
-
} else {
|
|
1026
|
-
return stringComparerFactory(locale);
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
991
|
})();
|
|
1030
992
|
var uiComparerCaseSensitive;
|
|
1031
993
|
var uiLocale;
|
|
@@ -1111,9 +1073,6 @@ function endsWith(str, suffix) {
|
|
|
1111
1073
|
function removeSuffix(str, suffix) {
|
|
1112
1074
|
return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : str;
|
|
1113
1075
|
}
|
|
1114
|
-
function stringContains(str, substring) {
|
|
1115
|
-
return str.indexOf(substring) !== -1;
|
|
1116
|
-
}
|
|
1117
1076
|
function orderedRemoveItem(array, item) {
|
|
1118
1077
|
for (let i = 0; i < array.length; i++) {
|
|
1119
1078
|
if (array[i] === item) {
|
|
@@ -1261,12 +1220,6 @@ function cartesianProductWorker(arrays, result, outer, index) {
|
|
|
1261
1220
|
}
|
|
1262
1221
|
}
|
|
1263
1222
|
}
|
|
1264
|
-
function padLeft(s, length2, padString = " ") {
|
|
1265
|
-
return length2 <= s.length ? s : padString.repeat(length2 - s.length) + s;
|
|
1266
|
-
}
|
|
1267
|
-
function padRight(s, length2, padString = " ") {
|
|
1268
|
-
return length2 <= s.length ? s : s + padString.repeat(length2 - s.length);
|
|
1269
|
-
}
|
|
1270
1223
|
function takeWhile(array, predicate) {
|
|
1271
1224
|
if (array) {
|
|
1272
1225
|
const len = array.length;
|
|
@@ -1287,18 +1240,6 @@ function skipWhile(array, predicate) {
|
|
|
1287
1240
|
return array.slice(index);
|
|
1288
1241
|
}
|
|
1289
1242
|
}
|
|
1290
|
-
var trimString = !!String.prototype.trim ? (s) => s.trim() : (s) => trimStringEnd(trimStringStart(s));
|
|
1291
|
-
var trimStringEnd = !!String.prototype.trimEnd ? (s) => s.trimEnd() : trimEndImpl;
|
|
1292
|
-
var trimStringStart = !!String.prototype.trimStart ? (s) => s.trimStart() : (s) => s.replace(/^\s+/g, "");
|
|
1293
|
-
function trimEndImpl(s) {
|
|
1294
|
-
let end = s.length - 1;
|
|
1295
|
-
while (end >= 0) {
|
|
1296
|
-
if (!isWhiteSpaceLike(s.charCodeAt(end)))
|
|
1297
|
-
break;
|
|
1298
|
-
end--;
|
|
1299
|
-
}
|
|
1300
|
-
return s.slice(0, end + 1);
|
|
1301
|
-
}
|
|
1302
1243
|
function isNodeLikeSystem() {
|
|
1303
1244
|
return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof module === "object";
|
|
1304
1245
|
}
|
|
@@ -2486,18 +2427,18 @@ var hyphenRegExp = /^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i;
|
|
|
2486
2427
|
var rangeRegExp = /^(~|\^|<|<=|>|>=|=)?\s*([a-z0-9-+.*]+)$/i;
|
|
2487
2428
|
function parseRange(text) {
|
|
2488
2429
|
const alternatives = [];
|
|
2489
|
-
for (let range of
|
|
2430
|
+
for (let range of text.trim().split(logicalOrRegExp)) {
|
|
2490
2431
|
if (!range)
|
|
2491
2432
|
continue;
|
|
2492
2433
|
const comparators = [];
|
|
2493
|
-
range =
|
|
2434
|
+
range = range.trim();
|
|
2494
2435
|
const match = hyphenRegExp.exec(range);
|
|
2495
2436
|
if (match) {
|
|
2496
2437
|
if (!parseHyphen(match[1], match[2], comparators))
|
|
2497
2438
|
return void 0;
|
|
2498
2439
|
} else {
|
|
2499
2440
|
for (const simple of range.split(whitespaceRegExp)) {
|
|
2500
|
-
const match2 = rangeRegExp.exec(
|
|
2441
|
+
const match2 = rangeRegExp.exec(simple.trim());
|
|
2501
2442
|
if (!match2 || !parseComparator(match2[1], match2[2], comparators))
|
|
2502
2443
|
return void 0;
|
|
2503
2444
|
}
|
|
@@ -4517,11 +4458,11 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4517
4458
|
return some(ignoredPaths, (searchPath) => isInPath(path, searchPath)) || isIgnoredByWatchOptions(path, options, useCaseSensitiveFileNames2, getCurrentDirectory);
|
|
4518
4459
|
}
|
|
4519
4460
|
function isInPath(path, searchPath) {
|
|
4520
|
-
if (
|
|
4461
|
+
if (path.includes(searchPath))
|
|
4521
4462
|
return true;
|
|
4522
4463
|
if (useCaseSensitiveFileNames2)
|
|
4523
4464
|
return false;
|
|
4524
|
-
return
|
|
4465
|
+
return toCanonicalFilePath(path).includes(searchPath);
|
|
4525
4466
|
}
|
|
4526
4467
|
}
|
|
4527
4468
|
function createFileWatcherCallback(callback) {
|
|
@@ -5358,7 +5299,7 @@ function pathIsBareSpecifier(path) {
|
|
|
5358
5299
|
return !pathIsAbsolute(path) && !pathIsRelative(path);
|
|
5359
5300
|
}
|
|
5360
5301
|
function hasExtension(fileName) {
|
|
5361
|
-
return
|
|
5302
|
+
return getBaseFileName(fileName).includes(".");
|
|
5362
5303
|
}
|
|
5363
5304
|
function fileExtensionIs(path, extension) {
|
|
5364
5305
|
return path.length > extension.length && endsWith(path, extension);
|
|
@@ -5503,7 +5444,7 @@ function getPathFromPathComponents(pathComponents2, length2) {
|
|
|
5503
5444
|
return root + pathComponents2.slice(1, length2).join(directorySeparator);
|
|
5504
5445
|
}
|
|
5505
5446
|
function normalizeSlashes(path) {
|
|
5506
|
-
return path.
|
|
5447
|
+
return path.includes("\\") ? path.replace(backslashRegExp, directorySeparator) : path;
|
|
5507
5448
|
}
|
|
5508
5449
|
function reducePathComponents(components) {
|
|
5509
5450
|
if (!some(components))
|
|
@@ -8861,7 +8802,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8861
8802
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8862
8803
|
if (shouldEmitInvalidEscapeError) {
|
|
8863
8804
|
const code = parseInt(text.substring(start2 + 1, pos), 8);
|
|
8864
|
-
error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" +
|
|
8805
|
+
error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
|
|
8865
8806
|
return String.fromCharCode(code);
|
|
8866
8807
|
}
|
|
8867
8808
|
return text.substring(start2, pos);
|
|
@@ -9664,7 +9605,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9664
9605
|
return token;
|
|
9665
9606
|
}
|
|
9666
9607
|
function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
|
|
9667
|
-
const type = getDirectiveFromComment(
|
|
9608
|
+
const type = getDirectiveFromComment(text2.trimStart(), commentDirectiveRegEx);
|
|
9668
9609
|
if (type === void 0) {
|
|
9669
9610
|
return commentDirectives2;
|
|
9670
9611
|
}
|
|
@@ -9998,20 +9939,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9998
9939
|
inJSDocType += inType ? 1 : -1;
|
|
9999
9940
|
}
|
|
10000
9941
|
}
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
return void 0;
|
|
10005
|
-
}
|
|
10006
|
-
const first2 = str.charCodeAt(i);
|
|
10007
|
-
if (first2 >= 55296 && first2 <= 56319 && size > i + 1) {
|
|
10008
|
-
const second = str.charCodeAt(i + 1);
|
|
10009
|
-
if (second >= 56320 && second <= 57343) {
|
|
10010
|
-
return (first2 - 55296) * 1024 + second - 56320 + 65536;
|
|
10011
|
-
}
|
|
10012
|
-
}
|
|
10013
|
-
return first2;
|
|
10014
|
-
};
|
|
9942
|
+
function codePointAt(s, i) {
|
|
9943
|
+
return s.codePointAt(i);
|
|
9944
|
+
}
|
|
10015
9945
|
function charSize(ch) {
|
|
10016
9946
|
if (ch >= 65536) {
|
|
10017
9947
|
return 2;
|
|
@@ -11523,7 +11453,7 @@ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, pack
|
|
|
11523
11453
|
void 0,
|
|
11524
11454
|
Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings,
|
|
11525
11455
|
node10Result,
|
|
11526
|
-
node10Result.
|
|
11456
|
+
node10Result.includes(nodeModulesPathPart + "@types/") ? `@types/${mangleScopedPackageName(packageName)}` : packageName
|
|
11527
11457
|
) : host.typesPackageExists(packageName) ? chainDiagnosticMessages(
|
|
11528
11458
|
/*details*/
|
|
11529
11459
|
void 0,
|
|
@@ -11750,7 +11680,7 @@ function getTextOfNodeFromSourceText(sourceText, node, includeTrivia = false) {
|
|
|
11750
11680
|
}
|
|
11751
11681
|
let text = sourceText.substring(includeTrivia ? node.pos : skipTrivia(sourceText, node.pos), node.end);
|
|
11752
11682
|
if (isJSDocTypeExpressionOrChild(node)) {
|
|
11753
|
-
text = text.split(/\r\n|\n|\r/).map((line) =>
|
|
11683
|
+
text = text.split(/\r\n|\n|\r/).map((line) => line.replace(/^\s*\*/, "").trimStart()).join("\n");
|
|
11754
11684
|
}
|
|
11755
11685
|
return text;
|
|
11756
11686
|
}
|
|
@@ -14780,7 +14710,7 @@ function isQuoteOrBacktick(charCode) {
|
|
|
14780
14710
|
}
|
|
14781
14711
|
function isIntrinsicJsxName(name) {
|
|
14782
14712
|
const ch = name.charCodeAt(0);
|
|
14783
|
-
return ch >= 97 /* a */ && ch <= 122 /* z */ ||
|
|
14713
|
+
return ch >= 97 /* a */ && ch <= 122 /* z */ || name.includes("-");
|
|
14784
14714
|
}
|
|
14785
14715
|
var indentStrings = ["", " "];
|
|
14786
14716
|
function getIndentString(level) {
|
|
@@ -14794,7 +14724,7 @@ function getIndentSize() {
|
|
|
14794
14724
|
return indentStrings[1].length;
|
|
14795
14725
|
}
|
|
14796
14726
|
function isNightly() {
|
|
14797
|
-
return
|
|
14727
|
+
return version.includes("-dev") || version.includes("-insiders");
|
|
14798
14728
|
}
|
|
14799
14729
|
function createTextWriter(newLine) {
|
|
14800
14730
|
var output;
|
|
@@ -14984,7 +14914,7 @@ function getExternalModuleNameFromDeclaration(host, resolver, declaration) {
|
|
|
14984
14914
|
return void 0;
|
|
14985
14915
|
}
|
|
14986
14916
|
const specifier = getExternalModuleName(declaration);
|
|
14987
|
-
if (specifier && isStringLiteralLike(specifier) && !pathIsRelative(specifier.text) && getCanonicalAbsolutePath(host, file.path).
|
|
14917
|
+
if (specifier && isStringLiteralLike(specifier) && !pathIsRelative(specifier.text) && !getCanonicalAbsolutePath(host, file.path).includes(getCanonicalAbsolutePath(host, ensureTrailingDirectorySeparator(host.getCommonSourceDirectory())))) {
|
|
14988
14918
|
return void 0;
|
|
14989
14919
|
}
|
|
14990
14920
|
return getResolvedExternalModuleName(host, file);
|
|
@@ -15329,7 +15259,7 @@ function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLin
|
|
|
15329
15259
|
}
|
|
15330
15260
|
function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) {
|
|
15331
15261
|
const end = Math.min(commentEnd, nextLineStart - 1);
|
|
15332
|
-
const currentLineText =
|
|
15262
|
+
const currentLineText = text.substring(pos, end).trim();
|
|
15333
15263
|
if (currentLineText) {
|
|
15334
15264
|
writer.writeComment(currentLineText);
|
|
15335
15265
|
if (end !== commentEnd) {
|
|
@@ -16792,7 +16722,7 @@ function getSupportedExtensions(options, extraFileExtensions) {
|
|
|
16792
16722
|
const flatBuiltins = flatten(builtins);
|
|
16793
16723
|
const extensions = [
|
|
16794
16724
|
...builtins,
|
|
16795
|
-
...mapDefined(extraFileExtensions, (x) => x.scriptKind === 7 /* Deferred */ || needJsExtensions && isJSLike(x.scriptKind) && flatBuiltins.
|
|
16725
|
+
...mapDefined(extraFileExtensions, (x) => x.scriptKind === 7 /* Deferred */ || needJsExtensions && isJSLike(x.scriptKind) && !flatBuiltins.includes(x.extension) ? [x.extension] : void 0)
|
|
16796
16726
|
];
|
|
16797
16727
|
return extensions;
|
|
16798
16728
|
}
|
|
@@ -17234,7 +17164,7 @@ function expressionResultIsUnused(node) {
|
|
|
17234
17164
|
}
|
|
17235
17165
|
}
|
|
17236
17166
|
function containsIgnoredPath(path) {
|
|
17237
|
-
return some(ignoredPaths, (p) =>
|
|
17167
|
+
return some(ignoredPaths, (p) => path.includes(p));
|
|
17238
17168
|
}
|
|
17239
17169
|
function getContainingNodeArray(node) {
|
|
17240
17170
|
if (!node.parent)
|
|
@@ -31750,7 +31680,7 @@ var Parser;
|
|
|
31750
31680
|
}
|
|
31751
31681
|
function parseModuleOrNamespaceDeclaration(pos, hasJSDoc, modifiers, flags) {
|
|
31752
31682
|
const namespaceFlag = flags & 32 /* Namespace */;
|
|
31753
|
-
const name = parseIdentifier();
|
|
31683
|
+
const name = flags & 8 /* NestedNamespace */ ? parseIdentifierName() : parseIdentifier();
|
|
31754
31684
|
const body = parseOptional(25 /* DotToken */) ? parseModuleOrNamespaceDeclaration(
|
|
31755
31685
|
getNodePos(),
|
|
31756
31686
|
/*hasJSDoc*/
|
|
@@ -32220,8 +32150,6 @@ var Parser;
|
|
|
32220
32150
|
PropertyLikeParse2[PropertyLikeParse2["CallbackParameter"] = 4] = "CallbackParameter";
|
|
32221
32151
|
})(PropertyLikeParse || (PropertyLikeParse = {}));
|
|
32222
32152
|
function parseJSDocCommentWorker(start = 0, length2) {
|
|
32223
|
-
const saveParsingContext = parsingContext;
|
|
32224
|
-
parsingContext |= 1 << 25 /* JSDocComment */;
|
|
32225
32153
|
const content = sourceText;
|
|
32226
32154
|
const end = length2 === void 0 ? content.length : start + length2;
|
|
32227
32155
|
length2 = end - start;
|
|
@@ -32238,6 +32166,8 @@ var Parser;
|
|
|
32238
32166
|
let commentsPos;
|
|
32239
32167
|
let comments = [];
|
|
32240
32168
|
const parts = [];
|
|
32169
|
+
const saveParsingContext = parsingContext;
|
|
32170
|
+
parsingContext |= 1 << 25 /* JSDocComment */;
|
|
32241
32171
|
const result = scanner.scanRange(start + 3, length2 - 5, doJSDocScan);
|
|
32242
32172
|
parsingContext = saveParsingContext;
|
|
32243
32173
|
return result;
|
|
@@ -32329,7 +32259,7 @@ var Parser;
|
|
|
32329
32259
|
nextTokenJSDoc();
|
|
32330
32260
|
}
|
|
32331
32261
|
}
|
|
32332
|
-
const trimmedComments =
|
|
32262
|
+
const trimmedComments = comments.join("").trimEnd();
|
|
32333
32263
|
if (parts.length && trimmedComments.length) {
|
|
32334
32264
|
parts.push(finishNode(factory2.createJSDocText(trimmedComments), linkEnd ?? start, commentsPos));
|
|
32335
32265
|
}
|
|
@@ -32345,7 +32275,7 @@ var Parser;
|
|
|
32345
32275
|
}
|
|
32346
32276
|
function removeTrailingWhitespace(comments2) {
|
|
32347
32277
|
while (comments2.length) {
|
|
32348
|
-
const trimmed =
|
|
32278
|
+
const trimmed = comments2[comments2.length - 1].trimEnd();
|
|
32349
32279
|
if (trimmed === "") {
|
|
32350
32280
|
comments2.pop();
|
|
32351
32281
|
} else if (trimmed.length < comments2[comments2.length - 1].length) {
|
|
@@ -32585,7 +32515,7 @@ var Parser;
|
|
|
32585
32515
|
}
|
|
32586
32516
|
}
|
|
32587
32517
|
removeLeadingNewlines(comments2);
|
|
32588
|
-
const trimmedComments =
|
|
32518
|
+
const trimmedComments = comments2.join("").trimEnd();
|
|
32589
32519
|
if (parts2.length) {
|
|
32590
32520
|
if (trimmedComments.length) {
|
|
32591
32521
|
parts2.push(finishNode(factory2.createJSDocText(trimmedComments), linkEnd2 ?? commentsPos2));
|
|
@@ -33483,7 +33413,7 @@ var IncrementalParser;
|
|
|
33483
33413
|
})(InvalidPosition || (InvalidPosition = {}));
|
|
33484
33414
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
33485
33415
|
function isDeclarationFileName(fileName) {
|
|
33486
|
-
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions) || fileExtensionIs(fileName, ".ts" /* Ts */) &&
|
|
33416
|
+
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions) || fileExtensionIs(fileName, ".ts" /* Ts */) && getBaseFileName(fileName).includes(".d.");
|
|
33487
33417
|
}
|
|
33488
33418
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
33489
33419
|
if (!mode) {
|
|
@@ -33669,7 +33599,7 @@ function getNamedPragmaArguments(pragma, text) {
|
|
|
33669
33599
|
return {};
|
|
33670
33600
|
if (!pragma.args)
|
|
33671
33601
|
return {};
|
|
33672
|
-
const args =
|
|
33602
|
+
const args = text.trim().split(/\s+/);
|
|
33673
33603
|
const argMap = {};
|
|
33674
33604
|
for (let i = 0; i < pragma.args.length; i++) {
|
|
33675
33605
|
const argument = pragma.args[i];
|
|
@@ -35191,14 +35121,14 @@ function createDiagnosticForInvalidCustomType(opt, createDiagnostic) {
|
|
|
35191
35121
|
return createDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, stringNames);
|
|
35192
35122
|
}
|
|
35193
35123
|
function parseCustomTypeOption(opt, value, errors) {
|
|
35194
|
-
return convertJsonOptionOfCustomType(opt,
|
|
35124
|
+
return convertJsonOptionOfCustomType(opt, (value ?? "").trim(), errors);
|
|
35195
35125
|
}
|
|
35196
35126
|
function parseListTypeOption(opt, value = "", errors) {
|
|
35197
|
-
value =
|
|
35127
|
+
value = value.trim();
|
|
35198
35128
|
if (startsWith(value, "-")) {
|
|
35199
35129
|
return void 0;
|
|
35200
35130
|
}
|
|
35201
|
-
if (opt.type === "listOrElement" && !
|
|
35131
|
+
if (opt.type === "listOrElement" && !value.includes(",")) {
|
|
35202
35132
|
return validateJsonOptionValue(opt, value, errors);
|
|
35203
35133
|
}
|
|
35204
35134
|
if (value === "") {
|
|
@@ -36222,7 +36152,7 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
|
|
|
36222
36152
|
var _a;
|
|
36223
36153
|
basePath = normalizeSlashes(basePath);
|
|
36224
36154
|
const resolvedPath = getNormalizedAbsolutePath(configFileName || "", basePath);
|
|
36225
|
-
if (resolutionStack.
|
|
36155
|
+
if (resolutionStack.includes(resolvedPath)) {
|
|
36226
36156
|
errors.push(createCompilerDiagnostic(Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, [...resolutionStack, resolvedPath].join(" -> ")));
|
|
36227
36157
|
return { raw: json || convertToObject(sourceFile, errors) };
|
|
36228
36158
|
}
|
|
@@ -37956,7 +37886,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37956
37886
|
result = tryResolve(extensions, state);
|
|
37957
37887
|
}
|
|
37958
37888
|
let legacyResult;
|
|
37959
|
-
if (((_a = result == null ? void 0 : result.value) == null ? void 0 : _a.isExternalLibraryImport) && !isConfigLookup && extensions & (1 /* TypeScript */ | 4 /* Declaration */) && features & 8 /* Exports */ && !isExternalModuleNameRelative(moduleName) && !extensionIsOk(1 /* TypeScript */ | 4 /* Declaration */, result.value.resolved.extension) && conditions.
|
|
37889
|
+
if (((_a = result == null ? void 0 : result.value) == null ? void 0 : _a.isExternalLibraryImport) && !isConfigLookup && extensions & (1 /* TypeScript */ | 4 /* Declaration */) && features & 8 /* Exports */ && !isExternalModuleNameRelative(moduleName) && !extensionIsOk(1 /* TypeScript */ | 4 /* Declaration */, result.value.resolved.extension) && conditions.includes("import")) {
|
|
37960
37890
|
traceIfEnabled(state, Diagnostics.Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_if_npm_library_needs_configuration_update);
|
|
37961
37891
|
const diagnosticState = {
|
|
37962
37892
|
...state,
|
|
@@ -38000,7 +37930,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
38000
37930
|
resolved2 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
38001
37931
|
}
|
|
38002
37932
|
if (!resolved2) {
|
|
38003
|
-
if (moduleName.
|
|
37933
|
+
if (moduleName.includes(":")) {
|
|
38004
37934
|
if (traceEnabled) {
|
|
38005
37935
|
trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
|
|
38006
37936
|
}
|
|
@@ -38090,7 +38020,7 @@ function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures,
|
|
|
38090
38020
|
}
|
|
38091
38021
|
var nodeModulesPathPart = "/node_modules/";
|
|
38092
38022
|
function pathContainsNodeModules(path) {
|
|
38093
|
-
return
|
|
38023
|
+
return path.includes(nodeModulesPathPart);
|
|
38094
38024
|
}
|
|
38095
38025
|
function parseNodeModuleFromPath(resolved, isFolder) {
|
|
38096
38026
|
const path = normalizePath(resolved);
|
|
@@ -38126,7 +38056,7 @@ function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
|
38126
38056
|
}
|
|
38127
38057
|
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
38128
38058
|
const filename = getBaseFileName(candidate);
|
|
38129
|
-
if (filename.
|
|
38059
|
+
if (!filename.includes(".")) {
|
|
38130
38060
|
return void 0;
|
|
38131
38061
|
}
|
|
38132
38062
|
let extensionless = removeFileExtension(candidate);
|
|
@@ -38550,7 +38480,7 @@ function comparePatternKeys(a, b) {
|
|
|
38550
38480
|
}
|
|
38551
38481
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
38552
38482
|
const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
38553
|
-
if (!endsWith(moduleName, directorySeparator) && moduleName.
|
|
38483
|
+
if (!endsWith(moduleName, directorySeparator) && !moduleName.includes("*") && hasProperty(lookupTable, moduleName)) {
|
|
38554
38484
|
const target = lookupTable[moduleName];
|
|
38555
38485
|
return loadModuleFromTargetImportOrExport(
|
|
38556
38486
|
target,
|
|
@@ -38561,7 +38491,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
|
|
|
38561
38491
|
moduleName
|
|
38562
38492
|
);
|
|
38563
38493
|
}
|
|
38564
|
-
const expandingKeys = sort(filter(getOwnKeys(lookupTable), (k) => k.
|
|
38494
|
+
const expandingKeys = sort(filter(getOwnKeys(lookupTable), (k) => k.includes("*") || endsWith(k, "/")), comparePatternKeys);
|
|
38565
38495
|
for (const potentialTarget of expandingKeys) {
|
|
38566
38496
|
if (state.features & 16 /* ExportsPatternTrailers */ && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
38567
38497
|
const target = lookupTable[potentialTarget];
|
|
@@ -38655,7 +38585,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38655
38585
|
}
|
|
38656
38586
|
const parts = pathIsRelative(target) ? getPathComponents(target).slice(1) : getPathComponents(target);
|
|
38657
38587
|
const partsAfterFirst = parts.slice(1);
|
|
38658
|
-
if (partsAfterFirst.
|
|
38588
|
+
if (partsAfterFirst.includes("..") || partsAfterFirst.includes(".") || partsAfterFirst.includes("node_modules")) {
|
|
38659
38589
|
if (state.traceEnabled) {
|
|
38660
38590
|
trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
38661
38591
|
}
|
|
@@ -38666,7 +38596,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38666
38596
|
}
|
|
38667
38597
|
const resolvedTarget = combinePaths(scope.packageDirectory, target);
|
|
38668
38598
|
const subpathParts = getPathComponents(subpath);
|
|
38669
|
-
if (subpathParts.
|
|
38599
|
+
if (subpathParts.includes("..") || subpathParts.includes(".") || subpathParts.includes("node_modules")) {
|
|
38670
38600
|
if (state.traceEnabled) {
|
|
38671
38601
|
trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
38672
38602
|
}
|
|
@@ -38693,7 +38623,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38693
38623
|
if (!Array.isArray(target)) {
|
|
38694
38624
|
traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
|
|
38695
38625
|
for (const condition of getOwnKeys(target)) {
|
|
38696
|
-
if (condition === "default" || state.conditions.
|
|
38626
|
+
if (condition === "default" || state.conditions.includes(condition) || isApplicableVersionedTypesKey(state.conditions, condition)) {
|
|
38697
38627
|
traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
|
|
38698
38628
|
const subTarget = target[condition];
|
|
38699
38629
|
const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
|
|
@@ -38754,7 +38684,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38754
38684
|
}
|
|
38755
38685
|
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
|
|
38756
38686
|
var _a, _b, _c, _d;
|
|
38757
|
-
if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath.
|
|
38687
|
+
if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && !finalPath.includes("/node_modules/") && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) {
|
|
38758
38688
|
const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
|
|
38759
38689
|
const commonSourceDirGuesses = [];
|
|
38760
38690
|
if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
|
|
@@ -38828,7 +38758,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38828
38758
|
}
|
|
38829
38759
|
}
|
|
38830
38760
|
function isApplicableVersionedTypesKey(conditions, key) {
|
|
38831
|
-
if (conditions.
|
|
38761
|
+
if (!conditions.includes("types"))
|
|
38832
38762
|
return false;
|
|
38833
38763
|
if (!startsWith(key, "types@"))
|
|
38834
38764
|
return false;
|
|
@@ -39033,7 +38963,7 @@ function getPackageNameFromTypesPackageName(mangledName) {
|
|
|
39033
38963
|
return mangledName;
|
|
39034
38964
|
}
|
|
39035
38965
|
function unmangleScopedPackageName(typesPackageName) {
|
|
39036
|
-
return
|
|
38966
|
+
return typesPackageName.includes(mangledScopedPackageSeparator) ? "@" + typesPackageName.replace(mangledScopedPackageSeparator, directorySeparator) : typesPackageName;
|
|
39037
38967
|
}
|
|
39038
38968
|
function tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, containingDirectory, redirectedReference, state) {
|
|
39039
38969
|
const result = cache && cache.getFromNonRelativeNameCache(moduleName, mode, containingDirectory, redirectedReference);
|
|
@@ -42663,12 +42593,12 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
42663
42593
|
/*currentDirectory*/
|
|
42664
42594
|
void 0
|
|
42665
42595
|
);
|
|
42666
|
-
const mode2 = endsWith(k, "/") ? 1 /* Directory */ :
|
|
42596
|
+
const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
42667
42597
|
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
|
|
42668
42598
|
});
|
|
42669
42599
|
} else {
|
|
42670
42600
|
for (const key of getOwnKeys(exports)) {
|
|
42671
|
-
if (key === "default" || conditions.
|
|
42601
|
+
if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
|
|
42672
42602
|
const subTarget = exports[key];
|
|
42673
42603
|
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
|
|
42674
42604
|
if (result) {
|
|
@@ -42834,7 +42764,7 @@ function processEnding(fileName, allowedEndings, options, host) {
|
|
|
42834
42764
|
return fileName;
|
|
42835
42765
|
} else if (fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */])) {
|
|
42836
42766
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
42837
|
-
} else if (!fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */]) && fileExtensionIsOneOf(fileName, [".ts" /* Ts */]) &&
|
|
42767
|
+
} else if (!fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */]) && fileExtensionIsOneOf(fileName, [".ts" /* Ts */]) && fileName.includes(".d.")) {
|
|
42838
42768
|
return tryGetRealFileNameForNonJsDeclarationFileName(fileName);
|
|
42839
42769
|
}
|
|
42840
42770
|
switch (allowedEndings[0]) {
|
|
@@ -42860,7 +42790,7 @@ function processEnding(fileName, allowedEndings, options, host) {
|
|
|
42860
42790
|
}
|
|
42861
42791
|
function tryGetRealFileNameForNonJsDeclarationFileName(fileName) {
|
|
42862
42792
|
const baseName = getBaseFileName(fileName);
|
|
42863
|
-
if (!endsWith(fileName, ".ts" /* Ts */) || !
|
|
42793
|
+
if (!endsWith(fileName, ".ts" /* Ts */) || !baseName.includes(".d.") || fileExtensionIsOneOf(baseName, [".d.ts" /* Dts */]))
|
|
42864
42794
|
return void 0;
|
|
42865
42795
|
const noExtension = removeExtension(fileName, ".ts" /* Ts */);
|
|
42866
42796
|
const ext = noExtension.substring(noExtension.lastIndexOf("."));
|
|
@@ -43579,6 +43509,7 @@ function createTypeChecker(host) {
|
|
|
43579
43509
|
var anyType = createIntrinsicType(1 /* Any */, "any");
|
|
43580
43510
|
var autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
|
|
43581
43511
|
var wildcardType = createIntrinsicType(1 /* Any */, "any");
|
|
43512
|
+
var blockedStringType = createIntrinsicType(1 /* Any */, "any");
|
|
43582
43513
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
43583
43514
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
43584
43515
|
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
|
|
@@ -45265,7 +45196,7 @@ function createTypeChecker(host) {
|
|
|
45265
45196
|
}
|
|
45266
45197
|
}
|
|
45267
45198
|
function isSameScopeDescendentOf(initial, parent, stopAt) {
|
|
45268
|
-
return !!parent && !!findAncestor(initial, (n) => n === parent || (n === stopAt || isFunctionLike(n) && (!getImmediatelyInvokedFunctionExpression(n) ||
|
|
45199
|
+
return !!parent && !!findAncestor(initial, (n) => n === parent || (n === stopAt || isFunctionLike(n) && (!getImmediatelyInvokedFunctionExpression(n) || getFunctionFlags(n) & 3 /* AsyncGenerator */) ? "quit" : false));
|
|
45269
45200
|
}
|
|
45270
45201
|
function getAnyImportSyntax(node) {
|
|
45271
45202
|
switch (node.kind) {
|
|
@@ -48921,12 +48852,12 @@ function createTypeChecker(host) {
|
|
|
48921
48852
|
if (!specifier) {
|
|
48922
48853
|
specifier = getSpecifierForModuleSymbol(chain[0], context);
|
|
48923
48854
|
}
|
|
48924
|
-
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && getEmitModuleResolutionKind(compilerOptions) !== 1 /* Classic */ && specifier.
|
|
48855
|
+
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && getEmitModuleResolutionKind(compilerOptions) !== 1 /* Classic */ && specifier.includes("/node_modules/")) {
|
|
48925
48856
|
const oldSpecifier = specifier;
|
|
48926
48857
|
if (getEmitModuleResolutionKind(compilerOptions) === 3 /* Node16 */ || getEmitModuleResolutionKind(compilerOptions) === 99 /* NodeNext */) {
|
|
48927
48858
|
const swappedMode = (contextFile == null ? void 0 : contextFile.impliedNodeFormat) === 99 /* ESNext */ ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
48928
48859
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
48929
|
-
if (specifier.
|
|
48860
|
+
if (specifier.includes("/node_modules/")) {
|
|
48930
48861
|
specifier = oldSpecifier;
|
|
48931
48862
|
} else {
|
|
48932
48863
|
assertion = factory.createImportTypeAssertionContainer(factory.createAssertClause(factory.createNodeArray([
|
|
@@ -49489,6 +49420,7 @@ function createTypeChecker(host) {
|
|
|
49489
49420
|
}
|
|
49490
49421
|
}
|
|
49491
49422
|
function symbolTableToDeclarationStatements(symbolTable, context, bundled) {
|
|
49423
|
+
var _a;
|
|
49492
49424
|
const serializePropertySymbolForClass = makeSerializePropertySymbol(
|
|
49493
49425
|
factory.createPropertyDeclaration,
|
|
49494
49426
|
174 /* MethodDeclaration */,
|
|
@@ -49510,12 +49442,15 @@ function createTypeChecker(host) {
|
|
|
49510
49442
|
...oldcontext,
|
|
49511
49443
|
usedSymbolNames: new Set(oldcontext.usedSymbolNames),
|
|
49512
49444
|
remappedSymbolNames: /* @__PURE__ */ new Map(),
|
|
49445
|
+
remappedSymbolReferences: new Map((_a = oldcontext.remappedSymbolReferences) == null ? void 0 : _a.entries()),
|
|
49513
49446
|
tracker: void 0
|
|
49514
49447
|
};
|
|
49515
49448
|
const tracker = {
|
|
49516
49449
|
...oldcontext.tracker.inner,
|
|
49517
49450
|
trackSymbol: (sym, decl, meaning) => {
|
|
49518
|
-
var
|
|
49451
|
+
var _a2, _b;
|
|
49452
|
+
if ((_a2 = context.remappedSymbolNames) == null ? void 0 : _a2.has(getSymbolId(sym)))
|
|
49453
|
+
return false;
|
|
49519
49454
|
const accessibleResult = isSymbolAccessible(
|
|
49520
49455
|
sym,
|
|
49521
49456
|
decl,
|
|
@@ -49532,7 +49467,7 @@ function createTypeChecker(host) {
|
|
|
49532
49467
|
includePrivateSymbol(root);
|
|
49533
49468
|
}
|
|
49534
49469
|
}
|
|
49535
|
-
} else if ((
|
|
49470
|
+
} else if ((_b = oldcontext.tracker.inner) == null ? void 0 : _b.trackSymbol) {
|
|
49536
49471
|
return oldcontext.tracker.inner.trackSymbol(sym, decl, meaning);
|
|
49537
49472
|
}
|
|
49538
49473
|
return false;
|
|
@@ -49632,7 +49567,7 @@ function createTypeChecker(host) {
|
|
|
49632
49567
|
for (const group2 of groups) {
|
|
49633
49568
|
if (group2.length > 1) {
|
|
49634
49569
|
statements = [
|
|
49635
|
-
...filter(statements, (s) => group2.
|
|
49570
|
+
...filter(statements, (s) => !group2.includes(s)),
|
|
49636
49571
|
factory.createExportDeclaration(
|
|
49637
49572
|
/*modifiers*/
|
|
49638
49573
|
void 0,
|
|
@@ -49741,10 +49676,10 @@ function createTypeChecker(host) {
|
|
|
49741
49676
|
context = oldContext;
|
|
49742
49677
|
}
|
|
49743
49678
|
}
|
|
49744
|
-
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
|
|
49745
|
-
var
|
|
49746
|
-
const symbolName2 = unescapeLeadingUnderscores(
|
|
49747
|
-
const isDefault =
|
|
49679
|
+
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias, escapedSymbolName = symbol.escapedName) {
|
|
49680
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
49681
|
+
const symbolName2 = unescapeLeadingUnderscores(escapedSymbolName);
|
|
49682
|
+
const isDefault = escapedSymbolName === "default" /* Default */;
|
|
49748
49683
|
if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && isStringANonContextualKeyword(symbolName2) && !isDefault) {
|
|
49749
49684
|
context.encounteredError = true;
|
|
49750
49685
|
return;
|
|
@@ -49755,7 +49690,7 @@ function createTypeChecker(host) {
|
|
|
49755
49690
|
isPrivate = true;
|
|
49756
49691
|
}
|
|
49757
49692
|
const modifierFlags = (!isPrivate ? 1 /* Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* Default */ : 0);
|
|
49758
|
-
const isConstMergedWithNS = symbol.flags & 1536 /* Module */ && symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) &&
|
|
49693
|
+
const isConstMergedWithNS = symbol.flags & 1536 /* Module */ && symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) && escapedSymbolName !== "export=" /* ExportEquals */;
|
|
49759
49694
|
const isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
|
|
49760
49695
|
if (symbol.flags & (16 /* Function */ | 8192 /* Method */) || isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
49761
49696
|
serializeAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol, getInternalSymbolName(symbol, symbolName2), modifierFlags);
|
|
@@ -49763,7 +49698,7 @@ function createTypeChecker(host) {
|
|
|
49763
49698
|
if (symbol.flags & 524288 /* TypeAlias */) {
|
|
49764
49699
|
serializeTypeAlias(symbol, symbolName2, modifierFlags);
|
|
49765
49700
|
}
|
|
49766
|
-
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */ | 98304 /* Accessor */) &&
|
|
49701
|
+
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */ | 98304 /* Accessor */) && escapedSymbolName !== "export=" /* ExportEquals */ && !(symbol.flags & 4194304 /* Prototype */) && !(symbol.flags & 32 /* Class */) && !(symbol.flags & 8192 /* Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
49767
49702
|
if (propertyAsAlias) {
|
|
49768
49703
|
const createdExport = serializeMaybeAliasAssignment(symbol);
|
|
49769
49704
|
if (createdExport) {
|
|
@@ -49773,17 +49708,24 @@ function createTypeChecker(host) {
|
|
|
49773
49708
|
} else {
|
|
49774
49709
|
const type = getTypeOfSymbol(symbol);
|
|
49775
49710
|
const localName = getInternalSymbolName(symbol, symbolName2);
|
|
49776
|
-
if (
|
|
49711
|
+
if (type.symbol && type.symbol !== symbol && type.symbol.flags & 16 /* Function */ && some(type.symbol.declarations, isFunctionExpressionOrArrowFunction) && (((_a2 = type.symbol.members) == null ? void 0 : _a2.size) || ((_b = type.symbol.exports) == null ? void 0 : _b.size))) {
|
|
49712
|
+
if (!context.remappedSymbolReferences) {
|
|
49713
|
+
context.remappedSymbolReferences = /* @__PURE__ */ new Map();
|
|
49714
|
+
}
|
|
49715
|
+
context.remappedSymbolReferences.set(getSymbolId(type.symbol), symbol);
|
|
49716
|
+
serializeSymbolWorker(type.symbol, isPrivate, propertyAsAlias, escapedSymbolName);
|
|
49717
|
+
context.remappedSymbolReferences.delete(getSymbolId(type.symbol));
|
|
49718
|
+
} else if (!(symbol.flags & 16 /* Function */) && isTypeRepresentableAsFunctionNamespaceMerge(type, symbol)) {
|
|
49777
49719
|
serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags);
|
|
49778
49720
|
} else {
|
|
49779
|
-
const flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? ((
|
|
49721
|
+
const flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? ((_c = symbol.parent) == null ? void 0 : _c.valueDeclaration) && isSourceFile((_d = symbol.parent) == null ? void 0 : _d.valueDeclaration) ? 2 /* Const */ : void 0 : isConstantVariable(symbol) ? 2 /* Const */ : 1 /* Let */;
|
|
49780
49722
|
const name = needsPostExportDefault || !(symbol.flags & 4 /* Property */) ? localName : getUnusedName(localName, symbol);
|
|
49781
49723
|
let textRange = symbol.declarations && find(symbol.declarations, (d) => isVariableDeclaration(d));
|
|
49782
49724
|
if (textRange && isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) {
|
|
49783
49725
|
textRange = textRange.parent.parent;
|
|
49784
49726
|
}
|
|
49785
|
-
const propertyAccessRequire = (
|
|
49786
|
-
if (propertyAccessRequire && isBinaryExpression(propertyAccessRequire.parent) && isIdentifier(propertyAccessRequire.parent.right) && ((
|
|
49727
|
+
const propertyAccessRequire = (_e = symbol.declarations) == null ? void 0 : _e.find(isPropertyAccessExpression);
|
|
49728
|
+
if (propertyAccessRequire && isBinaryExpression(propertyAccessRequire.parent) && isIdentifier(propertyAccessRequire.parent.right) && ((_f = type.symbol) == null ? void 0 : _f.valueDeclaration) && isSourceFile(type.symbol.valueDeclaration)) {
|
|
49787
49729
|
const alias = localName === propertyAccessRequire.parent.right.escapedText ? void 0 : propertyAccessRequire.parent.right;
|
|
49788
49730
|
addResult(
|
|
49789
49731
|
factory.createExportDeclaration(
|
|
@@ -49938,11 +49880,11 @@ function createTypeChecker(host) {
|
|
|
49938
49880
|
results.push(node);
|
|
49939
49881
|
}
|
|
49940
49882
|
function serializeTypeAlias(symbol, symbolName2, modifierFlags) {
|
|
49941
|
-
var
|
|
49883
|
+
var _a2;
|
|
49942
49884
|
const aliasType = getDeclaredTypeOfTypeAlias(symbol);
|
|
49943
49885
|
const typeParams = getSymbolLinks(symbol).typeParameters;
|
|
49944
49886
|
const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
|
|
49945
|
-
const jsdocAliasDecl = (
|
|
49887
|
+
const jsdocAliasDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isJSDocTypeAlias);
|
|
49946
49888
|
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
|
|
49947
49889
|
const oldFlags = context.flags;
|
|
49948
49890
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
@@ -50013,12 +49955,12 @@ function createTypeChecker(host) {
|
|
|
50013
49955
|
/*isTypeOnly*/
|
|
50014
49956
|
false,
|
|
50015
49957
|
factory.createNamedExports(mapDefined(filter(mergedMembers, (n) => n.escapedName !== "export=" /* ExportEquals */), (s) => {
|
|
50016
|
-
var
|
|
49958
|
+
var _a2, _b;
|
|
50017
49959
|
const name = unescapeLeadingUnderscores(s.escapedName);
|
|
50018
49960
|
const localName2 = getInternalSymbolName(s, name);
|
|
50019
49961
|
const aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
|
50020
49962
|
if (containingFile && (aliasDecl ? containingFile !== getSourceFileOfNode(aliasDecl) : !some(s.declarations, (d) => getSourceFileOfNode(d) === containingFile))) {
|
|
50021
|
-
(_b = (
|
|
49963
|
+
(_b = (_a2 = context.tracker) == null ? void 0 : _a2.reportNonlocalAugmentation) == null ? void 0 : _b.call(_a2, containingFile, symbol, s);
|
|
50022
49964
|
return void 0;
|
|
50023
49965
|
}
|
|
50024
49966
|
const target = aliasDecl && getTargetOfAliasDeclaration(
|
|
@@ -50184,8 +50126,8 @@ function createTypeChecker(host) {
|
|
|
50184
50126
|
return void 0;
|
|
50185
50127
|
}
|
|
50186
50128
|
function serializeAsClass(symbol, localName, modifierFlags) {
|
|
50187
|
-
var
|
|
50188
|
-
const originalDecl = (
|
|
50129
|
+
var _a2, _b;
|
|
50130
|
+
const originalDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isClassLike);
|
|
50189
50131
|
const oldEnclosing = context.enclosingDeclaration;
|
|
50190
50132
|
context.enclosingDeclaration = originalDecl || oldEnclosing;
|
|
50191
50133
|
const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
|
@@ -50281,7 +50223,7 @@ function createTypeChecker(host) {
|
|
|
50281
50223
|
});
|
|
50282
50224
|
}
|
|
50283
50225
|
function serializeAsAlias(symbol, localName, modifierFlags) {
|
|
50284
|
-
var
|
|
50226
|
+
var _a2, _b, _c, _d, _e;
|
|
50285
50227
|
const node = getDeclarationOfAliasSymbol(symbol);
|
|
50286
50228
|
if (!node)
|
|
50287
50229
|
return Debug.fail();
|
|
@@ -50301,7 +50243,7 @@ function createTypeChecker(host) {
|
|
|
50301
50243
|
includePrivateSymbol(target);
|
|
50302
50244
|
switch (node.kind) {
|
|
50303
50245
|
case 208 /* BindingElement */:
|
|
50304
|
-
if (((_b = (
|
|
50246
|
+
if (((_b = (_a2 = node.parent) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) {
|
|
50305
50247
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50306
50248
|
const { propertyName } = node;
|
|
50307
50249
|
addResult(
|
|
@@ -50520,7 +50462,7 @@ function createTypeChecker(host) {
|
|
|
50520
50462
|
);
|
|
50521
50463
|
}
|
|
50522
50464
|
function serializeMaybeAliasAssignment(symbol) {
|
|
50523
|
-
var
|
|
50465
|
+
var _a2;
|
|
50524
50466
|
if (symbol.flags & 4194304 /* Prototype */) {
|
|
50525
50467
|
return false;
|
|
50526
50468
|
}
|
|
@@ -50603,7 +50545,7 @@ function createTypeChecker(host) {
|
|
|
50603
50545
|
void 0,
|
|
50604
50546
|
serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled)
|
|
50605
50547
|
)
|
|
50606
|
-
], ((
|
|
50548
|
+
], ((_a2 = context.enclosingDeclaration) == null ? void 0 : _a2.kind) === 267 /* ModuleDeclaration */ ? 1 /* Let */ : 2 /* Const */)
|
|
50607
50549
|
);
|
|
50608
50550
|
addResult(
|
|
50609
50551
|
statement,
|
|
@@ -50633,7 +50575,7 @@ function createTypeChecker(host) {
|
|
|
50633
50575
|
}
|
|
50634
50576
|
function makeSerializePropertySymbol(createProperty2, methodKind, useAccessors) {
|
|
50635
50577
|
return function serializePropertySymbol(p, isStatic2, baseType) {
|
|
50636
|
-
var
|
|
50578
|
+
var _a2, _b, _c, _d, _e;
|
|
50637
50579
|
const modifierFlags = getDeclarationModifierFlagsFromSymbol(p);
|
|
50638
50580
|
const isPrivate = !!(modifierFlags & 8 /* Private */);
|
|
50639
50581
|
if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
|
|
@@ -50644,7 +50586,7 @@ function createTypeChecker(host) {
|
|
|
50644
50586
|
}
|
|
50645
50587
|
const flag = modifierFlags & ~512 /* Async */ | (isStatic2 ? 32 /* Static */ : 0);
|
|
50646
50588
|
const name = getPropertyNameNodeForSymbol(p, context);
|
|
50647
|
-
const firstPropertyLikeDecl = (
|
|
50589
|
+
const firstPropertyLikeDecl = (_a2 = p.declarations) == null ? void 0 : _a2.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression));
|
|
50648
50590
|
if (p.flags & 98304 /* Accessor */ && useAccessors) {
|
|
50649
50591
|
const result = [];
|
|
50650
50592
|
if (p.flags & 65536 /* SetAccessor */) {
|
|
@@ -50890,7 +50832,7 @@ function createTypeChecker(host) {
|
|
|
50890
50832
|
}
|
|
50891
50833
|
}
|
|
50892
50834
|
function getUnusedName(input, symbol) {
|
|
50893
|
-
var
|
|
50835
|
+
var _a2, _b;
|
|
50894
50836
|
const id = symbol ? getSymbolId(symbol) : void 0;
|
|
50895
50837
|
if (id) {
|
|
50896
50838
|
if (context.remappedSymbolNames.has(id)) {
|
|
@@ -50902,7 +50844,7 @@ function createTypeChecker(host) {
|
|
|
50902
50844
|
}
|
|
50903
50845
|
let i = 0;
|
|
50904
50846
|
const original = input;
|
|
50905
|
-
while ((
|
|
50847
|
+
while ((_a2 = context.usedSymbolNames) == null ? void 0 : _a2.has(input)) {
|
|
50906
50848
|
i++;
|
|
50907
50849
|
input = `${original}_${i}`;
|
|
50908
50850
|
}
|
|
@@ -51030,6 +50972,10 @@ function createTypeChecker(host) {
|
|
|
51030
50972
|
}
|
|
51031
50973
|
}
|
|
51032
50974
|
function getNameOfSymbolAsWritten(symbol, context) {
|
|
50975
|
+
var _a;
|
|
50976
|
+
if ((_a = context == null ? void 0 : context.remappedSymbolReferences) == null ? void 0 : _a.has(getSymbolId(symbol))) {
|
|
50977
|
+
symbol = context.remappedSymbolReferences.get(getSymbolId(symbol));
|
|
50978
|
+
}
|
|
51033
50979
|
if (context && symbol.escapedName === "default" /* Default */ && !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */) && // If it's not the first part of an entity name, it must print as `default`
|
|
51034
50980
|
(!(context.flags & 16777216 /* InInitialEntityName */) || // if the symbol is synthesized, it will only be referenced externally it must print as `default`
|
|
51035
50981
|
!symbol.declarations || // if not in the same binding context (source file, module declaration), it must print as `default`
|
|
@@ -53082,7 +53028,7 @@ function createTypeChecker(host) {
|
|
|
53082
53028
|
if (!lateSymbol)
|
|
53083
53029
|
lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
|
|
53084
53030
|
const earlySymbol = earlySymbols && earlySymbols.get(memberName);
|
|
53085
|
-
if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) {
|
|
53031
|
+
if (!(parent.flags & 32 /* Class */) && (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol)) {
|
|
53086
53032
|
const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
|
|
53087
53033
|
const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
|
|
53088
53034
|
forEach(declarations, (declaration) => error(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
|
|
@@ -53193,7 +53139,13 @@ function createTypeChecker(host) {
|
|
|
53193
53139
|
const baseTypes = getBaseTypes(source);
|
|
53194
53140
|
if (baseTypes.length) {
|
|
53195
53141
|
if (source.symbol && members === getMembersOfSymbol(source.symbol)) {
|
|
53196
|
-
|
|
53142
|
+
const symbolTable = createSymbolTable();
|
|
53143
|
+
for (const symbol of members.values()) {
|
|
53144
|
+
if (!(symbol.flags & 262144 /* TypeParameter */)) {
|
|
53145
|
+
symbolTable.set(symbol.escapedName, symbol);
|
|
53146
|
+
}
|
|
53147
|
+
}
|
|
53148
|
+
members = symbolTable;
|
|
53197
53149
|
}
|
|
53198
53150
|
setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
|
|
53199
53151
|
const thisArgument = lastOrUndefined(typeArguments);
|
|
@@ -61225,9 +61177,6 @@ function createTypeChecker(host) {
|
|
|
61225
61177
|
}
|
|
61226
61178
|
instantiateType(source2, reportUnreliableMapper);
|
|
61227
61179
|
}
|
|
61228
|
-
if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(target2) && isTypeAssignableTo(source2, stringType) && isTypeAssignableTo(target2.types[0], stringType)) {
|
|
61229
|
-
return isRelatedTo(source2, target2.types[0], 3 /* Both */, reportErrors2);
|
|
61230
|
-
}
|
|
61231
61180
|
if (isTypeMatchedByTemplateLiteralType(source2, target2)) {
|
|
61232
61181
|
return -1 /* True */;
|
|
61233
61182
|
}
|
|
@@ -61278,9 +61227,6 @@ function createTypeChecker(host) {
|
|
|
61278
61227
|
}
|
|
61279
61228
|
} else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
|
|
61280
61229
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
61281
|
-
if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source2) && isTypeAssignableTo(source2.types[0], stringType) && isTypeAssignableTo(target2, stringType)) {
|
|
61282
|
-
return isRelatedTo(source2.types[0], target2, 3 /* Both */, reportErrors2);
|
|
61283
|
-
}
|
|
61284
61230
|
const constraint = getBaseConstraintOfType(source2);
|
|
61285
61231
|
if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2))) {
|
|
61286
61232
|
return result2;
|
|
@@ -62598,6 +62544,9 @@ function createTypeChecker(host) {
|
|
|
62598
62544
|
function isArrayLikeType(type) {
|
|
62599
62545
|
return isArrayType(type) || !(type.flags & 98304 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType);
|
|
62600
62546
|
}
|
|
62547
|
+
function isMutableArrayLikeType(type) {
|
|
62548
|
+
return isMutableArrayOrTuple(type) || !(type.flags & (1 /* Any */ | 98304 /* Nullable */)) && isTypeAssignableTo(type, anyArrayType);
|
|
62549
|
+
}
|
|
62601
62550
|
function getSingleBaseForNonAugmentingSubtype(type) {
|
|
62602
62551
|
if (!(getObjectFlags(type) & 4 /* Reference */) || !(getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
|
|
62603
62552
|
return void 0;
|
|
@@ -63015,7 +62964,7 @@ function createTypeChecker(host) {
|
|
|
63015
62964
|
const param = declaration;
|
|
63016
62965
|
if (isIdentifier(param.name)) {
|
|
63017
62966
|
const originalKeywordKind = identifierToKeywordKind(param.name);
|
|
63018
|
-
if ((isCallSignatureDeclaration(param.parent) || isMethodSignature(param.parent) || isFunctionTypeNode(param.parent)) && param.parent.parameters.
|
|
62967
|
+
if ((isCallSignatureDeclaration(param.parent) || isMethodSignature(param.parent) || isFunctionTypeNode(param.parent)) && param.parent.parameters.includes(param) && (resolveName(
|
|
63019
62968
|
param,
|
|
63020
62969
|
param.name.escapedText,
|
|
63021
62970
|
788968 /* Type */,
|
|
@@ -63101,7 +63050,12 @@ function createTypeChecker(host) {
|
|
|
63101
63050
|
callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i));
|
|
63102
63051
|
}
|
|
63103
63052
|
if (targetRestType) {
|
|
63104
|
-
callback(getRestTypeAtPosition(
|
|
63053
|
+
callback(getRestTypeAtPosition(
|
|
63054
|
+
source,
|
|
63055
|
+
paramCount,
|
|
63056
|
+
/*readonly*/
|
|
63057
|
+
isConstTypeVariable(targetRestType) && !someType(targetRestType, isMutableArrayLikeType)
|
|
63058
|
+
), targetRestType);
|
|
63105
63059
|
}
|
|
63106
63060
|
}
|
|
63107
63061
|
function applyToReturnTypes(source, target, callback) {
|
|
@@ -63405,13 +63359,6 @@ function createTypeChecker(host) {
|
|
|
63405
63359
|
}
|
|
63406
63360
|
return false;
|
|
63407
63361
|
}
|
|
63408
|
-
function isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(type) {
|
|
63409
|
-
if (!(type.flags & 134217728 /* TemplateLiteral */)) {
|
|
63410
|
-
return false;
|
|
63411
|
-
}
|
|
63412
|
-
const texts = type.texts;
|
|
63413
|
-
return texts.length === 2 && texts[0] === "" && texts[1] === "";
|
|
63414
|
-
}
|
|
63415
63362
|
function isValidTypeForTemplateLiteralPlaceholder(source, target) {
|
|
63416
63363
|
if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
|
|
63417
63364
|
return true;
|
|
@@ -63431,8 +63378,9 @@ function createTypeChecker(host) {
|
|
|
63431
63378
|
false
|
|
63432
63379
|
) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
|
|
63433
63380
|
}
|
|
63434
|
-
if (
|
|
63435
|
-
|
|
63381
|
+
if (source.flags & 134217728 /* TemplateLiteral */) {
|
|
63382
|
+
const texts = source.texts;
|
|
63383
|
+
return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target);
|
|
63436
63384
|
}
|
|
63437
63385
|
return isTypeAssignableTo(source, target);
|
|
63438
63386
|
}
|
|
@@ -64148,7 +64096,7 @@ function createTypeChecker(host) {
|
|
|
64148
64096
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
64149
64097
|
if (constraint) {
|
|
64150
64098
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
64151
|
-
if (!inferredType || inferredType ===
|
|
64099
|
+
if (!inferredType || inferredType === blockedStringType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
64152
64100
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
64153
64101
|
}
|
|
64154
64102
|
}
|
|
@@ -68093,7 +68041,7 @@ function createTypeChecker(host) {
|
|
|
68093
68041
|
elementTypes,
|
|
68094
68042
|
elementFlags,
|
|
68095
68043
|
/*readonly*/
|
|
68096
|
-
inConstContext
|
|
68044
|
+
inConstContext && !(contextualType && someType(contextualType, isMutableArrayLikeType))
|
|
68097
68045
|
));
|
|
68098
68046
|
}
|
|
68099
68047
|
return createArrayLiteralType(createArrayType(
|
|
@@ -68409,7 +68357,7 @@ function createTypeChecker(host) {
|
|
|
68409
68357
|
return getJsxElementTypeAt(node) || anyType;
|
|
68410
68358
|
}
|
|
68411
68359
|
function isHyphenatedJsxName(name) {
|
|
68412
|
-
return
|
|
68360
|
+
return name.includes("-");
|
|
68413
68361
|
}
|
|
68414
68362
|
function isJsxIntrinsicTagName(tagName) {
|
|
68415
68363
|
return isIdentifier(tagName) && isIntrinsicJsxName(tagName.escapedText) || isJsxNamespacedName(tagName);
|
|
@@ -69331,7 +69279,7 @@ function createTypeChecker(host) {
|
|
|
69331
69279
|
apparentType,
|
|
69332
69280
|
right.escapedText,
|
|
69333
69281
|
/*skipObjectFunctionPropertyAugment*/
|
|
69334
|
-
|
|
69282
|
+
isConstEnumObjectType(apparentType),
|
|
69335
69283
|
/*includeTypeOnlyMembers*/
|
|
69336
69284
|
node.kind === 166 /* QualifiedName */
|
|
69337
69285
|
);
|
|
@@ -70114,7 +70062,7 @@ function createTypeChecker(host) {
|
|
|
70114
70062
|
names.push(arg.tupleNameSource);
|
|
70115
70063
|
}
|
|
70116
70064
|
}
|
|
70117
|
-
return createTupleType(types, flags, inConstContext, length(names) === length(types) ? names : void 0);
|
|
70065
|
+
return createTupleType(types, flags, inConstContext && !someType(restType, isMutableArrayLikeType), length(names) === length(types) ? names : void 0);
|
|
70118
70066
|
}
|
|
70119
70067
|
function checkTypeArguments(signature, typeArgumentNodes, reportErrors2, headMessage) {
|
|
70120
70068
|
const isJavascript = isInJSFile(signature.declaration);
|
|
@@ -72195,7 +72143,7 @@ function createTypeChecker(host) {
|
|
|
72195
72143
|
}
|
|
72196
72144
|
return void 0;
|
|
72197
72145
|
}
|
|
72198
|
-
function getRestTypeAtPosition(source, pos) {
|
|
72146
|
+
function getRestTypeAtPosition(source, pos, readonly) {
|
|
72199
72147
|
const parameterCount = getParameterCount(source);
|
|
72200
72148
|
const minArgumentCount = getMinArgumentCount(source);
|
|
72201
72149
|
const restType = getEffectiveRestType(source);
|
|
@@ -72218,13 +72166,7 @@ function createTypeChecker(host) {
|
|
|
72218
72166
|
names.push(name);
|
|
72219
72167
|
}
|
|
72220
72168
|
}
|
|
72221
|
-
return createTupleType(
|
|
72222
|
-
types,
|
|
72223
|
-
flags,
|
|
72224
|
-
/*readonly*/
|
|
72225
|
-
false,
|
|
72226
|
-
length(names) === length(types) ? names : void 0
|
|
72227
|
-
);
|
|
72169
|
+
return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
|
|
72228
72170
|
}
|
|
72229
72171
|
function getParameterCount(signature) {
|
|
72230
72172
|
const length2 = signature.parameters.length;
|
|
@@ -72304,18 +72246,16 @@ function createTypeChecker(host) {
|
|
|
72304
72246
|
const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
72305
72247
|
for (let i = 0; i < len; i++) {
|
|
72306
72248
|
const declaration = signature.parameters[i].valueDeclaration;
|
|
72307
|
-
|
|
72308
|
-
|
|
72309
|
-
|
|
72310
|
-
|
|
72311
|
-
|
|
72312
|
-
|
|
72313
|
-
|
|
72314
|
-
|
|
72315
|
-
|
|
72316
|
-
|
|
72317
|
-
inferTypes(inferenceContext.inferences, source, target);
|
|
72318
|
-
}
|
|
72249
|
+
const typeNode = getEffectiveTypeAnnotationNode(declaration);
|
|
72250
|
+
if (typeNode) {
|
|
72251
|
+
const source = addOptionality(
|
|
72252
|
+
getTypeFromTypeNode(typeNode),
|
|
72253
|
+
/*isProperty*/
|
|
72254
|
+
false,
|
|
72255
|
+
isOptionalDeclaration(declaration)
|
|
72256
|
+
);
|
|
72257
|
+
const target = getTypeAtPosition(context, i);
|
|
72258
|
+
inferTypes(inferenceContext.inferences, source, target);
|
|
72319
72259
|
}
|
|
72320
72260
|
}
|
|
72321
72261
|
}
|
|
@@ -74747,7 +74687,7 @@ function createTypeChecker(host) {
|
|
|
74747
74687
|
return nullWideningType;
|
|
74748
74688
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
74749
74689
|
case 11 /* StringLiteral */:
|
|
74750
|
-
return hasSkipDirectInferenceFlag(node) ?
|
|
74690
|
+
return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
|
|
74751
74691
|
case 9 /* NumericLiteral */: {
|
|
74752
74692
|
checkGrammarNumericLiteral(node);
|
|
74753
74693
|
const value = +node.text;
|
|
@@ -75096,7 +75036,7 @@ function createTypeChecker(host) {
|
|
|
75096
75036
|
const isPrivate = isPrivateIdentifier(name);
|
|
75097
75037
|
const privateStaticFlags = isPrivate && isStaticMember ? 16 /* PrivateStatic */ : 0;
|
|
75098
75038
|
const names = isPrivate ? privateIdentifiers : isStaticMember ? staticNames : instanceNames;
|
|
75099
|
-
const memberName = name &&
|
|
75039
|
+
const memberName = name && getEffectivePropertyNameForPropertyNameNode(name);
|
|
75100
75040
|
if (memberName) {
|
|
75101
75041
|
switch (member.kind) {
|
|
75102
75042
|
case 177 /* GetAccessor */:
|
|
@@ -75143,7 +75083,7 @@ function createTypeChecker(host) {
|
|
|
75143
75083
|
const memberNameNode = member.name;
|
|
75144
75084
|
const isStaticMember = isStatic(member);
|
|
75145
75085
|
if (isStaticMember && memberNameNode) {
|
|
75146
|
-
const memberName =
|
|
75086
|
+
const memberName = getEffectivePropertyNameForPropertyNameNode(memberNameNode);
|
|
75147
75087
|
switch (memberName) {
|
|
75148
75088
|
case "name":
|
|
75149
75089
|
case "length":
|
|
@@ -83572,7 +83512,7 @@ function createTypeChecker(host) {
|
|
|
83572
83512
|
return false;
|
|
83573
83513
|
}
|
|
83574
83514
|
function checkGrammarNumericLiteral(node) {
|
|
83575
|
-
const isFractional = getTextOfNode(node).
|
|
83515
|
+
const isFractional = getTextOfNode(node).includes(".");
|
|
83576
83516
|
const isScientific = node.numericLiteralFlags & 16 /* Scientific */;
|
|
83577
83517
|
if (isFractional || isScientific) {
|
|
83578
83518
|
return;
|
|
@@ -106547,7 +106487,7 @@ function getDeclarationDiagnostics(host, resolver, file) {
|
|
|
106547
106487
|
}
|
|
106548
106488
|
function hasInternalAnnotation(range, currentSourceFile) {
|
|
106549
106489
|
const comment = currentSourceFile.text.substring(range.pos, range.end);
|
|
106550
|
-
return
|
|
106490
|
+
return comment.includes("@internal");
|
|
106551
106491
|
}
|
|
106552
106492
|
function isInternalDeclaration(node, currentSourceFile) {
|
|
106553
106493
|
const parseTreeNode = getParseTreeNode(node);
|
|
@@ -107001,6 +106941,9 @@ function transformDeclarations(context) {
|
|
|
107001
106941
|
if (elem.kind === 232 /* OmittedExpression */) {
|
|
107002
106942
|
return elem;
|
|
107003
106943
|
}
|
|
106944
|
+
if (elem.propertyName && isComputedPropertyName(elem.propertyName) && isEntityNameExpression(elem.propertyName.expression)) {
|
|
106945
|
+
checkEntityNameVisibility(elem.propertyName.expression, enclosingDeclaration);
|
|
106946
|
+
}
|
|
107004
106947
|
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
|
|
107005
106948
|
return factory2.updateBindingElement(
|
|
107006
106949
|
elem,
|
|
@@ -111026,7 +110969,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111026
110969
|
/*jsxAttributeEscape*/
|
|
111027
110970
|
false
|
|
111028
110971
|
);
|
|
111029
|
-
return !(expression.numericLiteralFlags & 448 /* WithSpecifier */) && !
|
|
110972
|
+
return !(expression.numericLiteralFlags & 448 /* WithSpecifier */) && !text.includes(tokenToString(25 /* DotToken */)) && !text.includes(String.fromCharCode(69 /* E */)) && !text.includes(String.fromCharCode(101 /* e */));
|
|
111030
110973
|
} else if (isAccessExpression(expression)) {
|
|
111031
110974
|
const constantValue = getConstantValue(expression);
|
|
111032
110975
|
return typeof constantValue === "number" && isFinite(constantValue) && constantValue >= 0 && Math.floor(constantValue) === constantValue;
|
|
@@ -114914,17 +114857,17 @@ function formatCodeSpan(file, start, length2, indent2, squiggleColor, host) {
|
|
|
114914
114857
|
for (let i = firstLine; i <= lastLine; i++) {
|
|
114915
114858
|
context += host.getNewLine();
|
|
114916
114859
|
if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
|
|
114917
|
-
context += indent2 + formatColorAndReset(
|
|
114860
|
+
context += indent2 + formatColorAndReset(ellipsis.padStart(gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine();
|
|
114918
114861
|
i = lastLine - 1;
|
|
114919
114862
|
}
|
|
114920
114863
|
const lineStart = getPositionOfLineAndCharacter(file, i, 0);
|
|
114921
114864
|
const lineEnd = i < lastLineInFile ? getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length;
|
|
114922
114865
|
let lineContent = file.text.slice(lineStart, lineEnd);
|
|
114923
|
-
lineContent =
|
|
114866
|
+
lineContent = lineContent.trimEnd();
|
|
114924
114867
|
lineContent = lineContent.replace(/\t/g, " ");
|
|
114925
|
-
context += indent2 + formatColorAndReset(
|
|
114868
|
+
context += indent2 + formatColorAndReset((i + 1 + "").padStart(gutterWidth), gutterStyleSequence) + gutterSeparator;
|
|
114926
114869
|
context += lineContent + host.getNewLine();
|
|
114927
|
-
context += indent2 + formatColorAndReset(
|
|
114870
|
+
context += indent2 + formatColorAndReset("".padStart(gutterWidth), gutterStyleSequence) + gutterSeparator;
|
|
114928
114871
|
context += squiggleColor;
|
|
114929
114872
|
if (i === firstLine) {
|
|
114930
114873
|
const lastCharForLine = i === lastLine ? lastLineChar : void 0;
|
|
@@ -115859,7 +115802,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115859
115802
|
const resultFromDts = getRedirectReferenceForResolutionFromSourceOfProject(file.path);
|
|
115860
115803
|
if (resultFromDts)
|
|
115861
115804
|
return resultFromDts;
|
|
115862
|
-
if (!host.realpath || !options.preserveSymlinks || !
|
|
115805
|
+
if (!host.realpath || !options.preserveSymlinks || !file.originalFileName.includes(nodeModulesPathPart))
|
|
115863
115806
|
return void 0;
|
|
115864
115807
|
const realDeclarationPath = toPath3(host.realpath(file.originalFileName));
|
|
115865
115808
|
return realDeclarationPath === file.path ? void 0 : getRedirectReferenceForResolutionFromSourceOfProject(realDeclarationPath);
|
|
@@ -117117,7 +117060,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117117
117060
|
const path = toPath3(fileName);
|
|
117118
117061
|
if (useSourceOfProjectReferenceRedirect) {
|
|
117119
117062
|
let source = getSourceOfProjectReferenceRedirect(path);
|
|
117120
|
-
if (!source && host.realpath && options.preserveSymlinks && isDeclarationFileName(fileName) &&
|
|
117063
|
+
if (!source && host.realpath && options.preserveSymlinks && isDeclarationFileName(fileName) && fileName.includes(nodeModulesPathPart)) {
|
|
117121
117064
|
const realPath2 = toPath3(host.realpath(fileName));
|
|
117122
117065
|
if (realPath2 !== path)
|
|
117123
117066
|
source = getSourceOfProjectReferenceRedirect(realPath2);
|
|
@@ -118477,7 +118420,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
|
118477
118420
|
var _a;
|
|
118478
118421
|
if (!host.getResolvedProjectReferences() || containsIgnoredPath(directory))
|
|
118479
118422
|
return;
|
|
118480
|
-
if (!originalRealpath || !
|
|
118423
|
+
if (!originalRealpath || !directory.includes(nodeModulesPathPart))
|
|
118481
118424
|
return;
|
|
118482
118425
|
const symlinkCache = host.getSymlinkCache();
|
|
118483
118426
|
const directoryPath = ensureTrailingDirectorySeparator(host.toPath(directory));
|
|
@@ -118505,7 +118448,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
|
118505
118448
|
if (!symlinkedDirectories)
|
|
118506
118449
|
return false;
|
|
118507
118450
|
const fileOrDirectoryPath = host.toPath(fileOrDirectory);
|
|
118508
|
-
if (!
|
|
118451
|
+
if (!fileOrDirectoryPath.includes(nodeModulesPathPart))
|
|
118509
118452
|
return false;
|
|
118510
118453
|
if (isFile && ((_a = symlinkCache.getSymlinkedFiles()) == null ? void 0 : _a.has(fileOrDirectoryPath)))
|
|
118511
118454
|
return true;
|
|
@@ -120363,7 +120306,7 @@ function removeIgnoredPath(path) {
|
|
|
120363
120306
|
if (endsWith(path, "/node_modules/.staging")) {
|
|
120364
120307
|
return removeSuffix(path, "/.staging");
|
|
120365
120308
|
}
|
|
120366
|
-
return some(ignoredPaths, (searchPath) =>
|
|
120309
|
+
return some(ignoredPaths, (searchPath) => path.includes(searchPath)) ? void 0 : path;
|
|
120367
120310
|
}
|
|
120368
120311
|
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
120369
120312
|
if (length2 <= 1)
|
|
@@ -124779,7 +124722,7 @@ function createColors(sys2) {
|
|
|
124779
124722
|
function bold(str) {
|
|
124780
124723
|
return `\x1B[1m${str}\x1B[22m`;
|
|
124781
124724
|
}
|
|
124782
|
-
const isWindows = sys2.getEnvironmentVariable("OS") &&
|
|
124725
|
+
const isWindows = sys2.getEnvironmentVariable("OS") && sys2.getEnvironmentVariable("OS").toLowerCase().includes("windows");
|
|
124783
124726
|
const isWindowsTerminal = sys2.getEnvironmentVariable("WT_SESSION");
|
|
124784
124727
|
const isVSCode = sys2.getEnvironmentVariable("TERM_PROGRAM") && sys2.getEnvironmentVariable("TERM_PROGRAM") === "vscode";
|
|
124785
124728
|
function blue(str) {
|
|
@@ -124903,11 +124846,11 @@ function generateOptionOutput(sys2, option, rightAlignOfLeft, leftAlignOfRight)
|
|
|
124903
124846
|
while (remainRight.length > 0) {
|
|
124904
124847
|
let curLeft = "";
|
|
124905
124848
|
if (isFirstLine) {
|
|
124906
|
-
curLeft =
|
|
124907
|
-
curLeft =
|
|
124849
|
+
curLeft = left.padStart(rightAlignOfLeft2);
|
|
124850
|
+
curLeft = curLeft.padEnd(leftAlignOfRight2);
|
|
124908
124851
|
curLeft = colorLeft ? colors.blue(curLeft) : curLeft;
|
|
124909
124852
|
} else {
|
|
124910
|
-
curLeft =
|
|
124853
|
+
curLeft = "".padStart(leftAlignOfRight2);
|
|
124911
124854
|
}
|
|
124912
124855
|
const curRight = remainRight.substr(0, rightCharacterNumber);
|
|
124913
124856
|
remainRight = remainRight.slice(rightCharacterNumber);
|
|
@@ -125113,13 +125056,13 @@ function getHeader(sys2, message) {
|
|
|
125113
125056
|
const header = [];
|
|
125114
125057
|
const terminalWidth = ((_a = sys2.getWidthOfTerminal) == null ? void 0 : _a.call(sys2)) ?? 0;
|
|
125115
125058
|
const tsIconLength = 5;
|
|
125116
|
-
const tsIconFirstLine = colors.blueBackground(
|
|
125117
|
-
const tsIconSecondLine = colors.blueBackground(colors.brightWhite(
|
|
125059
|
+
const tsIconFirstLine = colors.blueBackground("".padStart(tsIconLength));
|
|
125060
|
+
const tsIconSecondLine = colors.blueBackground(colors.brightWhite("TS ".padStart(tsIconLength)));
|
|
125118
125061
|
if (terminalWidth >= message.length + tsIconLength) {
|
|
125119
125062
|
const rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
|
|
125120
125063
|
const leftAlign = rightAlign - tsIconLength;
|
|
125121
|
-
header.push(
|
|
125122
|
-
header.push(
|
|
125064
|
+
header.push(message.padEnd(leftAlign) + tsIconFirstLine + sys2.newLine);
|
|
125065
|
+
header.push("".padStart(leftAlign) + tsIconSecondLine + sys2.newLine);
|
|
125123
125066
|
} else {
|
|
125124
125067
|
header.push(message + sys2.newLine);
|
|
125125
125068
|
header.push(sys2.newLine);
|
|
@@ -125796,7 +125739,7 @@ function reportAllStatistics(sys2, statistics) {
|
|
|
125796
125739
|
}
|
|
125797
125740
|
}
|
|
125798
125741
|
for (const s of statistics) {
|
|
125799
|
-
sys2.write(
|
|
125742
|
+
sys2.write(`${s.name}:`.padEnd(nameSize + 2) + statisticValue(s).toString().padStart(valueSize) + sys2.newLine);
|
|
125800
125743
|
}
|
|
125801
125744
|
}
|
|
125802
125745
|
function statisticValue(s) {
|