typescript 5.5.0-dev.20240531 → 5.5.0-dev.20240601
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 +168 -78
- package/lib/typescript.js +190 -97
- 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.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240601`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -9795,7 +9795,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9795
9795
|
pos++;
|
|
9796
9796
|
let regExpFlags = 0 /* None */;
|
|
9797
9797
|
while (true) {
|
|
9798
|
-
const ch =
|
|
9798
|
+
const ch = charCodeChecked(pos);
|
|
9799
9799
|
if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
|
|
9800
9800
|
break;
|
|
9801
9801
|
}
|
|
@@ -11046,10 +11046,10 @@ var binaryUnicodeProperties = /* @__PURE__ */ new Set(["ASCII", "ASCII_Hex_Digit
|
|
|
11046
11046
|
var binaryUnicodePropertiesOfStrings = /* @__PURE__ */ new Set(["Basic_Emoji", "Emoji_Keycap_Sequence", "RGI_Emoji_Modifier_Sequence", "RGI_Emoji_Flag_Sequence", "RGI_Emoji_Tag_Sequence", "RGI_Emoji_ZWJ_Sequence", "RGI_Emoji"]);
|
|
11047
11047
|
var valuesOfNonBinaryUnicodeProperties = {
|
|
11048
11048
|
General_Category: /* @__PURE__ */ new Set(["C", "Other", "Cc", "Control", "cntrl", "Cf", "Format", "Cn", "Unassigned", "Co", "Private_Use", "Cs", "Surrogate", "L", "Letter", "LC", "Cased_Letter", "Ll", "Lowercase_Letter", "Lm", "Modifier_Letter", "Lo", "Other_Letter", "Lt", "Titlecase_Letter", "Lu", "Uppercase_Letter", "M", "Mark", "Combining_Mark", "Mc", "Spacing_Mark", "Me", "Enclosing_Mark", "Mn", "Nonspacing_Mark", "N", "Number", "Nd", "Decimal_Number", "digit", "Nl", "Letter_Number", "No", "Other_Number", "P", "Punctuation", "punct", "Pc", "Connector_Punctuation", "Pd", "Dash_Punctuation", "Pe", "Close_Punctuation", "Pf", "Final_Punctuation", "Pi", "Initial_Punctuation", "Po", "Other_Punctuation", "Ps", "Open_Punctuation", "S", "Symbol", "Sc", "Currency_Symbol", "Sk", "Modifier_Symbol", "Sm", "Math_Symbol", "So", "Other_Symbol", "Z", "Separator", "Zl", "Line_Separator", "Zp", "Paragraph_Separator", "Zs", "Space_Separator"]),
|
|
11049
|
-
Script: /* @__PURE__ */ new Set(["Adlm", "Adlam", "Aghb", "Caucasian_Albanian", "Ahom", "
|
|
11050
|
-
Script_Extensions:
|
|
11051
|
-
// Currently empty
|
|
11049
|
+
Script: /* @__PURE__ */ new Set(["Adlm", "Adlam", "Aghb", "Caucasian_Albanian", "Ahom", "Arab", "Arabic", "Armi", "Imperial_Aramaic", "Armn", "Armenian", "Avst", "Avestan", "Bali", "Balinese", "Bamu", "Bamum", "Bass", "Bassa_Vah", "Batk", "Batak", "Beng", "Bengali", "Bhks", "Bhaiksuki", "Bopo", "Bopomofo", "Brah", "Brahmi", "Brai", "Braille", "Bugi", "Buginese", "Buhd", "Buhid", "Cakm", "Chakma", "Cans", "Canadian_Aboriginal", "Cari", "Carian", "Cham", "Cher", "Cherokee", "Chrs", "Chorasmian", "Copt", "Coptic", "Qaac", "Cpmn", "Cypro_Minoan", "Cprt", "Cypriot", "Cyrl", "Cyrillic", "Deva", "Devanagari", "Diak", "Dives_Akuru", "Dogr", "Dogra", "Dsrt", "Deseret", "Dupl", "Duployan", "Egyp", "Egyptian_Hieroglyphs", "Elba", "Elbasan", "Elym", "Elymaic", "Ethi", "Ethiopic", "Geor", "Georgian", "Glag", "Glagolitic", "Gong", "Gunjala_Gondi", "Gonm", "Masaram_Gondi", "Goth", "Gothic", "Gran", "Grantha", "Grek", "Greek", "Gujr", "Gujarati", "Guru", "Gurmukhi", "Hang", "Hangul", "Hani", "Han", "Hano", "Hanunoo", "Hatr", "Hatran", "Hebr", "Hebrew", "Hira", "Hiragana", "Hluw", "Anatolian_Hieroglyphs", "Hmng", "Pahawh_Hmong", "Hmnp", "Nyiakeng_Puachue_Hmong", "Hrkt", "Katakana_Or_Hiragana", "Hung", "Old_Hungarian", "Ital", "Old_Italic", "Java", "Javanese", "Kali", "Kayah_Li", "Kana", "Katakana", "Kawi", "Khar", "Kharoshthi", "Khmr", "Khmer", "Khoj", "Khojki", "Kits", "Khitan_Small_Script", "Knda", "Kannada", "Kthi", "Kaithi", "Lana", "Tai_Tham", "Laoo", "Lao", "Latn", "Latin", "Lepc", "Lepcha", "Limb", "Limbu", "Lina", "Linear_A", "Linb", "Linear_B", "Lisu", "Lyci", "Lycian", "Lydi", "Lydian", "Mahj", "Mahajani", "Maka", "Makasar", "Mand", "Mandaic", "Mani", "Manichaean", "Marc", "Marchen", "Medf", "Medefaidrin", "Mend", "Mende_Kikakui", "Merc", "Meroitic_Cursive", "Mero", "Meroitic_Hieroglyphs", "Mlym", "Malayalam", "Modi", "Mong", "Mongolian", "Mroo", "Mro", "Mtei", "Meetei_Mayek", "Mult", "Multani", "Mymr", "Myanmar", "Nagm", "Nag_Mundari", "Nand", "Nandinagari", "Narb", "Old_North_Arabian", "Nbat", "Nabataean", "Newa", "Nkoo", "Nko", "Nshu", "Nushu", "Ogam", "Ogham", "Olck", "Ol_Chiki", "Orkh", "Old_Turkic", "Orya", "Oriya", "Osge", "Osage", "Osma", "Osmanya", "Ougr", "Old_Uyghur", "Palm", "Palmyrene", "Pauc", "Pau_Cin_Hau", "Perm", "Old_Permic", "Phag", "Phags_Pa", "Phli", "Inscriptional_Pahlavi", "Phlp", "Psalter_Pahlavi", "Phnx", "Phoenician", "Plrd", "Miao", "Prti", "Inscriptional_Parthian", "Rjng", "Rejang", "Rohg", "Hanifi_Rohingya", "Runr", "Runic", "Samr", "Samaritan", "Sarb", "Old_South_Arabian", "Saur", "Saurashtra", "Sgnw", "SignWriting", "Shaw", "Shavian", "Shrd", "Sharada", "Sidd", "Siddham", "Sind", "Khudawadi", "Sinh", "Sinhala", "Sogd", "Sogdian", "Sogo", "Old_Sogdian", "Sora", "Sora_Sompeng", "Soyo", "Soyombo", "Sund", "Sundanese", "Sylo", "Syloti_Nagri", "Syrc", "Syriac", "Tagb", "Tagbanwa", "Takr", "Takri", "Tale", "Tai_Le", "Talu", "New_Tai_Lue", "Taml", "Tamil", "Tang", "Tangut", "Tavt", "Tai_Viet", "Telu", "Telugu", "Tfng", "Tifinagh", "Tglg", "Tagalog", "Thaa", "Thaana", "Thai", "Tibt", "Tibetan", "Tirh", "Tirhuta", "Tnsa", "Tangsa", "Toto", "Ugar", "Ugaritic", "Vaii", "Vai", "Vith", "Vithkuqi", "Wara", "Warang_Citi", "Wcho", "Wancho", "Xpeo", "Old_Persian", "Xsux", "Cuneiform", "Yezi", "Yezidi", "Yiii", "Yi", "Zanb", "Zanabazar_Square", "Zinh", "Inherited", "Qaai", "Zyyy", "Common", "Zzzz", "Unknown"]),
|
|
11050
|
+
Script_Extensions: void 0
|
|
11052
11051
|
};
|
|
11052
|
+
valuesOfNonBinaryUnicodeProperties.Script_Extensions = valuesOfNonBinaryUnicodeProperties.Script;
|
|
11053
11053
|
|
|
11054
11054
|
// src/compiler/utilitiesPublic.ts
|
|
11055
11055
|
function isExternalModuleNameRelative(moduleName) {
|
|
@@ -13639,6 +13639,26 @@ function getErrorSpanForNode(sourceFile, node) {
|
|
|
13639
13639
|
const pos2 = skipTrivia(sourceFile.text, node.tagName.pos);
|
|
13640
13640
|
return getSpanOfTokenAtPosition(sourceFile, pos2);
|
|
13641
13641
|
}
|
|
13642
|
+
case 176 /* Constructor */: {
|
|
13643
|
+
const constructorDeclaration = node;
|
|
13644
|
+
const start = skipTrivia(sourceFile.text, constructorDeclaration.pos);
|
|
13645
|
+
const scanner = createScanner(
|
|
13646
|
+
sourceFile.languageVersion,
|
|
13647
|
+
/*skipTrivia*/
|
|
13648
|
+
true,
|
|
13649
|
+
sourceFile.languageVariant,
|
|
13650
|
+
sourceFile.text,
|
|
13651
|
+
/*onError*/
|
|
13652
|
+
void 0,
|
|
13653
|
+
start
|
|
13654
|
+
);
|
|
13655
|
+
let token = scanner.scan();
|
|
13656
|
+
while (token !== 137 /* ConstructorKeyword */ && token !== 1 /* EndOfFileToken */) {
|
|
13657
|
+
token = scanner.scan();
|
|
13658
|
+
}
|
|
13659
|
+
const end = scanner.getTokenEnd();
|
|
13660
|
+
return createTextSpanFromBounds(start, end);
|
|
13661
|
+
}
|
|
13642
13662
|
}
|
|
13643
13663
|
if (errorNode === void 0) {
|
|
13644
13664
|
return getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
@@ -18298,7 +18318,15 @@ function rangeOfTypeParameters(sourceFile, typeParameters) {
|
|
|
18298
18318
|
return { pos, end };
|
|
18299
18319
|
}
|
|
18300
18320
|
function skipTypeChecking(sourceFile, options, host) {
|
|
18301
|
-
return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName);
|
|
18321
|
+
return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnsotics(sourceFile, options);
|
|
18322
|
+
}
|
|
18323
|
+
function canIncludeBindAndCheckDiagnsotics(sourceFile, options) {
|
|
18324
|
+
if (!!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false) return false;
|
|
18325
|
+
if (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */ || sourceFile.scriptKind === 5 /* External */) return true;
|
|
18326
|
+
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
18327
|
+
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
18328
|
+
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
18329
|
+
return isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */;
|
|
18302
18330
|
}
|
|
18303
18331
|
function isJsonEqual(a, b) {
|
|
18304
18332
|
return a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && equalOwnProperties(a, b, isJsonEqual);
|
|
@@ -45374,6 +45402,7 @@ function createTypeChecker(host) {
|
|
|
45374
45402
|
getImmediateAliasedSymbol,
|
|
45375
45403
|
getAliasedSymbol: resolveAlias,
|
|
45376
45404
|
getEmitResolver,
|
|
45405
|
+
requiresAddingImplicitUndefined,
|
|
45377
45406
|
getExportsOfModule: getExportsOfModuleAsArray,
|
|
45378
45407
|
getExportsAndPropertiesOfModule,
|
|
45379
45408
|
forEachExportAndPropertyOfModule,
|
|
@@ -49255,7 +49284,7 @@ function createTypeChecker(host) {
|
|
|
49255
49284
|
return noMappedTypes && mappedType !== type ? void 0 : mappedType;
|
|
49256
49285
|
}
|
|
49257
49286
|
function setTextRange2(context, range, location) {
|
|
49258
|
-
if (!nodeIsSynthesized(range)
|
|
49287
|
+
if (!nodeIsSynthesized(range) || !(range.flags & 16 /* Synthesized */) || !context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(getOriginalNode(range))) {
|
|
49259
49288
|
range = factory.cloneNode(range);
|
|
49260
49289
|
}
|
|
49261
49290
|
if (range === location) return range;
|
|
@@ -50194,7 +50223,8 @@ function createTypeChecker(host) {
|
|
|
50194
50223
|
const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
|
|
50195
50224
|
const getterSignature = getSignatureFromDeclaration(getterDeclaration);
|
|
50196
50225
|
typeElements.push(
|
|
50197
|
-
|
|
50226
|
+
setCommentRange2(
|
|
50227
|
+
context,
|
|
50198
50228
|
signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
|
|
50199
50229
|
getterDeclaration
|
|
50200
50230
|
)
|
|
@@ -50202,7 +50232,8 @@ function createTypeChecker(host) {
|
|
|
50202
50232
|
const setterDeclaration = getDeclarationOfKind(propertySymbol, 178 /* SetAccessor */);
|
|
50203
50233
|
const setterSignature = getSignatureFromDeclaration(setterDeclaration);
|
|
50204
50234
|
typeElements.push(
|
|
50205
|
-
|
|
50235
|
+
setCommentRange2(
|
|
50236
|
+
context,
|
|
50206
50237
|
signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
|
|
50207
50238
|
setterDeclaration
|
|
50208
50239
|
)
|
|
@@ -50260,11 +50291,17 @@ function createTypeChecker(host) {
|
|
|
50260
50291
|
setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
|
|
50261
50292
|
}
|
|
50262
50293
|
} else if (propertySymbol.valueDeclaration) {
|
|
50263
|
-
|
|
50294
|
+
setCommentRange2(context, node, propertySymbol.valueDeclaration);
|
|
50264
50295
|
}
|
|
50265
50296
|
return node;
|
|
50266
50297
|
}
|
|
50267
50298
|
}
|
|
50299
|
+
function setCommentRange2(context, node, range) {
|
|
50300
|
+
if (context.enclosingFile && context.enclosingFile === getSourceFileOfNode(range)) {
|
|
50301
|
+
return setCommentRange(node, range);
|
|
50302
|
+
}
|
|
50303
|
+
return node;
|
|
50304
|
+
}
|
|
50268
50305
|
function mapToTypeNodes(types, context, isBareList) {
|
|
50269
50306
|
if (some(types)) {
|
|
50270
50307
|
if (checkTruncationLength(context)) {
|
|
@@ -51040,7 +51077,7 @@ function createTypeChecker(host) {
|
|
|
51040
51077
|
return false;
|
|
51041
51078
|
}
|
|
51042
51079
|
function typeParameterToName(type, context) {
|
|
51043
|
-
var _a, _b;
|
|
51080
|
+
var _a, _b, _c, _d;
|
|
51044
51081
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
51045
51082
|
const cached = context.typeParameterNames.get(getTypeId(type));
|
|
51046
51083
|
if (cached) {
|
|
@@ -51057,11 +51094,15 @@ function createTypeChecker(host) {
|
|
|
51057
51094
|
if (!(result.kind & 80 /* Identifier */)) {
|
|
51058
51095
|
return factory.createIdentifier("(Missing type parameter)");
|
|
51059
51096
|
}
|
|
51097
|
+
const decl = (_b = (_a = type.symbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b[0];
|
|
51098
|
+
if (decl && isTypeParameterDeclaration(decl)) {
|
|
51099
|
+
result = setTextRange2(context, result, decl.name);
|
|
51100
|
+
}
|
|
51060
51101
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
51061
51102
|
const rawtext = result.escapedText;
|
|
51062
|
-
let i = ((
|
|
51103
|
+
let i = ((_c = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _c.get(rawtext)) || 0;
|
|
51063
51104
|
let text = rawtext;
|
|
51064
|
-
while (((
|
|
51105
|
+
while (((_d = context.typeParameterNamesByText) == null ? void 0 : _d.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
|
|
51065
51106
|
i++;
|
|
51066
51107
|
text = `${rawtext}_${i}`;
|
|
51067
51108
|
}
|
|
@@ -51500,7 +51541,7 @@ function createTypeChecker(host) {
|
|
|
51500
51541
|
}
|
|
51501
51542
|
return node;
|
|
51502
51543
|
}
|
|
51503
|
-
return result
|
|
51544
|
+
return result ? setTextRange2(context, result, node) : void 0;
|
|
51504
51545
|
}
|
|
51505
51546
|
function createRecoveryBoundary() {
|
|
51506
51547
|
let unreportedErrors;
|
|
@@ -51585,6 +51626,31 @@ function createTypeChecker(host) {
|
|
|
51585
51626
|
function onEnterNewScope(node) {
|
|
51586
51627
|
return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
51587
51628
|
}
|
|
51629
|
+
function tryVisitTypeReference(node) {
|
|
51630
|
+
if (canReuseTypeNode(context, node)) {
|
|
51631
|
+
const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
|
|
51632
|
+
const typeArguments = visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode);
|
|
51633
|
+
if (!introducesError) {
|
|
51634
|
+
const updated = factory.updateTypeReferenceNode(
|
|
51635
|
+
node,
|
|
51636
|
+
newName,
|
|
51637
|
+
typeArguments
|
|
51638
|
+
);
|
|
51639
|
+
return setTextRange2(context, updated, node);
|
|
51640
|
+
} else {
|
|
51641
|
+
const serializedName = serializeTypeName(
|
|
51642
|
+
context,
|
|
51643
|
+
node.typeName,
|
|
51644
|
+
/*isTypeOf*/
|
|
51645
|
+
false,
|
|
51646
|
+
typeArguments
|
|
51647
|
+
);
|
|
51648
|
+
if (serializedName) {
|
|
51649
|
+
return setTextRange2(context, serializedName, node.typeName);
|
|
51650
|
+
}
|
|
51651
|
+
}
|
|
51652
|
+
}
|
|
51653
|
+
}
|
|
51588
51654
|
function visitExistingNodeTreeSymbolsWorker(node) {
|
|
51589
51655
|
if (isJSDocTypeExpression(node)) {
|
|
51590
51656
|
return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
|
|
@@ -51681,7 +51747,8 @@ function createTypeChecker(host) {
|
|
|
51681
51747
|
if (canReuseTypeNode(context, node)) {
|
|
51682
51748
|
return node;
|
|
51683
51749
|
}
|
|
51684
|
-
|
|
51750
|
+
hadError = true;
|
|
51751
|
+
return node;
|
|
51685
51752
|
}
|
|
51686
51753
|
if (isTypeParameterDeclaration(node)) {
|
|
51687
51754
|
return factory.updateTypeParameterDeclaration(
|
|
@@ -51692,31 +51759,21 @@ function createTypeChecker(host) {
|
|
|
51692
51759
|
visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
|
|
51693
51760
|
);
|
|
51694
51761
|
}
|
|
51762
|
+
if (isIndexedAccessTypeNode(node) && isTypeReferenceNode(node.objectType)) {
|
|
51763
|
+
const objectType = tryVisitTypeReference(node.objectType);
|
|
51764
|
+
if (!objectType) {
|
|
51765
|
+
hadError = true;
|
|
51766
|
+
return node;
|
|
51767
|
+
}
|
|
51768
|
+
return factory.updateIndexedAccessTypeNode(node, objectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51769
|
+
}
|
|
51695
51770
|
if (isTypeReferenceNode(node)) {
|
|
51696
|
-
|
|
51697
|
-
|
|
51698
|
-
|
|
51699
|
-
if (!introducesError) {
|
|
51700
|
-
const updated = factory.updateTypeReferenceNode(
|
|
51701
|
-
node,
|
|
51702
|
-
newName,
|
|
51703
|
-
typeArguments
|
|
51704
|
-
);
|
|
51705
|
-
return setTextRange2(context, updated, node);
|
|
51706
|
-
} else {
|
|
51707
|
-
const serializedName = serializeTypeName(
|
|
51708
|
-
context,
|
|
51709
|
-
node.typeName,
|
|
51710
|
-
/*isTypeOf*/
|
|
51711
|
-
false,
|
|
51712
|
-
typeArguments
|
|
51713
|
-
);
|
|
51714
|
-
if (serializedName) {
|
|
51715
|
-
return setTextRange2(context, serializedName, node.typeName);
|
|
51716
|
-
}
|
|
51717
|
-
}
|
|
51771
|
+
const result = tryVisitTypeReference(node);
|
|
51772
|
+
if (result) {
|
|
51773
|
+
return result;
|
|
51718
51774
|
}
|
|
51719
|
-
|
|
51775
|
+
hadError = true;
|
|
51776
|
+
return node;
|
|
51720
51777
|
}
|
|
51721
51778
|
if (isLiteralImportTypeNode(node)) {
|
|
51722
51779
|
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
@@ -51740,12 +51797,7 @@ function createTypeChecker(host) {
|
|
|
51740
51797
|
}
|
|
51741
51798
|
}
|
|
51742
51799
|
if (isFunctionLike(node) && !node.type || isPropertyDeclaration(node) && !node.type && !node.initializer || isPropertySignature(node) && !node.type && !node.initializer || isParameter(node) && !node.type && !node.initializer) {
|
|
51743
|
-
let visited =
|
|
51744
|
-
node,
|
|
51745
|
-
visitExistingNodeTreeSymbols,
|
|
51746
|
-
/*context*/
|
|
51747
|
-
void 0
|
|
51748
|
-
);
|
|
51800
|
+
let visited = visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
51749
51801
|
if (visited === node) {
|
|
51750
51802
|
visited = setTextRange2(context, factory.cloneNode(node), node);
|
|
51751
51803
|
}
|
|
@@ -51767,7 +51819,8 @@ function createTypeChecker(host) {
|
|
|
51767
51819
|
if (serializedName) {
|
|
51768
51820
|
return setTextRange2(context, serializedName, node.exprName);
|
|
51769
51821
|
}
|
|
51770
|
-
|
|
51822
|
+
hadError = true;
|
|
51823
|
+
return node;
|
|
51771
51824
|
}
|
|
51772
51825
|
return factory.updateTypeQueryNode(
|
|
51773
51826
|
node,
|
|
@@ -51805,12 +51858,7 @@ function createTypeChecker(host) {
|
|
|
51805
51858
|
return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51806
51859
|
}
|
|
51807
51860
|
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
51808
|
-
const visited =
|
|
51809
|
-
node,
|
|
51810
|
-
visitExistingNodeTreeSymbols,
|
|
51811
|
-
/*context*/
|
|
51812
|
-
void 0
|
|
51813
|
-
);
|
|
51861
|
+
const visited = visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
51814
51862
|
const clone = setTextRange2(context, visited === node ? factory.cloneNode(node) : visited, node);
|
|
51815
51863
|
const flags = getEmitFlags(clone);
|
|
51816
51864
|
setEmitFlags(clone, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
|
|
@@ -51836,17 +51884,46 @@ function createTypeChecker(host) {
|
|
|
51836
51884
|
falseType2
|
|
51837
51885
|
);
|
|
51838
51886
|
}
|
|
51839
|
-
if (isTypeOperatorNode(node)
|
|
51840
|
-
if (
|
|
51841
|
-
|
|
51887
|
+
if (isTypeOperatorNode(node)) {
|
|
51888
|
+
if (node.operator === 158 /* UniqueKeyword */ && node.type.kind === 155 /* SymbolKeyword */) {
|
|
51889
|
+
if (!canReuseTypeNode(context, node)) {
|
|
51890
|
+
hadError = true;
|
|
51891
|
+
return node;
|
|
51892
|
+
}
|
|
51893
|
+
} else if (node.operator === 143 /* KeyOfKeyword */) {
|
|
51894
|
+
if (isTypeReferenceNode(node.type)) {
|
|
51895
|
+
const type = tryVisitTypeReference(node.type);
|
|
51896
|
+
if (!type) {
|
|
51897
|
+
hadError = true;
|
|
51898
|
+
return node;
|
|
51899
|
+
}
|
|
51900
|
+
return factory.updateTypeOperatorNode(node, type);
|
|
51901
|
+
}
|
|
51842
51902
|
}
|
|
51843
51903
|
}
|
|
51844
|
-
return
|
|
51845
|
-
|
|
51846
|
-
|
|
51847
|
-
|
|
51848
|
-
|
|
51849
|
-
|
|
51904
|
+
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
51905
|
+
function visitEachChild2(node2, visitor) {
|
|
51906
|
+
const nonlocalNode = !context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(node2);
|
|
51907
|
+
return visitEachChild(
|
|
51908
|
+
node2,
|
|
51909
|
+
visitor,
|
|
51910
|
+
/*context*/
|
|
51911
|
+
void 0,
|
|
51912
|
+
nonlocalNode ? visitNodesWithoutCopyingPositions : void 0
|
|
51913
|
+
);
|
|
51914
|
+
}
|
|
51915
|
+
function visitNodesWithoutCopyingPositions(nodes, visitor, test, start, count) {
|
|
51916
|
+
let result = visitNodes2(nodes, visitor, test, start, count);
|
|
51917
|
+
if (result) {
|
|
51918
|
+
if (result.pos !== -1 || result.end !== -1) {
|
|
51919
|
+
if (result === nodes) {
|
|
51920
|
+
result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
|
|
51921
|
+
}
|
|
51922
|
+
setTextRangePosEnd(result, -1, -1);
|
|
51923
|
+
}
|
|
51924
|
+
}
|
|
51925
|
+
return result;
|
|
51926
|
+
}
|
|
51850
51927
|
function getEffectiveDotDotDotForParameter(p) {
|
|
51851
51928
|
return p.dotDotDotToken || (p.type && isJSDocVariadicType(p.type) ? factory.createToken(26 /* DotDotDotToken */) : void 0);
|
|
51852
51929
|
}
|
|
@@ -56912,7 +56989,16 @@ function createTypeChecker(host) {
|
|
|
56912
56989
|
}
|
|
56913
56990
|
}
|
|
56914
56991
|
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
56915
|
-
|
|
56992
|
+
if (type === thisArgument) {
|
|
56993
|
+
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
56994
|
+
type,
|
|
56995
|
+
thisArgument,
|
|
56996
|
+
/*needApparentType*/
|
|
56997
|
+
true
|
|
56998
|
+
));
|
|
56999
|
+
}
|
|
57000
|
+
const key = `I${getTypeId(type)},${getTypeId(thisArgument)}`;
|
|
57001
|
+
return getCachedType(key) ?? setCachedType(key, getTypeWithThisArgument(
|
|
56916
57002
|
type,
|
|
56917
57003
|
thisArgument,
|
|
56918
57004
|
/*needApparentType*/
|
|
@@ -69286,6 +69372,9 @@ function createTypeChecker(host) {
|
|
|
69286
69372
|
return contextualType && !isGenericType(contextualType);
|
|
69287
69373
|
}
|
|
69288
69374
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
69375
|
+
if (isNoInferType(type)) {
|
|
69376
|
+
type = type.baseType;
|
|
69377
|
+
}
|
|
69289
69378
|
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
69290
69379
|
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
|
69291
69380
|
}
|
|
@@ -84988,7 +85077,7 @@ function createTypeChecker(host) {
|
|
|
84988
85077
|
return !!(getNodeCheckFlags(node) & flag);
|
|
84989
85078
|
}
|
|
84990
85079
|
function calculateNodeCheckFlagWorker(node, flag) {
|
|
84991
|
-
if (!compilerOptions.noCheck) {
|
|
85080
|
+
if (!compilerOptions.noCheck && canIncludeBindAndCheckDiagnsotics(getSourceFileOfNode(node), compilerOptions)) {
|
|
84992
85081
|
return;
|
|
84993
85082
|
}
|
|
84994
85083
|
const links = getNodeLinks(node);
|
|
@@ -86631,7 +86720,6 @@ function createTypeChecker(host) {
|
|
|
86631
86720
|
return true;
|
|
86632
86721
|
}
|
|
86633
86722
|
}
|
|
86634
|
-
return false;
|
|
86635
86723
|
}
|
|
86636
86724
|
}
|
|
86637
86725
|
if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 65536 /* AwaitContext */) && isIdentifier(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") {
|
|
@@ -99836,10 +99924,10 @@ function transformESNext(context) {
|
|
|
99836
99924
|
function visitForOfStatement(node) {
|
|
99837
99925
|
if (isUsingVariableDeclarationList(node.initializer)) {
|
|
99838
99926
|
const forInitializer = node.initializer;
|
|
99839
|
-
|
|
99840
|
-
|
|
99841
|
-
|
|
99842
|
-
|
|
99927
|
+
const forDecl = firstOrUndefined(forInitializer.declarations) || factory2.createVariableDeclaration(factory2.createTempVariable(
|
|
99928
|
+
/*recordTempVariable*/
|
|
99929
|
+
void 0
|
|
99930
|
+
));
|
|
99843
99931
|
const isAwaitUsing = getUsingKindOfVariableDeclarationList(forInitializer) === 2 /* Async */;
|
|
99844
99932
|
const temp = factory2.getGeneratedNameForNode(forDecl.name);
|
|
99845
99933
|
const usingVar = factory2.updateVariableDeclaration(
|
|
@@ -112953,9 +113041,11 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
112953
113041
|
emitSkipped = true;
|
|
112954
113042
|
return;
|
|
112955
113043
|
}
|
|
112956
|
-
|
|
112957
|
-
(
|
|
112958
|
-
|
|
113044
|
+
(isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : filter(sourceFileOrBundle.sourceFiles, isSourceFileNotJson)).forEach(
|
|
113045
|
+
(sourceFile) => {
|
|
113046
|
+
if (compilerOptions.noCheck || !canIncludeBindAndCheckDiagnsotics(sourceFile, compilerOptions)) markLinkedReferences(sourceFile);
|
|
113047
|
+
}
|
|
113048
|
+
);
|
|
112959
113049
|
const transform = transformNodes(
|
|
112960
113050
|
resolver,
|
|
112961
113051
|
host,
|
|
@@ -113005,9 +113095,11 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113005
113095
|
const sourceFiles = isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
|
|
113006
113096
|
const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson);
|
|
113007
113097
|
const inputListOrBundle = compilerOptions.outFile ? [factory.createBundle(filesForEmit)] : filesForEmit;
|
|
113008
|
-
|
|
113009
|
-
|
|
113010
|
-
|
|
113098
|
+
filesForEmit.forEach((sourceFile) => {
|
|
113099
|
+
if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck || emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) || !canIncludeBindAndCheckDiagnsotics(sourceFile, compilerOptions)) {
|
|
113100
|
+
collectLinkedAliases(sourceFile);
|
|
113101
|
+
}
|
|
113102
|
+
});
|
|
113011
113103
|
const declarationTransform = transformNodes(
|
|
113012
113104
|
resolver,
|
|
113013
113105
|
host,
|
|
@@ -120059,15 +120151,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120059
120151
|
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
120060
120152
|
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
120061
120153
|
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
120062
|
-
|
|
120063
|
-
|
|
120064
|
-
let bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray;
|
|
120065
|
-
let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker2.getDiagnostics(sourceFile, cancellationToken) : emptyArray;
|
|
120154
|
+
let bindDiagnostics = sourceFile.bindDiagnostics;
|
|
120155
|
+
let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken);
|
|
120066
120156
|
if (isPlainJs) {
|
|
120067
120157
|
bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
120068
120158
|
checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
120069
120159
|
}
|
|
120070
|
-
return getMergedBindAndCheckDiagnostics(sourceFile,
|
|
120160
|
+
return getMergedBindAndCheckDiagnostics(sourceFile, !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : void 0);
|
|
120071
120161
|
});
|
|
120072
120162
|
}
|
|
120073
120163
|
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
|
package/lib/typescript.js
CHANGED
|
@@ -260,6 +260,7 @@ __export(typescript_exports, {
|
|
|
260
260
|
canHaveModifiers: () => canHaveModifiers,
|
|
261
261
|
canHaveModuleSpecifier: () => canHaveModuleSpecifier,
|
|
262
262
|
canHaveSymbol: () => canHaveSymbol,
|
|
263
|
+
canIncludeBindAndCheckDiagnsotics: () => canIncludeBindAndCheckDiagnsotics,
|
|
263
264
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
264
265
|
canProduceDiagnostics: () => canProduceDiagnostics,
|
|
265
266
|
canUsePropertyAccess: () => canUsePropertyAccess,
|
|
@@ -2370,7 +2371,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2370
2371
|
|
|
2371
2372
|
// src/compiler/corePublic.ts
|
|
2372
2373
|
var versionMajorMinor = "5.5";
|
|
2373
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2374
|
+
var version = `${versionMajorMinor}.0-dev.20240601`;
|
|
2374
2375
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2375
2376
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2376
2377
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -13401,7 +13402,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13401
13402
|
pos++;
|
|
13402
13403
|
let regExpFlags = 0 /* None */;
|
|
13403
13404
|
while (true) {
|
|
13404
|
-
const ch =
|
|
13405
|
+
const ch = charCodeChecked(pos);
|
|
13405
13406
|
if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
|
|
13406
13407
|
break;
|
|
13407
13408
|
}
|
|
@@ -14652,10 +14653,10 @@ var binaryUnicodeProperties = /* @__PURE__ */ new Set(["ASCII", "ASCII_Hex_Digit
|
|
|
14652
14653
|
var binaryUnicodePropertiesOfStrings = /* @__PURE__ */ new Set(["Basic_Emoji", "Emoji_Keycap_Sequence", "RGI_Emoji_Modifier_Sequence", "RGI_Emoji_Flag_Sequence", "RGI_Emoji_Tag_Sequence", "RGI_Emoji_ZWJ_Sequence", "RGI_Emoji"]);
|
|
14653
14654
|
var valuesOfNonBinaryUnicodeProperties = {
|
|
14654
14655
|
General_Category: /* @__PURE__ */ new Set(["C", "Other", "Cc", "Control", "cntrl", "Cf", "Format", "Cn", "Unassigned", "Co", "Private_Use", "Cs", "Surrogate", "L", "Letter", "LC", "Cased_Letter", "Ll", "Lowercase_Letter", "Lm", "Modifier_Letter", "Lo", "Other_Letter", "Lt", "Titlecase_Letter", "Lu", "Uppercase_Letter", "M", "Mark", "Combining_Mark", "Mc", "Spacing_Mark", "Me", "Enclosing_Mark", "Mn", "Nonspacing_Mark", "N", "Number", "Nd", "Decimal_Number", "digit", "Nl", "Letter_Number", "No", "Other_Number", "P", "Punctuation", "punct", "Pc", "Connector_Punctuation", "Pd", "Dash_Punctuation", "Pe", "Close_Punctuation", "Pf", "Final_Punctuation", "Pi", "Initial_Punctuation", "Po", "Other_Punctuation", "Ps", "Open_Punctuation", "S", "Symbol", "Sc", "Currency_Symbol", "Sk", "Modifier_Symbol", "Sm", "Math_Symbol", "So", "Other_Symbol", "Z", "Separator", "Zl", "Line_Separator", "Zp", "Paragraph_Separator", "Zs", "Space_Separator"]),
|
|
14655
|
-
Script: /* @__PURE__ */ new Set(["Adlm", "Adlam", "Aghb", "Caucasian_Albanian", "Ahom", "
|
|
14656
|
-
Script_Extensions:
|
|
14657
|
-
// Currently empty
|
|
14656
|
+
Script: /* @__PURE__ */ new Set(["Adlm", "Adlam", "Aghb", "Caucasian_Albanian", "Ahom", "Arab", "Arabic", "Armi", "Imperial_Aramaic", "Armn", "Armenian", "Avst", "Avestan", "Bali", "Balinese", "Bamu", "Bamum", "Bass", "Bassa_Vah", "Batk", "Batak", "Beng", "Bengali", "Bhks", "Bhaiksuki", "Bopo", "Bopomofo", "Brah", "Brahmi", "Brai", "Braille", "Bugi", "Buginese", "Buhd", "Buhid", "Cakm", "Chakma", "Cans", "Canadian_Aboriginal", "Cari", "Carian", "Cham", "Cher", "Cherokee", "Chrs", "Chorasmian", "Copt", "Coptic", "Qaac", "Cpmn", "Cypro_Minoan", "Cprt", "Cypriot", "Cyrl", "Cyrillic", "Deva", "Devanagari", "Diak", "Dives_Akuru", "Dogr", "Dogra", "Dsrt", "Deseret", "Dupl", "Duployan", "Egyp", "Egyptian_Hieroglyphs", "Elba", "Elbasan", "Elym", "Elymaic", "Ethi", "Ethiopic", "Geor", "Georgian", "Glag", "Glagolitic", "Gong", "Gunjala_Gondi", "Gonm", "Masaram_Gondi", "Goth", "Gothic", "Gran", "Grantha", "Grek", "Greek", "Gujr", "Gujarati", "Guru", "Gurmukhi", "Hang", "Hangul", "Hani", "Han", "Hano", "Hanunoo", "Hatr", "Hatran", "Hebr", "Hebrew", "Hira", "Hiragana", "Hluw", "Anatolian_Hieroglyphs", "Hmng", "Pahawh_Hmong", "Hmnp", "Nyiakeng_Puachue_Hmong", "Hrkt", "Katakana_Or_Hiragana", "Hung", "Old_Hungarian", "Ital", "Old_Italic", "Java", "Javanese", "Kali", "Kayah_Li", "Kana", "Katakana", "Kawi", "Khar", "Kharoshthi", "Khmr", "Khmer", "Khoj", "Khojki", "Kits", "Khitan_Small_Script", "Knda", "Kannada", "Kthi", "Kaithi", "Lana", "Tai_Tham", "Laoo", "Lao", "Latn", "Latin", "Lepc", "Lepcha", "Limb", "Limbu", "Lina", "Linear_A", "Linb", "Linear_B", "Lisu", "Lyci", "Lycian", "Lydi", "Lydian", "Mahj", "Mahajani", "Maka", "Makasar", "Mand", "Mandaic", "Mani", "Manichaean", "Marc", "Marchen", "Medf", "Medefaidrin", "Mend", "Mende_Kikakui", "Merc", "Meroitic_Cursive", "Mero", "Meroitic_Hieroglyphs", "Mlym", "Malayalam", "Modi", "Mong", "Mongolian", "Mroo", "Mro", "Mtei", "Meetei_Mayek", "Mult", "Multani", "Mymr", "Myanmar", "Nagm", "Nag_Mundari", "Nand", "Nandinagari", "Narb", "Old_North_Arabian", "Nbat", "Nabataean", "Newa", "Nkoo", "Nko", "Nshu", "Nushu", "Ogam", "Ogham", "Olck", "Ol_Chiki", "Orkh", "Old_Turkic", "Orya", "Oriya", "Osge", "Osage", "Osma", "Osmanya", "Ougr", "Old_Uyghur", "Palm", "Palmyrene", "Pauc", "Pau_Cin_Hau", "Perm", "Old_Permic", "Phag", "Phags_Pa", "Phli", "Inscriptional_Pahlavi", "Phlp", "Psalter_Pahlavi", "Phnx", "Phoenician", "Plrd", "Miao", "Prti", "Inscriptional_Parthian", "Rjng", "Rejang", "Rohg", "Hanifi_Rohingya", "Runr", "Runic", "Samr", "Samaritan", "Sarb", "Old_South_Arabian", "Saur", "Saurashtra", "Sgnw", "SignWriting", "Shaw", "Shavian", "Shrd", "Sharada", "Sidd", "Siddham", "Sind", "Khudawadi", "Sinh", "Sinhala", "Sogd", "Sogdian", "Sogo", "Old_Sogdian", "Sora", "Sora_Sompeng", "Soyo", "Soyombo", "Sund", "Sundanese", "Sylo", "Syloti_Nagri", "Syrc", "Syriac", "Tagb", "Tagbanwa", "Takr", "Takri", "Tale", "Tai_Le", "Talu", "New_Tai_Lue", "Taml", "Tamil", "Tang", "Tangut", "Tavt", "Tai_Viet", "Telu", "Telugu", "Tfng", "Tifinagh", "Tglg", "Tagalog", "Thaa", "Thaana", "Thai", "Tibt", "Tibetan", "Tirh", "Tirhuta", "Tnsa", "Tangsa", "Toto", "Ugar", "Ugaritic", "Vaii", "Vai", "Vith", "Vithkuqi", "Wara", "Warang_Citi", "Wcho", "Wancho", "Xpeo", "Old_Persian", "Xsux", "Cuneiform", "Yezi", "Yezidi", "Yiii", "Yi", "Zanb", "Zanabazar_Square", "Zinh", "Inherited", "Qaai", "Zyyy", "Common", "Zzzz", "Unknown"]),
|
|
14657
|
+
Script_Extensions: void 0
|
|
14658
14658
|
};
|
|
14659
|
+
valuesOfNonBinaryUnicodeProperties.Script_Extensions = valuesOfNonBinaryUnicodeProperties.Script;
|
|
14659
14660
|
|
|
14660
14661
|
// src/compiler/utilitiesPublic.ts
|
|
14661
14662
|
function isExternalModuleNameRelative(moduleName) {
|
|
@@ -17514,6 +17515,26 @@ function getErrorSpanForNode(sourceFile, node) {
|
|
|
17514
17515
|
const pos2 = skipTrivia(sourceFile.text, node.tagName.pos);
|
|
17515
17516
|
return getSpanOfTokenAtPosition(sourceFile, pos2);
|
|
17516
17517
|
}
|
|
17518
|
+
case 176 /* Constructor */: {
|
|
17519
|
+
const constructorDeclaration = node;
|
|
17520
|
+
const start = skipTrivia(sourceFile.text, constructorDeclaration.pos);
|
|
17521
|
+
const scanner2 = createScanner(
|
|
17522
|
+
sourceFile.languageVersion,
|
|
17523
|
+
/*skipTrivia*/
|
|
17524
|
+
true,
|
|
17525
|
+
sourceFile.languageVariant,
|
|
17526
|
+
sourceFile.text,
|
|
17527
|
+
/*onError*/
|
|
17528
|
+
void 0,
|
|
17529
|
+
start
|
|
17530
|
+
);
|
|
17531
|
+
let token = scanner2.scan();
|
|
17532
|
+
while (token !== 137 /* ConstructorKeyword */ && token !== 1 /* EndOfFileToken */) {
|
|
17533
|
+
token = scanner2.scan();
|
|
17534
|
+
}
|
|
17535
|
+
const end = scanner2.getTokenEnd();
|
|
17536
|
+
return createTextSpanFromBounds(start, end);
|
|
17537
|
+
}
|
|
17517
17538
|
}
|
|
17518
17539
|
if (errorNode === void 0) {
|
|
17519
17540
|
return getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
@@ -22511,7 +22532,15 @@ function rangeOfTypeParameters(sourceFile, typeParameters) {
|
|
|
22511
22532
|
return { pos, end };
|
|
22512
22533
|
}
|
|
22513
22534
|
function skipTypeChecking(sourceFile, options, host) {
|
|
22514
|
-
return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName);
|
|
22535
|
+
return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnsotics(sourceFile, options);
|
|
22536
|
+
}
|
|
22537
|
+
function canIncludeBindAndCheckDiagnsotics(sourceFile, options) {
|
|
22538
|
+
if (!!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false) return false;
|
|
22539
|
+
if (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */ || sourceFile.scriptKind === 5 /* External */) return true;
|
|
22540
|
+
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
22541
|
+
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
22542
|
+
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
22543
|
+
return isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */;
|
|
22515
22544
|
}
|
|
22516
22545
|
function isJsonEqual(a, b) {
|
|
22517
22546
|
return a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && equalOwnProperties(a, b, isJsonEqual);
|
|
@@ -50142,6 +50171,7 @@ function createTypeChecker(host) {
|
|
|
50142
50171
|
getImmediateAliasedSymbol,
|
|
50143
50172
|
getAliasedSymbol: resolveAlias,
|
|
50144
50173
|
getEmitResolver,
|
|
50174
|
+
requiresAddingImplicitUndefined,
|
|
50145
50175
|
getExportsOfModule: getExportsOfModuleAsArray,
|
|
50146
50176
|
getExportsAndPropertiesOfModule,
|
|
50147
50177
|
forEachExportAndPropertyOfModule,
|
|
@@ -54023,7 +54053,7 @@ function createTypeChecker(host) {
|
|
|
54023
54053
|
return noMappedTypes && mappedType !== type ? void 0 : mappedType;
|
|
54024
54054
|
}
|
|
54025
54055
|
function setTextRange2(context, range, location) {
|
|
54026
|
-
if (!nodeIsSynthesized(range)
|
|
54056
|
+
if (!nodeIsSynthesized(range) || !(range.flags & 16 /* Synthesized */) || !context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(getOriginalNode(range))) {
|
|
54027
54057
|
range = factory.cloneNode(range);
|
|
54028
54058
|
}
|
|
54029
54059
|
if (range === location) return range;
|
|
@@ -54962,7 +54992,8 @@ function createTypeChecker(host) {
|
|
|
54962
54992
|
const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
|
|
54963
54993
|
const getterSignature = getSignatureFromDeclaration(getterDeclaration);
|
|
54964
54994
|
typeElements.push(
|
|
54965
|
-
|
|
54995
|
+
setCommentRange2(
|
|
54996
|
+
context,
|
|
54966
54997
|
signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
|
|
54967
54998
|
getterDeclaration
|
|
54968
54999
|
)
|
|
@@ -54970,7 +55001,8 @@ function createTypeChecker(host) {
|
|
|
54970
55001
|
const setterDeclaration = getDeclarationOfKind(propertySymbol, 178 /* SetAccessor */);
|
|
54971
55002
|
const setterSignature = getSignatureFromDeclaration(setterDeclaration);
|
|
54972
55003
|
typeElements.push(
|
|
54973
|
-
|
|
55004
|
+
setCommentRange2(
|
|
55005
|
+
context,
|
|
54974
55006
|
signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
|
|
54975
55007
|
setterDeclaration
|
|
54976
55008
|
)
|
|
@@ -55028,11 +55060,17 @@ function createTypeChecker(host) {
|
|
|
55028
55060
|
setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
|
|
55029
55061
|
}
|
|
55030
55062
|
} else if (propertySymbol.valueDeclaration) {
|
|
55031
|
-
|
|
55063
|
+
setCommentRange2(context, node, propertySymbol.valueDeclaration);
|
|
55032
55064
|
}
|
|
55033
55065
|
return node;
|
|
55034
55066
|
}
|
|
55035
55067
|
}
|
|
55068
|
+
function setCommentRange2(context, node, range) {
|
|
55069
|
+
if (context.enclosingFile && context.enclosingFile === getSourceFileOfNode(range)) {
|
|
55070
|
+
return setCommentRange(node, range);
|
|
55071
|
+
}
|
|
55072
|
+
return node;
|
|
55073
|
+
}
|
|
55036
55074
|
function mapToTypeNodes(types, context, isBareList) {
|
|
55037
55075
|
if (some(types)) {
|
|
55038
55076
|
if (checkTruncationLength(context)) {
|
|
@@ -55808,7 +55846,7 @@ function createTypeChecker(host) {
|
|
|
55808
55846
|
return false;
|
|
55809
55847
|
}
|
|
55810
55848
|
function typeParameterToName(type, context) {
|
|
55811
|
-
var _a, _b;
|
|
55849
|
+
var _a, _b, _c, _d;
|
|
55812
55850
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
55813
55851
|
const cached = context.typeParameterNames.get(getTypeId(type));
|
|
55814
55852
|
if (cached) {
|
|
@@ -55825,11 +55863,15 @@ function createTypeChecker(host) {
|
|
|
55825
55863
|
if (!(result.kind & 80 /* Identifier */)) {
|
|
55826
55864
|
return factory.createIdentifier("(Missing type parameter)");
|
|
55827
55865
|
}
|
|
55866
|
+
const decl = (_b = (_a = type.symbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b[0];
|
|
55867
|
+
if (decl && isTypeParameterDeclaration(decl)) {
|
|
55868
|
+
result = setTextRange2(context, result, decl.name);
|
|
55869
|
+
}
|
|
55828
55870
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
55829
55871
|
const rawtext = result.escapedText;
|
|
55830
|
-
let i = ((
|
|
55872
|
+
let i = ((_c = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _c.get(rawtext)) || 0;
|
|
55831
55873
|
let text = rawtext;
|
|
55832
|
-
while (((
|
|
55874
|
+
while (((_d = context.typeParameterNamesByText) == null ? void 0 : _d.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
|
|
55833
55875
|
i++;
|
|
55834
55876
|
text = `${rawtext}_${i}`;
|
|
55835
55877
|
}
|
|
@@ -56268,7 +56310,7 @@ function createTypeChecker(host) {
|
|
|
56268
56310
|
}
|
|
56269
56311
|
return node;
|
|
56270
56312
|
}
|
|
56271
|
-
return result
|
|
56313
|
+
return result ? setTextRange2(context, result, node) : void 0;
|
|
56272
56314
|
}
|
|
56273
56315
|
function createRecoveryBoundary() {
|
|
56274
56316
|
let unreportedErrors;
|
|
@@ -56353,6 +56395,31 @@ function createTypeChecker(host) {
|
|
|
56353
56395
|
function onEnterNewScope(node) {
|
|
56354
56396
|
return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
56355
56397
|
}
|
|
56398
|
+
function tryVisitTypeReference(node) {
|
|
56399
|
+
if (canReuseTypeNode(context, node)) {
|
|
56400
|
+
const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
|
|
56401
|
+
const typeArguments = visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode);
|
|
56402
|
+
if (!introducesError) {
|
|
56403
|
+
const updated = factory.updateTypeReferenceNode(
|
|
56404
|
+
node,
|
|
56405
|
+
newName,
|
|
56406
|
+
typeArguments
|
|
56407
|
+
);
|
|
56408
|
+
return setTextRange2(context, updated, node);
|
|
56409
|
+
} else {
|
|
56410
|
+
const serializedName = serializeTypeName(
|
|
56411
|
+
context,
|
|
56412
|
+
node.typeName,
|
|
56413
|
+
/*isTypeOf*/
|
|
56414
|
+
false,
|
|
56415
|
+
typeArguments
|
|
56416
|
+
);
|
|
56417
|
+
if (serializedName) {
|
|
56418
|
+
return setTextRange2(context, serializedName, node.typeName);
|
|
56419
|
+
}
|
|
56420
|
+
}
|
|
56421
|
+
}
|
|
56422
|
+
}
|
|
56356
56423
|
function visitExistingNodeTreeSymbolsWorker(node) {
|
|
56357
56424
|
if (isJSDocTypeExpression(node)) {
|
|
56358
56425
|
return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
|
|
@@ -56449,7 +56516,8 @@ function createTypeChecker(host) {
|
|
|
56449
56516
|
if (canReuseTypeNode(context, node)) {
|
|
56450
56517
|
return node;
|
|
56451
56518
|
}
|
|
56452
|
-
|
|
56519
|
+
hadError = true;
|
|
56520
|
+
return node;
|
|
56453
56521
|
}
|
|
56454
56522
|
if (isTypeParameterDeclaration(node)) {
|
|
56455
56523
|
return factory.updateTypeParameterDeclaration(
|
|
@@ -56460,31 +56528,21 @@ function createTypeChecker(host) {
|
|
|
56460
56528
|
visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
|
|
56461
56529
|
);
|
|
56462
56530
|
}
|
|
56531
|
+
if (isIndexedAccessTypeNode(node) && isTypeReferenceNode(node.objectType)) {
|
|
56532
|
+
const objectType = tryVisitTypeReference(node.objectType);
|
|
56533
|
+
if (!objectType) {
|
|
56534
|
+
hadError = true;
|
|
56535
|
+
return node;
|
|
56536
|
+
}
|
|
56537
|
+
return factory.updateIndexedAccessTypeNode(node, objectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
|
|
56538
|
+
}
|
|
56463
56539
|
if (isTypeReferenceNode(node)) {
|
|
56464
|
-
|
|
56465
|
-
|
|
56466
|
-
|
|
56467
|
-
if (!introducesError) {
|
|
56468
|
-
const updated = factory.updateTypeReferenceNode(
|
|
56469
|
-
node,
|
|
56470
|
-
newName,
|
|
56471
|
-
typeArguments
|
|
56472
|
-
);
|
|
56473
|
-
return setTextRange2(context, updated, node);
|
|
56474
|
-
} else {
|
|
56475
|
-
const serializedName = serializeTypeName(
|
|
56476
|
-
context,
|
|
56477
|
-
node.typeName,
|
|
56478
|
-
/*isTypeOf*/
|
|
56479
|
-
false,
|
|
56480
|
-
typeArguments
|
|
56481
|
-
);
|
|
56482
|
-
if (serializedName) {
|
|
56483
|
-
return setTextRange2(context, serializedName, node.typeName);
|
|
56484
|
-
}
|
|
56485
|
-
}
|
|
56540
|
+
const result = tryVisitTypeReference(node);
|
|
56541
|
+
if (result) {
|
|
56542
|
+
return result;
|
|
56486
56543
|
}
|
|
56487
|
-
|
|
56544
|
+
hadError = true;
|
|
56545
|
+
return node;
|
|
56488
56546
|
}
|
|
56489
56547
|
if (isLiteralImportTypeNode(node)) {
|
|
56490
56548
|
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
@@ -56508,12 +56566,7 @@ function createTypeChecker(host) {
|
|
|
56508
56566
|
}
|
|
56509
56567
|
}
|
|
56510
56568
|
if (isFunctionLike(node) && !node.type || isPropertyDeclaration(node) && !node.type && !node.initializer || isPropertySignature(node) && !node.type && !node.initializer || isParameter(node) && !node.type && !node.initializer) {
|
|
56511
|
-
let visited =
|
|
56512
|
-
node,
|
|
56513
|
-
visitExistingNodeTreeSymbols,
|
|
56514
|
-
/*context*/
|
|
56515
|
-
void 0
|
|
56516
|
-
);
|
|
56569
|
+
let visited = visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
56517
56570
|
if (visited === node) {
|
|
56518
56571
|
visited = setTextRange2(context, factory.cloneNode(node), node);
|
|
56519
56572
|
}
|
|
@@ -56535,7 +56588,8 @@ function createTypeChecker(host) {
|
|
|
56535
56588
|
if (serializedName) {
|
|
56536
56589
|
return setTextRange2(context, serializedName, node.exprName);
|
|
56537
56590
|
}
|
|
56538
|
-
|
|
56591
|
+
hadError = true;
|
|
56592
|
+
return node;
|
|
56539
56593
|
}
|
|
56540
56594
|
return factory.updateTypeQueryNode(
|
|
56541
56595
|
node,
|
|
@@ -56573,12 +56627,7 @@ function createTypeChecker(host) {
|
|
|
56573
56627
|
return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
|
|
56574
56628
|
}
|
|
56575
56629
|
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
56576
|
-
const visited =
|
|
56577
|
-
node,
|
|
56578
|
-
visitExistingNodeTreeSymbols,
|
|
56579
|
-
/*context*/
|
|
56580
|
-
void 0
|
|
56581
|
-
);
|
|
56630
|
+
const visited = visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
56582
56631
|
const clone2 = setTextRange2(context, visited === node ? factory.cloneNode(node) : visited, node);
|
|
56583
56632
|
const flags = getEmitFlags(clone2);
|
|
56584
56633
|
setEmitFlags(clone2, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
|
|
@@ -56604,17 +56653,46 @@ function createTypeChecker(host) {
|
|
|
56604
56653
|
falseType2
|
|
56605
56654
|
);
|
|
56606
56655
|
}
|
|
56607
|
-
if (isTypeOperatorNode(node)
|
|
56608
|
-
if (
|
|
56609
|
-
|
|
56656
|
+
if (isTypeOperatorNode(node)) {
|
|
56657
|
+
if (node.operator === 158 /* UniqueKeyword */ && node.type.kind === 155 /* SymbolKeyword */) {
|
|
56658
|
+
if (!canReuseTypeNode(context, node)) {
|
|
56659
|
+
hadError = true;
|
|
56660
|
+
return node;
|
|
56661
|
+
}
|
|
56662
|
+
} else if (node.operator === 143 /* KeyOfKeyword */) {
|
|
56663
|
+
if (isTypeReferenceNode(node.type)) {
|
|
56664
|
+
const type = tryVisitTypeReference(node.type);
|
|
56665
|
+
if (!type) {
|
|
56666
|
+
hadError = true;
|
|
56667
|
+
return node;
|
|
56668
|
+
}
|
|
56669
|
+
return factory.updateTypeOperatorNode(node, type);
|
|
56670
|
+
}
|
|
56610
56671
|
}
|
|
56611
56672
|
}
|
|
56612
|
-
return
|
|
56613
|
-
|
|
56614
|
-
|
|
56615
|
-
|
|
56616
|
-
|
|
56617
|
-
|
|
56673
|
+
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
56674
|
+
function visitEachChild2(node2, visitor) {
|
|
56675
|
+
const nonlocalNode = !context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(node2);
|
|
56676
|
+
return visitEachChild(
|
|
56677
|
+
node2,
|
|
56678
|
+
visitor,
|
|
56679
|
+
/*context*/
|
|
56680
|
+
void 0,
|
|
56681
|
+
nonlocalNode ? visitNodesWithoutCopyingPositions : void 0
|
|
56682
|
+
);
|
|
56683
|
+
}
|
|
56684
|
+
function visitNodesWithoutCopyingPositions(nodes, visitor, test, start, count) {
|
|
56685
|
+
let result = visitNodes2(nodes, visitor, test, start, count);
|
|
56686
|
+
if (result) {
|
|
56687
|
+
if (result.pos !== -1 || result.end !== -1) {
|
|
56688
|
+
if (result === nodes) {
|
|
56689
|
+
result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
|
|
56690
|
+
}
|
|
56691
|
+
setTextRangePosEnd(result, -1, -1);
|
|
56692
|
+
}
|
|
56693
|
+
}
|
|
56694
|
+
return result;
|
|
56695
|
+
}
|
|
56618
56696
|
function getEffectiveDotDotDotForParameter(p) {
|
|
56619
56697
|
return p.dotDotDotToken || (p.type && isJSDocVariadicType(p.type) ? factory.createToken(26 /* DotDotDotToken */) : void 0);
|
|
56620
56698
|
}
|
|
@@ -61680,7 +61758,16 @@ function createTypeChecker(host) {
|
|
|
61680
61758
|
}
|
|
61681
61759
|
}
|
|
61682
61760
|
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
61683
|
-
|
|
61761
|
+
if (type === thisArgument) {
|
|
61762
|
+
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
61763
|
+
type,
|
|
61764
|
+
thisArgument,
|
|
61765
|
+
/*needApparentType*/
|
|
61766
|
+
true
|
|
61767
|
+
));
|
|
61768
|
+
}
|
|
61769
|
+
const key = `I${getTypeId(type)},${getTypeId(thisArgument)}`;
|
|
61770
|
+
return getCachedType(key) ?? setCachedType(key, getTypeWithThisArgument(
|
|
61684
61771
|
type,
|
|
61685
61772
|
thisArgument,
|
|
61686
61773
|
/*needApparentType*/
|
|
@@ -74054,6 +74141,9 @@ function createTypeChecker(host) {
|
|
|
74054
74141
|
return contextualType && !isGenericType(contextualType);
|
|
74055
74142
|
}
|
|
74056
74143
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
74144
|
+
if (isNoInferType(type)) {
|
|
74145
|
+
type = type.baseType;
|
|
74146
|
+
}
|
|
74057
74147
|
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
74058
74148
|
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
|
74059
74149
|
}
|
|
@@ -89756,7 +89846,7 @@ function createTypeChecker(host) {
|
|
|
89756
89846
|
return !!(getNodeCheckFlags(node) & flag);
|
|
89757
89847
|
}
|
|
89758
89848
|
function calculateNodeCheckFlagWorker(node, flag) {
|
|
89759
|
-
if (!compilerOptions.noCheck) {
|
|
89849
|
+
if (!compilerOptions.noCheck && canIncludeBindAndCheckDiagnsotics(getSourceFileOfNode(node), compilerOptions)) {
|
|
89760
89850
|
return;
|
|
89761
89851
|
}
|
|
89762
89852
|
const links = getNodeLinks(node);
|
|
@@ -91399,7 +91489,6 @@ function createTypeChecker(host) {
|
|
|
91399
91489
|
return true;
|
|
91400
91490
|
}
|
|
91401
91491
|
}
|
|
91402
|
-
return false;
|
|
91403
91492
|
}
|
|
91404
91493
|
}
|
|
91405
91494
|
if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 65536 /* AwaitContext */) && isIdentifier(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") {
|
|
@@ -104786,10 +104875,10 @@ function transformESNext(context) {
|
|
|
104786
104875
|
function visitForOfStatement(node) {
|
|
104787
104876
|
if (isUsingVariableDeclarationList(node.initializer)) {
|
|
104788
104877
|
const forInitializer = node.initializer;
|
|
104789
|
-
|
|
104790
|
-
|
|
104791
|
-
|
|
104792
|
-
|
|
104878
|
+
const forDecl = firstOrUndefined(forInitializer.declarations) || factory2.createVariableDeclaration(factory2.createTempVariable(
|
|
104879
|
+
/*recordTempVariable*/
|
|
104880
|
+
void 0
|
|
104881
|
+
));
|
|
104793
104882
|
const isAwaitUsing = getUsingKindOfVariableDeclarationList(forInitializer) === 2 /* Async */;
|
|
104794
104883
|
const temp = factory2.getGeneratedNameForNode(forDecl.name);
|
|
104795
104884
|
const usingVar = factory2.updateVariableDeclaration(
|
|
@@ -117914,9 +118003,11 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
117914
118003
|
emitSkipped = true;
|
|
117915
118004
|
return;
|
|
117916
118005
|
}
|
|
117917
|
-
|
|
117918
|
-
(
|
|
117919
|
-
|
|
118006
|
+
(isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : filter(sourceFileOrBundle.sourceFiles, isSourceFileNotJson)).forEach(
|
|
118007
|
+
(sourceFile) => {
|
|
118008
|
+
if (compilerOptions.noCheck || !canIncludeBindAndCheckDiagnsotics(sourceFile, compilerOptions)) markLinkedReferences(sourceFile);
|
|
118009
|
+
}
|
|
118010
|
+
);
|
|
117920
118011
|
const transform2 = transformNodes(
|
|
117921
118012
|
resolver,
|
|
117922
118013
|
host,
|
|
@@ -117966,9 +118057,11 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
117966
118057
|
const sourceFiles = isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
|
|
117967
118058
|
const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson);
|
|
117968
118059
|
const inputListOrBundle = compilerOptions.outFile ? [factory.createBundle(filesForEmit)] : filesForEmit;
|
|
117969
|
-
|
|
117970
|
-
|
|
117971
|
-
|
|
118060
|
+
filesForEmit.forEach((sourceFile) => {
|
|
118061
|
+
if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck || emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) || !canIncludeBindAndCheckDiagnsotics(sourceFile, compilerOptions)) {
|
|
118062
|
+
collectLinkedAliases(sourceFile);
|
|
118063
|
+
}
|
|
118064
|
+
});
|
|
117972
118065
|
const declarationTransform = transformNodes(
|
|
117973
118066
|
resolver,
|
|
117974
118067
|
host,
|
|
@@ -125066,15 +125159,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125066
125159
|
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
125067
125160
|
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
125068
125161
|
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
125069
|
-
|
|
125070
|
-
|
|
125071
|
-
let bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray;
|
|
125072
|
-
let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker2.getDiagnostics(sourceFile, cancellationToken) : emptyArray;
|
|
125162
|
+
let bindDiagnostics = sourceFile.bindDiagnostics;
|
|
125163
|
+
let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken);
|
|
125073
125164
|
if (isPlainJs) {
|
|
125074
125165
|
bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
125075
125166
|
checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
125076
125167
|
}
|
|
125077
|
-
return getMergedBindAndCheckDiagnostics(sourceFile,
|
|
125168
|
+
return getMergedBindAndCheckDiagnostics(sourceFile, !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : void 0);
|
|
125078
125169
|
});
|
|
125079
125170
|
}
|
|
125080
125171
|
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
|
|
@@ -158551,7 +158642,7 @@ registerCodeFix({
|
|
|
158551
158642
|
addCodeAction(addAnnotationFix, fixes, context, 2 /* Widened */, (f) => f.addTypeAnnotation(context.span));
|
|
158552
158643
|
addCodeAction(addInlineTypeAssertion, fixes, context, 0 /* Full */, (f) => f.addInlineAssertion(context.span));
|
|
158553
158644
|
addCodeAction(addInlineTypeAssertion, fixes, context, 1 /* Relative */, (f) => f.addInlineAssertion(context.span));
|
|
158554
|
-
addCodeAction(
|
|
158645
|
+
addCodeAction(addInlineTypeAssertion, fixes, context, 2 /* Widened */, (f) => f.addInlineAssertion(context.span));
|
|
158555
158646
|
addCodeAction(extractExpression, fixes, context, 0 /* Full */, (f) => f.extractAsVariable(context.span));
|
|
158556
158647
|
return fixes;
|
|
158557
158648
|
},
|
|
@@ -158582,7 +158673,6 @@ function withContext(context, typePrintMode, cb) {
|
|
|
158582
158673
|
const sourceFile = context.sourceFile;
|
|
158583
158674
|
const program = context.program;
|
|
158584
158675
|
const typeChecker = program.getTypeChecker();
|
|
158585
|
-
const emitResolver = typeChecker.getEmitResolver();
|
|
158586
158676
|
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
|
|
158587
158677
|
const importAdder = createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
158588
158678
|
const fixedNodes = /* @__PURE__ */ new Set();
|
|
@@ -159145,7 +159235,7 @@ function withContext(context, typePrintMode, cb) {
|
|
|
159145
159235
|
}
|
|
159146
159236
|
type = widenedType;
|
|
159147
159237
|
}
|
|
159148
|
-
if (isParameter(node) &&
|
|
159238
|
+
if (isParameter(node) && typeChecker.requiresAddingImplicitUndefined(node)) {
|
|
159149
159239
|
type = typeChecker.getUnionType([typeChecker.getUndefinedType(), type], 0 /* None */);
|
|
159150
159240
|
}
|
|
159151
159241
|
const flags = (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 /* Static */ | 8 /* Readonly */)) && type.flags & 8192 /* UniqueESSymbol */ ? 1048576 /* AllowUniqueESSymbolType */ : 0 /* None */;
|
|
@@ -159341,23 +159431,23 @@ function withContext(context, typePrintMode, cb) {
|
|
|
159341
159431
|
setEmitFlags(node, 0 /* None */);
|
|
159342
159432
|
return result2;
|
|
159343
159433
|
}
|
|
159344
|
-
|
|
159345
|
-
|
|
159346
|
-
|
|
159347
|
-
|
|
159348
|
-
});
|
|
159349
|
-
}
|
|
159350
|
-
function findBestFittingNode(node, span) {
|
|
159351
|
-
while (node && node.end < span.start + span.length) {
|
|
159352
|
-
node = node.parent;
|
|
159353
|
-
}
|
|
159354
|
-
while (node.parent.pos === node.pos && node.parent.end === node.end) {
|
|
159355
|
-
node = node.parent;
|
|
159434
|
+
function findAncestorWithMissingType(node) {
|
|
159435
|
+
return findAncestor(node, (n) => {
|
|
159436
|
+
return canHaveTypeAnnotation.has(n.kind) && (!isObjectBindingPattern(n) && !isArrayBindingPattern(n) || isVariableDeclaration(n.parent));
|
|
159437
|
+
});
|
|
159356
159438
|
}
|
|
159357
|
-
|
|
159358
|
-
|
|
159439
|
+
function findBestFittingNode(node, span) {
|
|
159440
|
+
while (node && node.end < span.start + span.length) {
|
|
159441
|
+
node = node.parent;
|
|
159442
|
+
}
|
|
159443
|
+
while (node.parent.pos === node.pos && node.parent.end === node.end) {
|
|
159444
|
+
node = node.parent;
|
|
159445
|
+
}
|
|
159446
|
+
if (isIdentifier(node) && hasInitializer(node.parent) && node.parent.initializer) {
|
|
159447
|
+
return node.parent.initializer;
|
|
159448
|
+
}
|
|
159449
|
+
return node;
|
|
159359
159450
|
}
|
|
159360
|
-
return node;
|
|
159361
159451
|
}
|
|
159362
159452
|
|
|
159363
159453
|
// src/services/codefixes/fixAwaitInSyncFunction.ts
|
|
@@ -160635,7 +160725,8 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
160635
160725
|
switch (kind) {
|
|
160636
160726
|
case 171 /* PropertySignature */:
|
|
160637
160727
|
case 172 /* PropertyDeclaration */:
|
|
160638
|
-
|
|
160728
|
+
let flags = 1 /* NoTruncation */;
|
|
160729
|
+
flags |= quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0;
|
|
160639
160730
|
let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context));
|
|
160640
160731
|
if (importAdder) {
|
|
160641
160732
|
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
|
|
@@ -178362,6 +178453,7 @@ __export(ts_exports2, {
|
|
|
178362
178453
|
canHaveModifiers: () => canHaveModifiers,
|
|
178363
178454
|
canHaveModuleSpecifier: () => canHaveModuleSpecifier,
|
|
178364
178455
|
canHaveSymbol: () => canHaveSymbol,
|
|
178456
|
+
canIncludeBindAndCheckDiagnsotics: () => canIncludeBindAndCheckDiagnsotics,
|
|
178365
178457
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
178366
178458
|
canProduceDiagnostics: () => canProduceDiagnostics,
|
|
178367
178459
|
canUsePropertyAccess: () => canUsePropertyAccess,
|
|
@@ -192793,6 +192885,7 @@ if (typeof console !== "undefined") {
|
|
|
192793
192885
|
canHaveModifiers,
|
|
192794
192886
|
canHaveModuleSpecifier,
|
|
192795
192887
|
canHaveSymbol,
|
|
192888
|
+
canIncludeBindAndCheckDiagnsotics,
|
|
192796
192889
|
canJsonReportNoInputFiles,
|
|
192797
192890
|
canProduceDiagnostics,
|
|
192798
192891
|
canUsePropertyAccess,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.5.0-dev.
|
|
5
|
+
"version": "5.5.0-dev.20240601",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"node": "20.1.0",
|
|
113
113
|
"npm": "8.19.4"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "ef514af2675389d38c793d6cc1945486c367e6fa"
|
|
116
116
|
}
|