typescript 5.3.0-dev.20230827 → 5.3.0-dev.20230829
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 +99 -143
- package/lib/tsserver.js +95 -154
- package/lib/typescript.js +97 -151
- package/lib/typingsInstaller.js +19 -83
- 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-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.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;
|
|
@@ -1258,12 +1220,6 @@ function cartesianProductWorker(arrays, result, outer, index) {
|
|
|
1258
1220
|
}
|
|
1259
1221
|
}
|
|
1260
1222
|
}
|
|
1261
|
-
function padLeft(s, length2, padString = " ") {
|
|
1262
|
-
return length2 <= s.length ? s : padString.repeat(length2 - s.length) + s;
|
|
1263
|
-
}
|
|
1264
|
-
function padRight(s, length2, padString = " ") {
|
|
1265
|
-
return length2 <= s.length ? s : s + padString.repeat(length2 - s.length);
|
|
1266
|
-
}
|
|
1267
1223
|
function takeWhile(array, predicate) {
|
|
1268
1224
|
if (array) {
|
|
1269
1225
|
const len = array.length;
|
|
@@ -1284,18 +1240,6 @@ function skipWhile(array, predicate) {
|
|
|
1284
1240
|
return array.slice(index);
|
|
1285
1241
|
}
|
|
1286
1242
|
}
|
|
1287
|
-
var trimString = !!String.prototype.trim ? (s) => s.trim() : (s) => trimStringEnd(trimStringStart(s));
|
|
1288
|
-
var trimStringEnd = !!String.prototype.trimEnd ? (s) => s.trimEnd() : trimEndImpl;
|
|
1289
|
-
var trimStringStart = !!String.prototype.trimStart ? (s) => s.trimStart() : (s) => s.replace(/^\s+/g, "");
|
|
1290
|
-
function trimEndImpl(s) {
|
|
1291
|
-
let end = s.length - 1;
|
|
1292
|
-
while (end >= 0) {
|
|
1293
|
-
if (!isWhiteSpaceLike(s.charCodeAt(end)))
|
|
1294
|
-
break;
|
|
1295
|
-
end--;
|
|
1296
|
-
}
|
|
1297
|
-
return s.slice(0, end + 1);
|
|
1298
|
-
}
|
|
1299
1243
|
function isNodeLikeSystem() {
|
|
1300
1244
|
return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof module === "object";
|
|
1301
1245
|
}
|
|
@@ -2483,18 +2427,18 @@ var hyphenRegExp = /^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i;
|
|
|
2483
2427
|
var rangeRegExp = /^(~|\^|<|<=|>|>=|=)?\s*([a-z0-9-+.*]+)$/i;
|
|
2484
2428
|
function parseRange(text) {
|
|
2485
2429
|
const alternatives = [];
|
|
2486
|
-
for (let range of
|
|
2430
|
+
for (let range of text.trim().split(logicalOrRegExp)) {
|
|
2487
2431
|
if (!range)
|
|
2488
2432
|
continue;
|
|
2489
2433
|
const comparators = [];
|
|
2490
|
-
range =
|
|
2434
|
+
range = range.trim();
|
|
2491
2435
|
const match = hyphenRegExp.exec(range);
|
|
2492
2436
|
if (match) {
|
|
2493
2437
|
if (!parseHyphen(match[1], match[2], comparators))
|
|
2494
2438
|
return void 0;
|
|
2495
2439
|
} else {
|
|
2496
2440
|
for (const simple of range.split(whitespaceRegExp)) {
|
|
2497
|
-
const match2 = rangeRegExp.exec(
|
|
2441
|
+
const match2 = rangeRegExp.exec(simple.trim());
|
|
2498
2442
|
if (!match2 || !parseComparator(match2[1], match2[2], comparators))
|
|
2499
2443
|
return void 0;
|
|
2500
2444
|
}
|
|
@@ -8858,7 +8802,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8858
8802
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8859
8803
|
if (shouldEmitInvalidEscapeError) {
|
|
8860
8804
|
const code = parseInt(text.substring(start2 + 1, pos), 8);
|
|
8861
|
-
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"));
|
|
8862
8806
|
return String.fromCharCode(code);
|
|
8863
8807
|
}
|
|
8864
8808
|
return text.substring(start2, pos);
|
|
@@ -9661,7 +9605,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9661
9605
|
return token;
|
|
9662
9606
|
}
|
|
9663
9607
|
function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
|
|
9664
|
-
const type = getDirectiveFromComment(
|
|
9608
|
+
const type = getDirectiveFromComment(text2.trimStart(), commentDirectiveRegEx);
|
|
9665
9609
|
if (type === void 0) {
|
|
9666
9610
|
return commentDirectives2;
|
|
9667
9611
|
}
|
|
@@ -9995,20 +9939,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9995
9939
|
inJSDocType += inType ? 1 : -1;
|
|
9996
9940
|
}
|
|
9997
9941
|
}
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
return void 0;
|
|
10002
|
-
}
|
|
10003
|
-
const first2 = str.charCodeAt(i);
|
|
10004
|
-
if (first2 >= 55296 && first2 <= 56319 && size > i + 1) {
|
|
10005
|
-
const second = str.charCodeAt(i + 1);
|
|
10006
|
-
if (second >= 56320 && second <= 57343) {
|
|
10007
|
-
return (first2 - 55296) * 1024 + second - 56320 + 65536;
|
|
10008
|
-
}
|
|
10009
|
-
}
|
|
10010
|
-
return first2;
|
|
10011
|
-
};
|
|
9942
|
+
function codePointAt(s, i) {
|
|
9943
|
+
return s.codePointAt(i);
|
|
9944
|
+
}
|
|
10012
9945
|
function charSize(ch) {
|
|
10013
9946
|
if (ch >= 65536) {
|
|
10014
9947
|
return 2;
|
|
@@ -11747,7 +11680,7 @@ function getTextOfNodeFromSourceText(sourceText, node, includeTrivia = false) {
|
|
|
11747
11680
|
}
|
|
11748
11681
|
let text = sourceText.substring(includeTrivia ? node.pos : skipTrivia(sourceText, node.pos), node.end);
|
|
11749
11682
|
if (isJSDocTypeExpressionOrChild(node)) {
|
|
11750
|
-
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");
|
|
11751
11684
|
}
|
|
11752
11685
|
return text;
|
|
11753
11686
|
}
|
|
@@ -15326,7 +15259,7 @@ function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLin
|
|
|
15326
15259
|
}
|
|
15327
15260
|
function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) {
|
|
15328
15261
|
const end = Math.min(commentEnd, nextLineStart - 1);
|
|
15329
|
-
const currentLineText =
|
|
15262
|
+
const currentLineText = text.substring(pos, end).trim();
|
|
15330
15263
|
if (currentLineText) {
|
|
15331
15264
|
writer.writeComment(currentLineText);
|
|
15332
15265
|
if (end !== commentEnd) {
|
|
@@ -31747,7 +31680,7 @@ var Parser;
|
|
|
31747
31680
|
}
|
|
31748
31681
|
function parseModuleOrNamespaceDeclaration(pos, hasJSDoc, modifiers, flags) {
|
|
31749
31682
|
const namespaceFlag = flags & 32 /* Namespace */;
|
|
31750
|
-
const name = parseIdentifier();
|
|
31683
|
+
const name = flags & 8 /* NestedNamespace */ ? parseIdentifierName() : parseIdentifier();
|
|
31751
31684
|
const body = parseOptional(25 /* DotToken */) ? parseModuleOrNamespaceDeclaration(
|
|
31752
31685
|
getNodePos(),
|
|
31753
31686
|
/*hasJSDoc*/
|
|
@@ -32217,8 +32150,6 @@ var Parser;
|
|
|
32217
32150
|
PropertyLikeParse2[PropertyLikeParse2["CallbackParameter"] = 4] = "CallbackParameter";
|
|
32218
32151
|
})(PropertyLikeParse || (PropertyLikeParse = {}));
|
|
32219
32152
|
function parseJSDocCommentWorker(start = 0, length2) {
|
|
32220
|
-
const saveParsingContext = parsingContext;
|
|
32221
|
-
parsingContext |= 1 << 25 /* JSDocComment */;
|
|
32222
32153
|
const content = sourceText;
|
|
32223
32154
|
const end = length2 === void 0 ? content.length : start + length2;
|
|
32224
32155
|
length2 = end - start;
|
|
@@ -32235,6 +32166,8 @@ var Parser;
|
|
|
32235
32166
|
let commentsPos;
|
|
32236
32167
|
let comments = [];
|
|
32237
32168
|
const parts = [];
|
|
32169
|
+
const saveParsingContext = parsingContext;
|
|
32170
|
+
parsingContext |= 1 << 25 /* JSDocComment */;
|
|
32238
32171
|
const result = scanner.scanRange(start + 3, length2 - 5, doJSDocScan);
|
|
32239
32172
|
parsingContext = saveParsingContext;
|
|
32240
32173
|
return result;
|
|
@@ -32326,7 +32259,7 @@ var Parser;
|
|
|
32326
32259
|
nextTokenJSDoc();
|
|
32327
32260
|
}
|
|
32328
32261
|
}
|
|
32329
|
-
const trimmedComments =
|
|
32262
|
+
const trimmedComments = comments.join("").trimEnd();
|
|
32330
32263
|
if (parts.length && trimmedComments.length) {
|
|
32331
32264
|
parts.push(finishNode(factory2.createJSDocText(trimmedComments), linkEnd ?? start, commentsPos));
|
|
32332
32265
|
}
|
|
@@ -32342,7 +32275,7 @@ var Parser;
|
|
|
32342
32275
|
}
|
|
32343
32276
|
function removeTrailingWhitespace(comments2) {
|
|
32344
32277
|
while (comments2.length) {
|
|
32345
|
-
const trimmed =
|
|
32278
|
+
const trimmed = comments2[comments2.length - 1].trimEnd();
|
|
32346
32279
|
if (trimmed === "") {
|
|
32347
32280
|
comments2.pop();
|
|
32348
32281
|
} else if (trimmed.length < comments2[comments2.length - 1].length) {
|
|
@@ -32582,7 +32515,7 @@ var Parser;
|
|
|
32582
32515
|
}
|
|
32583
32516
|
}
|
|
32584
32517
|
removeLeadingNewlines(comments2);
|
|
32585
|
-
const trimmedComments =
|
|
32518
|
+
const trimmedComments = comments2.join("").trimEnd();
|
|
32586
32519
|
if (parts2.length) {
|
|
32587
32520
|
if (trimmedComments.length) {
|
|
32588
32521
|
parts2.push(finishNode(factory2.createJSDocText(trimmedComments), linkEnd2 ?? commentsPos2));
|
|
@@ -33666,7 +33599,7 @@ function getNamedPragmaArguments(pragma, text) {
|
|
|
33666
33599
|
return {};
|
|
33667
33600
|
if (!pragma.args)
|
|
33668
33601
|
return {};
|
|
33669
|
-
const args =
|
|
33602
|
+
const args = text.trim().split(/\s+/);
|
|
33670
33603
|
const argMap = {};
|
|
33671
33604
|
for (let i = 0; i < pragma.args.length; i++) {
|
|
33672
33605
|
const argument = pragma.args[i];
|
|
@@ -35188,10 +35121,10 @@ function createDiagnosticForInvalidCustomType(opt, createDiagnostic) {
|
|
|
35188
35121
|
return createDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, stringNames);
|
|
35189
35122
|
}
|
|
35190
35123
|
function parseCustomTypeOption(opt, value, errors) {
|
|
35191
|
-
return convertJsonOptionOfCustomType(opt,
|
|
35124
|
+
return convertJsonOptionOfCustomType(opt, (value ?? "").trim(), errors);
|
|
35192
35125
|
}
|
|
35193
35126
|
function parseListTypeOption(opt, value = "", errors) {
|
|
35194
|
-
value =
|
|
35127
|
+
value = value.trim();
|
|
35195
35128
|
if (startsWith(value, "-")) {
|
|
35196
35129
|
return void 0;
|
|
35197
35130
|
}
|
|
@@ -43576,6 +43509,7 @@ function createTypeChecker(host) {
|
|
|
43576
43509
|
var anyType = createIntrinsicType(1 /* Any */, "any");
|
|
43577
43510
|
var autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
|
|
43578
43511
|
var wildcardType = createIntrinsicType(1 /* Any */, "any");
|
|
43512
|
+
var blockedStringType = createIntrinsicType(1 /* Any */, "any");
|
|
43579
43513
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
43580
43514
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
43581
43515
|
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
|
|
@@ -45262,7 +45196,7 @@ function createTypeChecker(host) {
|
|
|
45262
45196
|
}
|
|
45263
45197
|
}
|
|
45264
45198
|
function isSameScopeDescendentOf(initial, parent, stopAt) {
|
|
45265
|
-
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));
|
|
45266
45200
|
}
|
|
45267
45201
|
function getAnyImportSyntax(node) {
|
|
45268
45202
|
switch (node.kind) {
|
|
@@ -49486,6 +49420,7 @@ function createTypeChecker(host) {
|
|
|
49486
49420
|
}
|
|
49487
49421
|
}
|
|
49488
49422
|
function symbolTableToDeclarationStatements(symbolTable, context, bundled) {
|
|
49423
|
+
var _a;
|
|
49489
49424
|
const serializePropertySymbolForClass = makeSerializePropertySymbol(
|
|
49490
49425
|
factory.createPropertyDeclaration,
|
|
49491
49426
|
174 /* MethodDeclaration */,
|
|
@@ -49507,12 +49442,15 @@ function createTypeChecker(host) {
|
|
|
49507
49442
|
...oldcontext,
|
|
49508
49443
|
usedSymbolNames: new Set(oldcontext.usedSymbolNames),
|
|
49509
49444
|
remappedSymbolNames: /* @__PURE__ */ new Map(),
|
|
49445
|
+
remappedSymbolReferences: new Map((_a = oldcontext.remappedSymbolReferences) == null ? void 0 : _a.entries()),
|
|
49510
49446
|
tracker: void 0
|
|
49511
49447
|
};
|
|
49512
49448
|
const tracker = {
|
|
49513
49449
|
...oldcontext.tracker.inner,
|
|
49514
49450
|
trackSymbol: (sym, decl, meaning) => {
|
|
49515
|
-
var
|
|
49451
|
+
var _a2, _b;
|
|
49452
|
+
if ((_a2 = context.remappedSymbolNames) == null ? void 0 : _a2.has(getSymbolId(sym)))
|
|
49453
|
+
return false;
|
|
49516
49454
|
const accessibleResult = isSymbolAccessible(
|
|
49517
49455
|
sym,
|
|
49518
49456
|
decl,
|
|
@@ -49529,7 +49467,7 @@ function createTypeChecker(host) {
|
|
|
49529
49467
|
includePrivateSymbol(root);
|
|
49530
49468
|
}
|
|
49531
49469
|
}
|
|
49532
|
-
} else if ((
|
|
49470
|
+
} else if ((_b = oldcontext.tracker.inner) == null ? void 0 : _b.trackSymbol) {
|
|
49533
49471
|
return oldcontext.tracker.inner.trackSymbol(sym, decl, meaning);
|
|
49534
49472
|
}
|
|
49535
49473
|
return false;
|
|
@@ -49738,10 +49676,10 @@ function createTypeChecker(host) {
|
|
|
49738
49676
|
context = oldContext;
|
|
49739
49677
|
}
|
|
49740
49678
|
}
|
|
49741
|
-
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
|
|
49742
|
-
var
|
|
49743
|
-
const symbolName2 = unescapeLeadingUnderscores(
|
|
49744
|
-
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 */;
|
|
49745
49683
|
if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && isStringANonContextualKeyword(symbolName2) && !isDefault) {
|
|
49746
49684
|
context.encounteredError = true;
|
|
49747
49685
|
return;
|
|
@@ -49752,7 +49690,7 @@ function createTypeChecker(host) {
|
|
|
49752
49690
|
isPrivate = true;
|
|
49753
49691
|
}
|
|
49754
49692
|
const modifierFlags = (!isPrivate ? 1 /* Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* Default */ : 0);
|
|
49755
|
-
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 */;
|
|
49756
49694
|
const isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
|
|
49757
49695
|
if (symbol.flags & (16 /* Function */ | 8192 /* Method */) || isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
49758
49696
|
serializeAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol, getInternalSymbolName(symbol, symbolName2), modifierFlags);
|
|
@@ -49760,7 +49698,7 @@ function createTypeChecker(host) {
|
|
|
49760
49698
|
if (symbol.flags & 524288 /* TypeAlias */) {
|
|
49761
49699
|
serializeTypeAlias(symbol, symbolName2, modifierFlags);
|
|
49762
49700
|
}
|
|
49763
|
-
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) {
|
|
49764
49702
|
if (propertyAsAlias) {
|
|
49765
49703
|
const createdExport = serializeMaybeAliasAssignment(symbol);
|
|
49766
49704
|
if (createdExport) {
|
|
@@ -49770,17 +49708,24 @@ function createTypeChecker(host) {
|
|
|
49770
49708
|
} else {
|
|
49771
49709
|
const type = getTypeOfSymbol(symbol);
|
|
49772
49710
|
const localName = getInternalSymbolName(symbol, symbolName2);
|
|
49773
|
-
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)) {
|
|
49774
49719
|
serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags);
|
|
49775
49720
|
} else {
|
|
49776
|
-
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 */;
|
|
49777
49722
|
const name = needsPostExportDefault || !(symbol.flags & 4 /* Property */) ? localName : getUnusedName(localName, symbol);
|
|
49778
49723
|
let textRange = symbol.declarations && find(symbol.declarations, (d) => isVariableDeclaration(d));
|
|
49779
49724
|
if (textRange && isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) {
|
|
49780
49725
|
textRange = textRange.parent.parent;
|
|
49781
49726
|
}
|
|
49782
|
-
const propertyAccessRequire = (
|
|
49783
|
-
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)) {
|
|
49784
49729
|
const alias = localName === propertyAccessRequire.parent.right.escapedText ? void 0 : propertyAccessRequire.parent.right;
|
|
49785
49730
|
addResult(
|
|
49786
49731
|
factory.createExportDeclaration(
|
|
@@ -49935,11 +49880,11 @@ function createTypeChecker(host) {
|
|
|
49935
49880
|
results.push(node);
|
|
49936
49881
|
}
|
|
49937
49882
|
function serializeTypeAlias(symbol, symbolName2, modifierFlags) {
|
|
49938
|
-
var
|
|
49883
|
+
var _a2;
|
|
49939
49884
|
const aliasType = getDeclaredTypeOfTypeAlias(symbol);
|
|
49940
49885
|
const typeParams = getSymbolLinks(symbol).typeParameters;
|
|
49941
49886
|
const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
|
|
49942
|
-
const jsdocAliasDecl = (
|
|
49887
|
+
const jsdocAliasDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isJSDocTypeAlias);
|
|
49943
49888
|
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
|
|
49944
49889
|
const oldFlags = context.flags;
|
|
49945
49890
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
@@ -50010,12 +49955,12 @@ function createTypeChecker(host) {
|
|
|
50010
49955
|
/*isTypeOnly*/
|
|
50011
49956
|
false,
|
|
50012
49957
|
factory.createNamedExports(mapDefined(filter(mergedMembers, (n) => n.escapedName !== "export=" /* ExportEquals */), (s) => {
|
|
50013
|
-
var
|
|
49958
|
+
var _a2, _b;
|
|
50014
49959
|
const name = unescapeLeadingUnderscores(s.escapedName);
|
|
50015
49960
|
const localName2 = getInternalSymbolName(s, name);
|
|
50016
49961
|
const aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
|
50017
49962
|
if (containingFile && (aliasDecl ? containingFile !== getSourceFileOfNode(aliasDecl) : !some(s.declarations, (d) => getSourceFileOfNode(d) === containingFile))) {
|
|
50018
|
-
(_b = (
|
|
49963
|
+
(_b = (_a2 = context.tracker) == null ? void 0 : _a2.reportNonlocalAugmentation) == null ? void 0 : _b.call(_a2, containingFile, symbol, s);
|
|
50019
49964
|
return void 0;
|
|
50020
49965
|
}
|
|
50021
49966
|
const target = aliasDecl && getTargetOfAliasDeclaration(
|
|
@@ -50181,8 +50126,8 @@ function createTypeChecker(host) {
|
|
|
50181
50126
|
return void 0;
|
|
50182
50127
|
}
|
|
50183
50128
|
function serializeAsClass(symbol, localName, modifierFlags) {
|
|
50184
|
-
var
|
|
50185
|
-
const originalDecl = (
|
|
50129
|
+
var _a2, _b;
|
|
50130
|
+
const originalDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isClassLike);
|
|
50186
50131
|
const oldEnclosing = context.enclosingDeclaration;
|
|
50187
50132
|
context.enclosingDeclaration = originalDecl || oldEnclosing;
|
|
50188
50133
|
const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
|
@@ -50278,7 +50223,7 @@ function createTypeChecker(host) {
|
|
|
50278
50223
|
});
|
|
50279
50224
|
}
|
|
50280
50225
|
function serializeAsAlias(symbol, localName, modifierFlags) {
|
|
50281
|
-
var
|
|
50226
|
+
var _a2, _b, _c, _d, _e;
|
|
50282
50227
|
const node = getDeclarationOfAliasSymbol(symbol);
|
|
50283
50228
|
if (!node)
|
|
50284
50229
|
return Debug.fail();
|
|
@@ -50298,7 +50243,7 @@ function createTypeChecker(host) {
|
|
|
50298
50243
|
includePrivateSymbol(target);
|
|
50299
50244
|
switch (node.kind) {
|
|
50300
50245
|
case 208 /* BindingElement */:
|
|
50301
|
-
if (((_b = (
|
|
50246
|
+
if (((_b = (_a2 = node.parent) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) {
|
|
50302
50247
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50303
50248
|
const { propertyName } = node;
|
|
50304
50249
|
addResult(
|
|
@@ -50517,7 +50462,7 @@ function createTypeChecker(host) {
|
|
|
50517
50462
|
);
|
|
50518
50463
|
}
|
|
50519
50464
|
function serializeMaybeAliasAssignment(symbol) {
|
|
50520
|
-
var
|
|
50465
|
+
var _a2;
|
|
50521
50466
|
if (symbol.flags & 4194304 /* Prototype */) {
|
|
50522
50467
|
return false;
|
|
50523
50468
|
}
|
|
@@ -50600,7 +50545,7 @@ function createTypeChecker(host) {
|
|
|
50600
50545
|
void 0,
|
|
50601
50546
|
serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled)
|
|
50602
50547
|
)
|
|
50603
|
-
], ((
|
|
50548
|
+
], ((_a2 = context.enclosingDeclaration) == null ? void 0 : _a2.kind) === 267 /* ModuleDeclaration */ ? 1 /* Let */ : 2 /* Const */)
|
|
50604
50549
|
);
|
|
50605
50550
|
addResult(
|
|
50606
50551
|
statement,
|
|
@@ -50630,7 +50575,7 @@ function createTypeChecker(host) {
|
|
|
50630
50575
|
}
|
|
50631
50576
|
function makeSerializePropertySymbol(createProperty2, methodKind, useAccessors) {
|
|
50632
50577
|
return function serializePropertySymbol(p, isStatic2, baseType) {
|
|
50633
|
-
var
|
|
50578
|
+
var _a2, _b, _c, _d, _e;
|
|
50634
50579
|
const modifierFlags = getDeclarationModifierFlagsFromSymbol(p);
|
|
50635
50580
|
const isPrivate = !!(modifierFlags & 8 /* Private */);
|
|
50636
50581
|
if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
|
|
@@ -50641,7 +50586,7 @@ function createTypeChecker(host) {
|
|
|
50641
50586
|
}
|
|
50642
50587
|
const flag = modifierFlags & ~512 /* Async */ | (isStatic2 ? 32 /* Static */ : 0);
|
|
50643
50588
|
const name = getPropertyNameNodeForSymbol(p, context);
|
|
50644
|
-
const firstPropertyLikeDecl = (
|
|
50589
|
+
const firstPropertyLikeDecl = (_a2 = p.declarations) == null ? void 0 : _a2.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression));
|
|
50645
50590
|
if (p.flags & 98304 /* Accessor */ && useAccessors) {
|
|
50646
50591
|
const result = [];
|
|
50647
50592
|
if (p.flags & 65536 /* SetAccessor */) {
|
|
@@ -50887,7 +50832,7 @@ function createTypeChecker(host) {
|
|
|
50887
50832
|
}
|
|
50888
50833
|
}
|
|
50889
50834
|
function getUnusedName(input, symbol) {
|
|
50890
|
-
var
|
|
50835
|
+
var _a2, _b;
|
|
50891
50836
|
const id = symbol ? getSymbolId(symbol) : void 0;
|
|
50892
50837
|
if (id) {
|
|
50893
50838
|
if (context.remappedSymbolNames.has(id)) {
|
|
@@ -50899,7 +50844,7 @@ function createTypeChecker(host) {
|
|
|
50899
50844
|
}
|
|
50900
50845
|
let i = 0;
|
|
50901
50846
|
const original = input;
|
|
50902
|
-
while ((
|
|
50847
|
+
while ((_a2 = context.usedSymbolNames) == null ? void 0 : _a2.has(input)) {
|
|
50903
50848
|
i++;
|
|
50904
50849
|
input = `${original}_${i}`;
|
|
50905
50850
|
}
|
|
@@ -51027,6 +50972,10 @@ function createTypeChecker(host) {
|
|
|
51027
50972
|
}
|
|
51028
50973
|
}
|
|
51029
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
|
+
}
|
|
51030
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`
|
|
51031
50980
|
(!(context.flags & 16777216 /* InInitialEntityName */) || // if the symbol is synthesized, it will only be referenced externally it must print as `default`
|
|
51032
50981
|
!symbol.declarations || // if not in the same binding context (source file, module declaration), it must print as `default`
|
|
@@ -53190,7 +53139,13 @@ function createTypeChecker(host) {
|
|
|
53190
53139
|
const baseTypes = getBaseTypes(source);
|
|
53191
53140
|
if (baseTypes.length) {
|
|
53192
53141
|
if (source.symbol && members === getMembersOfSymbol(source.symbol)) {
|
|
53193
|
-
|
|
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;
|
|
53194
53149
|
}
|
|
53195
53150
|
setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
|
|
53196
53151
|
const thisArgument = lastOrUndefined(typeArguments);
|
|
@@ -64141,7 +64096,7 @@ function createTypeChecker(host) {
|
|
|
64141
64096
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
64142
64097
|
if (constraint) {
|
|
64143
64098
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
64144
|
-
if (!inferredType || inferredType ===
|
|
64099
|
+
if (!inferredType || inferredType === blockedStringType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
64145
64100
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
64146
64101
|
}
|
|
64147
64102
|
}
|
|
@@ -69324,7 +69279,7 @@ function createTypeChecker(host) {
|
|
|
69324
69279
|
apparentType,
|
|
69325
69280
|
right.escapedText,
|
|
69326
69281
|
/*skipObjectFunctionPropertyAugment*/
|
|
69327
|
-
|
|
69282
|
+
isConstEnumObjectType(apparentType),
|
|
69328
69283
|
/*includeTypeOnlyMembers*/
|
|
69329
69284
|
node.kind === 166 /* QualifiedName */
|
|
69330
69285
|
);
|
|
@@ -72291,18 +72246,16 @@ function createTypeChecker(host) {
|
|
|
72291
72246
|
const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
72292
72247
|
for (let i = 0; i < len; i++) {
|
|
72293
72248
|
const declaration = signature.parameters[i].valueDeclaration;
|
|
72294
|
-
|
|
72295
|
-
|
|
72296
|
-
|
|
72297
|
-
|
|
72298
|
-
|
|
72299
|
-
|
|
72300
|
-
|
|
72301
|
-
|
|
72302
|
-
|
|
72303
|
-
|
|
72304
|
-
inferTypes(inferenceContext.inferences, source, target);
|
|
72305
|
-
}
|
|
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);
|
|
72306
72259
|
}
|
|
72307
72260
|
}
|
|
72308
72261
|
}
|
|
@@ -74734,7 +74687,7 @@ function createTypeChecker(host) {
|
|
|
74734
74687
|
return nullWideningType;
|
|
74735
74688
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
74736
74689
|
case 11 /* StringLiteral */:
|
|
74737
|
-
return hasSkipDirectInferenceFlag(node) ?
|
|
74690
|
+
return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
|
|
74738
74691
|
case 9 /* NumericLiteral */: {
|
|
74739
74692
|
checkGrammarNumericLiteral(node);
|
|
74740
74693
|
const value = +node.text;
|
|
@@ -106988,6 +106941,9 @@ function transformDeclarations(context) {
|
|
|
106988
106941
|
if (elem.kind === 232 /* OmittedExpression */) {
|
|
106989
106942
|
return elem;
|
|
106990
106943
|
}
|
|
106944
|
+
if (elem.propertyName && isComputedPropertyName(elem.propertyName) && isEntityNameExpression(elem.propertyName.expression)) {
|
|
106945
|
+
checkEntityNameVisibility(elem.propertyName.expression, enclosingDeclaration);
|
|
106946
|
+
}
|
|
106991
106947
|
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
|
|
106992
106948
|
return factory2.updateBindingElement(
|
|
106993
106949
|
elem,
|
|
@@ -114901,17 +114857,17 @@ function formatCodeSpan(file, start, length2, indent2, squiggleColor, host) {
|
|
|
114901
114857
|
for (let i = firstLine; i <= lastLine; i++) {
|
|
114902
114858
|
context += host.getNewLine();
|
|
114903
114859
|
if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
|
|
114904
|
-
context += indent2 + formatColorAndReset(
|
|
114860
|
+
context += indent2 + formatColorAndReset(ellipsis.padStart(gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine();
|
|
114905
114861
|
i = lastLine - 1;
|
|
114906
114862
|
}
|
|
114907
114863
|
const lineStart = getPositionOfLineAndCharacter(file, i, 0);
|
|
114908
114864
|
const lineEnd = i < lastLineInFile ? getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length;
|
|
114909
114865
|
let lineContent = file.text.slice(lineStart, lineEnd);
|
|
114910
|
-
lineContent =
|
|
114866
|
+
lineContent = lineContent.trimEnd();
|
|
114911
114867
|
lineContent = lineContent.replace(/\t/g, " ");
|
|
114912
|
-
context += indent2 + formatColorAndReset(
|
|
114868
|
+
context += indent2 + formatColorAndReset((i + 1 + "").padStart(gutterWidth), gutterStyleSequence) + gutterSeparator;
|
|
114913
114869
|
context += lineContent + host.getNewLine();
|
|
114914
|
-
context += indent2 + formatColorAndReset(
|
|
114870
|
+
context += indent2 + formatColorAndReset("".padStart(gutterWidth), gutterStyleSequence) + gutterSeparator;
|
|
114915
114871
|
context += squiggleColor;
|
|
114916
114872
|
if (i === firstLine) {
|
|
114917
114873
|
const lastCharForLine = i === lastLine ? lastLineChar : void 0;
|
|
@@ -124890,11 +124846,11 @@ function generateOptionOutput(sys2, option, rightAlignOfLeft, leftAlignOfRight)
|
|
|
124890
124846
|
while (remainRight.length > 0) {
|
|
124891
124847
|
let curLeft = "";
|
|
124892
124848
|
if (isFirstLine) {
|
|
124893
|
-
curLeft =
|
|
124894
|
-
curLeft =
|
|
124849
|
+
curLeft = left.padStart(rightAlignOfLeft2);
|
|
124850
|
+
curLeft = curLeft.padEnd(leftAlignOfRight2);
|
|
124895
124851
|
curLeft = colorLeft ? colors.blue(curLeft) : curLeft;
|
|
124896
124852
|
} else {
|
|
124897
|
-
curLeft =
|
|
124853
|
+
curLeft = "".padStart(leftAlignOfRight2);
|
|
124898
124854
|
}
|
|
124899
124855
|
const curRight = remainRight.substr(0, rightCharacterNumber);
|
|
124900
124856
|
remainRight = remainRight.slice(rightCharacterNumber);
|
|
@@ -125100,13 +125056,13 @@ function getHeader(sys2, message) {
|
|
|
125100
125056
|
const header = [];
|
|
125101
125057
|
const terminalWidth = ((_a = sys2.getWidthOfTerminal) == null ? void 0 : _a.call(sys2)) ?? 0;
|
|
125102
125058
|
const tsIconLength = 5;
|
|
125103
|
-
const tsIconFirstLine = colors.blueBackground(
|
|
125104
|
-
const tsIconSecondLine = colors.blueBackground(colors.brightWhite(
|
|
125059
|
+
const tsIconFirstLine = colors.blueBackground("".padStart(tsIconLength));
|
|
125060
|
+
const tsIconSecondLine = colors.blueBackground(colors.brightWhite("TS ".padStart(tsIconLength)));
|
|
125105
125061
|
if (terminalWidth >= message.length + tsIconLength) {
|
|
125106
125062
|
const rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
|
|
125107
125063
|
const leftAlign = rightAlign - tsIconLength;
|
|
125108
|
-
header.push(
|
|
125109
|
-
header.push(
|
|
125064
|
+
header.push(message.padEnd(leftAlign) + tsIconFirstLine + sys2.newLine);
|
|
125065
|
+
header.push("".padStart(leftAlign) + tsIconSecondLine + sys2.newLine);
|
|
125110
125066
|
} else {
|
|
125111
125067
|
header.push(message + sys2.newLine);
|
|
125112
125068
|
header.push(sys2.newLine);
|
|
@@ -125783,7 +125739,7 @@ function reportAllStatistics(sys2, statistics) {
|
|
|
125783
125739
|
}
|
|
125784
125740
|
}
|
|
125785
125741
|
for (const s of statistics) {
|
|
125786
|
-
sys2.write(
|
|
125742
|
+
sys2.write(`${s.name}:`.padEnd(nameSize + 2) + statisticValue(s).toString().padStart(valueSize) + sys2.newLine);
|
|
125787
125743
|
}
|
|
125788
125744
|
}
|
|
125789
125745
|
function statisticValue(s) {
|